forked from the-tcpdump-group/libpcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2872 lines (2645 loc) · 75.9 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
dnl
dnl Copyright (c) 1994, 1995, 1996, 1997
dnl The Regents of the University of California. All rights reserved.
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
#
# See
#
# https://ftp.gnu.org/gnu/config/README
#
# for the URLs to use to fetch new versions of config.guess and
# config.sub.
#
AC_PREREQ(2.64)
AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
AC_CONFIG_SRCDIR(pcap.c)
AC_SUBST(PACKAGE_NAME)
AC_CANONICAL_SYSTEM
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
#
# We require C99 or later.
# Try to get it, which may involve adding compiler flags;
# if that fails, give up.
#
AC_PROG_CC_C99
if test "$ac_cv_prog_cc_c99" = "no"; then
AC_MSG_ERROR([The C compiler does not support C99])
fi
case "$host_os" in
haiku*)
#
# Haiku's platform file is in C++.
#
AC_PROG_CXX
;;
esac
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_SHLIBS_INIT
AC_LBL_C_INLINE
AC_PCAP_C___ATOMICS
#
# Try to arrange for large file support.
#
AC_SYS_LARGEFILE
AC_FUNC_FSEEKO
dnl
dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
dnl include <sys/ioccom.h>, and we were to drop support for older
dnl releases without that fix, so that pcap-bpf.c doesn't need to
dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
dnl in "aclocal.m4" uses it, so we would still have to test for it
dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
dnl
AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
AC_CHECK_HEADERS(netpacket/packet.h)
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>])
if test "$ac_cv_header_net_pfvar_h" = yes; then
#
# Check for various PF actions.
#
AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/pfvar.h>],
[return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
[define if net/pfvar.h defines PF_NAT through PF_NORDR])
],
AC_MSG_RESULT(no))
fi
case "$host_os" in
haiku*)
#
# Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
#
CFLAGS="$CFLAGS -D_BSD_SOURCE"
;;
esac
AC_LBL_FIXINCLUDES
AC_CHECK_FUNCS(strerror)
AC_CHECK_FUNC(strerror_r,
[
#
# We have strerror_r; if we define _GNU_SOURCE, is it a
# POSIX-compliant strerror_r() or a GNU strerror_r()?
#
AC_MSG_CHECKING(whether strerror_r is GNU-style)
AC_COMPILE_IFELSE(
[
AC_LANG_SOURCE(
#define _GNU_SOURCE
#include <string.h>
/* Define it GNU-style; that will cause an error if it's not GNU-style */
extern char *strerror_r(int, char *, size_t);
int
main(void)
{
return 0;
}
)
],
[
# GNU-style
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_GNU_STRERROR_R,,
[Define to 1 if you have a GNU-style `strerror_r' function.])
],
[
AC_MSG_RESULT(no)
AC_DEFINE(HAVE_POSIX_STRERROR_R,,
[Define to 1 if you have a POSIX-style `strerror_r' function.])
])
],
[
#
# We don't have strerror_r; do we have _wcserror_s?
#
AC_CHECK_FUNCS(_wcserror_s)
])
#
# Thanks, IBM, for not providing vsyslog() in AIX!
#
AC_CHECK_FUNCS(vsyslog)
#
# Make sure we have vsnprintf() and snprintf(); we require them.
#
AC_CHECK_FUNC(vsnprintf,,
AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
AC_CHECK_FUNC(snprintf,,
AC_MSG_ERROR([snprintf() is required but wasn't found]))
needasprintf=no
AC_CHECK_FUNCS(vasprintf asprintf,,
[needasprintf=yes])
if test $needasprintf = yes; then
AC_LIBOBJ([asprintf])
fi
needstrlcat=no
AC_CHECK_FUNCS(strlcat,,
[needstrlcat=yes])
if test $needstrlcat = yes; then
AC_LIBOBJ([strlcat])
fi
needstrlcpy=no
AC_CHECK_FUNCS(strlcpy,,
[needstrlcpy=yes])
if test $needstrlcpy = yes; then
AC_LIBOBJ([strlcpy])
fi
needstrtok_r=no
AC_CHECK_FUNCS(strtok_r,,
[needstrtok_r=yes])
if test $needstrtok_r = yes; then
AC_LIBOBJ([strtok_r])
fi
#
# Do we have ffs(), and is it declared in <strings.h>?
#
AC_CHECK_FUNCS(ffs)
if test "$ac_cv_func_ffs" = yes; then
#
# We have ffs(); is it declared in <strings.h>?
#
# This test fails if we don't have <strings.h> or if we do
# but it doesn't declare ffs().
#
AC_CHECK_DECL(ffs,
[
AC_DEFINE(STRINGS_H_DECLARES_FFS,,
[Define to 1 if strings.h declares `ffs'])
],,
[
#include <strings.h>
])
fi
#
# Do this before checking for ether_hostton(), as it's a
# "getaddrinfo()-ish function".
#
AC_LBL_LIBRARY_NET
#
# Check for reentrant versions of getnetbyname_r(), as provided by
# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
# If we don't find one, we just use getnetbyname(), which uses
# thread-specific data on many platforms, but doesn't use it on
# NetBSD or OpenBSD, and may not use it on older versions of other
# platforms.
#
# Only do the check if we have a declaration of getnetbyname_r();
# without it, we can't check which API it has. (We assume that
# if there's a declaration, it has a prototype, so that the API
# can be checked.)
#
AC_CHECK_DECL(getnetbyname_r,
[
AC_MSG_CHECKING([for the Linux getnetbyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct netent netent_buf;
char buf[1024];
struct netent *resultp;
int h_errnoval;
return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
[define if we have the Linux getnetbyname_r()])
],
[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct netent netent_buf;
char buf[1024];
return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
[define if we have the Solaris/IRIX getnetbyname_r()])
],
[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([for AIX getnetbyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct netent netent_buf;
struct netent_data net_data;
return getnetbyname_r((const char *)0, &netent_buf, &net_data);
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
[define if we have the AIX getnetbyname_r()])
],
[
AC_MSG_RESULT(no)
])
])
])
],,[#include <netdb.h>])
#
# Check for reentrant versions of getprotobyname_r(), as provided by
# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
# If we don't find one, we just use getprotobyname(), which uses
# thread-specific data on many platforms, but doesn't use it on
# NetBSD or OpenBSD, and may not use it on older versions of other
# platforms.
#
# Only do the check if we have a declaration of getprotobyname_r();
# without it, we can't check which API it has. (We assume that
# if there's a declaration, it has a prototype, so that the API
# can be checked.)
#
AC_CHECK_DECL(getprotobyname_r,
[
AC_MSG_CHECKING([for the Linux getprotobyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct protoent protoent_buf;
char buf[1024];
struct protoent *resultp;
return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
[define if we have the Linux getprotobyname_r()])
],
[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct protoent protoent_buf;
char buf[1024];
return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
[define if we have the Solaris/IRIX getprotobyname_r()])
],
[
AC_MSG_RESULT(no)
AC_MSG_CHECKING([for AIX getprotobyname_r()])
AC_TRY_LINK(
[#include <netdb.h>],
[
struct protoent protoent_buf;
struct protoent_data proto_data;
return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
[define if we have the AIX getprotobyname_r()])
],
[
AC_MSG_RESULT(no)
])
])
])
],,[#include <netdb.h>])
#
# You are in a twisty little maze of UN*Xes, all different.
# Some might not have ether_hostton().
# Some might have it and declare it in <net/ethernet.h>.
# Some might have it and declare it in <netinet/ether.h>
# Some might have it and declare it in <sys/ethernet.h>.
# Some might have it and declare it in <arpa/inet.h>.
# Some might have it and declare it in <netinet/if_ether.h>.
# Some might have it and not declare it in any header file.
#
# Before you is a C compiler.
#
AC_CHECK_FUNCS(ether_hostton)
if test "$ac_cv_func_ether_hostton" = yes; then
#
# OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
#
# This test fails if we don't have <net/ethernet.h> or if we do
# but it doesn't declare ether_hostton().
#
AC_CHECK_DECL(ether_hostton,
[
AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
[Define to 1 if net/ethernet.h declares `ether_hostton'])
],,
[
#include <net/ethernet.h>
])
#
# Did that succeed?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, how about <netinet/ether.h>, as on Linux?
#
# This test fails if we don't have <netinet/ether.h>
# or if we do but it doesn't declare ether_hostton().
#
# Unset ac_cv_have_decl_ether_hostton so we don't
# treat the previous failure as a cached value and
# suppress the next test.
#
unset ac_cv_have_decl_ether_hostton
AC_CHECK_DECL(ether_hostton,
[
AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
[Define to 1 if netinet/ether.h declares `ether_hostton'])
],,
[
#include <netinet/ether.h>
])
fi
#
# Did that succeed?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, how about <sys/ethernet.h>, as on Solaris 10
# and later?
#
# This test fails if we don't have <sys/ethernet.h>
# or if we do but it doesn't declare ether_hostton().
#
# Unset ac_cv_have_decl_ether_hostton so we don't
# treat the previous failure as a cached value and
# suppress the next test.
#
unset ac_cv_have_decl_ether_hostton
AC_CHECK_DECL(ether_hostton,
[
AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
[Define to 1 if sys/ethernet.h declares `ether_hostton'])
],,
[
#include <sys/ethernet.h>
])
fi
#
# Did that succeed?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, how about <arpa/inet.h>, as in AIX?
#
# This test fails if we don't have <arpa/inet.h>
# (if we have ether_hostton(), we should have
# networking, and if we have networking, we should
# have <arapa/inet.h>) or if we do but it doesn't
# declare ether_hostton().
#
# Unset ac_cv_have_decl_ether_hostton so we don't
# treat the previous failure as a cached value and
# suppress the next test.
#
unset ac_cv_have_decl_ether_hostton
AC_CHECK_DECL(ether_hostton,
[
AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
[Define to 1 if arpa/inet.h declares `ether_hostton'])
],,
[
#include <arpa/inet.h>
])
fi
#
# Did that succeed?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, how about <netinet/if_ether.h>?
# On some platforms, it requires <net/if.h> and
# <netinet/in.h>, and we always include it with
# both of them, so test it with both of them.
#
# This test fails if we don't have <netinet/if_ether.h>
# and the headers we include before it, or if we do but
# <netinet/if_ether.h> doesn't declare ether_hostton().
#
# Unset ac_cv_have_decl_ether_hostton so we don't
# treat the previous failure as a cached value and
# suppress the next test.
#
unset ac_cv_have_decl_ether_hostton
AC_CHECK_DECL(ether_hostton,
[
AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
[Define to 1 if netinet/if_ether.h declares `ether_hostton'])
],,
[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
])
fi
#
# After all that, is ether_hostton() declared?
#
if test "$ac_cv_have_decl_ether_hostton" = yes; then
#
# Yes.
#
AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
[Define to 1 if you have the declaration of `ether_hostton'])
else
#
# No, we'll have to declare it ourselves.
# Do we have "struct ether_addr" if we include
# <netinet/if_ether.h>?
#
AC_CHECK_TYPES(struct ether_addr,,,
[
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>
#include <netinet/if_ether.h>
])
fi
fi
#
# For various things that might use pthreads.
#
AC_CHECK_HEADER(pthread.h,
[
#
# OK, we have pthread.h. Do we have pthread_create in the
# system libraries?
#
AC_CHECK_FUNC(pthread_create,
[
#
# Yes.
#
ac_lbl_have_pthreads="found"
],
[
#
# No - do we have it in -lpthreads?
#
AC_CHECK_LIB(pthreads, pthread_create,
[
#
# Yes - add -lpthreads.
#
ac_lbl_have_pthreads="found"
PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
],
[
#
# No - do we have it in -lpthread?
#
AC_CHECK_LIB(pthread, pthread_create,
[
#
# Yes - add -lpthread.
#
ac_lbl_have_pthreads="found"
PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
],
[
#
# No.
#
ac_lbl_have_pthreads="not found"
])
])
])
],
[
#
# We didn't find pthread.h.
#
ac_lbl_have_pthreads="not found"
]
)
dnl to pacify those who hate protochain insn
AC_MSG_CHECKING(if --disable-protochain option is specified)
AC_ARG_ENABLE(protochain,
AS_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
case "x$enable_protochain" in
xyes) enable_protochain=enabled ;;
xno) enable_protochain=disabled ;;
x) enable_protochain=enabled ;;
esac
if test "$enable_protochain" = "disabled"; then
AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
fi
AC_MSG_RESULT(${enable_protochain})
#
# valgrindtest directly uses the native capture mechanism, but
# only tests with BPF and PF_PACKET sockets; only enable it if
# we have BPF or PF_PACKET sockets.
#
VALGRINDTEST_SRC=
AC_ARG_WITH(pcap,
AS_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
if test ! -z "$with_pcap" ; then
V_PCAP="$withval"
else
#
# Check for a bunch of headers for various packet
# capture mechanisms.
#
AC_CHECK_HEADERS(net/bpf.h)
if test "$ac_cv_header_net_bpf_h" = yes; then
#
# Does it define BIOCSETIF?
# I.e., is it a header for an LBL/BSD-style capture
# mechanism, or is it just a header for a BPF filter
# engine? Some versions of Arch Linux, for example,
# have a net/bpf.h that doesn't define BIOCSETIF;
# as it's a Linux, it should use packet sockets,
# instead.
#
# We need:
#
# sys/types.h, because FreeBSD 10's net/bpf.h
# requires that various BSD-style integer types
# be defined;
#
# sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
# doesn't include it but does use struct timeval
# in ioctl definitions;
#
# sys/ioctl.h and, if we have it, sys/ioccom.h,
# because net/bpf.h defines ioctls;
#
# net/if.h, because it defines some structures
# used in ioctls defined by net/bpf.h;
#
# sys/socket.h, because OpenBSD 5.9's net/bpf.h
# defines some structure fields as being
# struct sockaddrs;
#
# and net/bpf.h doesn't necessarily include all
# of those headers itself.
#
AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/time.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#include <net/bpf.h>
#include <net/if.h>
],
[u_int i = BIOCSETIF;],
ac_cv_lbl_bpf_h_defines_biocsetif=yes,
ac_cv_lbl_bpf_h_defines_biocsetif=no))
AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
fi
AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
AC_CHECK_HEADERS(config/HaikuConfig.h)
if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
#
# BPF.
# Check this before DLPI, so that we pick BPF on
# Solaris 11 and later.
#
V_PCAP=bpf
#
# We have BPF, so build valgrindtest with "make test"
# on macOS and FreeBSD (add your OS once there's a
# valgrind for it).
#
case "$host_os" in
freebsd*|darwin*|linux*)
VALGRINDTEST_SRC=valgrindtest.c
;;
esac
elif test "$ac_cv_header_linux_socket_h" = yes; then
#
# No prizes for guessing this one.
#
V_PCAP=linux
VALGRINDTEST_SRC=valgrindtest.c
elif test "$ac_cv_header_net_pfilt_h" = yes; then
#
# DEC OSF/1, Digital UNIX, Tru64 UNIX
#
V_PCAP=pf
elif test "$ac_cv_header_net_enet_h" = yes; then
#
# Stanford Enetfilter.
#
V_PCAP=enet
elif test "$ac_cv_header_net_nit_h" = yes; then
#
# SunOS 4.x STREAMS NIT.
#
V_PCAP=snit
elif test "$ac_cv_header_sys_net_nit_h" = yes; then
#
# Pre-SunOS 4.x non-STREAMS NIT.
#
V_PCAP=nit
elif test "$ac_cv_header_net_raw_h" = yes; then
#
# IRIX snoop.
#
V_PCAP=snoop
elif test "$ac_cv_header_sys_dlpi_h" = yes; then
#
# DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
#
V_PCAP=dlpi
elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
#
# Haiku.
#
V_PCAP=haiku
else
#
# Nothing we support.
#
V_PCAP=null
AC_MSG_WARN(cannot determine packet capture interface)
AC_MSG_WARN((see the INSTALL doc for more info))
fi
fi
AC_MSG_CHECKING(packet capture type)
AC_MSG_RESULT($V_PCAP)
AC_SUBST(VALGRINDTEST_SRC)
#
# Do we have pkg-config?
#
AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
#
# Handle each capture type.
#
case "$V_PCAP" in
dlpi)
#
# Checks for some header files.
#
AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
#
# Checks to see if Solaris has the public libdlpi(3LIB) library.
# Note: The existence of /usr/include/libdlpi.h does not mean it is the
# public libdlpi(3LIB) version. Before libdlpi was made public, a
# private version also existed, which did not have the same APIs.
# Due to a gcc bug, the default search path for 32-bit libraries does
# not include /lib, we add it explicitly here.
# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
# Also, due to the bug above applications that link to libpcap with
# libdlpi will have to add "-L/lib" option to "configure".
#
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LIBS -L/lib"
AC_CHECK_LIB(dlpi, dlpi_walk,
[
LIBS="-ldlpi $LIBS"
V_PCAP=libdlpi
#
# Capture module plus common code needed for
# common functions used by pcap-[dlpi,libdlpi].c
#
PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
],
[
V_PCAP=dlpi
#
# Capture module plus common code needed for
# common functions used by pcap-[dlpi,libdlpi].c
#
PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
])
LDFLAGS="$save_LDFLAGS"
#
# Checks whether <sys/dlpi.h> is usable, to catch weird SCO
# versions of DLPI.
#
AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
AC_TRY_COMPILE(
[
#include <sys/types.h>
#include <sys/time.h>
#include <sys/dlpi.h>
],
[int i = DL_PROMISC_PHYS;],
ac_cv_sys_dlpi_usable=yes,
ac_cv_sys_dlpi_usable=no))
AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
if test $ac_cv_sys_dlpi_usable = no ; then
AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
fi
#
# Check to see if Solaris has the dl_passive_req_t struct defined
# in <sys/dlpi.h>.
# This check is for DLPI support for passive modes.
# See dlpi(7P) for more details.
#
AC_CHECK_TYPES(dl_passive_req_t,,,
[
#include <sys/types.h>
#include <sys/dlpi.h>
])
;;
enet)
#
# Capture module
#
PLATFORM_C_SRC="pcap-enet.c"
;;
haiku)
#
# Capture module
#
PLATFORM_CXX_SRC="pcap-haiku.cpp"
#
# Just for the sake of it.
#
AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
;;
linux)
#
# Capture module
#
PLATFORM_C_SRC="pcap-linux.c"
#
# Do we have the wireless extensions?
#
AC_CHECK_HEADERS(linux/wireless.h, [], [],
[
#include <sys/socket.h>
#include <linux/if.h>
#include <linux/types.h>
])
#
# Do we have libnl?
# We only want version 3. Version 2 was, apparently,
# short-lived, and version 1 is source and binary
# incompatible with version 3, and it appears that,
# these days, everybody's using version 3. We're
# not supporting older versions of the Linux kernel;
# let's drop support for older versions of libnl, too.
#
AC_ARG_WITH(libnl,
AS_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
with_libnl=$withval,with_libnl=if_available)
if test x$with_libnl != xno ; then
if test "x$PKGCONFIG" != "xno"; then
#
# We have pkg-config; see if we have libnl-genl-3.0
# as a package.
#
AC_MSG_CHECKING([for libnl-genl-3.0 with pkg-config])
if "$PKGCONFIG" libnl-genl-3.0; then
AC_MSG_RESULT([found])
pkg_config_found_libnl=yes
libnl_genl_cflags=`"$PKGCONFIG" --cflags libnl-genl-3.0`
V_INCLS="$V_INCLS ${libnl_genl_cflags}"
libnl_genl_libs=`"$PKGCONFIG" --libs libnl-genl-3.0`
LIBS="${libnl_genl_libs} $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
else
AC_MSG_RESULT([not found])
fi
fi
if test x$pkg_config_found_libnl != xyes; then
#
# OK, either we don't have pkg-config or there
# wasn't a .pc file for it; Check for it directly.
#
case "$with_libnl" in
yes|if_available)
incdir=-I/usr/include/libnl3
libnldir=
;;
*)
if test -d $withval; then
libnldir=-L${withval}/lib
incdir=-I${withval}/include
fi
;;
esac
AC_CHECK_LIB(nl-3, nl_socket_alloc,
[
#
# Yes, we have libnl 3.x.
#
LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
V_INCLS="$V_INCLS ${incdir}"
],[
#
# No, we don't have libnl at all.
# Fail if the user explicitly requested
# it.
#
if test x$with_libnl = xyes ; then
AC_MSG_ERROR([libnl support requested but libnl not found])
fi
], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
fi
fi
#
# Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
#
# NOTE: any failure means we conclude that it doesn't have that
# member, so if we don't have tpacket_auxdata, we conclude it
# doesn't have that member (which is OK, as either we won't be
# using code that would use that member, or we wouldn't compile
# in any case).
AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
[
#include <sys/types.h>
#include <linux/if_packet.h>
])
;;
bpf)
#
# Capture module
#
PLATFORM_C_SRC="pcap-bpf.c"
#
# Check whether we have the *BSD-style ioctls.
#
AC_CHECK_HEADERS(net/if_media.h)
#
# Check whether we have struct BPF_TIMEVAL.
#
AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
[
#include <sys/types.h>
#include <sys/ioctl.h>
#ifdef HAVE_SYS_IOCCOM_H
#include <sys/ioccom.h>
#endif
#include <net/bpf.h>
])
;;
pf)
#
# Capture module
#
PLATFORM_C_SRC="pcap-pf.c"
;;
snit)
#
# Capture module
#
PLATFORM_C_SRC="pcap-snit.c"
;;
snoop)
#
# Capture module
#
PLATFORM_C_SRC="pcap-snoop.c"
;;
dag)
#
# --with-pcap=dag is the only way to get here, and it means
# "DAG support but nothing else"
#
V_DEFS="$V_DEFS -DDAG_ONLY"
PLATFORM_C_SRC="pcap-dag.c"
xxx_only=yes
;;
dpdk)
#
# --with-pcap=dpdk is the only way to get here, and it means