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 # https://ftp.gnu.org/gnu/config/README
13 # for the URLs to use to fetch new versions of config.guess and
19 AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
20 AC_CONFIG_SRCDIR(pcap.c)
21 AC_SUBST(PACKAGE_NAME)
25 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
27 # We require C99 or later.
28 # Try to get it, which may involve adding compiler flags;
29 # if that fails, give up.
32 if test "$ac_cv_prog_cc_c99" = "no"; then
33 AC_MSG_ERROR([The C compiler does not support C99])
38 # Haiku's platform file is in C++.
44 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
49 # Try to arrange for large file support.
55 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
56 dnl include <sys/ioccom.h>, and we were to drop support for older
57 dnl releases without that fix, so that pcap-bpf.c doesn't need to
58 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
59 dnl in "aclocal.m4" uses it, so we would still have to test for it
60 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
61 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
63 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
64 AC_CHECK_HEADERS(netpacket/packet.h)
65 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
66 #include <sys/socket.h>
68 if test "$ac_cv_header_net_pfvar_h" = yes; then
70 # Check for various PF actions.
72 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
74 [#include <sys/types.h>
75 #include <sys/socket.h>
77 #include <net/pfvar.h>],
78 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
81 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
82 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
90 # Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
92 CFLAGS="$CFLAGS -D_BSD_SOURCE"
98 AC_CHECK_FUNCS(strerror)
99 AC_CHECK_FUNC(strerror_r,
102 # We have strerror_r; if we define _GNU_SOURCE, is it a
103 # POSIX-compliant strerror_r() or a GNU strerror_r()?
105 AC_MSG_CHECKING(whether strerror_r is GNU-style)
112 /* Define it GNU-style; that will cause an error if it's not GNU-style */
113 extern char *strerror_r(int, char *, size_t);
125 AC_DEFINE(HAVE_GNU_STRERROR_R,,
126 [Define to 1 if you have a GNU-style `strerror_r' function.])
130 AC_DEFINE(HAVE_POSIX_STRERROR_R,,
131 [Define to 1 if you have a POSIX-style `strerror_r' function.])
136 # We don't have strerror_r; do we have strerror_s?
138 AC_CHECK_FUNCS(strerror_s)
142 # Thanks, IBM, for not providing vsyslog() in AIX!
144 AC_CHECK_FUNCS(vsyslog)
147 # Make sure we have vsnprintf() and snprintf(); we require them.
149 AC_CHECK_FUNC(vsnprintf,,
150 AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
151 AC_CHECK_FUNC(snprintf,,
152 AC_MSG_ERROR([snprintf() is required but wasn't found]))
155 AC_CHECK_FUNCS(vasprintf asprintf,,
157 if test $needasprintf = yes; then
158 AC_LIBOBJ([asprintf])
162 AC_CHECK_FUNCS(strlcat,,
164 if test $needstrlcat = yes; then
169 AC_CHECK_FUNCS(strlcpy,,
171 if test $needstrlcpy = yes; then
176 AC_CHECK_FUNCS(strtok_r,,
178 if test $needstrtok_r = yes; then
179 AC_LIBOBJ([strtok_r])
183 # Do we have ffs(), and is it declared in <strings.h>?
186 if test "$ac_cv_func_ffs" = yes; then
188 # We have ffs(); is it declared in <strings.h>?
190 # This test fails if we don't have <strings.h> or if we do
191 # but it doesn't declare ffs().
195 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
196 [Define to 1 if strings.h declares `ffs'])
204 # Do this before checking for ether_hostton(), as it's a
205 # "getaddrinfo()-ish function".
210 # Check for reentrant versions of getnetbyname_r(), as provided by
211 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
212 # If we don't find one, we just use getnetbyname(), which uses
213 # thread-specific data on many platforms, but doesn't use it on
214 # NetBSD or OpenBSD, and may not use it on older versions of other
217 # Only do the check if we have a declaration of getnetbyname_r();
218 # without it, we can't check which API it has. (We assume that
219 # if there's a declaration, it has a prototype, so that the API
222 AC_CHECK_DECL(getnetbyname_r,
224 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
226 [#include <netdb.h>],
228 struct netent netent_buf;
230 struct netent *resultp;
233 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
237 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
238 [define if we have the Linux getnetbyname_r()])
243 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
245 [#include <netdb.h>],
247 struct netent netent_buf;
250 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
254 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
255 [define if we have the Solaris/IRIX getnetbyname_r()])
260 AC_MSG_CHECKING([for AIX getnetbyname_r()])
262 [#include <netdb.h>],
264 struct netent netent_buf;
265 struct netent_data net_data;
267 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
271 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
272 [define if we have the AIX getnetbyname_r()])
279 ],,[#include <netdb.h>])
282 # Check for reentrant versions of getprotobyname_r(), as provided by
283 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
284 # If we don't find one, we just use getprotobyname(), which uses
285 # thread-specific data on many platforms, but doesn't use it on
286 # NetBSD or OpenBSD, and may not use it on older versions of other
289 # Only do the check if we have a declaration of getprotobyname_r();
290 # without it, we can't check which API it has. (We assume that
291 # if there's a declaration, it has a prototype, so that the API
294 AC_CHECK_DECL(getprotobyname_r,
296 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
298 [#include <netdb.h>],
300 struct protoent protoent_buf;
302 struct protoent *resultp;
304 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
308 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
309 [define if we have the Linux getprotobyname_r()])
314 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
316 [#include <netdb.h>],
318 struct protoent protoent_buf;
321 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
325 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
326 [define if we have the Solaris/IRIX getprotobyname_r()])
331 AC_MSG_CHECKING([for AIX getprotobyname_r()])
333 [#include <netdb.h>],
335 struct protoent protoent_buf;
336 struct protoent_data proto_data;
338 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
342 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
343 [define if we have the AIX getprotobyname_r()])
350 ],,[#include <netdb.h>])
353 # You are in a twisty little maze of UN*Xes, all different.
354 # Some might not have ether_hostton().
355 # Some might have it and declare it in <net/ethernet.h>.
356 # Some might have it and declare it in <netinet/ether.h>
357 # Some might have it and declare it in <sys/ethernet.h>.
358 # Some might have it and declare it in <arpa/inet.h>.
359 # Some might have it and declare it in <netinet/if_ether.h>.
360 # Some might have it and not declare it in any header file.
362 # Before you is a C compiler.
364 AC_CHECK_FUNCS(ether_hostton)
365 if test "$ac_cv_func_ether_hostton" = yes; then
367 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
369 # This test fails if we don't have <net/ethernet.h> or if we do
370 # but it doesn't declare ether_hostton().
372 AC_CHECK_DECL(ether_hostton,
374 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
375 [Define to 1 if net/ethernet.h declares `ether_hostton'])
378 #include <net/ethernet.h>
383 if test "$ac_cv_have_decl_ether_hostton" != yes; then
385 # No, how about <netinet/ether.h>, as on Linux?
387 # This test fails if we don't have <netinet/ether.h>
388 # or if we do but it doesn't declare ether_hostton().
390 # Unset ac_cv_have_decl_ether_hostton so we don't
391 # treat the previous failure as a cached value and
392 # suppress the next test.
394 unset ac_cv_have_decl_ether_hostton
395 AC_CHECK_DECL(ether_hostton,
397 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
398 [Define to 1 if netinet/ether.h declares `ether_hostton'])
401 #include <netinet/ether.h>
407 if test "$ac_cv_have_decl_ether_hostton" != yes; then
409 # No, how about <sys/ethernet.h>, as on Solaris 10
412 # This test fails if we don't have <sys/ethernet.h>
413 # or if we do but it doesn't declare ether_hostton().
415 # Unset ac_cv_have_decl_ether_hostton so we don't
416 # treat the previous failure as a cached value and
417 # suppress the next test.
419 unset ac_cv_have_decl_ether_hostton
420 AC_CHECK_DECL(ether_hostton,
422 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
423 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
426 #include <sys/ethernet.h>
432 if test "$ac_cv_have_decl_ether_hostton" != yes; then
434 # No, how about <arpa/inet.h>, as in AIX?
436 # This test fails if we don't have <arpa/inet.h>
437 # (if we have ether_hostton(), we should have
438 # networking, and if we have networking, we should
439 # have <arapa/inet.h>) or if we do but it doesn't
440 # declare ether_hostton().
442 # Unset ac_cv_have_decl_ether_hostton so we don't
443 # treat the previous failure as a cached value and
444 # suppress the next test.
446 unset ac_cv_have_decl_ether_hostton
447 AC_CHECK_DECL(ether_hostton,
449 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
450 [Define to 1 if arpa/inet.h declares `ether_hostton'])
453 #include <arpa/inet.h>
459 if test "$ac_cv_have_decl_ether_hostton" != yes; then
461 # No, how about <netinet/if_ether.h>?
462 # On some platforms, it requires <net/if.h> and
463 # <netinet/in.h>, and we always include it with
464 # both of them, so test it with both of them.
466 # This test fails if we don't have <netinet/if_ether.h>
467 # and the headers we include before it, or if we do but
468 # <netinet/if_ether.h> doesn't declare ether_hostton().
470 # Unset ac_cv_have_decl_ether_hostton so we don't
471 # treat the previous failure as a cached value and
472 # suppress the next test.
474 unset ac_cv_have_decl_ether_hostton
475 AC_CHECK_DECL(ether_hostton,
477 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
478 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
481 #include <sys/types.h>
482 #include <sys/socket.h>
484 #include <netinet/in.h>
485 #include <netinet/if_ether.h>
489 # After all that, is ether_hostton() declared?
491 if test "$ac_cv_have_decl_ether_hostton" = yes; then
495 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
496 [Define to 1 if you have the declaration of `ether_hostton'])
499 # No, we'll have to declare it ourselves.
500 # Do we have "struct ether_addr" if we include
501 # <netinet/if_ether.h>?
503 AC_CHECK_TYPES(struct ether_addr,,,
505 #include <sys/types.h>
506 #include <sys/socket.h>
508 #include <netinet/in.h>
509 #include <netinet/if_ether.h>
515 # For various things that might use pthreads.
517 AC_CHECK_HEADER(pthread.h,
520 # OK, we have pthread.h. Do we have pthread_create in the
523 AC_CHECK_FUNC(pthread_create,
528 ac_lbl_have_pthreads="found"
532 # No - do we have it in -lpthreads?
534 AC_CHECK_LIB(pthreads, pthread_create,
537 # Yes - add -lpthreads.
539 ac_lbl_have_pthreads="found"
540 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
544 # No - do we have it in -lpthread?
546 AC_CHECK_LIB(pthread, pthread_create,
549 # Yes - add -lpthread.
551 ac_lbl_have_pthreads="found"
552 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
558 ac_lbl_have_pthreads="not found"
565 # We didn't find pthread.h.
567 ac_lbl_have_pthreads="not found"
571 dnl to pacify those who hate protochain insn
572 AC_MSG_CHECKING(if --disable-protochain option is specified)
573 AC_ARG_ENABLE(protochain,
574 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
575 case "x$enable_protochain" in
576 xyes) enable_protochain=enabled ;;
577 xno) enable_protochain=disabled ;;
578 x) enable_protochain=enabled ;;
581 if test "$enable_protochain" = "disabled"; then
582 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
584 AC_MSG_RESULT(${enable_protochain})
587 # valgrindtest directly uses the native capture mechanism, but
588 # only tests with BPF and PF_PACKET sockets; only enable it if
589 # we have BPF or PF_PACKET sockets.
594 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
595 if test ! -z "$with_pcap" ; then
599 # Check for a bunch of headers for various packet
600 # capture mechanisms.
602 AC_CHECK_HEADERS(net/bpf.h)
603 if test "$ac_cv_header_net_bpf_h" = yes; then
605 # Does it define BIOCSETIF?
606 # I.e., is it a header for an LBL/BSD-style capture
607 # mechanism, or is it just a header for a BPF filter
608 # engine? Some versions of Arch Linux, for example,
609 # have a net/bpf.h that doesn't define BIOCSETIF;
610 # as it's a Linux, it should use packet sockets,
615 # sys/types.h, because FreeBSD 10's net/bpf.h
616 # requires that various BSD-style integer types
619 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
620 # doesn't include it but does use struct timeval
621 # in ioctl definitions;
623 # sys/ioctl.h and, if we have it, sys/ioccom.h,
624 # because net/bpf.h defines ioctls;
626 # net/if.h, because it defines some structures
627 # used in ioctls defined by net/bpf.h;
629 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
630 # defines some structure fields as being
633 # and net/bpf.h doesn't necessarily include all
634 # of those headers itself.
636 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
637 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
640 #include <sys/types.h>
641 #include <sys/time.h>
642 #include <sys/ioctl.h>
643 #include <sys/socket.h>
644 #ifdef HAVE_SYS_IOCCOM_H
645 #include <sys/ioccom.h>
650 [u_int i = BIOCSETIF;],
651 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
652 ac_cv_lbl_bpf_h_defines_biocsetif=no))
653 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
655 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
656 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
657 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
658 AC_CHECK_HEADERS(config/HaikuConfig.h)
660 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
663 # Check this before DLPI, so that we pick BPF on
664 # Solaris 11 and later.
669 # We have BPF, so build valgrindtest with "make test"
670 # on macOS and FreeBSD (add your OS once there's a
675 freebsd*|darwin*|linux*)
676 VALGRINDTEST_SRC=valgrindtest.c
679 elif test "$ac_cv_header_linux_socket_h" = yes; then
681 # No prizes for guessing this one.
684 VALGRINDTEST_SRC=valgrindtest.c
685 elif test "$ac_cv_header_net_pfilt_h" = yes; then
687 # DEC OSF/1, Digital UNIX, Tru64 UNIX
690 elif test "$ac_cv_header_net_enet_h" = yes; then
692 # Stanford Enetfilter.
695 elif test "$ac_cv_header_net_nit_h" = yes; then
697 # SunOS 4.x STREAMS NIT.
700 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
702 # Pre-SunOS 4.x non-STREAMS NIT.
705 elif test "$ac_cv_header_net_raw_h" = yes; then
710 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
712 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
715 elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
722 # Nothing we support.
725 AC_MSG_WARN(cannot determine packet capture interface)
726 AC_MSG_WARN((see the INSTALL doc for more info))
729 AC_MSG_CHECKING(packet capture type)
730 AC_MSG_RESULT($V_PCAP)
731 AC_SUBST(VALGRINDTEST_SRC)
734 # Handle each capture type.
739 # Checks for some header files.
741 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
744 # Checks to see if Solaris has the public libdlpi(3LIB) library.
745 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
746 # public libdlpi(3LIB) version. Before libdlpi was made public, a
747 # private version also existed, which did not have the same APIs.
748 # Due to a gcc bug, the default search path for 32-bit libraries does
749 # not include /lib, we add it explicitly here.
750 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
751 # Also, due to the bug above applications that link to libpcap with
752 # libdlpi will have to add "-L/lib" option to "configure".
754 saved_ldflags=$LDFLAGS
755 LDFLAGS="$LIBS -L/lib"
756 AC_CHECK_LIB(dlpi, dlpi_walk,
762 # Capture module plus common code needed for
763 # common functions used by pcap-[dlpi,libdlpi].c
765 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
766 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
772 # Capture module plus common code needed for
773 # common functions used by pcap-[dlpi,libdlpi].c
775 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
777 LDFLAGS=$saved_ldflags
780 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
783 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
784 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
787 #include <sys/types.h>
788 #include <sys/time.h>
789 #include <sys/dlpi.h>
791 [int i = DL_PROMISC_PHYS;],
792 ac_cv_sys_dlpi_usable=yes,
793 ac_cv_sys_dlpi_usable=no))
794 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
795 if test $ac_cv_sys_dlpi_usable = no ; then
796 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
800 # Check to see if Solaris has the dl_passive_req_t struct defined
802 # This check is for DLPI support for passive modes.
803 # See dlpi(7P) for more details.
805 AC_CHECK_TYPES(dl_passive_req_t,,,
807 #include <sys/types.h>
808 #include <sys/dlpi.h>
816 PLATFORM_C_SRC="pcap-enet.c"
823 PLATFORM_CXX_SRC="pcap-haiku.cpp"
826 # Just for the sake of it.
828 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
835 PLATFORM_C_SRC="pcap-linux.c"
838 # Do we have the wireless extensions?
840 AC_CHECK_HEADERS(linux/wireless.h, [], [],
842 #include <sys/socket.h>
843 #include <linux/if.h>
844 #include <linux/types.h>
851 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
852 with_libnl=$withval,with_libnl=if_available)
854 if test x$with_libnl != xno ; then
857 incdir=-I/usr/include/libnl3
859 case "$with_libnl" in
865 if test -d $withval; then
866 libnldir=-L${withval}/lib/.libs
867 incdir=-I${withval}/include
873 # Try libnl 3.x first.
875 AC_CHECK_LIB(nl-3, nl_socket_alloc,
878 # Yes, we have libnl 3.x.
880 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
881 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
882 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
883 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
884 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
885 V_INCLS="$V_INCLS ${incdir}"
887 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
889 if test x$have_any_nl = xno ; then
893 AC_CHECK_LIB(nl, nl_socket_alloc,
896 # Yes, we have libnl 2.x.
898 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
899 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
900 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
901 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
902 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
907 if test x$have_any_nl = xno ; then
909 # No, we don't; do we have libnl 1.x?
911 AC_CHECK_LIB(nl, nl_handle_alloc,
916 LIBS="${libnldir} -lnl $LIBS"
917 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
922 if test x$have_any_nl = xno ; then
924 # No, we don't have libnl at all.
926 if test x$with_libnl = xyes ; then
927 AC_MSG_ERROR([libnl support requested but libnl not found])
933 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
935 # NOTE: any failure means we conclude that it doesn't have that
936 # member, so if we don't have tpacket_auxdata, we conclude it
937 # doesn't have that member (which is OK, as either we won't be
938 # using code that would use that member, or we wouldn't compile
940 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
942 #include <sys/types.h>
943 #include <linux/if_packet.h>
951 PLATFORM_C_SRC="pcap-bpf.c"
954 # Check whether we have the *BSD-style ioctls.
956 AC_CHECK_HEADERS(net/if_media.h)
959 # Check whether we have struct BPF_TIMEVAL.
961 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
963 #include <sys/types.h>
964 #include <sys/ioctl.h>
965 #ifdef HAVE_SYS_IOCCOM_H
966 #include <sys/ioccom.h>
976 PLATFORM_C_SRC="pcap-pf.c"
983 PLATFORM_C_SRC="pcap-snit.c"
990 PLATFORM_C_SRC="pcap-snoop.c"
995 # --with-pcap=dag is the only way to get here, and it means
996 # "DAG support but nothing else"
998 V_DEFS="$V_DEFS -DDAG_ONLY"
999 PLATFORM_C_SRC="pcap-dag.c"
1005 # --with-pcap=dpdk is the only way to get here, and it means
1006 # "DPDK support but nothing else"
1008 V_DEFS="$V_DEFS -DDPDK_ONLY"
1009 PLATFORM_C_SRC="pcap-dpdk.c"
1015 # --with-pcap=septel is the only way to get here, and it means
1016 # "Septel support but nothing else"
1018 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1019 PLATFORM_C_SRC="pcap-septel.c"
1025 # --with-pcap=snf is the only way to get here, and it means
1026 # "SNF support but nothing else"
1028 V_DEFS="$V_DEFS -DSNF_ONLY"
1029 PLATFORM_C_SRC="pcap-snf.c"
1037 PLATFORM_C_SRC="pcap-null.c"
1041 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1046 dnl Now figure out how we get a list of interfaces and addresses,
1047 dnl if we support capturing. Don't bother if we don't support
1050 if test "$V_PCAP" != null
1052 AC_CHECK_FUNC(getifaddrs,[
1054 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1055 # as well, just in case some platform is really weird.
1057 AC_CHECK_HEADER(ifaddrs.h,[
1059 # We have the header, so we use "getifaddrs()" to
1060 # get the list of interfaces.
1062 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1065 # We don't have the header - give up.
1066 # XXX - we could also fall back on some other
1067 # mechanism, but, for now, this'll catch this
1068 # problem so that we can at least try to figure
1069 # out something to do on systems with "getifaddrs()"
1070 # but without "ifaddrs.h", if there is something
1071 # we can do on those systems.
1073 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1077 # Well, we don't have "getifaddrs()", at least not with the
1078 # libraries with which we've decided we need to link
1079 # libpcap with, so we have to use some other mechanism.
1081 # Note that this may happen on Solaris, which has
1082 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1083 # won't find it if we link with -lxnet, which we want
1084 # to do for other reasons.
1086 # For now, we use either the SIOCGIFCONF ioctl or the
1087 # SIOCGLIFCONF ioctl, preferring the latter if we have
1088 # it; the latter is a Solarisism that first appeared
1089 # in Solaris 8. (Solaris's getifaddrs() appears to
1090 # be built atop SIOCGLIFCONF; using it directly
1091 # avoids a not-all-that-useful middleman.)
1093 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1094 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1096 [#include <sys/param.h>
1097 #include <sys/file.h>
1098 #include <sys/ioctl.h>
1099 #include <sys/socket.h>
1100 #include <sys/sockio.h>],
1101 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1102 ac_cv_lbl_have_siocglifconf=yes,
1103 ac_cv_lbl_have_siocglifconf=no))
1104 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1105 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1106 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1108 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1113 dnl check for hardware timestamp support
1116 AC_CHECK_HEADERS([linux/net_tstamp.h])
1119 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1124 # Check for socklen_t.
1126 AC_CHECK_TYPES(socklen_t,,,
1128 #include <sys/types.h>
1129 #include <sys/socket.h>
1133 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1136 if test "$enable_ipv6" != "no"; then
1138 # We've already made sure we have getaddrinfo above in
1139 # AC_LBL_LIBRARY_NET.
1141 AC_DEFINE(INET6,1,[IPv6])
1145 # Do we have pkg-config?
1147 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1149 # Check for Endace DAG card support.
1151 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1153 if test "$withval" = no
1155 # User doesn't want DAG support.
1157 elif test "$withval" = yes
1159 # User wants DAG support but hasn't specified a directory.
1162 # User wants DAG support and has specified a directory, so use the provided value.
1167 if test "$V_PCAP" = dag; then
1168 # User requested DAG-only libpcap, so we'd better have
1171 elif test "xxx_only" = yes; then
1172 # User requested something-else-only pcap, so they don't
1177 # Use DAG API if present, otherwise don't
1183 AC_ARG_WITH([dag-includes],
1184 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1186 # User wants DAG support and has specified a header directory, so use the provided value.
1188 dag_include_dir=$withval
1191 AC_ARG_WITH([dag-libraries],
1192 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1194 # User wants DAG support and has specified a library directory, so use the provided value.
1196 dag_lib_dir=$withval
1199 if test "$want_dag" != no; then
1201 # If necessary, set default paths for DAG API headers and libraries.
1202 if test -z "$dag_root"; then
1206 if test -z "$dag_include_dir"; then
1207 dag_include_dir="$dag_root/include"
1210 if test -z "$dag_lib_dir"; then
1211 dag_lib_dir="$dag_root/lib"
1214 V_INCLS="$V_INCLS -I$dag_include_dir"
1216 AC_CHECK_HEADERS([dagapi.h])
1218 if test "$ac_cv_header_dagapi_h" = yes; then
1220 if test $V_PCAP != dag ; then
1221 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1224 # Check for various DAG API functions.
1225 # Don't need to save and restore LIBS to prevent -ldag being
1226 # included if there's a found-action (arg 3).
1227 saved_ldflags=$LDFLAGS
1228 LDFLAGS="-L$dag_lib_dir"
1229 AC_CHECK_LIB([dag], [dag_attach_stream],
1231 [AC_MSG_ERROR(DAG library lacks streams support)])
1232 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1233 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1234 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1235 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1236 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1238 LDFLAGS=$saved_ldflags
1241 # We assume that if we have libdag we have libdagconf,
1242 # as they're installed at the same time from the same
1245 LIBS="$LIBS -ldag -ldagconf"
1246 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1248 if test "$dag_large_streams" = 1; then
1249 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1250 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1251 if test "$ac_dag_have_vdag" = 1; then
1252 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1253 if test "$ac_lbl_have_pthreads" != "found"; then
1254 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1256 LIBS="$LIBS $PTHREAD_LIBS"
1260 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1263 if test "$V_PCAP" = dag; then
1264 # User requested "dag" capture type but we couldn't
1265 # find the DAG API support.
1266 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])
1269 if test "$want_dag" = yes; then
1270 # User wanted DAG support but we couldn't find it.
1271 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])
1277 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1279 if test "$withval" = no
1282 elif test "$withval" = yes
1288 septel_root=$withval
1291 if test "$V_PCAP" = septel; then
1292 # User requested Septel-only libpcap, so we'd better have
1295 elif test "xxx_only" = yes; then
1296 # User requested something-else-only pcap, so they don't
1297 # want Septel support.
1301 # Use Septel API if present, otherwise don't
1303 want_septel=ifpresent
1307 ac_cv_lbl_septel_api=no
1308 if test "$with_septel" != no; then
1310 AC_MSG_CHECKING([whether we have Septel API headers])
1312 # If necessary, set default paths for Septel API headers and libraries.
1313 if test -z "$septel_root"; then
1314 septel_root=$srcdir/../septel
1317 septel_tools_dir="$septel_root"
1318 septel_include_dir="$septel_root/INC"
1320 if test -r "$septel_include_dir/msg.h"; then
1321 ac_cv_lbl_septel_api=yes
1324 if test "$ac_cv_lbl_septel_api" = yes; then
1325 AC_MSG_RESULT([yes ($septel_include_dir)])
1327 V_INCLS="$V_INCLS -I$septel_include_dir"
1328 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"
1329 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"
1331 if test "$V_PCAP" != septel ; then
1332 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1335 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1339 if test "$V_PCAP" = septel; then
1340 # User requested "septel" capture type but
1341 # we couldn't find the Septel API support.
1342 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])
1345 if test "$want_septel" = yes; then
1346 # User wanted Septel support but we couldn't find it.
1347 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])
1352 # Check for Myricom SNF support.
1354 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1356 if test "$withval" = no
1358 # User explicitly doesn't want SNF
1360 elif test "$withval" = yes
1362 # User wants SNF support but hasn't specified a directory.
1365 # User wants SNF support with a specified directory.
1370 if test "$V_PCAP" = snf; then
1371 # User requested Sniffer-only libpcap, so we'd better have
1374 elif test "xxx_only" = yes; then
1375 # User requested something-else-only pcap, so they don't
1380 # Use Sniffer API if present, otherwise don't
1386 AC_ARG_WITH([snf-includes],
1387 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1389 # User wants SNF with specific header directory
1391 snf_include_dir=$withval
1394 AC_ARG_WITH([snf-libraries],
1395 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1397 # User wants SNF with specific lib directory
1399 snf_lib_dir=$withval
1402 ac_cv_lbl_snf_api=no
1403 if test "$with_snf" != no; then
1405 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1407 # If necessary, set default paths for Sniffer headers and libraries.
1408 if test -z "$snf_root"; then
1412 if test -z "$snf_include_dir"; then
1413 snf_include_dir="$snf_root/include"
1416 if test -z "$snf_lib_dir"; then
1417 snf_lib_dir="$snf_root/lib"
1420 if test -f "$snf_include_dir/snf.h"; then
1421 # We found a header; make sure we can link with the library
1422 saved_ldflags=$LDFLAGS
1423 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1424 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1425 LDFLAGS="$saved_ldflags"
1426 if test "$ac_cv_lbl_snf_api" = no; then
1427 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1431 if test "$ac_cv_lbl_snf_api" = yes; then
1432 AC_MSG_RESULT([yes ($snf_root)])
1434 V_INCLS="$V_INCLS -I$snf_include_dir"
1436 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1438 if test "$V_PCAP" != snf ; then
1439 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1442 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1446 if test "$want_snf" = yes; then
1447 # User requested "snf" capture type but
1448 # we couldn't find the Sniffer API support.
1449 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])
1452 if test "$want_snf" = yes; then
1453 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])
1458 # Check for Riverbed TurboCap support.
1459 AC_ARG_WITH([turbocap],
1460 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1462 if test "$withval" = no
1464 # User explicitly doesn't want TurboCap
1466 elif test "$withval" = yes
1468 # User wants TurboCap support but hasn't specified a directory.
1471 # User wants TurboCap support with a specified directory.
1473 turbocap_root=$withval
1476 if test "xxx_only" = yes; then
1477 # User requested something-else-only pcap, so they don't
1478 # want TurboCap support.
1482 # Use TurboCap API if present, otherwise don't
1484 want_turbocap=ifpresent
1488 ac_cv_lbl_turbocap_api=no
1489 if test "$want_turbocap" != no; then
1491 AC_MSG_CHECKING(whether TurboCap is supported)
1493 save_CFLAGS="$CFLAGS"
1495 if test ! -z "$turbocap_root"; then
1496 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1497 TURBOCAP_LIBS="-L$turbocap_root/lib"
1498 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1506 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1508 (void)TcInstanceCreateByName("foo", &i);
1510 ac_cv_lbl_turbocap_api=yes)
1512 CFLAGS="$save_CFLAGS"
1513 if test $ac_cv_lbl_turbocap_api = yes; then
1516 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1517 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1518 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1520 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1524 if test "$want_turbocap" = yes; then
1525 # User wanted Turbo support but we couldn't find it.
1526 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])
1532 dnl Allow the user to enable remote capture.
1533 dnl It's off by default, as that increases the attack surface of
1534 dnl libpcap, exposing it to malicious servers.
1536 AC_MSG_CHECKING([whether to enable remote packet capture])
1537 AC_ARG_ENABLE(remote,
1538 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1539 --disable-remote disable remote packet capture],,
1541 case "$enableval" in
1542 yes) AC_MSG_RESULT(yes)
1543 AC_WARN([Remote packet capture may expose libpcap-based applications])
1544 AC_WARN([to attacks by malicious remote capture servers!])
1546 # rpcapd requires pthreads on UN*X.
1548 if test "$ac_lbl_have_pthreads" != "found"; then
1549 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1552 # It also requires crypt().
1553 # Do we have it in the system libraries?
1555 AC_CHECK_FUNC(crypt,,
1558 # No. Do we have it in -lcrypt?
1560 AC_CHECK_LIB(crypt, crypt,
1563 # Yes; add -lcrypt to the libraries for rpcapd.
1565 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1568 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1573 # OK, we have crypt(). Do we have getspnam()?
1575 AC_CHECK_FUNCS(getspnam)
1578 # Check for various members of struct msghdr.
1580 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1582 #include "ftmacros.h"
1583 #include <sys/socket.h>
1585 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1587 #include "ftmacros.h"
1588 #include <sys/socket.h>
1592 # Optionally, we may want to support SSL.
1593 # Check for OpenSSL/libressl.
1595 # First, try looking for it as a regular system library.
1596 # Make sure we can find SSL_library_init() using the
1597 # standard headers, just in case we're running a version
1598 # of macOS that ships with the OpenSSL library but not
1599 # the OpenSSL headers, and have also installed another
1600 # version of OpenSSL with headers.
1603 LIBS="-lssl -lcrypto"
1604 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1607 #include <openssl/ssl.h>
1616 OPENSSL_LIBS="-lssl -lcrypto"
1622 # If we didn't find it, check for it with pkg-config.
1624 if test "x$HAVE_OPENSSL" != "xyes"; then
1625 if test "x$PKGCONFIG" != "xno"; then
1627 # We have pkg-config; see if we have OpenSSL/
1628 # libressl installed as a package.
1630 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1631 if "$PKGCONFIG" openssl; then
1632 AC_MSG_RESULT([found])
1634 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1635 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1637 AC_MSG_RESULT([not found])
1643 # If we didn't find it, check for it under /usr/local/opt/openssl;
1644 # that's where Homebrew puts it on macOS. Feel free to add other
1645 # -L directories as necessary; the "system library" check should
1646 # also handle "add-on library under /usr/local", so that shouldn't
1647 # be necessary here.
1649 if test "x$HAVE_OPENSSL" != "xyes"; then
1650 save_CFLAGS="$CFLAGS"
1652 CFLAGS="$CFLAGS -L/usr/local/opt/openssl/include"
1653 LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
1654 AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local/opt that we can use)
1657 #include <openssl/ssl.h>
1666 OPENSSL_CFLAGS="-I/usr/local/opt/openssl/include"
1667 OPENSSL_LIBS="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
1670 CFLAGS="$save_CFLAGS"
1675 # OK, did we find it?
1677 if test "x$HAVE_OPENSSL" = "xyes"; then
1678 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1679 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1680 LIBS="$LIBS $OPENSSL_LIBS"
1682 AC_MSG_NOTICE(OpenSSL not found)
1685 AC_DEFINE(ENABLE_REMOTE,,
1686 [Define to 1 if remote packet capture is to be supported])
1687 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1688 BUILD_RPCAPD=build-rpcapd
1689 INSTALL_RPCAPD=install-rpcapd
1691 *) AC_MSG_RESULT(no)
1695 AC_MSG_CHECKING(whether to build optimizer debugging code)
1696 AC_ARG_ENABLE(optimizer-dbg,
1697 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1698 if test "$enable_optimizer_dbg" = "yes"; then
1699 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1701 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1703 AC_MSG_CHECKING(whether to build parser debugging code)
1704 AC_ARG_ENABLE(yydebug,
1705 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1706 if test "$enable_yydebug" = "yes"; then
1707 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1709 AC_MSG_RESULT(${enable_yydebug-no})
1715 if test "$LEX" = ":"; then
1716 AC_MSG_ERROR([Neither flex nor lex was found.])
1720 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1721 # and supports processing our scanner.l.
1723 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1724 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1725 tcpdump_cv_capable_lex=yes
1727 tcpdump_cv_capable_lex=insufficient
1729 if test $tcpdump_cv_capable_lex = insufficient ; then
1730 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1731 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1735 # Look for yacc/bison/byacc.
1740 # Make sure it supports the -p flag and supports processing our
1743 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1744 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1745 tcpdump_cv_capable_yacc=yes
1747 tcpdump_cv_capable_yacc=insufficient
1749 if test $tcpdump_cv_capable_yacc = insufficient ; then
1750 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1751 libpcap requires Bison, a newer version of Berkeley YACC with support
1752 for reentrant parsers, or another YACC compatible with them.])
1756 # Do various checks for various OSes and versions of those OSes.
1758 # Assume, by default, no support for shared libraries and V7/BSD
1759 # convention for man pages (devices in section 4, file formats in
1760 # section 5, miscellaneous info in section 7, administrative commands
1761 # and daemons in section 8). Individual cases can override this.
1767 MAN_ADMIN_COMMANDS=8
1771 dnl Workaround to enable certain features
1772 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1775 # AIX makes it fun to build shared and static libraries,
1776 # because they're *both* ".a" archive libraries. We
1777 # build the static library for the benefit of the traditional
1778 # scheme of building libpcap and tcpdump in subdirectories of
1779 # the same directory, with tcpdump statically linked with the
1780 # libpcap in question, but we also build a shared library as
1781 # "libpcap.shareda" and install *it*, rather than the static
1782 # library, as "libpcap.a".
1790 # If we're using DLPI, applications will need to
1791 # use /lib/pse.exp if present, as we use the
1794 pseexe="/lib/pse.exp"
1795 AC_MSG_CHECKING(for $pseexe)
1796 if test -f $pseexe ; then
1804 # If we're using BPF, we need "-lodm" and "-lcfg", as
1805 # we use them to load the BPF module.
1814 V_CCOPT="$V_CCOPT -fno-common"
1815 AC_ARG_ENABLE(universal,
1816 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1817 if test "$enable_universal" != "no"; then
1822 # Pre-Tiger. Build only for 32-bit PowerPC; no
1823 # need for any special compiler or linker flags.
1827 darwin8.[[0123]]|darwin8.[[0123]].*)
1829 # Tiger, prior to Intel support. Build
1830 # libraries and executables for 32-bit PowerPC
1831 # and 64-bit PowerPC, with 32-bit PowerPC first.
1832 # (I'm guessing that's what Apple does.)
1834 # (The double brackets are needed because
1835 # autotools/m4 use brackets as a quoting
1836 # character; the double brackets turn into
1837 # single brackets in the generated configure
1840 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1841 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1842 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1843 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1846 darwin8.[[456]]|darwin.[[456]].*)
1848 # Tiger, subsequent to Intel support but prior
1849 # to x86-64 support. Build libraries and
1850 # executables for 32-bit PowerPC, 64-bit
1851 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1852 # first. (I'm guessing that's what Apple does.)
1854 # (The double brackets are needed because
1855 # autotools/m4 use brackets as a quoting
1856 # character; the double brackets turn into
1857 # single brackets in the generated configure
1860 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1861 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1862 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1863 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1868 # All other Tiger, so subsequent to x86-64
1869 # support. Build libraries and executables for
1870 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1871 # and x86-64, with 32-bit PowerPC first. (I'm
1872 # guessing that's what Apple does.)
1874 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1875 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1876 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1877 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1882 # Leopard. Build libraries for 32-bit PowerPC,
1883 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1884 # 32-bit PowerPC first, and build executables
1885 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1886 # x86 first. (That's what Apple does.)
1888 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1889 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1890 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1891 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1896 # Snow Leopard. Build libraries for x86-64,
1897 # 32-bit x86, and 32-bit PowerPC, with x86-64
1898 # first, and build executables for x86-64 and
1899 # 32-bit x86, with x86-64 first. (That's what
1900 # Apple does, even though Snow Leopard doesn't
1901 # run on PPC, so PPC libpcap runs under Rosetta,
1902 # and Rosetta doesn't support BPF ioctls, so PPC
1903 # programs can't do live captures.)
1905 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1906 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1907 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1908 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1913 # Post-Snow Leopard. Build libraries for x86-64
1914 # and 32-bit x86, with x86-64 first, and build
1915 # executables only for x86-64. (That's what
1916 # Apple does.) This requires no special flags
1918 # XXX - update if and when Apple drops support
1919 # for 32-bit x86 code and if and when Apple adds
1920 # ARM-based Macs. (You're on your own for iOS
1923 # XXX - check whether we *can* build for
1924 # i386 and, if not, suggest that the user
1925 # install the /usr/include headers if they
1926 # want to build fat.
1928 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1929 save_CFLAGS="$CFLAGS"
1930 CFLAGS="$CFLAGS -arch i386"
1936 V_LIB_CCOPT_FAT="-arch x86_64"
1937 V_LIB_LDFLAGS_FAT="-arch x86_64"
1940 # OpenSSL installation on macOS seems
1941 # to install only the libs for 64-bit
1942 # x86 - at least that's what Brew does:
1943 # only configure 32-bit builds if we
1944 # don't have OpenSSL.
1946 if test "$HAVE_OPENSSL" != yes; then
1947 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1948 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1953 V_LIB_CCOPT_FAT="-arch x86_64"
1954 V_LIB_LDFLAGS_FAT="-arch x86_64"
1959 # Mojave; you need to install the
1960 # /usr/include headers to get
1961 # 32-bit x86 builds to work.
1963 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools and, after that, installing the /usr/include headers from the /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg package])
1968 # Pre-Mojave; the command-line
1969 # tools should be sufficient to
1970 # enable 32-bit x86 builds.
1972 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
1976 CFLAGS="$save_CFLAGS"
1983 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1986 # Use System V conventions for man pages.
1988 MAN_ADMIN_COMMANDS=1m
1996 # Use System V conventions for man pages.
1998 MAN_ADMIN_COMMANDS=1m
2006 # Use System V conventions for man pages.
2008 MAN_ADMIN_COMMANDS=1m
2014 dnl HPUX 10.20 and above is similar to HPUX 9, but
2015 dnl not the same....
2017 dnl XXX - DYEXT should be set to "sl" if this is building
2018 dnl for 32-bit PA-RISC, but should be left as "so" for
2019 dnl 64-bit PA-RISC or, I suspect, IA-64.
2020 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2021 if test "`uname -m`" = "ia64"; then
2028 # "-b" builds a shared library; "+h" sets the soname.
2034 # Use System V conventions for man pages.
2042 # Use IRIX conventions for man pages; they're the same as the
2043 # System V conventions, except that they use section 8 for
2044 # administrative commands and daemons.
2050 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2054 # Compiler assumed to be GCC; run-time linker may require a -R
2057 if test "$libdir" != "/usr/lib"; then
2058 V_RFLAGS=-Wl,-R$libdir
2066 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
2067 # Use Tru64 UNIX conventions for man pages; they're the same as
2068 # the System V conventions except that they use section 8 for
2069 # administrative commands and daemons.
2077 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2078 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2082 ac_cv_cc_sinix_defined=yes,
2083 ac_cv_cc_sinix_defined=no))
2084 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2085 if test $ac_cv_cc_sinix_defined = no ; then
2086 AC_DEFINE(sinix,1,[on sinix])
2091 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2096 # Make sure errno is thread-safe, in case we're called in
2097 # a multithreaded program. We don't guarantee that two
2098 # threads can use the *same* pcap_t safely, but the
2099 # current version does guarantee that you can use different
2100 # pcap_t's in different threads, and even that pcap_compile()
2101 # is thread-safe (it wasn't thread-safe in some older versions).
2103 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2105 case "`uname -r`" in
2112 # Use System V conventions for man pages.
2114 MAN_ADMIN_COMMANDS=1m
2122 AC_ARG_ENABLE(shared,
2123 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2124 test "x$enable_shared" = "xno" && DYEXT="none"
2127 AC_CHECK_TOOL([AR], [ar])
2132 AC_LBL_DEVEL(V_CCOPT)
2135 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2137 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2139 #include <sys/types.h>
2140 #include <sys/socket.h>
2144 # Check to see if there's a sockaddr_storage structure.
2146 AC_CHECK_TYPES(struct sockaddr_storage,,,
2148 #include <sys/types.h>
2149 #include <sys/socket.h>
2153 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2154 # dl_module_id_1 member.
2156 # NOTE: any failure means we conclude that it doesn't have that member,
2157 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2158 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2159 # it doesn't have that member (which is OK, as either we won't be
2160 # using code that would use that member, or we wouldn't compile in
2163 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2165 #include <sys/types.h>
2166 #include <sys/dlpi.h>
2167 #include <sys/dlpi_ext.h>
2171 AC_SUBST(V_LIB_CCOPT_FAT)
2172 AC_SUBST(V_LIB_LDFLAGS_FAT)
2173 AC_SUBST(V_PROG_CCOPT_FAT)
2174 AC_SUBST(V_PROG_LDFLAGS_FAT)
2178 AC_SUBST(V_SHLIB_CCOPT)
2179 AC_SUBST(V_SHLIB_CMD)
2180 AC_SUBST(V_SHLIB_OPT)
2181 AC_SUBST(V_SONAME_OPT)
2182 AC_SUBST(V_RPATH_OPT)
2185 AC_SUBST(ADDLARCHIVEOBJS)
2186 AC_SUBST(PLATFORM_C_SRC)
2187 AC_SUBST(PLATFORM_CXX_SRC)
2188 AC_SUBST(MODULE_C_SRC)
2189 AC_SUBST(REMOTE_C_SRC)
2191 AC_SUBST(MAN_DEVICES)
2192 AC_SUBST(MAN_FILE_FORMATS)
2193 AC_SUBST(MAN_MISC_INFO)
2194 AC_SUBST(MAN_ADMIN_COMMANDS)
2195 AC_SUBST(PTHREAD_LIBS)
2196 AC_SUBST(BUILD_RPCAPD)
2197 AC_SUBST(INSTALL_RPCAPD)
2198 AC_SUBST(RPCAPD_LIBS)
2199 AC_SUBST(EXTRA_NETWORK_LIBS)
2202 # Various Linux-specific mechanisms.
2204 AC_ARG_ENABLE([usb],
2205 [AC_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
2210 # If somebody requested an XXX-only pcap, that doesn't include
2211 # additional mechanisms.
2213 if test "xxx_only" != yes; then
2216 dnl check for USB sniffing support
2217 AC_MSG_CHECKING(for Linux usbmon USB sniffing support)
2218 if test "x$enable_usb" != "xno" ; then
2219 AC_DEFINE(PCAP_SUPPORT_LINUX_USBMON, 1, [target host supports Linux usbmon for USB sniffing])
2220 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2222 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2223 if test $? -ne 0 ; then
2224 ac_usb_dev_name="usbmon"
2226 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2227 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2229 # Do we have a version of <linux/compiler.h> available?
2230 # If so, we might need it for <linux/usbdevice_fs.h>.
2232 AC_CHECK_HEADERS(linux/compiler.h)
2233 if test "$ac_cv_header_linux_compiler_h" = yes; then
2235 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2237 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2239 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2241 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2243 # OK, does it define bRequestType? Older versions of the kernel
2244 # define fields with names like "requesttype, "request", and
2245 # "value", rather than "bRequestType", "bRequest", and
2248 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2251 #ifdef HAVE_LINUX_COMPILER_H
2252 #include <linux/compiler.h>
2254 #include <linux/usbdevice_fs.h>
2262 # Life's too short to deal with trying to get this to compile
2263 # if you don't get the right types defined with
2264 # __KERNEL_STRICT_NAMES getting defined by some other include.
2266 # Check whether the includes Just Work. If not, don't turn on
2267 # netfilter support.
2269 AC_MSG_CHECKING(whether we can compile the netfilter support)
2270 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2273 #include <sys/socket.h>
2274 #include <netinet/in.h>
2275 #include <linux/types.h>
2277 #include <linux/netlink.h>
2278 #include <linux/netfilter.h>
2279 #include <linux/netfilter/nfnetlink.h>
2280 #include <linux/netfilter/nfnetlink_log.h>
2281 #include <linux/netfilter/nfnetlink_queue.h>],
2283 ac_cv_netfilter_can_compile=yes,
2284 ac_cv_netfilter_can_compile=no))
2285 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2286 if test $ac_cv_netfilter_can_compile = yes ; then
2287 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2288 [target host supports netfilter sniffing])
2289 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2294 AC_SUBST(PCAP_SUPPORT_LINUX_USBMON)
2295 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2297 AC_ARG_ENABLE([netmap],
2298 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2300 [enable_netmap=yes])
2302 if test "x$enable_netmap" != "xno" ; then
2304 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2305 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2306 # is defined, for example, as it includes a non-existent malloc.h
2309 AC_MSG_CHECKING(whether we can compile the netmap support)
2310 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2313 #define NETMAP_WITH_LIBS
2314 #include <net/netmap_user.h>],
2316 ac_cv_net_netmap_user_can_compile=yes,
2317 ac_cv_net_netmap_user_can_compile=no))
2318 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2319 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2320 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2321 [target host supports netmap])
2322 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2324 AC_SUBST(PCAP_SUPPORT_NETMAP)
2327 # Check for DPDK support.
2329 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2331 if test "$withval" = no
2333 # User doesn't want DPDK support.
2335 elif test "$withval" = yes
2337 # User wants DPDK support but hasn't specified a directory.
2340 # User wants DPDK support and has specified a directory,
2341 # so use the provided value.
2346 if test "$V_PCAP" = dpdk; then
2347 # User requested DPDK-only libpcap, so we'd better have
2350 elif test "xxx_only" = yes; then
2351 # User requested something-else-only pcap, so they don't
2352 # want DPDK support.
2356 # Use DPDK API if present, otherwise don't
2362 if test "$want_dpdk" != no; then
2363 if test -z "$dpdk_dir"; then
2365 # The user didn't specify a directory containing
2366 # the DPDK headers and libraries. If we find
2367 # a /usr/local/include/dpdk directory, assume
2368 # it's /usr/local, otherwise assume it's /usr.
2370 if test -d "/usr/local/include/dpdk"; then
2371 dpdk_dir="/usr/local"
2377 # The convention appears to be that 1) there's a "dpdk"
2378 # subdirectory of the include directory, containing DPDK
2379 # headers (at least in the installation on Ubuntu with
2380 # the system DPDK packages) and 2) includes of DPDK
2381 # headers don't use "dpdk/{header}" (at least from the
2382 # way the DPDK documentation is written).
2384 # So we add "/dpdk" to the include directory, and always
2385 # add that to the list of include directories to search.
2387 dpdk_inc_dir="$dpdk_dir/include/dpdk"
2388 dpdk_lib_dir="$dpdk_dir/lib"
2389 DPDK_MACHINE_CFLAGS="-march=native"
2390 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_inc_dir"
2391 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2393 save_CFLAGS="$CFLAGS"
2395 save_LDFLAGS="$LDFLAGS"
2396 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2397 LIBS="$LIBS $DPDK_LDFLAGS"
2398 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2400 AC_MSG_CHECKING(whether we can compile the DPDK support)
2401 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2404 #include <rte_common.h>],
2406 ac_cv_dpdk_can_compile=yes,
2407 ac_cv_dpdk_can_compile=no))
2408 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2411 # We include rte_bus.h, and older versions of DPDK
2412 # didn't have it, so check for it.
2414 if test "$ac_cv_dpdk_can_compile" = yes; then
2415 AC_CHECK_HEADERS(rte_bus.h)
2418 CFLAGS="$save_CFLAGS"
2420 LDFLAGS="$save_LDFLAGS"
2422 if test "$ac_cv_header_rte_bus_h" = yes; then
2423 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2424 LIBS="$LIBS $DPDK_LDFLAGS"
2425 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2426 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2427 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2428 if test $V_PCAP != dpdk ; then
2429 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2432 if test "$V_PCAP" = dpdk; then
2433 # User requested "dpdk" capture type but we couldn't
2434 # find the DPDK API support.
2435 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
2438 if test "$want_dpdk" = yes; then
2439 # User wanted DPDK support but we couldn't find it.
2440 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but the DPDK headers weren't found at $dpdk_inc_dir: make sure the DPDK support is installed, specify a different path or paths if necessary, or don't request DPDK support])
2444 AC_SUBST(PCAP_SUPPORT_DPDK)
2446 AC_ARG_ENABLE([bluetooth],
2447 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2449 [enable_bluetooth=ifsupportavailable])
2451 if test "xxx_only" = yes; then
2452 # User requested something-else-only pcap, so they don't
2453 # want Bluetooth support.
2457 if test "x$enable_bluetooth" != "xno" ; then
2458 dnl check for Bluetooth sniffing support
2461 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2464 # We have bluetooth.h, so we support Bluetooth
2467 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2468 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2469 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2470 ac_lbl_bluetooth_available=yes
2473 # OK, does struct sockaddr_hci have an hci_channel
2476 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2479 # Yes; is HCI_CHANNEL_MONITOR defined?
2481 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2482 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2485 #include <bluetooth/bluetooth.h>
2486 #include <bluetooth/hci.h>
2489 u_int i = HCI_CHANNEL_MONITOR;
2493 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2494 [target host supports Bluetooth Monitor])
2495 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2502 #include <bluetooth/bluetooth.h>
2503 #include <bluetooth/hci.h>
2508 # We don't have bluetooth.h, so we don't support
2509 # Bluetooth sniffing.
2511 if test "x$enable_bluetooth" = "xyes" ; then
2512 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2514 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2519 if test "x$enable_bluetooth" = "xyes" ; then
2520 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2522 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2526 AC_SUBST(PCAP_SUPPORT_BT)
2529 AC_ARG_ENABLE([dbus],
2530 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2532 [enable_dbus=ifavailable])
2534 if test "xxx_only" = yes; then
2535 # User requested something-else-only pcap, so they don't
2536 # want D-Bus support.
2540 if test "x$enable_dbus" != "xno"; then
2541 if test "x$enable_dbus" = "xyes"; then
2546 # We don't support D-Bus sniffing on macOS; see
2548 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2550 # The user requested it, so fail.
2552 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2559 # We don't support D-Bus sniffing on macOS; see
2561 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2563 # The user dind't explicitly request it, so just
2564 # silently refuse to enable it.
2572 if test "x$enable_dbus" != "xno"; then
2573 if test "x$PKGCONFIG" != "xno"; then
2574 AC_MSG_CHECKING([for D-Bus])
2575 if "$PKGCONFIG" dbus-1; then
2576 AC_MSG_RESULT([yes])
2577 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2578 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2579 save_CFLAGS="$CFLAGS"
2581 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2582 LIBS="$LIBS $DBUS_LIBS"
2583 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2585 [#include <string.h>
2588 #include <sys/time.h>
2590 #include <dbus/dbus.h>],
2591 [return dbus_connection_read_write(NULL, 0);],
2593 AC_MSG_RESULT([yes])
2594 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2595 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2596 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2600 if test "x$enable_dbus" = "xyes"; then
2601 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2605 CFLAGS="$save_CFLAGS"
2608 if test "x$enable_dbus" = "xyes"; then
2609 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2613 AC_SUBST(PCAP_SUPPORT_DBUS)
2616 AC_ARG_ENABLE([rdma],
2617 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2619 [enable_rdma=ifavailable])
2621 if test "xxx_only" = yes; then
2622 # User requested something-else-only pcap, so they don't
2623 # want RDMA support.
2627 if test "x$enable_rdma" != "xno"; then
2628 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2629 AC_CHECK_HEADER(infiniband/verbs.h, [
2631 # ibv_create_flow may be defined as a static inline
2632 # function in infiniband/verbs.h, so we can't
2635 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2636 # macro that works like CMake's check_symbol_exists()
2637 # function, to check do a compile check like
2638 # this (they do a clever trick to avoid having
2639 # to know the function's signature).
2641 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2644 #include <infiniband/verbs.h>
2647 (void) ibv_create_flow((struct ibv_qp *) NULL,
2648 (struct ibv_flow_attr *) NULL);
2651 AC_MSG_RESULT([yes])
2652 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2653 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
2654 LIBS="-libverbs $LIBS"
2662 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2667 AC_CONFIG_HEADER(config.h)
2669 AC_OUTPUT_COMMANDS([if test -f .devel; then
2670 echo timestamp > stamp-h
2671 cat $srcdir/Makefile-devel-adds >> Makefile
2674 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2675 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2676 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2677 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2678 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2679 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2680 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2681 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile