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
32 AC_CHECK_HEADERS(sys/bitypes.h)
34 AC_CHECK_TYPE([int8_t], ,
35 [AC_DEFINE([int8_t], [signed char],
36 [Define to `signed char' if int8_t not defined.])],
38 #ifdef HAVE_SYS_BITYPES_H
39 #include <sys/bitypes.h>
41 AC_CHECK_TYPE([u_int8_t], ,
42 [AC_DEFINE([u_int8_t], [unsigned char],
43 [Define to `unsigned char' if u_int8_t not defined.])],
45 #ifdef HAVE_SYS_BITYPES_H
46 #include <sys/bitypes.h>
48 AC_CHECK_TYPE([int16_t], ,
49 [AC_DEFINE([int16_t], [short],
50 [Define to `short' if int16_t not defined.])]
52 #ifdef HAVE_SYS_BITYPES_H
53 #include <sys/bitypes.h>
55 AC_CHECK_TYPE([u_int16_t], ,
56 [AC_DEFINE([u_int16_t], [unsigned short],
57 [Define to `unsigned short' if u_int16_t not defined.])],
59 #ifdef HAVE_SYS_BITYPES_H
60 #include <sys/bitypes.h>
62 AC_CHECK_TYPE([int32_t], ,
63 [AC_DEFINE([int32_t], [int],
64 [Define to `int' if int32_t not defined.])],
66 #ifdef HAVE_SYS_BITYPES_H
67 #include <sys/bitypes.h>
69 AC_CHECK_TYPE([u_int32_t], ,
70 [AC_DEFINE([u_int32_t], [unsigned int],
71 [Define to `unsigned int' if u_int32_t not defined.])],
73 #ifdef HAVE_SYS_BITYPES_H
74 #include <sys/bitypes.h>
76 AC_CHECK_TYPE([int64_t], ,
77 [AC_DEFINE([int64_t], [long long],
78 [Define to `long long' if int64_t not defined.])],
80 #ifdef HAVE_SYS_BITYPES_H
81 #include <sys/bitypes.h>
83 AC_CHECK_TYPE([u_int64_t], ,
84 [AC_DEFINE([u_int64_t], [unsigned long long],
85 [Define to `unsigned long long' if u_int64_t not defined.])],
87 #ifdef HAVE_SYS_BITYPES_H
88 #include <sys/bitypes.h>
92 # Try to arrange for large file support.
98 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
99 dnl include <sys/ioccom.h>, and we were to drop support for older
100 dnl releases without that fix, so that pcap-bpf.c doesn't need to
101 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
102 dnl in "aclocal.m4" uses it, so we would still have to test for it
103 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
104 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
106 AC_CHECK_HEADERS(sys/ioccom.h sys/select.h sys/sockio.h limits.h)
107 AC_CHECK_HEADERS(linux/types.h)
108 AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h)
109 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
110 #include <sys/socket.h>
111 #include <net/if.h>])
112 if test "$ac_cv_header_net_pfvar_h" = yes; then
114 # Check for various PF actions.
116 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
118 [#include <sys/types.h>
119 #include <sys/socket.h>
121 #include <net/pfvar.h>],
122 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
125 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
126 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
130 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
131 #include <sys/socket.h>])
132 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
134 # The simple test didn't work.
135 # Do we need to include <net/if.h> first?
136 # Unset ac_cv_header_netinet_if_ether_h so we don't
137 # treat the previous failure as a cached value and
138 # suppress the next test.
140 AC_MSG_NOTICE([Rechecking with some additional includes])
141 unset ac_cv_header_netinet_if_ether_h
142 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
143 #include <sys/socket.h>
144 #include <netinet/in.h>
147 #include <net/if.h>])
152 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
154 #include <sys/socket.h>
155 #include <linux/if.h>
162 AC_CHECK_FUNCS(strerror strlcpy strlcat)
165 AC_CHECK_FUNCS(vsnprintf snprintf,,
167 if test $needsnprintf = yes; then
168 AC_LIBOBJ([snprintf])
172 AC_CHECK_FUNCS(strtok_r,,
174 if test $needstrtok_r = yes; then
175 AC_LIBOBJ([strtok_r])
179 # Do this before checking for ether_hostton(), as it's a
180 # "gethostbyname() -ish function".
185 # You are in a twisty little maze of UN*Xes, all different.
186 # Some might not have ether_hostton().
187 # Some might have it, but not declare it in any header file.
188 # Some might have it, but declare it in <netinet/if_ether.h>.
189 # Some might have it, but declare it in <netinet/ether.h>
190 # (And some might have it but document it as something declared in
191 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
193 # Before you is a C compiler.
195 AC_CHECK_FUNCS(ether_hostton)
196 if test "$ac_cv_func_ether_hostton" = yes; then
198 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
200 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
202 # Yes. Does it declare ether_hostton()?
204 AC_CHECK_DECL(ether_hostton,
206 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
207 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
210 #include <sys/types.h>
211 #include <sys/socket.h>
212 #include <netinet/in.h>
213 #include <arpa/inet.h>
217 #include <netinet/if_ether.h>
223 if test "$ac_cv_have_decl_ether_hostton" != yes; then
225 # No, how about <netinet/ether.h>, as on Linux?
227 AC_CHECK_HEADERS(netinet/ether.h)
228 if test "$ac_cv_header_netinet_ether_h" = yes; then
230 # We have it - does it declare ether_hostton()?
231 # Unset ac_cv_have_decl_ether_hostton so we don't
232 # treat the previous failure as a cached value and
233 # suppress the next test.
235 unset ac_cv_have_decl_ether_hostton
236 AC_CHECK_DECL(ether_hostton,
238 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
239 [Define to 1 if netinet/ether.h declares `ether_hostton'])
242 #include <netinet/ether.h>
247 # Is ether_hostton() declared?
249 if test "$ac_cv_have_decl_ether_hostton" != yes; then
251 # No, we'll have to declare it ourselves.
252 # Do we have "struct ether_addr"?
254 AC_CHECK_TYPES(struct ether_addr,,,
256 #include <sys/types.h>
257 #include <sys/socket.h>
258 #include <netinet/in.h>
259 #include <arpa/inet.h>
263 #include <netinet/if_ether.h>
265 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
266 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
269 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
270 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
275 dnl to pacify those who hate protochain insn
276 AC_MSG_CHECKING(if --disable-protochain option is specified)
277 AC_ARG_ENABLE(protochain,
278 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
279 case "x$enable_protochain" in
280 xyes) enable_protochain=enabled ;;
281 xno) enable_protochain=disabled ;;
282 x) enable_protochain=enabled ;;
285 if test "$enable_protochain" = "disabled"; then
286 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
288 AC_MSG_RESULT(${enable_protochain})
291 # valgrindtest directly uses the native capture mechanism, but
292 # only tests with BPF and PF_PACKET sockets; only enable it if
293 # we have BPF or PF_PACKET sockets.
298 # SITA support is mutually exclusive with native capture support;
299 # "--with-sita" selects SITA support.
302 AC_HELP_STRING([--with-sita],[include SITA support]),
304 if test ! "x$withval" = "xno" ; then
305 AC_DEFINE(SITA,1,[include ACN support])
306 AC_MSG_NOTICE(Enabling SITA ACN support)
312 dnl Not all versions of test support -c (character special) but it's a
313 dnl better way of testing since the device might be protected. So we
314 dnl check in our normal order using -r and then check the for the /dev
315 dnl guys again using -c.
317 dnl XXX This could be done for cross-compiling, but for now it's not.
319 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
320 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
323 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
324 AC_MSG_CHECKING(packet capture type)
325 if test ! -z "$with_pcap" ; then
327 elif test -r /dev/bpf -o -h /dev/bpf ; then
329 # Cloning BPF device.
332 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
335 # We have BPF, so build valgrindtest with "make test".
337 VALGRINDTEST=valgrindtest
338 elif test -r /dev/bpf0 ; then
342 # We have BPF, so build valgrindtest with "make test".
344 VALGRINDTEST=valgrindtest
345 elif test -r /usr/include/net/pfilt.h ; then
347 elif test -r /dev/enet ; then
349 elif test -r /dev/nit ; then
351 elif test -r /usr/include/sys/net/nit.h ; then
353 elif test -r /usr/include/linux/socket.h ; then
357 # XXX - this won't work with older kernels that have SOCK_PACKET
358 # sockets but not PF_PACKET sockets.
360 VALGRINDTEST=valgrindtest
361 elif test -r /usr/include/net/raw.h ; then
363 elif test -r /usr/include/odmi.h ; then
365 # On AIX, the BPF devices might not yet be present - they're
366 # created the first time libpcap runs after booting.
367 # We check for odmi.h instead.
370 elif test -c /dev/bpf0 ; then # check again in case not readable
374 # We have BPF, so build valgrindtest with "make test".
376 VALGRINDTEST=valgrindtest
377 elif test -r /usr/include/sys/dlpi.h ; then
379 elif test -c /dev/enet ; then # check again in case not readable
381 elif test -c /dev/nit ; then # check again in case not readable
386 AC_MSG_RESULT($V_PCAP)
387 AC_SUBST(VALGRINDTEST)
390 # Do capture-mechanism-dependent tests.
395 # Needed for common functions used by pcap-[dlpi,libdlpi].c
400 # Checks for some header files.
402 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
405 # Checks to see if Solaris has the public libdlpi(3LIB) library.
406 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
407 # public libdlpi(3LIB) version. Before libdlpi was made public, a
408 # private version also existed, which did not have the same APIs.
409 # Due to a gcc bug, the default search path for 32-bit libraries does
410 # not include /lib, we add it explicitly here.
411 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
412 # Also, due to the bug above applications that link to libpcap with
413 # libdlpi will have to add "-L/lib" option to "configure".
415 saved_ldflags=$LDFLAGS
416 LDFLAGS="$LIBS -L/lib"
417 AC_CHECK_LIB(dlpi, dlpi_walk,
421 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
424 LDFLAGS=$saved_ldflags
427 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
430 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
431 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
434 #include <sys/types.h>
435 #include <sys/time.h>
436 #include <sys/dlpi.h>
438 [int i = DL_PROMISC_PHYS;],
439 ac_cv_sys_dlpi_usable=yes,
440 ac_cv_sys_dlpi_usable=no))
441 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
442 if test $ac_cv_sys_dlpi_usable = no ; then
443 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
447 # Check whether we have a /dev/dlpi device or have multiple devices.
449 AC_MSG_CHECKING(for /dev/dlpi device)
450 if test -c /dev/dlpi ; then
452 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
456 AC_MSG_CHECKING(for $dir directory)
457 if test -d $dir ; then
459 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
466 # This check is for Solaris with DLPI support for passive modes.
467 # See dlpi(7P) for more details.
469 AC_LBL_DL_PASSIVE_REQ_T
474 # Do we have the wireless extensions?
476 AC_CHECK_HEADERS(linux/wireless.h, [], [],
478 #include <sys/socket.h>
479 #include <linux/if.h>
480 #include <linux/types.h>
487 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
488 with_libnl=$withval,,)
490 if test x$with_libnl != xno ; then
493 incdir=-I/usr/include/libnl3
495 if test x$withval != x ; then
496 libnldir=-L${withval}/lib/.libs
497 incdir=-I${withval}/include
501 # Try libnl 3.x first.
503 AC_CHECK_LIB(nl-3, nl_socket_alloc,
506 # Yes, we have libnl 3.x.
508 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
509 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
510 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
511 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
512 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
513 V_INCLS="$V_INCLS ${incdir}"
515 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
517 if test x$have_any_nl = xno ; then
521 AC_CHECK_LIB(nl, nl_socket_alloc,
524 # Yes, we have libnl 2.x.
526 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
527 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
528 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
529 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
530 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
535 if test x$have_any_nl = xno ; then
537 # No, we don't; do we have libnl 1.x?
539 AC_CHECK_LIB(nl, nl_handle_alloc,
544 LIBS="${libnldir} -lnl $LIBS"
545 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
550 if test x$have_any_nl = xno ; then
552 # No, we don't have libnl at all.
554 if test x$with_libnl = xyes ; then
555 AC_MSG_ERROR([libnl support requested but libnl not found])
560 AC_CHECK_HEADERS(linux/ethtool.h,,,
563 #include <linux/types.h>
566 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
571 # Check whether we have the *BSD-style ioctls.
573 AC_CHECK_HEADERS(net/if_media.h)
575 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
577 [#include <sys/socket.h>
578 #include <sys/ioctl.h>
580 #include <net/bpf.h>],
581 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
584 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
585 [define if the system supports zerocopy BPF])
590 # Check whether we have struct BPF_TIMEVAL.
592 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
594 #include <sys/types.h>
595 #include <sys/ioctl.h>
596 #ifdef HAVE_SYS_IOCCOM_H
597 #include <sys/ioccom.h>
605 # --with-pcap=dag is the only way to get here, and it means
606 # "DAG support but nothing else"
608 V_DEFS="$V_DEFS -DDAG_ONLY"
614 # --with-pcap=septel is the only way to get here, and it means
615 # "Septel support but nothing else"
617 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
623 # --with-pcap=snf is the only way to get here, and it means
624 # "SNF support but nothing else"
626 V_DEFS="$V_DEFS -DSNF_ONLY"
631 AC_MSG_WARN(cannot determine packet capture interface)
632 AC_MSG_WARN((see the INSTALL doc for more info))
636 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
641 dnl Now figure out how we get a list of interfaces and addresses,
642 dnl if we support capturing. Don't bother if we don't support
645 if test "$V_PCAP" != null
647 AC_CHECK_FUNC(getifaddrs,[
649 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
650 # as well, just in case some platform is really weird.
652 AC_CHECK_HEADER(ifaddrs.h,[
654 # We have the header, so we use "getifaddrs()" to
655 # get the list of interfaces.
657 V_FINDALLDEVS=fad-getad.c
660 # We don't have the header - give up.
661 # XXX - we could also fall back on some other
662 # mechanism, but, for now, this'll catch this
663 # problem so that we can at least try to figure
664 # out something to do on systems with "getifaddrs()"
665 # but without "ifaddrs.h", if there is something
666 # we can do on those systems.
668 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
672 # Well, we don't have "getifaddrs()", so we have to use
673 # some other mechanism; determine what that mechanism is.
675 # The first thing we use is the type of capture mechanism,
676 # which is somewhat of a proxy for the OS we're using.
682 # This might be Solaris 8 or later, with
683 # SIOCGLIFCONF, or it might be some other OS
684 # or some older version of Solaris, with
687 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
688 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
690 [#include <sys/param.h>
691 #include <sys/file.h>
692 #include <sys/ioctl.h>
693 #include <sys/socket.h>
694 #include <sys/sockio.h>],
695 [ioctl(0, SIOCGLIFCONF, (char *)0);],
696 ac_cv_lbl_have_siocglifconf=yes,
697 ac_cv_lbl_have_siocglifconf=no))
698 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
699 if test $ac_cv_lbl_have_siocglifconf = yes ; then
700 V_FINDALLDEVS=fad-glifc.c
702 V_FINDALLDEVS=fad-gifc.c
708 # Assume we just have SIOCGIFCONF.
709 # (XXX - on at least later Linux kernels, there's
710 # another mechanism, and we should be using that
713 V_FINDALLDEVS=fad-gifc.c
719 AC_MSG_CHECKING(for socklen_t)
721 #include <sys/types.h>
722 #include <sys/socket.h>
727 if test "x$have_socklen_t" = "xyes"; then
728 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
730 AC_MSG_RESULT($have_socklen_t)
733 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
735 [enable_ipv6=ifavailable])
736 if test "$enable_ipv6" != "no"; then
737 AC_CHECK_FUNC(getaddrinfo,
739 AC_DEFINE(INET6,1,[IPv6])
742 if test "$enable_ipv6" != "ifavailable"; then
743 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
748 AC_MSG_CHECKING(whether to build optimizer debugging code)
749 AC_ARG_ENABLE(optimizer-dbg,
750 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
751 if test "$enable_optimizer_dbg" = "yes"; then
752 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
754 AC_MSG_RESULT(${enable_optimizer_dbg-no})
756 AC_MSG_CHECKING(whether to build parser debugging code)
757 AC_ARG_ENABLE(yydebug,
758 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
759 if test "$enable_yydebug" = "yes"; then
760 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
762 AC_MSG_RESULT(${enable_yydebug-no})
764 # Check for Endace DAG card support.
766 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
768 if test "$withval" = no
770 # User doesn't want DAG support.
772 elif test "$withval" = yes
774 # User wants DAG support but hasn't specified a directory.
777 # User wants DAG support and has specified a directory, so use the provided value.
782 if test "$V_PCAP" = dag; then
783 # User requested DAG-only libpcap, so we'd better have
786 elif test "xxx_only" = yes; then
787 # User requested something-else-only pcap, so they don't
792 # Use DAG API if present, otherwise don't
798 AC_ARG_WITH([dag-includes],
799 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
801 # User wants DAG support and has specified a header directory, so use the provided value.
803 dag_include_dir=$withval
806 AC_ARG_WITH([dag-libraries],
807 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
809 # User wants DAG support and has specified a library directory, so use the provided value.
815 if test "$want_dag" != no; then
817 AC_MSG_CHECKING([whether we have DAG API headers])
819 # If necessary, set default paths for DAG API headers and libraries.
820 if test -z "$dag_root"; then
824 if test -z "$dag_include_dir"; then
825 dag_include_dir="$dag_root/include"
828 if test -z "$dag_lib_dir"; then
829 dag_lib_dir="$dag_root/lib"
832 if test -z "$dag_tools_dir"; then
833 dag_tools_dir="$dag_root/tools"
836 if test -r $dag_include_dir/dagapi.h; then
837 ac_cv_lbl_dag_api=yes
840 if test "$ac_cv_lbl_dag_api" = yes; then
841 AC_MSG_RESULT([yes ($dag_include_dir)])
843 V_INCLS="$V_INCLS -I$dag_include_dir"
845 if test $V_PCAP != dag ; then
846 SSRC="$SSRC pcap-dag.c"
849 # See if we can find a general version string.
850 # Don't need to save and restore LIBS to prevent -ldag being
851 # included if there's a found-action (arg 3).
852 saved_ldflags=$LDFLAGS
853 LDFLAGS="-L$dag_lib_dir"
854 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
855 AC_CHECK_LIB([dag],[dag_get_erf_types], [
856 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
857 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
858 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
860 LDFLAGS=$saved_ldflags
862 if test "$dag_large_streams" = 1; then
863 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
865 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
867 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
868 if test "$ac_dag_have_vdag" = 1; then
869 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
870 LIBS="$LIBS -lpthread"
874 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
878 if test "$V_PCAP" = dag; then
879 # User requested "dag" capture type but we couldn't
880 # find the DAG API support.
881 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])
884 if test "$want_dag" = yes; then
885 # User wanted DAG support but we couldn't find it.
886 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])
892 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
894 if test "$withval" = no
897 elif test "$withval" = yes
906 if test "$V_PCAP" = septel; then
907 # User requested Septel-only libpcap, so we'd better have
910 elif test "xxx_only" = yes; then
911 # User requested something-else-only pcap, so they don't
912 # want Septel support.
916 # Use Septel API if present, otherwise don't
918 want_septel=ifpresent
922 ac_cv_lbl_septel_api=no
923 if test "$with_septel" != no; then
925 AC_MSG_CHECKING([whether we have Septel API headers])
927 # If necessary, set default paths for Septel API headers and libraries.
928 if test -z "$septel_root"; then
929 septel_root=$srcdir/../septel
932 septel_tools_dir="$septel_root"
933 septel_include_dir="$septel_root/INC"
935 if test -r "$septel_include_dir/msg.h"; then
936 ac_cv_lbl_septel_api=yes
939 if test "$ac_cv_lbl_septel_api" = yes; then
940 AC_MSG_RESULT([yes ($septel_include_dir)])
942 V_INCLS="$V_INCLS -I$septel_include_dir"
943 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"
944 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"
946 if test "$V_PCAP" != septel ; then
947 SSRC="$SSRC pcap-septel.c"
950 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
954 if test "$V_PCAP" = septel; then
955 # User requested "septel" capture type but
956 # we couldn't find the Septel API support.
957 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])
960 if test "$want_septel" = yes; then
961 # User wanted Septel support but we couldn't find it.
962 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])
967 # Check for Myricom SNF support.
969 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
971 if test "$withval" = no
973 # User explicitly doesn't want SNF
975 elif test "$withval" = yes
977 # User wants SNF support but hasn't specified a directory.
980 # User wants SNF support with a specified directory.
985 if test "$V_PCAP" = snf; then
986 # User requested Sniffer-only libpcap, so we'd better have
989 elif test "xxx_only" = yes; then
990 # User requested something-else-only pcap, so they don't
995 # Use Sniffer API if present, otherwise don't
1001 AC_ARG_WITH([snf-includes],
1002 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1004 # User wants SNF with specific header directory
1006 snf_include_dir=$withval
1009 AC_ARG_WITH([snf-libraries],
1010 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1012 # User wants SNF with specific lib directory
1014 snf_lib_dir=$withval
1017 ac_cv_lbl_snf_api=no
1018 if test "$with_snf" != no; then
1020 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1022 # If necessary, set default paths for Sniffer headers and libraries.
1023 if test -z "$snf_root"; then
1027 if test -z "$snf_include_dir"; then
1028 snf_include_dir="$snf_root/include"
1031 if test -z "$snf_lib_dir"; then
1032 snf_lib_dir="$snf_root/lib"
1035 if test -f "$snf_include_dir/snf.h"; then
1036 # We found a header; make sure we can link with the library
1037 saved_ldflags=$LDFLAGS
1038 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1039 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1040 LDFLAGS="$saved_ldflags"
1041 if test "$ac_cv_lbl_snf_api" = no; then
1042 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1046 if test "$ac_cv_lbl_snf_api" = yes; then
1047 AC_MSG_RESULT([yes ($snf_root)])
1049 V_INCLS="$V_INCLS -I$snf_include_dir"
1051 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1053 if test "$V_PCAP" != snf ; then
1054 SSRC="$SSRC pcap-snf.c"
1057 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1061 if test "$want_snf" = yes; then
1062 # User requested "snf" capture type but
1063 # we couldn't find the Sniffer API support.
1064 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])
1067 if test "$want_snf" = yes; then
1068 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])
1073 # Check for Riverbed TurboCap support.
1074 AC_ARG_WITH([turbocap],
1075 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1077 if test "$withval" = no
1079 # User explicitly doesn't want TurboCap
1081 elif test "$withval" = yes
1083 # User wants TurboCap support but hasn't specified a directory.
1086 # User wants TurboCap support with a specified directory.
1088 turbocap_root=$withval
1091 if test "xxx_only" = yes; then
1092 # User requested something-else-only pcap, so they don't
1093 # want TurboCap support.
1097 # Use TurboCap API if present, otherwise don't
1099 want_turbocap=ifpresent
1103 ac_cv_lbl_turbocap_api=no
1104 if test "$want_turbocap" != no; then
1106 AC_MSG_CHECKING(whether TurboCap is supported)
1108 save_CFLAGS="$CFLAGS"
1110 if test ! -z "$turbocap_root"; then
1111 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1112 TURBOCAP_LIBS="-L$turbocap_root/lib"
1113 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1121 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1123 (void)TcInstanceCreateByName("foo", &i);
1125 ac_cv_lbl_turbocap_api=yes)
1127 CFLAGS="$save_CFLAGS"
1128 if test $ac_cv_lbl_turbocap_api = yes; then
1131 SSRC="$SSRC pcap-tc.c"
1132 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1133 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1135 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1139 if test "$want_turbocap" = yes; then
1140 # User wanted Turbo support but we couldn't find it.
1141 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])
1150 if test "$LEX" = ":"; then
1151 AC_MSG_ERROR([Neither flex nor lex was found.])
1155 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1156 # and supports processing our scanner.l.
1158 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1159 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1160 tcpdump_cv_capable_lex=yes
1162 tcpdump_cv_capable_lex=insufficient
1164 if test $tcpdump_cv_capable_lex = insufficient ; then
1165 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1166 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1170 # Look for yacc/bison/byacc.
1175 # Make sure it supports the -p flag and supports processing our
1178 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1179 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1180 tcpdump_cv_capable_yacc=yes
1182 tcpdump_cv_capable_yacc=insufficient
1184 if test $tcpdump_cv_capable_yacc = insufficient ; then
1185 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1186 libpcap requires Bison, Berkeley YACC, or another YACC compatible with them.])
1190 dnl Allow the user to enable remote capture.
1191 dnl It's off by default, as that increases the attack surface of
1192 dnl libpcap, exposing it to malicious servers.
1194 AC_MSG_CHECKING([whether to enable remote packet capture])
1195 AC_ARG_ENABLE(remote,
1196 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1197 --disable-remote disable remote packet capture],,
1199 case "$enableval" in
1200 yes) AC_MSG_RESULT(yes)
1201 AC_WARN([Remote packet capture may expose libpcap-based applications])
1202 AC_WARN([to attacks by malicious remote capture servers!])
1203 AC_DEFINE(HAVE_REMOTE,,
1204 [Define to 1 if remote packet capture is to be supported])
1205 SSRC="$SSRC pcap-new.c pcap-rpcap.c sockutils.c"
1207 INSTALL_RPCAPD=install-rpcapd
1209 *) AC_MSG_RESULT(no)
1214 # Assume, by default, no support for shared libraries and V7/BSD convention
1215 # for man pages (file formats in section 5, miscellaneous info in section 7).
1216 # Individual cases can override this.
1221 MAN_USERMOD_SECTION=8
1225 dnl Workaround to enable certain features
1226 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1229 # AIX makes it fun to build shared and static libraries,
1230 # because they're *both* ".a" archive libraries. We
1231 # build the static library for the benefit of the traditional
1232 # scheme of building libpcap and tcpdump in subdirectories of
1233 # the same directory, with tcpdump statically linked with the
1234 # libpcap in question, but we also build a shared library as
1235 # "libpcap.shareda" and install *it*, rather than the static
1236 # library, as "libpcap.a".
1244 # If we're using DLPI, applications will need to
1245 # use /lib/pse.exp if present, as we use the
1248 pseexe="/lib/pse.exp"
1249 AC_MSG_CHECKING(for $pseexe)
1250 if test -f $pseexe ; then
1258 # If we're using BPF, we need "-lodm" and "-lcfg", as
1259 # we use them to load the BPF module.
1268 V_CCOPT="$V_CCOPT -fno-common"
1269 AC_ARG_ENABLE(universal,
1270 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1271 if test "$enable_universal" != "no"; then
1276 # Pre-Tiger. Build only for 32-bit PowerPC; no
1277 # need for any special compiler or linker flags.
1283 # Tiger, prior to Intel support. Build for 32-bit
1284 # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
1285 # first. (I'm guessing that's what Apple does.)
1287 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
1288 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
1293 # Tiger, subsequent to Intel support but prior to
1294 # x86-64 support. Build for 32-bit PowerPC, 64-bit
1295 # PowerPC, and x86, with 32-bit PowerPC first.
1296 # (I'm guessing that's what Apple does.)
1298 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
1299 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
1304 # All other Tiger, so subsequent to x86-64
1305 # support. Build for 32-bit PowerPC, 64-bit
1306 # PowerPC, x86, and x86-64, and with 32-bit PowerPC
1307 # first. (I'm guessing that's what Apple does.)
1309 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1310 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1315 # Leopard. Build for 32-bit PowerPC, 64-bit
1316 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1317 # first. (That's what Apple does.)
1319 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1320 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1325 # Snow Leopard. Build for x86-64, x86, and
1326 # 32-bit PowerPC, with x86-64 first. (That's
1327 # what Apple does, even though Snow Leopard
1328 # doesn't run on PPC, so PPC libpcap runs under
1329 # Rosetta, and Rosetta doesn't support BPF
1330 # ioctls, so PPC programs can't do live
1333 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1334 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1339 # Post-Snow Leopard. Build for x86-64 and
1340 # x86, with x86-64 first. (That's probably what
1341 # Apple does, given that Rosetta is gone.)
1342 # XXX - update if and when Apple drops support
1343 # for 32-bit x86 code.
1345 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1346 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1353 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1356 # Use System V conventions for man pages.
1365 # Use System V conventions for man pages.
1374 # Use System V conventions for man pages.
1381 dnl HPUX 10.20 and above is similar to HPUX 9, but
1382 dnl not the same....
1384 dnl XXX - DYEXT should be set to "sl" if this is building
1385 dnl for 32-bit PA-RISC, but should be left as "so" for
1386 dnl 64-bit PA-RISC or, I suspect, IA-64.
1387 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1388 if test "`uname -m`" = "ia64"; then
1395 # "-b" builds a shared library; "+h" sets the soname.
1401 # Use System V conventions for man pages.
1409 # Use System V conventions for man pages.
1415 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1419 # Compiler assumed to be GCC; run-time linker may require a -R
1422 if test "$libdir" != "/usr/lib"; then
1423 V_RFLAGS=-Wl,-R$libdir
1431 # Use System V conventions for man pages.
1438 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1439 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1443 ac_cv_cc_sinix_defined=yes,
1444 ac_cv_cc_sinix_defined=no))
1445 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1446 if test $ac_cv_cc_sinix_defined = no ; then
1447 AC_DEFINE(sinix,1,[on sinix])
1452 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1456 case "`uname -r`" in
1463 # Use System V conventions for man pages.
1465 MAN_USERMOD_SECTION=1m
1472 AC_ARG_ENABLE(shared,
1473 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1474 test "x$enable_shared" = "xno" && DYEXT="none"
1477 AC_CHECK_TOOL([AR], [ar])
1482 AC_LBL_DEVEL(V_CCOPT)
1484 AC_LBL_SOCKADDR_SA_LEN
1486 AC_LBL_SOCKADDR_STORAGE
1488 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1490 AC_LBL_UNALIGNED_ACCESS
1493 ln -s ${srcdir}/bpf/net net
1497 AC_SUBST(V_FINDALLDEVS)
1501 AC_SUBST(V_SHLIB_CMD)
1502 AC_SUBST(V_SHLIB_OPT)
1503 AC_SUBST(V_SONAME_OPT)
1504 AC_SUBST(V_RPATH_OPT)
1507 AC_SUBST(ADDLARCHIVEOBJS)
1510 AC_SUBST(MAN_FILE_FORMATS)
1511 AC_SUBST(MAN_MISC_INFO)
1512 AC_SUBST(MAN_USERMOD_SECTION)
1514 AC_SUBST(INSTALL_RPCAPD)
1516 AC_ARG_ENABLE([usb],
1517 [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
1521 if test "xxx_only" = yes; then
1522 # User requested something-else-only pcap, so they don't
1527 if test "x$enable_usb" != "xno" ; then
1528 dnl check for USB sniffing support
1529 AC_MSG_CHECKING(for USB sniffing support)
1532 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1533 USB_SRC=pcap-usb-linux.c
1535 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1536 if test $? -ne 0 ; then
1537 ac_usb_dev_name="usbmon"
1539 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1540 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1542 # Do we have a version of <linux/compiler.h> available?
1543 # If so, we might need it for <linux/usbdevice_fs.h>.
1545 AC_CHECK_HEADERS(linux/compiler.h)
1546 if test "$ac_cv_header_linux_compiler_h" = yes; then
1548 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1550 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1552 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1554 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1556 # OK, does it define bRequestType? Older versions of the kernel
1557 # define fields with names like "requesttype, "request", and
1558 # "value", rather than "bRequestType", "bRequest", and
1561 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1562 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1565 #ifdef HAVE_SYS_BITYPES_H
1566 #include <sys/bitypes.h>
1568 #ifdef HAVE_LINUX_COMPILER_H
1569 #include <linux/compiler.h>
1571 #include <linux/usbdevice_fs.h>],
1572 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1573 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1574 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1575 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1576 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1577 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1578 [if struct usbdevfs_ctrltransfer has bRequestType])
1584 # This just uses BPF in FreeBSD 8.4 and later; we don't need
1585 # to check for anything special for capturing.
1587 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
1595 AC_SUBST(PCAP_SUPPORT_USB)
1598 dnl check for netfilter sniffing support
1599 if test "xxx_only" != yes; then
1600 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1605 # Life's too short to deal with trying to get this to compile
1606 # if you don't get the right types defined with
1607 # __KERNEL_STRICT_NAMES getting defined by some other include.
1609 # Check whether the includes Just Work. If not, don't turn on
1610 # netfilter support.
1612 AC_MSG_CHECKING(whether we can compile the netfilter support)
1613 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1616 #include <sys/socket.h>
1617 #include <netinet/in.h>
1618 #include <linux/types.h>
1620 #include <linux/netlink.h>
1621 #include <linux/netfilter.h>
1622 #include <linux/netfilter/nfnetlink.h>
1623 #include <linux/netfilter/nfnetlink_log.h>
1624 #include <linux/netfilter/nfnetlink_queue.h>],
1626 ac_cv_netfilter_can_compile=yes,
1627 ac_cv_netfilter_can_compile=no))
1628 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1629 if test $ac_cv_netfilter_can_compile = yes ; then
1630 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1631 [target host supports netfilter sniffing])
1632 NETFILTER_SRC=pcap-netfilter-linux.c
1640 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1641 AC_SUBST(NETFILTER_SRC)
1643 AC_ARG_ENABLE([netmap],
1644 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
1646 [enable_netmap=yes])
1648 if test "x$enable_netmap" != "xno" ; then
1649 dnl check for netmap support
1650 AC_CHECK_HEADER(net/netmap_user.h,
1651 [ AC_DEFINE(PCAP_SUPPORT_NETMAP, 1, [target host supports netmap])
1652 NETMAP_SRC=pcap-netmap.c
1653 AC_MSG_NOTICE(netmap is supported)],
1654 AC_MSG_NOTICE(netmap is not supported),
1657 AC_SUBST(PCAP_SUPPORT_NETMAP)
1658 AC_SUBST(NETMAP_SRC)
1662 AC_ARG_ENABLE([bluetooth],
1663 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1665 [enable_bluetooth=ifsupportavailable])
1667 if test "xxx_only" = yes; then
1668 # User requested something-else-only pcap, so they don't
1669 # want Bluetooth support.
1673 if test "x$enable_bluetooth" != "xno" ; then
1674 dnl check for Bluetooth sniffing support
1677 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1679 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1680 BT_SRC=pcap-bt-linux.c
1681 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1684 # OK, does struct sockaddr_hci have an hci_channel
1687 AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
1688 AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
1691 #include <bluetooth/bluetooth.h>
1692 #include <bluetooth/hci.h>
1694 [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
1695 ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
1696 ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
1697 AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
1698 if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
1699 AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
1700 [if struct sockaddr_hci has hci_channel member])
1703 # OK, is HCI_CHANNEL_MONITOR defined?
1705 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
1706 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
1709 #include <bluetooth/bluetooth.h>
1710 #include <bluetooth/hci.h>
1712 [u_int i = HCI_CHANNEL_MONITOR],
1713 ac_cv_lbl_hci_channel_monitor_is_defined=yes,
1714 ac_cv_lbl_hci_channel_monitor_is_defined=no))
1715 AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
1716 if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
1717 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
1718 [target host supports Bluetooth Monitor])
1719 BT_MONITOR_SRC=pcap-bt-monitor-linux.c
1722 ac_lbl_bluetooth_available=yes
1724 ac_lbl_bluetooth_available=no
1726 if test "x$ac_lbl_bluetooth_available" == "xno" ; then
1727 if test "x$enable_bluetooth" = "xyes" ; then
1728 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1730 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1735 if test "x$enable_bluetooth" = "xyes" ; then
1736 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
1738 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1742 AC_SUBST(PCAP_SUPPORT_BT)
1744 AC_SUBST(BT_MONITOR_SRC)
1747 AC_ARG_ENABLE([dbus],
1748 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
1750 [enable_dbus=ifavailable])
1752 if test "xxx_only" = yes; then
1753 # User requested something-else-only pcap, so they don't
1754 # want D-Bus support.
1758 if test "x$enable_dbus" != "xno"; then
1759 if test "x$enable_dbus" = "xyes"; then
1764 # We don't support D-Bus sniffing on macOS; see
1766 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1768 # The user requested it, so fail.
1770 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
1777 # We don't support D-Bus sniffing on macOS; see
1779 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1781 # The user dind't explicitly request it, so just
1782 # silently refuse to enable it.
1790 if test "x$enable_dbus" != "xno"; then
1791 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1792 if test "x$PKGCONFIG" != "xno"; then
1793 AC_MSG_CHECKING([for D-Bus])
1794 if "$PKGCONFIG" dbus-1; then
1795 AC_MSG_RESULT([yes])
1796 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
1797 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
1798 save_CFLAGS="$CFLAGS"
1800 CFLAGS="$CFLAGS $DBUS_CFLAGS"
1801 LIBS="$LIBS $DBUS_LIBS"
1802 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
1804 [#include <string.h>
1807 #include <sys/time.h>
1809 #include <dbus/dbus.h>],
1810 [return dbus_connection_read_write(NULL, 0);],
1812 AC_MSG_RESULT([yes])
1813 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
1814 DBUS_SRC=pcap-dbus.c
1815 V_INCLS="$V_INCLS $DBUS_CFLAGS"
1819 if test "x$enable_dbus" = "xyes"; then
1820 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
1824 CFLAGS="$save_CFLAGS"
1827 if test "x$enable_dbus" = "xyes"; then
1828 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
1832 AC_SUBST(PCAP_SUPPORT_DBUS)
1836 dnl check for hardware timestamp support
1839 AC_CHECK_HEADERS([linux/net_tstamp.h])
1842 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1846 dnl The packet ring capture facility of Linux, described in
1847 dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
1848 dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
1849 dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
1850 dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
1851 dnl kernel struct). This problem was solved in Linux 2.6.27. Use
1852 dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
1853 dnl target host, and either the build host or the target host run Linux 2.6.26
1855 AC_ARG_ENABLE([packet-ring],
1856 [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
1857 ,enable_packet_ring=yes)
1859 if test "x$enable_packet_ring" != "xno" ; then
1860 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
1861 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1866 AC_CONFIG_HEADER(config.h)
1868 AC_OUTPUT_COMMANDS([if test -f .devel; then
1869 echo timestamp > stamp-h
1870 cat Makefile-devel-adds >> Makefile
1873 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1874 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1875 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1876 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
1877 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
1878 pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
1879 pcap_set_tstamp_type.3pcap rpcapd/Makefile)