forked from the-tcpdump-group/libpcap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
1630 lines (1483 loc) · 42.5 KB
/
configure.in
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
#
# http://ftp.gnu.org/gnu/config/README
#
# for the URLs to use to fetch new versions of config.guess and
# config.sub.
#
AC_PREREQ(2.61)
AC_INIT(pcap.c)
AC_CANONICAL_SYSTEM
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
AC_PROG_CC
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
AC_LBL_SHLIBS_INIT
AC_LBL_C_INLINE
AC_C___ATTRIBUTE__
if test "$ac_cv___attribute__" = "yes"; then
AC_C___ATTRIBUTE___UNUSED
AC_C___ATTRIBUTE___FORMAT
fi
AC_CHECK_HEADERS(sys/bitypes.h)
AC_CHECK_TYPE([int8_t], ,
[AC_DEFINE([int8_t], [signed char],
[Define to `signed char' if int8_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([u_int8_t], ,
[AC_DEFINE([u_int8_t], [unsigned char],
[Define to `unsigned char' if u_int8_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([int16_t], ,
[AC_DEFINE([int16_t], [short],
[Define to `short' if int16_t not defined.])]
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([u_int16_t], ,
[AC_DEFINE([u_int16_t], [unsigned short],
[Define to `unsigned short' if u_int16_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([int32_t], ,
[AC_DEFINE([int32_t], [int],
[Define to `int' if int32_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([u_int32_t], ,
[AC_DEFINE([u_int32_t], [unsigned int],
[Define to `unsigned int' if u_int32_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([int64_t], ,
[AC_DEFINE([int64_t], [long long],
[Define to `long long' if int64_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
AC_CHECK_TYPE([u_int64_t], ,
[AC_DEFINE([u_int64_t], [unsigned long long],
[Define to `unsigned long long' if u_int64_t not defined.])],
[AC_INCLUDES_DEFAULT
#ifdef HAVE_SYS_BITYPES_H
#include <sys/bitypes.h>
#endif])
#
# 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 limits.h paths.h)
AC_CHECK_HEADERS(linux/types.h)
AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_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
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
#include <sys/socket.h>])
if test "$ac_cv_header_netinet_if_ether_h" != yes; then
#
# The simple test didn't work.
# Do we need to include <net/if.h> first?
# Unset ac_cv_header_netinet_if_ether_h so we don't
# treat the previous failure as a cached value and
# suppress the next test.
#
AC_MSG_NOTICE([Rechecking with some additional includes])
unset ac_cv_header_netinet_if_ether_h
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
struct mbuf;
struct rtentry;
#include <net/if.h>])
fi
AC_LBL_FIXINCLUDES
AC_CHECK_FUNCS(strerror strlcpy)
needsnprintf=no
AC_CHECK_FUNCS(vsnprintf snprintf,,
[needsnprintf=yes])
if test $needsnprintf = yes; then
AC_LIBOBJ([snprintf])
fi
#
# Do this before checking for ether_hostton(), as it's a
# "gethostbyname() -ish function".
#
AC_LBL_LIBRARY_NET
#
# You are in a twisty little maze of UN*Xes, all different.
# Some might not have ether_hostton().
# Some might have it, but not declare it in any header file.
# Some might have it, but declare it in <netinet/if_ether.h>.
# Some might have it, but declare it in <netinet/ether.h>
# (And some might have it but document it as something declared in
# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
#
# 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(). Do we have <netinet/if_ether.h>?
#
if test "$ac_cv_header_netinet_if_ether_h" = yes; then
#
# Yes. Does it declare 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 <netinet/in.h>
#include <arpa/inet.h>
struct mbuf;
struct rtentry;
#include <net/if.h>
#include <netinet/if_ether.h>
])
fi
#
# Did that succeed?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, how about <netinet/ether.h>, as on Linux?
#
AC_CHECK_HEADERS(netinet/ether.h)
if test "$ac_cv_header_netinet_ether_h" = yes; then
#
# We have it - does it 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
fi
#
# Is ether_hostton() declared?
#
if test "$ac_cv_have_decl_ether_hostton" != yes; then
#
# No, we'll have to declare it ourselves.
# Do we have "struct ether_addr"?
#
AC_CHECK_TYPES(struct ether_addr,,,
[
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
struct mbuf;
struct rtentry;
#include <net/if.h>
#include <netinet/if_ether.h>
])
AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
[Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
don't.])
else
AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
[Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
don't.])
fi
fi
dnl to pacify those who hate protochain insn
AC_MSG_CHECKING(if --disable-protochain option is specified)
AC_ARG_ENABLE(protochain,
AC_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})
#
# SITA support is mutually exclusive with native capture support;
# "--with-sita" selects SITA support.
#
AC_ARG_WITH(sita,
AC_HELP_STRING([--with-sita],[include SITA support]),
[
if test ! "x$withval" = "xno" ; then
AC_DEFINE(SITA,1,[include ACN support])
AC_MSG_NOTICE(Enabling SITA ACN support)
V_PCAP=sita
V_FINDALLDEVS=sita
fi
],
[
dnl
dnl Not all versions of test support -c (character special) but it's a
dnl better way of testing since the device might be protected. So we
dnl check in our normal order using -r and then check the for the /dev
dnl guys again using -c.
dnl
dnl XXX This could be done for cross-compiling, but for now it's not.
dnl
if test -z "$with_pcap" && test "$cross_compiling" = yes; then
AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
fi
AC_ARG_WITH(pcap,
AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
AC_MSG_CHECKING(packet capture type)
if test ! -z "$with_pcap" ; then
V_PCAP="$withval"
elif test -r /dev/bpf -o -h /dev/bpf ; then
#
# Cloning BPF device.
#
V_PCAP=bpf
AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
elif test -r /dev/bpf0 ; then
V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then
V_PCAP=pf
elif test -r /dev/enet ; then
V_PCAP=enet
elif test -r /dev/nit ; then
V_PCAP=snit
elif test -r /usr/include/sys/net/nit.h ; then
V_PCAP=nit
elif test -r /usr/include/linux/socket.h ; then
V_PCAP=linux
elif test -r /usr/include/net/raw.h ; then
V_PCAP=snoop
elif test -r /usr/include/odmi.h ; then
#
# On AIX, the BPF devices might not yet be present - they're
# created the first time libpcap runs after booting.
# We check for odmi.h instead.
#
V_PCAP=bpf
elif test -c /dev/bpf0 ; then # check again in case not readable
V_PCAP=bpf
elif test -r /usr/include/sys/dlpi.h ; then
V_PCAP=dlpi
elif test -c /dev/enet ; then # check again in case not readable
V_PCAP=enet
elif test -c /dev/nit ; then # check again in case not readable
V_PCAP=snit
else
V_PCAP=null
fi
AC_MSG_RESULT($V_PCAP)
#
# Do capture-mechanism-dependent tests.
#
case "$V_PCAP" in
dlpi)
#
# Needed for common functions used by pcap-[dlpi,libdlpi].c
#
SSRC="dlpisubs.c"
#
# 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".
#
saved_ldflags=$LDFLAGS
LDFLAGS="$LIBS -L/lib"
AC_CHECK_LIB(dlpi, dlpi_walk,
[
LIBS="-ldlpi $LIBS"
V_PCAP=libdlpi
AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
],
V_PCAP=dlpi)
LDFLAGS=$saved_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 whether we have a /dev/dlpi device or have multiple devices.
#
AC_MSG_CHECKING(for /dev/dlpi device)
if test -c /dev/dlpi ; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
else
AC_MSG_RESULT(no)
dir="/dev/dlpi"
AC_MSG_CHECKING(for $dir directory)
if test -d $dir ; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
else
AC_MSG_RESULT(no)
fi
fi
#
# This check is for Solaris with DLPI support for passive modes.
# See dlpi(7P) for more details.
#
AC_LBL_DL_PASSIVE_REQ_T
;;
linux)
#
# 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?
#
AC_ARG_WITH(libnl,
AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
with_libnl=$withval,,)
if test x$with_libnl != xno ; then
have_any_nl="no"
#
# Try libnl 3.x first.
#
AC_CHECK_LIB(nl-3, nl_socket_alloc,
[
#
# Yes, we have libnl 3.x.
#
LIBS="-lnl-genl-3 -lnl-3 $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
V_INCLS="$V_INCLS -I/usr/include/libnl3"
have_any_nl="yes"
])
if test x$have_any_nl = xno ; then
#
# Try libnl 2.x
#
AC_CHECK_LIB(nl, nl_socket_alloc,
[
#
# Yes, we have libnl 2.x.
#
LIBS="-lnl-genl -lnl $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
have_any_nl="yes"
])
fi
if test x$have_any_nl = xno ; then
#
# No, we don't; do we have libnl 1.x?
#
AC_CHECK_LIB(nl, nl_handle_alloc,
[
#
# Yes.
#
LIBS="-lnl $LIBS"
AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
have_any_nl="yes"
])
fi
if test x$have_any_nl = xno ; then
#
# No, we don't have libnl at all.
#
if test x$with_libnl = xyes ; then
AC_MSG_ERROR([libnl support requested but libnl not found])
fi
fi
fi
AC_CHECK_HEADERS(linux/ethtool.h,,,
[
AC_INCLUDES_DEFAULT
#include <linux/types.h>
])
AC_LBL_TPACKET_STATS
AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
;;
bpf)
#
# Check whether we have the *BSD-style ioctls.
#
AC_CHECK_HEADERS(net/if_media.h)
AC_MSG_CHECKING(whether the system supports zerocopy BPF)
AC_TRY_COMPILE(
[#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/bpf.h>],
[return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
[define if the system supports zerocopy BPF])
],
AC_MSG_RESULT(no))
#
# 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>
])
;;
dag)
V_DEFS="$V_DEFS -DDAG_ONLY"
;;
septel)
V_DEFS="$V_DEFS -DSEPTEL_ONLY"
;;
snf)
V_DEFS="$V_DEFS -DSNF_ONLY"
;;
null)
AC_MSG_WARN(cannot determine packet capture interface)
AC_MSG_WARN((see the INSTALL doc for more info))
;;
esac
dnl
dnl Now figure out how we get a list of interfaces and addresses,
dnl if we support capturing. Don't bother if we don't support
dnl capturing.
dnl
if test "$V_PCAP" = null
then
#
# We can't capture, so we can't open any capture
# devices, so we won't return any interfaces.
#
V_FINDALLDEVS=null
else
AC_CHECK_FUNC(getifaddrs,[
#
# We have "getifaddrs()"; make sure we have <ifaddrs.h>
# as well, just in case some platform is really weird.
#
AC_CHECK_HEADER(ifaddrs.h,[
#
# We have the header, so we use "getifaddrs()" to
# get the list of interfaces.
#
V_FINDALLDEVS=getad
],[
#
# We don't have the header - give up.
# XXX - we could also fall back on some other
# mechanism, but, for now, this'll catch this
# problem so that we can at least try to figure
# out something to do on systems with "getifaddrs()"
# but without "ifaddrs.h", if there is something
# we can do on those systems.
#
AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
])
],[
#
# Well, we don't have "getifaddrs()", so we have to use
# some other mechanism; determine what that mechanism is.
#
# The first thing we use is the type of capture mechanism,
# which is somewhat of a proxy for the OS we're using.
#
case "$V_PCAP" in
dlpi|libdlpi)
#
# This might be Solaris 8 or later, with
# SIOCGLIFCONF, or it might be some other OS
# or some older version of Solaris, with
# just SIOCGIFCONF.
#
AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
AC_TRY_COMPILE(
[#include <sys/param.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/sockio.h>],
[ioctl(0, SIOCGLIFCONF, (char *)0);],
ac_cv_lbl_have_siocglifconf=yes,
ac_cv_lbl_have_siocglifconf=no))
AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
if test $ac_cv_lbl_have_siocglifconf = yes ; then
V_FINDALLDEVS=glifc
else
V_FINDALLDEVS=gifc
fi
;;
*)
#
# Assume we just have SIOCGIFCONF.
# (XXX - on at least later Linux kernels, there's
# another mechanism, and we should be using that
# instead.)
#
V_FINDALLDEVS=gifc
;;
esac])
fi
])
AC_MSG_CHECKING(for socklen_t)
AC_TRY_COMPILE([
#include <sys/types.h>
#include <sys/socket.h>
],
[ socklen_t x; ],
have_socklen_t=yes,
have_socklen_t=no)
if test "x$have_socklen_t" = "xyes"; then
AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
fi
AC_MSG_RESULT($have_socklen_t)
AC_ARG_ENABLE(ipv6,
AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
[],
[enable_ipv6=ifavailable])
if test "$enable_ipv6" != "no"; then
AC_CHECK_FUNC(getaddrinfo,
[
AC_DEFINE(INET6,1,[IPv6])
],
[
if test "$enable_ipv6" != "ifavailable"; then
AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
fi
])
fi
AC_MSG_CHECKING(whether to build optimizer debugging code)
AC_ARG_ENABLE(optimizer-dbg,
AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
if test "$enable_optimizer_dbg" = "yes"; then
AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
fi
AC_MSG_RESULT(${enable_optimizer_dbg-no})
AC_MSG_CHECKING(whether to build parser debugging code)
AC_ARG_ENABLE(yydebug,
AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
if test "$enable_yydebug" = "yes"; then
AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
fi
AC_MSG_RESULT(${enable_yydebug-no})
# Check for Endace DAG card support.
AC_ARG_WITH([dag],
AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
[
if test "$withval" = no
then
# User doesn't want DAG support.
want_dag=no
elif test "$withval" = yes
then
# User wants DAG support but hasn't specified a directory.
want_dag=yes
else
# User wants DAG support and has specified a directory, so use the provided value.
want_dag=yes
dag_root=$withval
fi
],[
#
# Use DAG API if present, otherwise don't
#
want_dag=ifpresent
])
AC_ARG_WITH([dag-includes],
AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
[
# User wants DAG support and has specified a header directory, so use the provided value.
want_dag=yes
dag_include_dir=$withval
],[])
AC_ARG_WITH([dag-libraries],
AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
[
# User wants DAG support and has specified a library directory, so use the provided value.
want_dag=yes
dag_lib_dir=$withval
],[])
case "$V_PCAP" in
linux|bpf|dag)
#
# We support the DAG API if we're on Linux or BSD, or if we're
# building a DAG-only libpcap.
#
;;
*)
#
# If the user explicitly requested DAG, tell them it's not
# supported.
#
# If they expressed no preference, don't include it.
#
if test $want_dag = yes; then
AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
elif test $want_dag = yes; then
want_dag=no
fi
;;
esac
ac_cv_lbl_dag_api=no
if test "$want_dag" != no; then
AC_MSG_CHECKING([whether we have DAG API headers])
# If necessary, set default paths for DAG API headers and libraries.
if test -z "$dag_root"; then
dag_root=/usr/local
fi
if test -z "$dag_include_dir"; then
dag_include_dir="$dag_root/include"
fi
if test -z "$dag_lib_dir"; then
dag_lib_dir="$dag_root/lib"
fi
if test -z "$dag_tools_dir"; then
dag_tools_dir="$dag_root/tools"
fi
if test -r $dag_include_dir/dagapi.h; then
ac_cv_lbl_dag_api=yes
fi
AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
fi
if test $ac_cv_lbl_dag_api = yes; then
V_INCLS="$V_INCLS -I$dag_include_dir"
if test $V_PCAP != dag ; then
SSRC="pcap-dag.c"
fi
# See if we can find a general version string.
# Don't need to save and restore LIBS to prevent -ldag being
# included if there's a found-action (arg 3).
saved_ldflags=$LDFLAGS
LDFLAGS="-L$dag_lib_dir"
AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
AC_CHECK_LIB([dag],[dag_get_erf_types], [
AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
LDFLAGS=$saved_ldflags
if test "$dag_streams" = 1; then
AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
LIBS="$LIBS -ldag"
LDFLAGS="$LDFLAGS -L$dag_lib_dir"
AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
if test "$ac_dag_have_vdag" = 1; then
AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
LIBS="$LIBS -lpthread"
fi
fi
AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
fi
AC_MSG_CHECKING(whether we have the DAG API)
if test $ac_cv_lbl_dag_api = no; then
AC_MSG_RESULT(no)
if test "$want_dag" = yes; then
# User wanted DAG support but we couldn't find it.
AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
fi
if test "$V_PCAP" = dag; then
# User requested "dag" capture type but the DAG API wasn't
# found.
AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)])
fi
else
AC_MSG_RESULT(yes)
fi
AC_ARG_WITH(septel,
AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
[
if test "$withval" = no
then
want_septel=no
elif test "$withval" = yes
then
want_septel=yes
septel_root=
else
want_septel=yes
septel_root=$withval
fi
],[
#
# Use Septel API if present, otherwise don't
#
want_septel=ifpresent
septel_root=./../septel
])
ac_cv_lbl_septel_api=no
case "$V_PCAP" in
linux|septel)
#
# We support the Septel API if we're on Linux, or if we're building
# a Septel-only libpcap.
#
;;
*)
#
# If the user explicitly requested Septel, tell them it's not
# supported.
#
# If they expressed no preference, don't include it.
#
if test $want_septel = yes; then
AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
elif test $want_septel = yes; then
want_septel=no
fi
;;
esac
if test "$with_septel" != no; then
AC_MSG_CHECKING(whether we have Septel API)
if test -z "$septel_root"; then
septel_root=$srcdir/../septel
fi
septel_tools_dir="$septel_root"
septel_include_dir="$septel_root/INC"
ac_cv_lbl_septel_api=no
if test -r "$septel_include_dir/msg.h"; then
V_INCLS="$V_INCLS -I$septel_include_dir"
ADDLOBJS="$ADDLOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o"
if test "$V_PCAP" != septel ; then
SSRC="pcap-septel.c"
fi
ac_cv_lbl_septel_api=yes
fi
AC_MSG_RESULT($ac_cv_lbl_septel_api)
if test $ac_cv_lbl_septel_api = no; then
if test "$want_septel" = yes; then
AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
fi
else
AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
fi
fi
if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
fi
# Check for Myricom SNF support.
AC_ARG_WITH([snf],
AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
[
if test "$withval" = no
then
# User explicitly doesn't want SNF
want_snf=no
elif test "$withval" = yes
then
# User wants SNF support but hasn't specific a directory.
want_snf=yes
else
# User wants SNF support with a specified directory.
want_snf=yes
snf_root=$withval
fi
],[
#
# Use Sniffer API if present, otherwise don't
#
want_snf=ifpresent
])
AC_ARG_WITH([snf-includes],
AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
[
# User wants SNF with specific header directory
want_snf=yes
snf_include_dir=$withval
],[])
AC_ARG_WITH([snf-libraries],
AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
[
# User wants SNF with specific lib directory
want_snf=yes
snf_lib_dir=$withval
],[])
case "$V_PCAP" in
bpf|linux|snf)
#
# We support the Sniffer API if we're on BSD, Linux, or if we're
# building a Sniffer-only libpcap.
#
;;
*)
#
# If the user explicitly requested Sniffer, tell them it's not
# supported.
#
# If they expressed no preference, don't include it.
#
if test $want_snf = yes; then
AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
elif test $want_snf = yes; then
want_snf=no
fi
;;
esac
ac_cv_lbl_snf_api=no
if test "$with_snf" != no; then
AC_MSG_CHECKING(whether we have Myricom Sniffer API)
if test -z "$snf_root"; then
snf_root=/opt/snf
fi
if test -z "$snf_include_dir"; then
snf_include_dir="$snf_root/include"
fi
if test -z "$snf_lib_dir"; then
snf_lib_dir="$snf_root/lib"
fi