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 _wcserror_s?
138 AC_CHECK_FUNCS(_wcserror_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 # Do we have pkg-config?
736 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
739 # Handle each capture type.
744 # Checks for some header files.
746 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
749 # Checks to see if Solaris has the public libdlpi(3LIB) library.
750 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
751 # public libdlpi(3LIB) version. Before libdlpi was made public, a
752 # private version also existed, which did not have the same APIs.
753 # Due to a gcc bug, the default search path for 32-bit libraries does
754 # not include /lib, we add it explicitly here.
755 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
756 # Also, due to the bug above applications that link to libpcap with
757 # libdlpi will have to add "-L/lib" option to "configure".
759 save_LDFLAGS="$LDFLAGS"
760 LDFLAGS="$LIBS -L/lib"
761 AC_CHECK_LIB(dlpi, dlpi_walk,
767 # Capture module plus common code needed for
768 # common functions used by pcap-[dlpi,libdlpi].c
770 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
771 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
777 # Capture module plus common code needed for
778 # common functions used by pcap-[dlpi,libdlpi].c
780 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
782 LDFLAGS="$save_LDFLAGS"
785 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
788 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
789 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
792 #include <sys/types.h>
793 #include <sys/time.h>
794 #include <sys/dlpi.h>
796 [int i = DL_PROMISC_PHYS;],
797 ac_cv_sys_dlpi_usable=yes,
798 ac_cv_sys_dlpi_usable=no))
799 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
800 if test $ac_cv_sys_dlpi_usable = no ; then
801 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
805 # Check to see if Solaris has the dl_passive_req_t struct defined
807 # This check is for DLPI support for passive modes.
808 # See dlpi(7P) for more details.
810 AC_CHECK_TYPES(dl_passive_req_t,,,
812 #include <sys/types.h>
813 #include <sys/dlpi.h>
821 PLATFORM_C_SRC="pcap-enet.c"
828 PLATFORM_CXX_SRC="pcap-haiku.cpp"
831 # Just for the sake of it.
833 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
840 PLATFORM_C_SRC="pcap-linux.c"
843 # Do we have the wireless extensions?
845 AC_CHECK_HEADERS(linux/wireless.h, [], [],
847 #include <sys/socket.h>
848 #include <linux/if.h>
849 #include <linux/types.h>
854 # We only want version 3. Version 2 was, apparently,
855 # short-lived, and version 1 is source and binary
856 # incompatible with version 3, and it appears that,
857 # these days, everybody's using version 3. We're
858 # not supporting older versions of the Linux kernel;
859 # let's drop support for older versions of libnl, too.
862 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
863 with_libnl=$withval,with_libnl=if_available)
865 if test x$with_libnl != xno ; then
868 incdir=-I/usr/include/libnl3
870 case "$with_libnl" in
876 if test -d $withval; then
877 libnldir=-L${withval}/lib/.libs
878 incdir=-I${withval}/include
883 if test "x$PKGCONFIG" != "xno"; then
885 # We have pkg-config; see if we have libnl-3.0
888 AC_MSG_CHECKING([for libnl-3.0 with pkg-config])
889 if "$PKGCONFIG" libnl-3.0; then
890 AC_MSG_RESULT([found])
892 libnl_cflags=`"$PKGCONFIG" --cflags libnl-3.0`
893 V_INCLS="$V_INCLS ${libnl_cflags}"
894 libnl_libs=`"$PKGCONFIG" --libs openssl`
895 LIBS="${libnl_libs} $LIBS"
897 AC_MSG_RESULT([not found])
901 if test x$have_libnl != xyes; then
903 # Check for it directly.
905 AC_CHECK_LIB(nl-3, nl_socket_alloc,
908 # Yes, we have libnl 3.x.
910 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
911 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
912 V_INCLS="$V_INCLS ${incdir}"
916 # No, we don't have libnl at all.
918 if test x$with_libnl = xyes ; then
919 AC_MSG_ERROR([libnl support requested but libnl not found])
921 ], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
926 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
928 # NOTE: any failure means we conclude that it doesn't have that
929 # member, so if we don't have tpacket_auxdata, we conclude it
930 # doesn't have that member (which is OK, as either we won't be
931 # using code that would use that member, or we wouldn't compile
933 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
935 #include <sys/types.h>
936 #include <linux/if_packet.h>
944 PLATFORM_C_SRC="pcap-bpf.c"
947 # Check whether we have the *BSD-style ioctls.
949 AC_CHECK_HEADERS(net/if_media.h)
952 # Check whether we have struct BPF_TIMEVAL.
954 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
956 #include <sys/types.h>
957 #include <sys/ioctl.h>
958 #ifdef HAVE_SYS_IOCCOM_H
959 #include <sys/ioccom.h>
969 PLATFORM_C_SRC="pcap-pf.c"
976 PLATFORM_C_SRC="pcap-snit.c"
983 PLATFORM_C_SRC="pcap-snoop.c"
988 # --with-pcap=dag is the only way to get here, and it means
989 # "DAG support but nothing else"
991 V_DEFS="$V_DEFS -DDAG_ONLY"
992 PLATFORM_C_SRC="pcap-dag.c"
998 # --with-pcap=dpdk is the only way to get here, and it means
999 # "DPDK support but nothing else"
1001 V_DEFS="$V_DEFS -DDPDK_ONLY"
1002 PLATFORM_C_SRC="pcap-dpdk.c"
1008 # --with-pcap=septel is the only way to get here, and it means
1009 # "Septel support but nothing else"
1011 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1012 PLATFORM_C_SRC="pcap-septel.c"
1018 # --with-pcap=snf is the only way to get here, and it means
1019 # "SNF support but nothing else"
1021 V_DEFS="$V_DEFS -DSNF_ONLY"
1022 PLATFORM_C_SRC="pcap-snf.c"
1030 PLATFORM_C_SRC="pcap-null.c"
1034 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1039 dnl Now figure out how we get a list of interfaces and addresses,
1040 dnl if we support capturing. Don't bother if we don't support
1043 if test "$V_PCAP" != null
1045 AC_CHECK_FUNC(getifaddrs,[
1047 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1048 # as well, just in case some platform is really weird.
1050 AC_CHECK_HEADER(ifaddrs.h,[
1052 # We have the header, so we use "getifaddrs()" to
1053 # get the list of interfaces.
1055 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1058 # We don't have the header - give up.
1059 # XXX - we could also fall back on some other
1060 # mechanism, but, for now, this'll catch this
1061 # problem so that we can at least try to figure
1062 # out something to do on systems with "getifaddrs()"
1063 # but without "ifaddrs.h", if there is something
1064 # we can do on those systems.
1066 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1070 # Well, we don't have "getifaddrs()", at least not with the
1071 # libraries with which we've decided we need to link
1072 # libpcap with, so we have to use some other mechanism.
1074 # Note that this may happen on Solaris, which has
1075 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1076 # won't find it if we link with -lxnet, which we want
1077 # to do for other reasons.
1079 # For now, we use either the SIOCGIFCONF ioctl or the
1080 # SIOCGLIFCONF ioctl, preferring the latter if we have
1081 # it; the latter is a Solarisism that first appeared
1082 # in Solaris 8. (Solaris's getifaddrs() appears to
1083 # be built atop SIOCGLIFCONF; using it directly
1084 # avoids a not-all-that-useful middleman.)
1086 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1087 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1089 [#include <sys/param.h>
1090 #include <sys/file.h>
1091 #include <sys/ioctl.h>
1092 #include <sys/socket.h>
1093 #include <sys/sockio.h>],
1094 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1095 ac_cv_lbl_have_siocglifconf=yes,
1096 ac_cv_lbl_have_siocglifconf=no))
1097 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1098 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1099 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1101 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1106 dnl check for hardware timestamp support
1109 AC_CHECK_HEADERS([linux/net_tstamp.h])
1112 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1117 # Check for socklen_t.
1119 AC_CHECK_TYPES(socklen_t,,,
1121 #include <sys/types.h>
1122 #include <sys/socket.h>
1126 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1129 if test "$enable_ipv6" != "no"; then
1131 # We've already made sure we have getaddrinfo above in
1132 # AC_LBL_LIBRARY_NET.
1134 AC_DEFINE(INET6,1,[IPv6])
1137 # Check for Endace DAG card support.
1139 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1141 if test "$withval" = no
1143 # User doesn't want DAG support.
1145 elif test "$withval" = yes
1147 # User wants DAG support but hasn't specified a directory.
1150 # User wants DAG support and has specified a directory, so use the provided value.
1155 if test "$V_PCAP" = dag; then
1156 # User requested DAG-only libpcap, so we'd better have
1159 elif test "xxx_only" = yes; then
1160 # User requested something-else-only pcap, so they don't
1165 # Use DAG API if present, otherwise don't
1171 AC_ARG_WITH([dag-includes],
1172 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1174 # User wants DAG support and has specified a header directory, so use the provided value.
1176 dag_include_dir=$withval
1179 AC_ARG_WITH([dag-libraries],
1180 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1182 # User wants DAG support and has specified a library directory, so use the provided value.
1184 dag_lib_dir=$withval
1187 if test "$want_dag" != no; then
1189 # If necessary, set default paths for DAG API headers and libraries.
1190 if test -z "$dag_root"; then
1194 if test -z "$dag_include_dir"; then
1195 dag_include_dir="$dag_root/include"
1198 if test -z "$dag_lib_dir"; then
1199 dag_lib_dir="$dag_root/lib"
1201 # Handle multiarch systems.
1203 if test -d "$dag_lib_dir/$host"
1205 dag_lib_dir="$dag_lib_dir/$host"
1209 save_CFLAGS="$CFLAGS"
1210 CFLAGS="$CFLAGS -I$dag_include_dir"
1211 AC_CHECK_HEADERS([dagapi.h])
1213 if test "$ac_cv_header_dagapi_h" = yes; then
1215 V_INCLS="$V_INCLS -I$dag_include_dir"
1217 if test $V_PCAP != dag ; then
1218 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1221 # Check for various DAG API functions.
1222 # Don't need to save and restore LIBS to prevent -ldag being
1223 # included if there's a found-action (arg 3).
1224 save_LDFLAGS="$LDFLAGS"
1225 LDFLAGS="-L$dag_lib_dir"
1226 AC_CHECK_LIB([dag], [dag_attach_stream],
1228 [AC_MSG_ERROR(DAG library lacks streams support)])
1229 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1230 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1231 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1232 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1233 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1235 LDFLAGS="$save_LDFLAGS"
1238 # We assume that if we have libdag we have libdagconf,
1239 # as they're installed at the same time from the same
1242 LIBS="$LIBS -ldag -ldagconf"
1243 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1245 if test "$dag_large_streams" = 1; then
1246 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1247 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1248 if test "$ac_dag_have_vdag" = 1; then
1249 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1250 if test "$ac_lbl_have_pthreads" != "found"; then
1251 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1253 LIBS="$LIBS $PTHREAD_LIBS"
1257 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1260 if test "$V_PCAP" = dag; then
1261 # User requested "dag" capture type but we couldn't
1262 # find the DAG API support.
1263 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])
1266 if test "$want_dag" = yes; then
1267 # User wanted DAG support but we couldn't find it.
1268 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])
1271 CFLAGS="$save_CFLAGS"
1275 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1277 if test "$withval" = no
1280 elif test "$withval" = yes
1286 septel_root=$withval
1289 if test "$V_PCAP" = septel; then
1290 # User requested Septel-only libpcap, so we'd better have
1293 elif test "xxx_only" = yes; then
1294 # User requested something-else-only pcap, so they don't
1295 # want Septel support.
1299 # Use Septel API if present, otherwise don't
1301 want_septel=ifpresent
1305 ac_cv_lbl_septel_api=no
1306 if test "$with_septel" != no; then
1308 AC_MSG_CHECKING([whether we have Septel API headers])
1310 # If necessary, set default paths for Septel API headers and libraries.
1311 if test -z "$septel_root"; then
1312 septel_root=$srcdir/../septel
1315 septel_tools_dir="$septel_root"
1316 septel_include_dir="$septel_root/INC"
1318 if test -r "$septel_include_dir/msg.h"; then
1319 ac_cv_lbl_septel_api=yes
1322 if test "$ac_cv_lbl_septel_api" = yes; then
1323 AC_MSG_RESULT([yes ($septel_include_dir)])
1325 V_INCLS="$V_INCLS -I$septel_include_dir"
1326 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"
1327 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"
1329 if test "$V_PCAP" != septel ; then
1330 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1333 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1337 if test "$V_PCAP" = septel; then
1338 # User requested "septel" capture type but
1339 # we couldn't find the Septel API support.
1340 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])
1343 if test "$want_septel" = yes; then
1344 # User wanted Septel support but we couldn't find it.
1345 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])
1350 # Check for Myricom SNF support.
1352 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1354 if test "$withval" = no
1356 # User explicitly doesn't want SNF
1358 elif test "$withval" = yes
1360 # User wants SNF support but hasn't specified a directory.
1363 # User wants SNF support with a specified directory.
1368 if test "$V_PCAP" = snf; then
1369 # User requested Sniffer-only libpcap, so we'd better have
1372 elif test "xxx_only" = yes; then
1373 # User requested something-else-only pcap, so they don't
1378 # Use Sniffer API if present, otherwise don't
1384 AC_ARG_WITH([snf-includes],
1385 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1387 # User wants SNF with specific header directory
1389 snf_include_dir=$withval
1392 AC_ARG_WITH([snf-libraries],
1393 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1395 # User wants SNF with specific lib directory
1397 snf_lib_dir=$withval
1400 ac_cv_lbl_snf_api=no
1401 if test "$with_snf" != no; then
1403 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1405 # If necessary, set default paths for Sniffer headers and libraries.
1406 if test -z "$snf_root"; then
1410 if test -z "$snf_include_dir"; then
1411 snf_include_dir="$snf_root/include"
1414 if test -z "$snf_lib_dir"; then
1415 snf_lib_dir="$snf_root/lib"
1417 # Handle multiarch systems.
1419 if test -d "$snf_lib_dir/$host"
1421 snf_lib_dir="$snf_lib_dir/$host"
1425 if test -f "$snf_include_dir/snf.h"; then
1426 # We found a header; make sure we can link with the library
1427 save_LDFLAGS="$LDFLAGS"
1428 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1429 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1430 LDFLAGS="$save_LDFLAGS"
1431 if test "$ac_cv_lbl_snf_api" = no; then
1432 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1436 if test "$ac_cv_lbl_snf_api" = yes; then
1437 AC_MSG_RESULT([yes ($snf_root)])
1439 V_INCLS="$V_INCLS -I$snf_include_dir"
1441 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1443 if test "$V_PCAP" != snf ; then
1444 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1447 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1451 if test "$want_snf" = yes; then
1452 # User requested "snf" capture type but
1453 # we couldn't find the Sniffer API support.
1454 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])
1457 if test "$want_snf" = yes; then
1458 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])
1463 # Check for Riverbed TurboCap support.
1464 AC_ARG_WITH([turbocap],
1465 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1467 if test "$withval" = no
1469 # User explicitly doesn't want TurboCap
1471 elif test "$withval" = yes
1473 # User wants TurboCap support but hasn't specified a directory.
1476 # User wants TurboCap support with a specified directory.
1478 turbocap_root=$withval
1481 if test "xxx_only" = yes; then
1482 # User requested something-else-only pcap, so they don't
1483 # want TurboCap support.
1487 # Use TurboCap API if present, otherwise don't
1489 want_turbocap=ifpresent
1493 ac_cv_lbl_turbocap_api=no
1494 if test "$want_turbocap" != no; then
1496 AC_MSG_CHECKING(whether TurboCap is supported)
1498 save_CFLAGS="$CFLAGS"
1500 if test ! -z "$turbocap_root"; then
1501 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1502 TURBOCAP_LIBS="-L$turbocap_root/lib"
1503 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1511 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1513 (void)TcInstanceCreateByName("foo", &i);
1515 ac_cv_lbl_turbocap_api=yes)
1517 CFLAGS="$save_CFLAGS"
1518 if test $ac_cv_lbl_turbocap_api = yes; then
1521 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1522 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1523 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1525 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1529 if test "$want_turbocap" = yes; then
1530 # User wanted Turbo support but we couldn't find it.
1531 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])
1537 dnl Allow the user to enable remote capture.
1538 dnl It's off by default, as that increases the attack surface of
1539 dnl libpcap, exposing it to malicious servers.
1541 AC_MSG_CHECKING([whether to enable remote packet capture])
1542 AC_ARG_ENABLE(remote,
1543 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1544 --disable-remote disable remote packet capture],,
1546 case "$enableval" in
1547 yes) AC_MSG_RESULT(yes)
1548 AC_WARN([Remote packet capture may expose libpcap-based applications])
1549 AC_WARN([to attacks by malicious remote capture servers!])
1551 # rpcapd requires pthreads on UN*X.
1553 if test "$ac_lbl_have_pthreads" != "found"; then
1554 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1557 # It also requires crypt().
1558 # Do we have it in the system libraries?
1560 AC_CHECK_FUNC(crypt,,
1563 # No. Do we have it in -lcrypt?
1565 AC_CHECK_LIB(crypt, crypt,
1568 # Yes; add -lcrypt to the libraries for rpcapd.
1570 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1573 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1578 # OK, we have crypt(). Do we have getspnam()?
1580 AC_CHECK_FUNCS(getspnam)
1583 # Check for various members of struct msghdr.
1585 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1587 #include "ftmacros.h"
1588 #include <sys/socket.h>
1590 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1592 #include "ftmacros.h"
1593 #include <sys/socket.h>
1597 # Optionally, we may want to support SSL.
1598 # Check for OpenSSL/libressl.
1600 # First, try looking for it as a regular system library.
1601 # Make sure we can find SSL_library_init() using the
1602 # standard headers, just in case we're running a version
1603 # of macOS that ships with the OpenSSL library but not
1604 # the OpenSSL headers, and have also installed another
1605 # version of OpenSSL with headers.
1608 LIBS="-lssl -lcrypto"
1609 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1612 #include <openssl/ssl.h>
1621 OPENSSL_LIBS="-lssl -lcrypto"
1627 # If we didn't find it, check for it with pkg-config.
1629 if test "x$HAVE_OPENSSL" != "xyes"; then
1630 if test "x$PKGCONFIG" != "xno"; then
1632 # We have pkg-config; see if we have OpenSSL/
1633 # libressl installed as a package.
1635 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1636 if "$PKGCONFIG" openssl; then
1637 AC_MSG_RESULT([found])
1639 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1640 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1642 AC_MSG_RESULT([not found])
1648 # If we didn't find it, check for it under /usr/local/opt/openssl;
1649 # that's where Homebrew puts it on macOS. Feel free to add other
1650 # -L directories as necessary; the "system library" check should
1651 # also handle "add-on library under /usr/local", so that shouldn't
1652 # be necessary here.
1654 if test "x$HAVE_OPENSSL" != "xyes"; then
1655 save_CFLAGS="$CFLAGS"
1657 CFLAGS="$CFLAGS -L/usr/local/opt/openssl/include"
1658 LIBS="$LIBS -L/usr/local/opt/openssl/lib -lssl -lcrypto"
1659 AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local/opt that we can use)
1662 #include <openssl/ssl.h>
1671 OPENSSL_CFLAGS="-I/usr/local/opt/openssl/include"
1672 OPENSSL_LIBS="-L/usr/local/opt/openssl/lib -lssl -lcrypto"
1675 CFLAGS="$save_CFLAGS"
1680 # OK, did we find it?
1682 if test "x$HAVE_OPENSSL" = "xyes"; then
1683 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1684 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1685 LIBS="$LIBS $OPENSSL_LIBS"
1687 AC_MSG_NOTICE(OpenSSL not found)
1690 AC_DEFINE(ENABLE_REMOTE,,
1691 [Define to 1 if remote packet capture is to be supported])
1692 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1693 BUILD_RPCAPD=build-rpcapd
1694 INSTALL_RPCAPD=install-rpcapd
1696 *) AC_MSG_RESULT(no)
1700 AC_MSG_CHECKING(whether to build optimizer debugging code)
1701 AC_ARG_ENABLE(optimizer-dbg,
1702 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1703 if test "$enable_optimizer_dbg" = "yes"; then
1704 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1706 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1708 AC_MSG_CHECKING(whether to build parser debugging code)
1709 AC_ARG_ENABLE(yydebug,
1710 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1711 if test "$enable_yydebug" = "yes"; then
1712 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1714 AC_MSG_RESULT(${enable_yydebug-no})
1720 if test "$LEX" = ":"; then
1721 AC_MSG_ERROR([Neither flex nor lex was found.])
1725 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1726 # and supports processing our scanner.l.
1728 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1729 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1730 tcpdump_cv_capable_lex=yes
1732 tcpdump_cv_capable_lex=insufficient
1734 if test $tcpdump_cv_capable_lex = insufficient ; then
1735 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1736 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1740 # Look for yacc/bison/byacc.
1745 # Make sure it supports the -p flag and supports processing our
1748 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1749 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1750 tcpdump_cv_capable_yacc=yes
1752 tcpdump_cv_capable_yacc=insufficient
1754 if test $tcpdump_cv_capable_yacc = insufficient ; then
1755 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1756 libpcap requires Bison, a newer version of Berkeley YACC with support
1757 for reentrant parsers, or another YACC compatible with them.])
1761 # Do various checks for various OSes and versions of those OSes.
1763 # Assume, by default, no support for shared libraries and V7/BSD
1764 # convention for man pages (devices in section 4, file formats in
1765 # section 5, miscellaneous info in section 7, administrative commands
1766 # and daemons in section 8). Individual cases can override this.
1772 MAN_ADMIN_COMMANDS=8
1776 dnl Workaround to enable certain features
1777 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1780 # AIX makes it fun to build shared and static libraries,
1781 # because they're *both* ".a" archive libraries. We
1782 # build the static library for the benefit of the traditional
1783 # scheme of building libpcap and tcpdump in subdirectories of
1784 # the same directory, with tcpdump statically linked with the
1785 # libpcap in question, but we also build a shared library as
1786 # "libpcap.shareda" and install *it*, rather than the static
1787 # library, as "libpcap.a".
1795 # If we're using DLPI, applications will need to
1796 # use /lib/pse.exp if present, as we use the
1799 pseexe="/lib/pse.exp"
1800 AC_MSG_CHECKING(for $pseexe)
1801 if test -f $pseexe ; then
1809 # If we're using BPF, we need "-lodm" and "-lcfg", as
1810 # we use them to load the BPF module.
1819 V_CCOPT="$V_CCOPT -fno-common"
1820 AC_ARG_ENABLE(universal,
1821 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1822 if test "$enable_universal" != "no"; then
1827 # Pre-Tiger. Build only for 32-bit PowerPC; no
1828 # need for any special compiler or linker flags.
1832 darwin8.[[0123]]|darwin8.[[0123]].*)
1834 # Tiger, prior to Intel support. Build
1835 # libraries and executables for 32-bit PowerPC
1836 # and 64-bit PowerPC, with 32-bit PowerPC first.
1837 # (I'm guessing that's what Apple does.)
1839 # (The double brackets are needed because
1840 # autotools/m4 use brackets as a quoting
1841 # character; the double brackets turn into
1842 # single brackets in the generated configure
1845 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1846 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1847 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1848 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1851 darwin8.[[456]]|darwin.[[456]].*)
1853 # Tiger, subsequent to Intel support but prior
1854 # to x86-64 support. Build libraries and
1855 # executables for 32-bit PowerPC, 64-bit
1856 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1857 # first. (I'm guessing that's what Apple does.)
1859 # (The double brackets are needed because
1860 # autotools/m4 use brackets as a quoting
1861 # character; the double brackets turn into
1862 # single brackets in the generated configure
1865 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1866 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1867 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1868 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1873 # All other Tiger, so subsequent to x86-64
1874 # support. Build libraries and executables for
1875 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1876 # and x86-64, with 32-bit PowerPC first. (I'm
1877 # guessing that's what Apple does.)
1879 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1880 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1881 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1882 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1887 # Leopard. Build libraries for 32-bit PowerPC,
1888 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1889 # 32-bit PowerPC first, and build executables
1890 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1891 # x86 first. (That's what Apple does.)
1893 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1894 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1895 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1896 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1901 # Snow Leopard. Build libraries for x86-64,
1902 # 32-bit x86, and 32-bit PowerPC, with x86-64
1903 # first, and build executables for x86-64 and
1904 # 32-bit x86, with x86-64 first. (That's what
1905 # Apple does, even though Snow Leopard doesn't
1906 # run on PPC, so PPC libpcap runs under Rosetta,
1907 # and Rosetta doesn't support BPF ioctls, so PPC
1908 # programs can't do live captures.)
1910 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1911 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1912 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1913 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1918 # Post-Snow Leopard. Build libraries for x86-64
1919 # and 32-bit x86, with x86-64 first, and build
1920 # executables only for x86-64. (That's what
1921 # Apple does.) This requires no special flags
1923 # XXX - update if and when Apple drops support
1924 # for 32-bit x86 code and if and when Apple adds
1925 # ARM-based Macs. (You're on your own for iOS
1928 # XXX - check whether we *can* build for
1929 # i386 and, if not, suggest that the user
1930 # install the /usr/include headers if they
1931 # want to build fat.
1933 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1934 save_CFLAGS="$CFLAGS"
1935 CFLAGS="$CFLAGS -arch i386"
1941 V_LIB_CCOPT_FAT="-arch x86_64"
1942 V_LIB_LDFLAGS_FAT="-arch x86_64"
1945 # OpenSSL installation on macOS seems
1946 # to install only the libs for 64-bit
1947 # x86 - at least that's what Brew does:
1948 # only configure 32-bit builds if we
1949 # don't have OpenSSL.
1951 if test "$HAVE_OPENSSL" != yes; then
1952 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1953 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1958 V_LIB_CCOPT_FAT="-arch x86_64"
1959 V_LIB_LDFLAGS_FAT="-arch x86_64"
1964 # Mojave; you need to install the
1965 # /usr/include headers to get
1966 # 32-bit x86 builds to work.
1968 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])
1973 # Pre-Mojave; the command-line
1974 # tools should be sufficient to
1975 # enable 32-bit x86 builds.
1977 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
1981 CFLAGS="$save_CFLAGS"
1988 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1991 # Use System V conventions for man pages.
1993 MAN_ADMIN_COMMANDS=1m
2001 # Use System V conventions for man pages.
2003 MAN_ADMIN_COMMANDS=1m
2011 # Use System V conventions for man pages.
2013 MAN_ADMIN_COMMANDS=1m
2019 dnl HPUX 10.20 and above is similar to HPUX 9, but
2020 dnl not the same....
2022 dnl XXX - DYEXT should be set to "sl" if this is building
2023 dnl for 32-bit PA-RISC, but should be left as "so" for
2024 dnl 64-bit PA-RISC or, I suspect, IA-64.
2025 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2026 if test "`uname -m`" = "ia64"; then
2033 # "-b" builds a shared library; "+h" sets the soname.
2039 # Use System V conventions for man pages.
2047 # Use IRIX conventions for man pages; they're the same as the
2048 # System V conventions, except that they use section 8 for
2049 # administrative commands and daemons.
2055 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2059 # Compiler assumed to be GCC; run-time linker may require a -R
2062 if test "$libdir" != "/usr/lib"; then
2063 V_RFLAGS=-Wl,-R$libdir
2071 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
2072 # Use Tru64 UNIX conventions for man pages; they're the same as
2073 # the System V conventions except that they use section 8 for
2074 # administrative commands and daemons.
2082 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2083 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2087 ac_cv_cc_sinix_defined=yes,
2088 ac_cv_cc_sinix_defined=no))
2089 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2090 if test $ac_cv_cc_sinix_defined = no ; then
2091 AC_DEFINE(sinix,1,[on sinix])
2096 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2101 # Make sure errno is thread-safe, in case we're called in
2102 # a multithreaded program. We don't guarantee that two
2103 # threads can use the *same* pcap_t safely, but the
2104 # current version does guarantee that you can use different
2105 # pcap_t's in different threads, and even that pcap_compile()
2106 # is thread-safe (it wasn't thread-safe in some older versions).
2108 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2110 case "`uname -r`" in
2117 # Use System V conventions for man pages.
2119 MAN_ADMIN_COMMANDS=1m
2127 AC_ARG_ENABLE(shared,
2128 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2129 test "x$enable_shared" = "xno" && DYEXT="none"
2132 AC_CHECK_TOOL([AR], [ar])
2137 AC_LBL_DEVEL(V_CCOPT)
2140 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2142 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2144 #include <sys/types.h>
2145 #include <sys/socket.h>
2149 # Check to see if there's a sockaddr_storage structure.
2151 AC_CHECK_TYPES(struct sockaddr_storage,,,
2153 #include <sys/types.h>
2154 #include <sys/socket.h>
2158 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2159 # dl_module_id_1 member.
2161 # NOTE: any failure means we conclude that it doesn't have that member,
2162 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2163 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2164 # it doesn't have that member (which is OK, as either we won't be
2165 # using code that would use that member, or we wouldn't compile in
2168 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2170 #include <sys/types.h>
2171 #include <sys/dlpi.h>
2172 #include <sys/dlpi_ext.h>
2176 AC_SUBST(V_LIB_CCOPT_FAT)
2177 AC_SUBST(V_LIB_LDFLAGS_FAT)
2178 AC_SUBST(V_PROG_CCOPT_FAT)
2179 AC_SUBST(V_PROG_LDFLAGS_FAT)
2183 AC_SUBST(V_SHLIB_CCOPT)
2184 AC_SUBST(V_SHLIB_CMD)
2185 AC_SUBST(V_SHLIB_OPT)
2186 AC_SUBST(V_SONAME_OPT)
2187 AC_SUBST(V_RPATH_OPT)
2190 AC_SUBST(ADDLARCHIVEOBJS)
2191 AC_SUBST(PLATFORM_C_SRC)
2192 AC_SUBST(PLATFORM_CXX_SRC)
2193 AC_SUBST(MODULE_C_SRC)
2194 AC_SUBST(REMOTE_C_SRC)
2196 AC_SUBST(MAN_DEVICES)
2197 AC_SUBST(MAN_FILE_FORMATS)
2198 AC_SUBST(MAN_MISC_INFO)
2199 AC_SUBST(MAN_ADMIN_COMMANDS)
2200 AC_SUBST(PTHREAD_LIBS)
2201 AC_SUBST(BUILD_RPCAPD)
2202 AC_SUBST(INSTALL_RPCAPD)
2203 AC_SUBST(RPCAPD_LIBS)
2204 AC_SUBST(EXTRA_NETWORK_LIBS)
2207 # Various Linux-specific mechanisms.
2209 AC_ARG_ENABLE([usb],
2210 [AC_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
2215 # If somebody requested an XXX-only pcap, that doesn't include
2216 # additional mechanisms.
2218 if test "xxx_only" != yes; then
2221 dnl check for USB sniffing support
2222 AC_MSG_CHECKING(for Linux usbmon USB sniffing support)
2223 if test "x$enable_usb" != "xno" ; then
2224 AC_DEFINE(PCAP_SUPPORT_LINUX_USBMON, 1, [target host supports Linux usbmon for USB sniffing])
2225 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2227 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2228 if test $? -ne 0 ; then
2229 ac_usb_dev_name="usbmon"
2231 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2232 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2234 # Do we have a version of <linux/compiler.h> available?
2235 # If so, we might need it for <linux/usbdevice_fs.h>.
2237 AC_CHECK_HEADERS(linux/compiler.h)
2238 if test "$ac_cv_header_linux_compiler_h" = yes; then
2240 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2242 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2244 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2246 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2248 # OK, does it define bRequestType? Older versions of the kernel
2249 # define fields with names like "requesttype, "request", and
2250 # "value", rather than "bRequestType", "bRequest", and
2253 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2256 #ifdef HAVE_LINUX_COMPILER_H
2257 #include <linux/compiler.h>
2259 #include <linux/usbdevice_fs.h>
2267 # Life's too short to deal with trying to get this to compile
2268 # if you don't get the right types defined with
2269 # __KERNEL_STRICT_NAMES getting defined by some other include.
2271 # Check whether the includes Just Work. If not, don't turn on
2272 # netfilter support.
2274 AC_MSG_CHECKING(whether we can compile the netfilter support)
2275 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2278 #include <sys/socket.h>
2279 #include <netinet/in.h>
2280 #include <linux/types.h>
2282 #include <linux/netlink.h>
2283 #include <linux/netfilter.h>
2284 #include <linux/netfilter/nfnetlink.h>
2285 #include <linux/netfilter/nfnetlink_log.h>
2286 #include <linux/netfilter/nfnetlink_queue.h>],
2288 ac_cv_netfilter_can_compile=yes,
2289 ac_cv_netfilter_can_compile=no))
2290 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2291 if test $ac_cv_netfilter_can_compile = yes ; then
2292 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2293 [target host supports netfilter sniffing])
2294 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2299 AC_SUBST(PCAP_SUPPORT_LINUX_USBMON)
2300 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2302 AC_ARG_ENABLE([netmap],
2303 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2305 [enable_netmap=yes])
2307 if test "x$enable_netmap" != "xno" ; then
2309 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2310 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2311 # is defined, for example, as it includes a non-existent malloc.h
2314 AC_MSG_CHECKING(whether we can compile the netmap support)
2315 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2318 #define NETMAP_WITH_LIBS
2319 #include <net/netmap_user.h>],
2321 ac_cv_net_netmap_user_can_compile=yes,
2322 ac_cv_net_netmap_user_can_compile=no))
2323 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2324 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2325 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2326 [target host supports netmap])
2327 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2329 AC_SUBST(PCAP_SUPPORT_NETMAP)
2332 # Check for DPDK support.
2334 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2336 if test "$withval" = no
2338 # User doesn't want DPDK support.
2340 elif test "$withval" = yes
2342 # User wants DPDK support but hasn't specified a directory.
2345 # User wants DPDK support and has specified a directory,
2346 # so use the provided value.
2351 if test "$V_PCAP" = dpdk; then
2352 # User requested DPDK-only libpcap, so we'd better have
2355 elif test "xxx_only" = yes; then
2356 # User requested something-else-only pcap, so they don't
2357 # want DPDK support.
2361 # Use DPDK API if present, otherwise don't
2367 if test "$want_dpdk" != no; then
2368 if test "x$PKGCONFIG" != "xno"
2371 # We have pkg-config; see if we have DPDK installed
2374 AC_MSG_CHECKING([for DPDK with pkg-config])
2375 if "$PKGCONFIG" libdpdk
2377 AC_MSG_RESULT([found])
2378 found_dpdk_with_pkg_config=yes
2379 DPDK_CFLAGS=`"$PKGCONFIG" --cflags libdpdk`
2380 DPDK_LDFLAGS=`"$PKGCONFIG" --libs libdpdk`
2382 AC_MSG_RESULT([not found])
2387 # If we didn't find it with pkg-config, try checking for
2390 if test "x$found_dpdk_with_pkg_config" != "xyes"
2392 if test -z "$dpdk_dir"; then
2394 # The user didn't specify a directory containing
2395 # the DPDK headers and libraries. If we find
2396 # a /usr/local/include/dpdk directory, assume
2397 # it's /usr/local, otherwise assume it's /usr.
2399 if test -d "/usr/local/include/dpdk"; then
2400 dpdk_dir="/usr/local"
2406 # The convention appears to be that 1) there's a "dpdk"
2407 # subdirectory of the include directory, containing DPDK
2408 # headers (at least in the installation on Ubuntu with
2409 # the system DPDK packages) and 2) includes of DPDK
2410 # headers don't use "dpdk/{header}" (at least from the
2411 # way the DPDK documentation is written).
2413 # So we add "/dpdk" to the include directory, and always
2414 # add that to the list of include directories to search.
2416 dpdk_inc_dir="$dpdk_dir/include/dpdk"
2417 dpdk_inc_flags="-I$dpdk_inc_dir"
2418 dpdk_lib_dir="$dpdk_dir/lib"
2420 # Handle multiarch systems.
2422 # Step 1: run the C compiler with the -dumpmachine option;
2423 # if it succeeds, the output would be the multiarch directory
2424 # name if your system has multiarch directories.
2426 multiarch_dir=`$CC -dumpmachine 2>/dev/null`
2427 if test ! -z "$multiarch_dir"
2430 # OK, we have a multiarch directory.
2432 # Now deal with includes. On Ubuntu 20.04, for
2433 # example, we have /usr/include/dpdk *and*
2434 # /usr/include/$multiarch_dir/dpdk, and must
2437 if test -d "$dpdk_dir/include/$multiarch_dir/dpdk"
2439 dpdk_inc_flags="-I$dpdk_dir/include/$multiarch_dir/dpdk $dpdk_inc_flags"
2443 # Now deal with libraries.
2445 if test -d "$dpdk_lib_dir/$multiarch_dir"
2447 dpdk_lib_dir="$dpdk_lib_dir/$multiarch_dir"
2450 DPDK_MACHINE_CFLAGS="-march=native"
2451 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS $dpdk_inc_flags"
2452 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2455 save_CFLAGS="$CFLAGS"
2457 save_LDFLAGS="$LDFLAGS"
2458 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2459 LIBS="$LIBS $DPDK_LDFLAGS"
2460 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2462 AC_MSG_CHECKING(whether we can compile the DPDK support)
2463 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2466 #include <rte_common.h>],
2468 ac_cv_dpdk_can_compile=yes,
2469 ac_cv_dpdk_can_compile=no))
2470 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2473 # We include rte_bus.h, and older versions of DPDK
2474 # didn't have it, so check for it.
2476 if test "$ac_cv_dpdk_can_compile" = yes; then
2477 AC_CHECK_HEADER(rte_bus.h)
2481 # We call rte_eth_dev_count_avail(), and older versions
2482 # of DPDK didn't have it, so check for it.
2484 if test "$ac_cv_header_rte_bus_h" = yes; then
2485 AC_CHECK_FUNC(rte_eth_dev_count_avail)
2488 CFLAGS="$save_CFLAGS"
2490 LDFLAGS="$save_LDFLAGS"
2492 if test "$ac_cv_func_rte_eth_dev_count_avail" = yes; then
2493 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2494 LIBS="$LIBS $DPDK_LDFLAGS"
2495 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2496 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2497 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2498 if test $V_PCAP != dpdk ; then
2499 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2502 if test "$V_PCAP" = dpdk; then
2503 # User requested DPDK-only capture support, but
2504 # we couldn't the DPDK API support at all, or we
2505 # found it but it wasn't a sufficiently recent
2507 if test "$ac_cv_dpdk_can_compile" != yes; then
2509 # Couldn't even find the headers.
2511 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])
2514 # Found the headers, but we couldn't find
2515 # rte_bus.h or rte_eth_dev_count_avail(),
2516 # we don't have a sufficiently recent
2519 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later; install a newer version of DPDK, or don't request DPDK support])
2523 if test "$want_dpdk" = yes; then
2524 # User requested DPDK-only capture support, but
2525 # we couldn't the DPDK API support at all, or we
2526 # found it but it wasn't a sufficiently recent
2528 if test "$ac_cv_dpdk_can_compile" != yes; then
2530 # Couldn't even find the headers.
2532 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])
2535 # Found the headers, but we couldn't find
2536 # rte_bus.h or rte_eth_dev_count_avail(),
2537 # we don't have a sufficiently recent
2540 AC_MSG_ERROR([DPDK support requested with --with-pcap=dpdk, but we require DPDK 18.x or later: install a newer version of DPDK, or don't request DPDK support])
2545 AC_SUBST(PCAP_SUPPORT_DPDK)
2547 AC_ARG_ENABLE([bluetooth],
2548 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2550 [enable_bluetooth=ifsupportavailable])
2552 if test "xxx_only" = yes; then
2553 # User requested something-else-only pcap, so they don't
2554 # want Bluetooth support.
2558 if test "x$enable_bluetooth" != "xno" ; then
2559 dnl check for Bluetooth sniffing support
2562 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2565 # We have bluetooth.h, so we support Bluetooth
2568 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2569 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2570 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2571 ac_lbl_bluetooth_available=yes
2574 # OK, does struct sockaddr_hci have an hci_channel
2577 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2580 # Yes; is HCI_CHANNEL_MONITOR defined?
2582 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2583 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2586 #include <bluetooth/bluetooth.h>
2587 #include <bluetooth/hci.h>
2590 u_int i = HCI_CHANNEL_MONITOR;
2594 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2595 [target host supports Bluetooth Monitor])
2596 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2603 #include <bluetooth/bluetooth.h>
2604 #include <bluetooth/hci.h>
2609 # We don't have bluetooth.h, so we don't support
2610 # Bluetooth sniffing.
2612 if test "x$enable_bluetooth" = "xyes" ; then
2613 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2615 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2620 if test "x$enable_bluetooth" = "xyes" ; then
2621 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2623 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2627 AC_SUBST(PCAP_SUPPORT_BT)
2630 AC_ARG_ENABLE([dbus],
2631 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2633 [enable_dbus=ifavailable])
2635 if test "xxx_only" = yes; then
2636 # User requested something-else-only pcap, so they don't
2637 # want D-Bus support.
2641 if test "x$enable_dbus" != "xno"; then
2642 if test "x$enable_dbus" = "xyes"; then
2647 # We don't support D-Bus sniffing on macOS; see
2649 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2651 # The user requested it, so fail.
2653 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2660 # We don't support D-Bus sniffing on macOS; see
2662 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2664 # The user dind't explicitly request it, so just
2665 # silently refuse to enable it.
2673 if test "x$enable_dbus" != "xno"; then
2674 if test "x$PKGCONFIG" != "xno"; then
2675 AC_MSG_CHECKING([for D-Bus])
2676 if "$PKGCONFIG" dbus-1; then
2677 AC_MSG_RESULT([yes])
2678 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2679 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2680 save_CFLAGS="$CFLAGS"
2682 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2683 LIBS="$LIBS $DBUS_LIBS"
2684 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2686 [#include <string.h>
2689 #include <sys/time.h>
2691 #include <dbus/dbus.h>],
2692 [return dbus_connection_read_write(NULL, 0);],
2694 AC_MSG_RESULT([yes])
2695 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2696 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2697 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2701 if test "x$enable_dbus" = "xyes"; then
2702 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2706 CFLAGS="$save_CFLAGS"
2709 if test "x$enable_dbus" = "xyes"; then
2710 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2714 AC_SUBST(PCAP_SUPPORT_DBUS)
2717 AC_ARG_ENABLE([rdma],
2718 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2720 [enable_rdma=ifavailable])
2722 if test "xxx_only" = yes; then
2723 # User requested something-else-only pcap, so they don't
2724 # want RDMA support.
2728 if test "x$enable_rdma" != "xno"; then
2729 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2730 AC_CHECK_HEADER(infiniband/verbs.h, [
2732 # ibv_create_flow may be defined as a static inline
2733 # function in infiniband/verbs.h, so we can't
2736 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2737 # macro that works like CMake's check_symbol_exists()
2738 # function, to check do a compile check like
2739 # this (they do a clever trick to avoid having
2740 # to know the function's signature).
2742 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2745 #include <infiniband/verbs.h>
2748 (void) ibv_create_flow((struct ibv_qp *) NULL,
2749 (struct ibv_flow_attr *) NULL);
2752 AC_MSG_RESULT([yes])
2753 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2754 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
2755 LIBS="-libverbs $LIBS"
2763 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2768 AC_CONFIG_HEADER(config.h)
2770 AC_OUTPUT_COMMANDS([if test -f .devel; then
2771 echo timestamp > stamp-h
2772 cat $srcdir/Makefile-devel-adds >> Makefile
2775 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2776 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2777 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2778 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2779 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2780 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2781 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2782 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile