2 dnl Copyright (c) 1994, 1995, 1996, 1997
3 dnl The Regents of the University of California. All rights reserved.
5 dnl Process this file with autoconf to produce a configure script.
11 # http://ftp.gnu.org/gnu/config/README
13 # for the URLs to use to fetch new versions of config.guess and
22 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
24 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
28 if test "$ac_cv___attribute__" = "yes"; then
29 AC_C___ATTRIBUTE___UNUSED
30 AC_C___ATTRIBUTE___FORMAT
33 AC_CHECK_HEADERS(sys/bitypes.h)
35 AC_CHECK_TYPE([int8_t], ,
36 [AC_DEFINE([int8_t], [signed char],
37 [Define to `signed char' if int8_t not defined.])],
39 #ifdef HAVE_SYS_BITYPES_H
40 #include <sys/bitypes.h>
42 AC_CHECK_TYPE([u_int8_t], ,
43 [AC_DEFINE([u_int8_t], [unsigned char],
44 [Define to `unsigned char' if u_int8_t not defined.])],
46 #ifdef HAVE_SYS_BITYPES_H
47 #include <sys/bitypes.h>
49 AC_CHECK_TYPE([int16_t], ,
50 [AC_DEFINE([int16_t], [short],
51 [Define to `short' if int16_t not defined.])]
53 #ifdef HAVE_SYS_BITYPES_H
54 #include <sys/bitypes.h>
56 AC_CHECK_TYPE([u_int16_t], ,
57 [AC_DEFINE([u_int16_t], [unsigned short],
58 [Define to `unsigned short' if u_int16_t not defined.])],
60 #ifdef HAVE_SYS_BITYPES_H
61 #include <sys/bitypes.h>
63 AC_CHECK_TYPE([int32_t], ,
64 [AC_DEFINE([int32_t], [int],
65 [Define to `int' if int32_t not defined.])],
67 #ifdef HAVE_SYS_BITYPES_H
68 #include <sys/bitypes.h>
70 AC_CHECK_TYPE([u_int32_t], ,
71 [AC_DEFINE([u_int32_t], [unsigned int],
72 [Define to `unsigned int' if u_int32_t not defined.])],
74 #ifdef HAVE_SYS_BITYPES_H
75 #include <sys/bitypes.h>
77 AC_CHECK_TYPE([int64_t], ,
78 [AC_DEFINE([int64_t], [long long],
79 [Define to `long long' if int64_t not defined.])],
81 #ifdef HAVE_SYS_BITYPES_H
82 #include <sys/bitypes.h>
84 AC_CHECK_TYPE([u_int64_t], ,
85 [AC_DEFINE([u_int64_t], [unsigned long long],
86 [Define to `unsigned long long' if u_int64_t not defined.])],
88 #ifdef HAVE_SYS_BITYPES_H
89 #include <sys/bitypes.h>
93 # Try to arrange for large file support.
99 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
100 dnl include <sys/ioccom.h>, and we were to drop support for older
101 dnl releases without that fix, so that pcap-bpf.c doesn't need to
102 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
103 dnl in "aclocal.m4" uses it, so we would still have to test for it
104 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
105 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
107 AC_CHECK_HEADERS(sys/ioccom.h sys/select.h sys/sockio.h limits.h)
108 AC_CHECK_HEADERS(linux/types.h)
109 AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h)
110 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
111 #include <sys/socket.h>
112 #include <net/if.h>])
113 if test "$ac_cv_header_net_pfvar_h" = yes; then
115 # Check for various PF actions.
117 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
119 [#include <sys/types.h>
120 #include <sys/socket.h>
122 #include <net/pfvar.h>],
123 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
126 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
127 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
131 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
132 #include <sys/socket.h>])
133 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
135 # The simple test didn't work.
136 # Do we need to include <net/if.h> first?
137 # Unset ac_cv_header_netinet_if_ether_h so we don't
138 # treat the previous failure as a cached value and
139 # suppress the next test.
141 AC_MSG_NOTICE([Rechecking with some additional includes])
142 unset ac_cv_header_netinet_if_ether_h
143 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
144 #include <sys/socket.h>
145 #include <netinet/in.h>
148 #include <net/if.h>])
153 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
155 #include <sys/socket.h>
156 #include <linux/if.h>
163 AC_CHECK_FUNCS(strerror strlcpy strlcat)
166 AC_CHECK_FUNCS(vsnprintf snprintf,,
168 if test $needsnprintf = yes; then
169 AC_LIBOBJ([snprintf])
173 AC_CHECK_FUNCS(strtok_r,,
175 if test $needstrtok_r = yes; then
176 AC_LIBOBJ([strtok_r])
180 # Do this before checking for ether_hostton(), as it's a
181 # "gethostbyname() -ish function".
186 # You are in a twisty little maze of UN*Xes, all different.
187 # Some might not have ether_hostton().
188 # Some might have it, but not declare it in any header file.
189 # Some might have it, but declare it in <netinet/if_ether.h>.
190 # Some might have it, but declare it in <netinet/ether.h>
191 # (And some might have it but document it as something declared in
192 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
194 # Before you is a C compiler.
196 AC_CHECK_FUNCS(ether_hostton)
197 if test "$ac_cv_func_ether_hostton" = yes; then
199 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
201 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
203 # Yes. Does it declare ether_hostton()?
205 AC_CHECK_DECL(ether_hostton,
207 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
208 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
211 #include <sys/types.h>
212 #include <sys/socket.h>
213 #include <netinet/in.h>
214 #include <arpa/inet.h>
218 #include <netinet/if_ether.h>
224 if test "$ac_cv_have_decl_ether_hostton" != yes; then
226 # No, how about <netinet/ether.h>, as on Linux?
228 AC_CHECK_HEADERS(netinet/ether.h)
229 if test "$ac_cv_header_netinet_ether_h" = yes; then
231 # We have it - does it declare ether_hostton()?
232 # Unset ac_cv_have_decl_ether_hostton so we don't
233 # treat the previous failure as a cached value and
234 # suppress the next test.
236 unset ac_cv_have_decl_ether_hostton
237 AC_CHECK_DECL(ether_hostton,
239 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
240 [Define to 1 if netinet/ether.h declares `ether_hostton'])
243 #include <netinet/ether.h>
248 # Is ether_hostton() declared?
250 if test "$ac_cv_have_decl_ether_hostton" != yes; then
252 # No, we'll have to declare it ourselves.
253 # Do we have "struct ether_addr"?
255 AC_CHECK_TYPES(struct ether_addr,,,
257 #include <sys/types.h>
258 #include <sys/socket.h>
259 #include <netinet/in.h>
260 #include <arpa/inet.h>
264 #include <netinet/if_ether.h>
266 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
267 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
270 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
271 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
276 dnl to pacify those who hate protochain insn
277 AC_MSG_CHECKING(if --disable-protochain option is specified)
278 AC_ARG_ENABLE(protochain,
279 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
280 case "x$enable_protochain" in
281 xyes) enable_protochain=enabled ;;
282 xno) enable_protochain=disabled ;;
283 x) enable_protochain=enabled ;;
286 if test "$enable_protochain" = "disabled"; then
287 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
289 AC_MSG_RESULT(${enable_protochain})
292 # valgrindtest directly uses the native capture mechanism, but
293 # only tests with BPF and PF_PACKET sockets; only enable it if
294 # we have BPF or PF_PACKET sockets.
299 # SITA support is mutually exclusive with native capture support;
300 # "--with-sita" selects SITA support.
303 AC_HELP_STRING([--with-sita],[include SITA support]),
305 if test ! "x$withval" = "xno" ; then
306 AC_DEFINE(SITA,1,[include ACN support])
307 AC_MSG_NOTICE(Enabling SITA ACN support)
313 dnl Not all versions of test support -c (character special) but it's a
314 dnl better way of testing since the device might be protected. So we
315 dnl check in our normal order using -r and then check the for the /dev
316 dnl guys again using -c.
318 dnl XXX This could be done for cross-compiling, but for now it's not.
320 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
321 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
324 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
325 AC_MSG_CHECKING(packet capture type)
326 if test ! -z "$with_pcap" ; then
328 elif test -r /dev/bpf -o -h /dev/bpf ; then
330 # Cloning BPF device.
333 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
336 # We have BPF, so build valgrindtest with "make test".
338 VALGRINDTEST=valgrindtest
339 elif test -r /dev/bpf0 ; then
343 # We have BPF, so build valgrindtest with "make test".
345 VALGRINDTEST=valgrindtest
346 elif test -r /usr/include/net/pfilt.h ; then
348 elif test -r /dev/enet ; then
350 elif test -r /dev/nit ; then
352 elif test -r /usr/include/sys/net/nit.h ; then
354 elif test -r /usr/include/linux/socket.h ; then
358 # XXX - this won't work with older kernels that have SOCK_PACKET
359 # sockets but not PF_PACKET sockets.
361 VALGRINDTEST=valgrindtest
362 elif test -r /usr/include/net/raw.h ; then
364 elif test -r /usr/include/odmi.h ; then
366 # On AIX, the BPF devices might not yet be present - they're
367 # created the first time libpcap runs after booting.
368 # We check for odmi.h instead.
371 elif test -c /dev/bpf0 ; then # check again in case not readable
375 # We have BPF, so build valgrindtest with "make test".
377 VALGRINDTEST=valgrindtest
378 elif test -r /usr/include/sys/dlpi.h ; then
380 elif test -c /dev/enet ; then # check again in case not readable
382 elif test -c /dev/nit ; then # check again in case not readable
387 AC_MSG_RESULT($V_PCAP)
388 AC_SUBST(VALGRINDTEST)
391 # Do capture-mechanism-dependent tests.
396 # Needed for common functions used by pcap-[dlpi,libdlpi].c
401 # Checks for some header files.
403 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
406 # Checks to see if Solaris has the public libdlpi(3LIB) library.
407 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
408 # public libdlpi(3LIB) version. Before libdlpi was made public, a
409 # private version also existed, which did not have the same APIs.
410 # Due to a gcc bug, the default search path for 32-bit libraries does
411 # not include /lib, we add it explicitly here.
412 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
413 # Also, due to the bug above applications that link to libpcap with
414 # libdlpi will have to add "-L/lib" option to "configure".
416 saved_ldflags=$LDFLAGS
417 LDFLAGS="$LIBS -L/lib"
418 AC_CHECK_LIB(dlpi, dlpi_walk,
422 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
425 LDFLAGS=$saved_ldflags
428 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
431 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
432 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
435 #include <sys/types.h>
436 #include <sys/time.h>
437 #include <sys/dlpi.h>
439 [int i = DL_PROMISC_PHYS;],
440 ac_cv_sys_dlpi_usable=yes,
441 ac_cv_sys_dlpi_usable=no))
442 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
443 if test $ac_cv_sys_dlpi_usable = no ; then
444 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
448 # Check whether we have a /dev/dlpi device or have multiple devices.
450 AC_MSG_CHECKING(for /dev/dlpi device)
451 if test -c /dev/dlpi ; then
453 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
457 AC_MSG_CHECKING(for $dir directory)
458 if test -d $dir ; then
460 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
467 # This check is for Solaris with DLPI support for passive modes.
468 # See dlpi(7P) for more details.
470 AC_LBL_DL_PASSIVE_REQ_T
475 # Do we have the wireless extensions?
477 AC_CHECK_HEADERS(linux/wireless.h, [], [],
479 #include <sys/socket.h>
480 #include <linux/if.h>
481 #include <linux/types.h>
488 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
489 with_libnl=$withval,,)
491 if test x$with_libnl != xno ; then
494 incdir=-I/usr/include/libnl3
496 if test x$withval != x ; then
497 libnldir=-L${withval}/lib/.libs
498 incdir=-I${withval}/include
502 # Try libnl 3.x first.
504 AC_CHECK_LIB(nl-3, nl_socket_alloc,
507 # Yes, we have libnl 3.x.
509 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
510 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
511 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
512 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
513 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
514 V_INCLS="$V_INCLS ${incdir}"
516 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
518 if test x$have_any_nl = xno ; then
522 AC_CHECK_LIB(nl, nl_socket_alloc,
525 # Yes, we have libnl 2.x.
527 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
528 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
529 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
530 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
531 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
536 if test x$have_any_nl = xno ; then
538 # No, we don't; do we have libnl 1.x?
540 AC_CHECK_LIB(nl, nl_handle_alloc,
545 LIBS="${libnldir} -lnl $LIBS"
546 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
551 if test x$have_any_nl = xno ; then
553 # No, we don't have libnl at all.
555 if test x$with_libnl = xyes ; then
556 AC_MSG_ERROR([libnl support requested but libnl not found])
561 AC_CHECK_HEADERS(linux/ethtool.h,,,
564 #include <linux/types.h>
567 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
572 # Check whether we have the *BSD-style ioctls.
574 AC_CHECK_HEADERS(net/if_media.h)
576 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
578 [#include <sys/socket.h>
579 #include <sys/ioctl.h>
581 #include <net/bpf.h>],
582 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
585 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
586 [define if the system supports zerocopy BPF])
591 # Check whether we have struct BPF_TIMEVAL.
593 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
595 #include <sys/types.h>
596 #include <sys/ioctl.h>
597 #ifdef HAVE_SYS_IOCCOM_H
598 #include <sys/ioccom.h>
606 # --with-pcap=dag is the only way to get here, and it means
607 # "DAG support but nothing else"
609 V_DEFS="$V_DEFS -DDAG_ONLY"
615 # --with-pcap=septel is the only way to get here, and it means
616 # "Septel support but nothing else"
618 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
624 # --with-pcap=snf is the only way to get here, and it means
625 # "SNF support but nothing else"
627 V_DEFS="$V_DEFS -DSNF_ONLY"
632 AC_MSG_WARN(cannot determine packet capture interface)
633 AC_MSG_WARN((see the INSTALL doc for more info))
637 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
642 dnl Now figure out how we get a list of interfaces and addresses,
643 dnl if we support capturing. Don't bother if we don't support
646 if test "$V_PCAP" != null
648 AC_CHECK_FUNC(getifaddrs,[
650 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
651 # as well, just in case some platform is really weird.
653 AC_CHECK_HEADER(ifaddrs.h,[
655 # We have the header, so we use "getifaddrs()" to
656 # get the list of interfaces.
658 V_FINDALLDEVS=fad-getad.c
661 # We don't have the header - give up.
662 # XXX - we could also fall back on some other
663 # mechanism, but, for now, this'll catch this
664 # problem so that we can at least try to figure
665 # out something to do on systems with "getifaddrs()"
666 # but without "ifaddrs.h", if there is something
667 # we can do on those systems.
669 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
673 # Well, we don't have "getifaddrs()", so we have to use
674 # some other mechanism; determine what that mechanism is.
676 # The first thing we use is the type of capture mechanism,
677 # which is somewhat of a proxy for the OS we're using.
683 # This might be Solaris 8 or later, with
684 # SIOCGLIFCONF, or it might be some other OS
685 # or some older version of Solaris, with
688 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
689 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
691 [#include <sys/param.h>
692 #include <sys/file.h>
693 #include <sys/ioctl.h>
694 #include <sys/socket.h>
695 #include <sys/sockio.h>],
696 [ioctl(0, SIOCGLIFCONF, (char *)0);],
697 ac_cv_lbl_have_siocglifconf=yes,
698 ac_cv_lbl_have_siocglifconf=no))
699 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
700 if test $ac_cv_lbl_have_siocglifconf = yes ; then
701 V_FINDALLDEVS=fad-glifc.c
703 V_FINDALLDEVS=fad-gifc.c
709 # Assume we just have SIOCGIFCONF.
710 # (XXX - on at least later Linux kernels, there's
711 # another mechanism, and we should be using that
714 V_FINDALLDEVS=fad-gifc.c
720 AC_MSG_CHECKING(for socklen_t)
722 #include <sys/types.h>
723 #include <sys/socket.h>
728 if test "x$have_socklen_t" = "xyes"; then
729 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
731 AC_MSG_RESULT($have_socklen_t)
734 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
736 [enable_ipv6=ifavailable])
737 if test "$enable_ipv6" != "no"; then
738 AC_CHECK_FUNC(getaddrinfo,
740 AC_DEFINE(INET6,1,[IPv6])
743 if test "$enable_ipv6" != "ifavailable"; then
744 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
749 AC_MSG_CHECKING(whether to build optimizer debugging code)
750 AC_ARG_ENABLE(optimizer-dbg,
751 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
752 if test "$enable_optimizer_dbg" = "yes"; then
753 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
755 AC_MSG_RESULT(${enable_optimizer_dbg-no})
757 AC_MSG_CHECKING(whether to build parser debugging code)
758 AC_ARG_ENABLE(yydebug,
759 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
760 if test "$enable_yydebug" = "yes"; then
761 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
763 AC_MSG_RESULT(${enable_yydebug-no})
765 # Check for Endace DAG card support.
767 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
769 if test "$withval" = no
771 # User doesn't want DAG support.
773 elif test "$withval" = yes
775 # User wants DAG support but hasn't specified a directory.
778 # User wants DAG support and has specified a directory, so use the provided value.
783 if test "$V_PCAP" = dag; then
784 # User requested DAG-only libpcap, so we'd better have
787 elif test "xxx_only" = yes; then
788 # User requested something-else-only pcap, so they don't
793 # Use DAG API if present, otherwise don't
799 AC_ARG_WITH([dag-includes],
800 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
802 # User wants DAG support and has specified a header directory, so use the provided value.
804 dag_include_dir=$withval
807 AC_ARG_WITH([dag-libraries],
808 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
810 # User wants DAG support and has specified a library directory, so use the provided value.
816 if test "$want_dag" != no; then
818 AC_MSG_CHECKING([whether we have DAG API headers])
820 # If necessary, set default paths for DAG API headers and libraries.
821 if test -z "$dag_root"; then
825 if test -z "$dag_include_dir"; then
826 dag_include_dir="$dag_root/include"
829 if test -z "$dag_lib_dir"; then
830 dag_lib_dir="$dag_root/lib"
833 if test -z "$dag_tools_dir"; then
834 dag_tools_dir="$dag_root/tools"
837 if test -r $dag_include_dir/dagapi.h; then
838 ac_cv_lbl_dag_api=yes
841 if test "$ac_cv_lbl_dag_api" = yes; then
842 AC_MSG_RESULT([yes ($dag_include_dir)])
844 V_INCLS="$V_INCLS -I$dag_include_dir"
846 if test $V_PCAP != dag ; then
847 SSRC="$SSRC pcap-dag.c"
850 # See if we can find a general version string.
851 # Don't need to save and restore LIBS to prevent -ldag being
852 # included if there's a found-action (arg 3).
853 saved_ldflags=$LDFLAGS
854 LDFLAGS="-L$dag_lib_dir"
855 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
856 AC_CHECK_LIB([dag],[dag_get_erf_types], [
857 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
858 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
859 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
861 LDFLAGS=$saved_ldflags
863 if test "$dag_large_streams" = 1; then
864 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
866 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
868 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
869 if test "$ac_dag_have_vdag" = 1; then
870 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
871 LIBS="$LIBS -lpthread"
875 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
879 if test "$V_PCAP" = dag; then
880 # User requested "dag" capture type but we couldn't
881 # find the DAG API support.
882 AC_MSG_ERROR([DAG support requested with --with-pcap=dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
885 if test "$want_dag" = yes; then
886 # User wanted DAG support but we couldn't find it.
887 AC_MSG_ERROR([DAG support requested with --with-dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support])
893 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
895 if test "$withval" = no
898 elif test "$withval" = yes
907 if test "$V_PCAP" = septel; then
908 # User requested Septel-only libpcap, so we'd better have
911 elif test "xxx_only" = yes; then
912 # User requested something-else-only pcap, so they don't
913 # want Septel support.
917 # Use Septel API if present, otherwise don't
919 want_septel=ifpresent
923 ac_cv_lbl_septel_api=no
924 if test "$with_septel" != no; then
926 AC_MSG_CHECKING([whether we have Septel API headers])
928 # If necessary, set default paths for Septel API headers and libraries.
929 if test -z "$septel_root"; then
930 septel_root=$srcdir/../septel
933 septel_tools_dir="$septel_root"
934 septel_include_dir="$septel_root/INC"
936 if test -r "$septel_include_dir/msg.h"; then
937 ac_cv_lbl_septel_api=yes
940 if test "$ac_cv_lbl_septel_api" = yes; then
941 AC_MSG_RESULT([yes ($septel_include_dir)])
943 V_INCLS="$V_INCLS -I$septel_include_dir"
944 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"
945 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"
947 if test "$V_PCAP" != septel ; then
948 SSRC="$SSRC pcap-septel.c"
951 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
955 if test "$V_PCAP" = septel; then
956 # User requested "septel" capture type but
957 # we couldn't find the Septel API support.
958 AC_MSG_ERROR([Septel support requested with --with-pcap=septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
961 if test "$want_septel" = yes; then
962 # User wanted Septel support but we couldn't find it.
963 AC_MSG_ERROR([Septel support requested with --with-septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support])
968 # Check for Myricom SNF support.
970 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
972 if test "$withval" = no
974 # User explicitly doesn't want SNF
976 elif test "$withval" = yes
978 # User wants SNF support but hasn't specified a directory.
981 # User wants SNF support with a specified directory.
986 if test "$V_PCAP" = snf; then
987 # User requested Sniffer-only libpcap, so we'd better have
990 elif test "xxx_only" = yes; then
991 # User requested something-else-only pcap, so they don't
996 # Use Sniffer API if present, otherwise don't
1002 AC_ARG_WITH([snf-includes],
1003 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1005 # User wants SNF with specific header directory
1007 snf_include_dir=$withval
1010 AC_ARG_WITH([snf-libraries],
1011 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1013 # User wants SNF with specific lib directory
1015 snf_lib_dir=$withval
1018 ac_cv_lbl_snf_api=no
1019 if test "$with_snf" != no; then
1021 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1023 # If necessary, set default paths for Sniffer headers and libraries.
1024 if test -z "$snf_root"; then
1028 if test -z "$snf_include_dir"; then
1029 snf_include_dir="$snf_root/include"
1032 if test -z "$snf_lib_dir"; then
1033 snf_lib_dir="$snf_root/lib"
1036 if test -f "$snf_include_dir/snf.h"; then
1037 # We found a header; make sure we can link with the library
1038 saved_ldflags=$LDFLAGS
1039 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1040 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1041 LDFLAGS="$saved_ldflags"
1042 if test "$ac_cv_lbl_snf_api" = no; then
1043 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1047 if test "$ac_cv_lbl_snf_api" = yes; then
1048 AC_MSG_RESULT([yes ($snf_root)])
1050 V_INCLS="$V_INCLS -I$snf_include_dir"
1052 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1054 if test "$V_PCAP" != snf ; then
1055 SSRC="$SSRC pcap-snf.c"
1058 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1062 if test "$want_snf" = yes; then
1063 # User requested "snf" capture type but
1064 # we couldn't find the Sniffer API support.
1065 AC_MSG_ERROR([Myricom Sniffer support requested with --with-pcap=snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
1068 if test "$want_snf" = yes; then
1069 AC_MSG_ERROR([Myricom Sniffer support requested with --with-snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support])
1074 # Check for Riverbed TurboCap support.
1075 AC_ARG_WITH([turbocap],
1076 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1078 if test "$withval" = no
1080 # User explicitly doesn't want TurboCap
1082 elif test "$withval" = yes
1084 # User wants TurboCap support but hasn't specified a directory.
1087 # User wants TurboCap support with a specified directory.
1089 turbocap_root=$withval
1092 if test "xxx_only" = yes; then
1093 # User requested something-else-only pcap, so they don't
1094 # want TurboCap support.
1098 # Use TurboCap API if present, otherwise don't
1100 want_turbocap=ifpresent
1104 ac_cv_lbl_turbocap_api=no
1105 if test "$want_turbocap" != no; then
1107 AC_MSG_CHECKING(whether TurboCap is supported)
1109 save_CFLAGS="$CFLAGS"
1111 if test ! -z "$turbocap_root"; then
1112 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1113 TURBOCAP_LIBS="-L$turbocap_root/lib"
1114 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1122 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1124 (void)TcInstanceCreateByName("foo", &i);
1126 ac_cv_lbl_turbocap_api=yes)
1128 CFLAGS="$save_CFLAGS"
1129 if test $ac_cv_lbl_turbocap_api = yes; then
1132 SSRC="$SSRC pcap-tc.c"
1133 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1134 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1136 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1140 if test "$want_turbocap" = yes; then
1141 # User wanted Turbo support but we couldn't find it.
1142 AC_MSG_ERROR([TurboCap support requested with --with-turbocap, but the TurboCap headers weren't found: make sure the TurboCap support is installed or don't request TurboCap support])
1151 if test "$LEX" = ":"; then
1152 AC_MSG_ERROR([Neither flex nor lex was found.])
1156 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1157 # and supports processing our scanner.l.
1159 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1160 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1161 tcpdump_cv_capable_lex=yes
1163 tcpdump_cv_capable_lex=insufficient
1165 if test $tcpdump_cv_capable_lex = insufficient ; then
1166 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1167 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1171 # Look for yacc/bison/byacc.
1176 # Make sure it supports the -p flag and supports processing our
1179 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1180 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1181 tcpdump_cv_capable_yacc=yes
1183 tcpdump_cv_capable_yacc=insufficient
1185 if test $tcpdump_cv_capable_yacc = insufficient ; then
1186 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1187 libpcap requires Bison, Berkeley YACC, or another YACC compatible with them.])
1191 dnl Allow the user to enable remote capture.
1192 dnl It's off by default, as that increases the attack surface of
1193 dnl libpcap, exposing it to malicious servers.
1195 AC_MSG_CHECKING([whether to enable remote packet capture])
1196 AC_ARG_ENABLE(remote,
1197 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1198 --disable-remote disable remote packet capture],,
1200 case "$enableval" in
1201 yes) AC_MSG_RESULT(yes)
1202 AC_WARN([Remote packet capture may expose libpcap-based applications])
1203 AC_WARN([to attacks by malicious remote capture servers!])
1204 AC_DEFINE(HAVE_REMOTE,,
1205 [Define to 1 if remote packet capture is to be supported])
1206 SSRC="$SSRC pcap-new.c pcap-rpcap.c sockutils.c"
1208 INSTALL_RPCAPD=install-rpcapd
1210 *) AC_MSG_RESULT(no)
1215 # Assume, by default, no support for shared libraries and V7/BSD convention
1216 # for man pages (file formats in section 5, miscellaneous info in section 7).
1217 # Individual cases can override this.
1222 MAN_USERMOD_SECTION=8
1226 dnl Workaround to enable certain features
1227 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1230 # AIX makes it fun to build shared and static libraries,
1231 # because they're *both* ".a" archive libraries. We
1232 # build the static library for the benefit of the traditional
1233 # scheme of building libpcap and tcpdump in subdirectories of
1234 # the same directory, with tcpdump statically linked with the
1235 # libpcap in question, but we also build a shared library as
1236 # "libpcap.shareda" and install *it*, rather than the static
1237 # library, as "libpcap.a".
1245 # If we're using DLPI, applications will need to
1246 # use /lib/pse.exp if present, as we use the
1249 pseexe="/lib/pse.exp"
1250 AC_MSG_CHECKING(for $pseexe)
1251 if test -f $pseexe ; then
1259 # If we're using BPF, we need "-lodm" and "-lcfg", as
1260 # we use them to load the BPF module.
1269 V_CCOPT="$V_CCOPT -fno-common"
1270 AC_ARG_ENABLE(universal,
1271 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1272 if test "$enable_universal" != "no"; then
1277 # Pre-Tiger. Build only for 32-bit PowerPC; no
1278 # need for any special compiler or linker flags.
1284 # Tiger, prior to Intel support. Build for 32-bit
1285 # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
1286 # first. (I'm guessing that's what Apple does.)
1288 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
1289 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
1294 # Tiger, subsequent to Intel support but prior to
1295 # x86-64 support. Build for 32-bit PowerPC, 64-bit
1296 # PowerPC, and x86, with 32-bit PowerPC first.
1297 # (I'm guessing that's what Apple does.)
1299 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
1300 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
1305 # All other Tiger, so subsequent to x86-64
1306 # support. Build for 32-bit PowerPC, 64-bit
1307 # PowerPC, x86, and x86-64, and with 32-bit PowerPC
1308 # first. (I'm guessing that's what Apple does.)
1310 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1311 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1316 # Leopard. Build for 32-bit PowerPC, 64-bit
1317 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1318 # first. (That's what Apple does.)
1320 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1321 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1326 # Snow Leopard. Build for x86-64, x86, and
1327 # 32-bit PowerPC, with x86-64 first. (That's
1328 # what Apple does, even though Snow Leopard
1329 # doesn't run on PPC, so PPC libpcap runs under
1330 # Rosetta, and Rosetta doesn't support BPF
1331 # ioctls, so PPC programs can't do live
1334 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1335 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1340 # Post-Snow Leopard. Build for x86-64 and
1341 # x86, with x86-64 first. (That's probably what
1342 # Apple does, given that Rosetta is gone.)
1343 # XXX - update if and when Apple drops support
1344 # for 32-bit x86 code.
1346 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1347 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1354 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1357 # Use System V conventions for man pages.
1366 # Use System V conventions for man pages.
1375 # Use System V conventions for man pages.
1382 dnl HPUX 10.20 and above is similar to HPUX 9, but
1383 dnl not the same....
1385 dnl XXX - DYEXT should be set to "sl" if this is building
1386 dnl for 32-bit PA-RISC, but should be left as "so" for
1387 dnl 64-bit PA-RISC or, I suspect, IA-64.
1388 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1389 if test "`uname -m`" = "ia64"; then
1396 # "-b" builds a shared library; "+h" sets the soname.
1402 # Use System V conventions for man pages.
1410 # Use System V conventions for man pages.
1416 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1420 # Compiler assumed to be GCC; run-time linker may require a -R
1423 if test "$libdir" != "/usr/lib"; then
1424 V_RFLAGS=-Wl,-R$libdir
1432 # Use System V conventions for man pages.
1439 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1440 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1444 ac_cv_cc_sinix_defined=yes,
1445 ac_cv_cc_sinix_defined=no))
1446 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1447 if test $ac_cv_cc_sinix_defined = no ; then
1448 AC_DEFINE(sinix,1,[on sinix])
1453 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1457 case "`uname -r`" in
1464 # Use System V conventions for man pages.
1466 MAN_USERMOD_SECTION=1m
1473 AC_ARG_ENABLE(shared,
1474 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1475 test "x$enable_shared" = "xno" && DYEXT="none"
1478 AC_CHECK_TOOL([AR], [ar])
1483 AC_LBL_DEVEL(V_CCOPT)
1485 AC_LBL_SOCKADDR_SA_LEN
1487 AC_LBL_SOCKADDR_STORAGE
1489 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1491 AC_LBL_UNALIGNED_ACCESS
1494 ln -s ${srcdir}/bpf/net net
1498 AC_SUBST(V_FINDALLDEVS)
1502 AC_SUBST(V_SHLIB_CMD)
1503 AC_SUBST(V_SHLIB_OPT)
1504 AC_SUBST(V_SONAME_OPT)
1505 AC_SUBST(V_RPATH_OPT)
1508 AC_SUBST(ADDLARCHIVEOBJS)
1511 AC_SUBST(MAN_FILE_FORMATS)
1512 AC_SUBST(MAN_MISC_INFO)
1513 AC_SUBST(MAN_USERMOD_SECTION)
1515 AC_SUBST(INSTALL_RPCAPD)
1517 AC_ARG_ENABLE([usb],
1518 [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
1522 if test "xxx_only" = yes; then
1523 # User requested something-else-only pcap, so they don't
1528 if test "x$enable_usb" != "xno" ; then
1529 dnl check for USB sniffing support
1530 AC_MSG_CHECKING(for USB sniffing support)
1533 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1534 USB_SRC=pcap-usb-linux.c
1536 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1537 if test $? -ne 0 ; then
1538 ac_usb_dev_name="usbmon"
1540 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1541 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1543 # Do we have a version of <linux/compiler.h> available?
1544 # If so, we might need it for <linux/usbdevice_fs.h>.
1546 AC_CHECK_HEADERS(linux/compiler.h)
1547 if test "$ac_cv_header_linux_compiler_h" = yes; then
1549 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1551 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1553 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1555 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1557 # OK, does it define bRequestType? Older versions of the kernel
1558 # define fields with names like "requesttype, "request", and
1559 # "value", rather than "bRequestType", "bRequest", and
1562 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1563 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1566 #ifdef HAVE_SYS_BITYPES_H
1567 #include <sys/bitypes.h>
1569 #ifdef HAVE_LINUX_COMPILER_H
1570 #include <linux/compiler.h>
1572 #include <linux/usbdevice_fs.h>],
1573 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1574 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1575 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1576 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1577 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1578 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1579 [if struct usbdevfs_ctrltransfer has bRequestType])
1585 # This just uses BPF in FreeBSD 8.4 and later; we don't need
1586 # to check for anything special for capturing.
1588 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
1596 AC_SUBST(PCAP_SUPPORT_USB)
1599 dnl check for netfilter sniffing support
1600 if test "xxx_only" != yes; then
1601 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1606 # Life's too short to deal with trying to get this to compile
1607 # if you don't get the right types defined with
1608 # __KERNEL_STRICT_NAMES getting defined by some other include.
1610 # Check whether the includes Just Work. If not, don't turn on
1611 # netfilter support.
1613 AC_MSG_CHECKING(whether we can compile the netfilter support)
1614 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1617 #include <sys/socket.h>
1618 #include <netinet/in.h>
1619 #include <linux/types.h>
1621 #include <linux/netlink.h>
1622 #include <linux/netfilter.h>
1623 #include <linux/netfilter/nfnetlink.h>
1624 #include <linux/netfilter/nfnetlink_log.h>
1625 #include <linux/netfilter/nfnetlink_queue.h>],
1627 ac_cv_netfilter_can_compile=yes,
1628 ac_cv_netfilter_can_compile=no))
1629 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1630 if test $ac_cv_netfilter_can_compile = yes ; then
1631 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1632 [target host supports netfilter sniffing])
1633 NETFILTER_SRC=pcap-netfilter-linux.c
1641 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1642 AC_SUBST(NETFILTER_SRC)
1644 AC_ARG_ENABLE([bluetooth],
1645 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1647 [enable_bluetooth=ifsupportavailable])
1649 if test "xxx_only" = yes; then
1650 # User requested something-else-only pcap, so they don't
1651 # want Bluetooth support.
1655 if test "x$enable_bluetooth" != "xno" ; then
1656 dnl check for Bluetooth sniffing support
1659 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1661 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1662 BT_SRC=pcap-bt-linux.c
1663 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1666 # OK, does struct sockaddr_hci have an hci_channel
1669 AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
1670 AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
1673 #include <bluetooth/bluetooth.h>
1674 #include <bluetooth/hci.h>
1676 [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
1677 ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
1678 ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
1679 AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
1680 if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
1681 AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
1682 [if struct sockaddr_hci has hci_channel member])
1685 # OK, is HCI_CHANNEL_MONITOR defined?
1687 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
1688 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
1691 #include <bluetooth/bluetooth.h>
1692 #include <bluetooth/hci.h>
1694 [u_int i = HCI_CHANNEL_MONITOR],
1695 ac_cv_lbl_hci_channel_monitor_is_defined=yes,
1696 ac_cv_lbl_hci_channel_monitor_is_defined=no))
1697 AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
1698 if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
1699 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
1700 [target host supports Bluetooth Monitor])
1701 BT_MONITOR_SRC=pcap-bt-monitor-linux.c
1704 ac_lbl_bluetooth_available=yes
1706 ac_lbl_bluetooth_available=no
1708 if test "x$ac_lbl_bluetooth_available" == "xno" ; then
1709 if test "x$enable_bluetooth" = "xyes" ; then
1710 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1712 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1717 if test "x$enable_bluetooth" = "xyes" ; then
1718 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
1720 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1724 AC_SUBST(PCAP_SUPPORT_BT)
1726 AC_SUBST(BT_MONITOR_SRC)
1729 AC_ARG_ENABLE([dbus],
1730 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
1732 [enable_dbus=ifavailable])
1734 if test "xxx_only" = yes; then
1735 # User requested something-else-only pcap, so they don't
1736 # want D-Bus support.
1740 if test "x$enable_dbus" != "xno"; then
1741 if test "x$enable_dbus" = "xyes"; then
1746 # We don't support D-Bus sniffing on macOS; see
1748 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1750 # The user requested it, so fail.
1752 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
1759 # We don't support D-Bus sniffing on macOS; see
1761 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1763 # The user dind't explicitly request it, so just
1764 # silently refuse to enable it.
1772 if test "x$enable_dbus" != "xno"; then
1773 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1774 if test "x$PKGCONFIG" != "xno"; then
1775 AC_MSG_CHECKING([for D-Bus])
1776 if "$PKGCONFIG" dbus-1; then
1777 AC_MSG_RESULT([yes])
1778 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
1779 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
1780 save_CFLAGS="$CFLAGS"
1782 CFLAGS="$CFLAGS $DBUS_CFLAGS"
1783 LIBS="$LIBS $DBUS_LIBS"
1784 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
1786 [#include <string.h>
1789 #include <sys/time.h>
1791 #include <dbus/dbus.h>],
1792 [return dbus_connection_read_write(NULL, 0);],
1794 AC_MSG_RESULT([yes])
1795 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
1796 DBUS_SRC=pcap-dbus.c
1797 V_INCLS="$V_INCLS $DBUS_CFLAGS"
1801 if test "x$enable_dbus" = "xyes"; then
1802 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
1806 CFLAGS="$save_CFLAGS"
1809 if test "x$enable_dbus" = "xyes"; then
1810 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
1814 AC_SUBST(PCAP_SUPPORT_DBUS)
1818 dnl check for hardware timestamp support
1821 AC_CHECK_HEADERS([linux/net_tstamp.h])
1824 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1828 dnl The packet ring capture facility of Linux, described in
1829 dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
1830 dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
1831 dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
1832 dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
1833 dnl kernel struct). This problem was solved in Linux 2.6.27. Use
1834 dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
1835 dnl target host, and either the build host or the target host run Linux 2.6.26
1837 AC_ARG_ENABLE([packet-ring],
1838 [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
1839 ,enable_packet_ring=yes)
1841 if test "x$enable_packet_ring" != "xno" ; then
1842 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
1843 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1848 AC_CONFIG_HEADER(config.h)
1850 AC_OUTPUT_COMMANDS([if test -f .devel; then
1851 echo timestamp > stamp-h
1852 cat Makefile-devel-adds >> Makefile
1855 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1856 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1857 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1858 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
1859 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
1860 pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
1861 pcap_set_tstamp_type.3pcap rpcap/Makefile)