2 dnl Copyright (c) 1994, 1995, 1996, 1997
3 dnl The Regents of the University of California. All rights reserved.
5 dnl Process this file with autoconf to produce a configure script.
11 # http://ftp.gnu.org/gnu/config/README
13 # for the URLs to use to fetch new versions of config.guess and
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 # Try to enable as many C99 features as we can.
28 # At minimum, we want C++/C99-style // comments.
31 if test "$ac_cv_prog_cc_c99" = "no"; then
32 AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
37 # Haiku's platform file is in C++.
43 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
48 # Try to arrange for large file support.
54 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
55 dnl include <sys/ioccom.h>, and we were to drop support for older
56 dnl releases without that fix, so that pcap-bpf.c doesn't need to
57 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
58 dnl in "aclocal.m4" uses it, so we would still have to test for it
59 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
60 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
62 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
63 AC_CHECK_HEADERS(netpacket/packet.h)
64 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
65 #include <sys/socket.h>
67 if test "$ac_cv_header_net_pfvar_h" = yes; then
69 # Check for various PF actions.
71 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
73 [#include <sys/types.h>
74 #include <sys/socket.h>
76 #include <net/pfvar.h>],
77 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
80 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
81 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
89 # linux/if_bonding.h requires sys/socket.h.
91 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
93 #include <sys/socket.h>
98 # Check for the eventfd header.
100 AC_CHECK_HEADERS(sys/eventfd.h)
105 # Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
107 CFLAGS="$CFLAGS -D_BSD_SOURCE"
113 AC_CHECK_FUNCS(strerror)
114 AC_CHECK_FUNC(strerror_r,
117 # We have strerror_r; if we define _GNU_SOURCE, is it a
118 # POSIX-compliant strerror_r() or a GNU strerror_r()?
120 AC_MSG_CHECKING(whether strerror_r is GNU-style)
127 /* Define it GNU-style; that will cause an error if it's not GNU-style */
128 extern char *strerror_r(int, char *, size_t);
140 AC_DEFINE(HAVE_GNU_STRERROR_R,,
141 [Define to 1 if you have a GNU-style `strerror_r' function.])
145 AC_DEFINE(HAVE_POSIX_STRERROR_R,,
146 [Define to 1 if you have a POSIX-style `strerror_r' function.])
151 # We don't have strerror_r; do we have strerror_s?
153 AC_CHECK_FUNCS(strerror_s)
157 # Thanks, IBM, for not providing vsyslog() in AIX!
159 AC_CHECK_FUNCS(vsyslog)
164 # we have snprintf() and vsnprintf(), and have asprintf() and
167 # we have snprintf() and vsnprintf(), but don't have asprintf()
170 # we have neither snprintf() nor vsnprintf(), and don't have
171 # asprintf() or vasprintf(), either.
173 # We assume that if we have asprintf() we have vasprintf(), as well
174 # as snprintf() and vsnprintf(), and that if we have snprintf() we
177 # For the first case, we don't need any replacement routines.
178 # For the second case, we need replacement asprintf()/vasprintf()
180 # For the third case, we need replacement snprintf()/vsnprintf() and
181 # asprintf()/vasprintf() routines.
184 AC_CHECK_FUNCS(vsnprintf snprintf,,
187 AC_CHECK_FUNCS(vasprintf asprintf,,
189 if test $needsnprintf = yes; then
191 # We assume we have none of them; missing/snprintf.c supplies
194 AC_LIBOBJ([snprintf])
195 elif test $needasprintf = yes; then
197 # We assume we have snprintf()/vsnprintf() but lack
198 # asprintf()/vasprintf(); missing/asprintf.c supplies
199 # the latter (using vsnprintf()).
201 AC_LIBOBJ([asprintf])
205 AC_CHECK_FUNCS(strlcat,,
207 if test $needstrlcat = yes; then
212 AC_CHECK_FUNCS(strlcpy,,
214 if test $needstrlcpy = yes; then
219 AC_CHECK_FUNCS(strtok_r,,
221 if test $needstrtok_r = yes; then
222 AC_LIBOBJ([strtok_r])
226 # Do we have ffs(), and is it declared in <strings.h>?
229 if test "$ac_cv_func_ffs" = yes; then
231 # We have ffs(); is it declared in <strings.h>?
233 # This test fails if we don't have <strings.h> or if we do
234 # but it doesn't declare ffs().
238 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
239 [Define to 1 if strings.h declares `ffs'])
247 # Do this before checking for ether_hostton(), as it's a
248 # "getaddrinfo()-ish function".
253 # Check for reentrant versions of getnetbyname_r(), as provided by
254 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
255 # If we don't find one, we just use getnetbyname(), which uses
256 # thread-specific data on many platforms, but doesn't use it on
257 # NetBSD or OpenBSD, and may not use it on older versions of other
260 # Only do the check if we have a declaration of getnetbyname_r();
261 # without it, we can't check which API it has. (We assume that
262 # if there's a declaration, it has a prototype, so that the API
265 AC_CHECK_DECL(getnetbyname_r,
267 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
269 [#include <netdb.h>],
271 struct netent netent_buf;
273 struct netent *resultp;
276 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
280 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
281 [define if we have the Linux getnetbyname_r()])
286 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
288 [#include <netdb.h>],
290 struct netent netent_buf;
293 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
297 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
298 [define if we have the Solaris/IRIX getnetbyname_r()])
303 AC_MSG_CHECKING([for AIX getnetbyname_r()])
305 [#include <netdb.h>],
307 struct netent netent_buf;
308 struct netent_data net_data;
310 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
314 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
315 [define if we have the AIX getnetbyname_r()])
322 ],,[#include <netdb.h>])
325 # Check for reentrant versions of getprotobyname_r(), as provided by
326 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
327 # If we don't find one, we just use getprotobyname(), which uses
328 # thread-specific data on many platforms, but doesn't use it on
329 # NetBSD or OpenBSD, and may not use it on older versions of other
332 # Only do the check if we have a declaration of getprotobyname_r();
333 # without it, we can't check which API it has. (We assume that
334 # if there's a declaration, it has a prototype, so that the API
337 AC_CHECK_DECL(getprotobyname_r,
339 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
341 [#include <netdb.h>],
343 struct protoent protoent_buf;
345 struct protoent *resultp;
347 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
351 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
352 [define if we have the Linux getprotobyname_r()])
357 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
359 [#include <netdb.h>],
361 struct protoent protoent_buf;
364 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
368 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
369 [define if we have the Solaris/IRIX getprotobyname_r()])
374 AC_MSG_CHECKING([for AIX getprotobyname_r()])
376 [#include <netdb.h>],
378 struct protoent protoent_buf;
379 struct protoent_data proto_data;
381 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
385 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
386 [define if we have the AIX getprotobyname_r()])
393 ],,[#include <netdb.h>])
396 # You are in a twisty little maze of UN*Xes, all different.
397 # Some might not have ether_hostton().
398 # Some might have it and declare it in <net/ethernet.h>.
399 # Some might have it and declare it in <netinet/ether.h>
400 # Some might have it and declare it in <sys/ethernet.h>.
401 # Some might have it and declare it in <arpa/inet.h>.
402 # Some might have it and declare it in <netinet/if_ether.h>.
403 # Some might have it and not declare it in any header file.
405 # Before you is a C compiler.
407 AC_CHECK_FUNCS(ether_hostton)
408 if test "$ac_cv_func_ether_hostton" = yes; then
410 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
412 # This test fails if we don't have <net/ethernet.h> or if we do
413 # but it doesn't declare ether_hostton().
415 AC_CHECK_DECL(ether_hostton,
417 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
418 [Define to 1 if net/ethernet.h declares `ether_hostton'])
421 #include <net/ethernet.h>
426 if test "$ac_cv_have_decl_ether_hostton" != yes; then
428 # No, how about <netinet/ether.h>, as on Linux?
430 # This test fails if we don't have <netinet/ether.h>
431 # or if we do but it doesn't declare ether_hostton().
433 # Unset ac_cv_have_decl_ether_hostton so we don't
434 # treat the previous failure as a cached value and
435 # suppress the next test.
437 unset ac_cv_have_decl_ether_hostton
438 AC_CHECK_DECL(ether_hostton,
440 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
441 [Define to 1 if netinet/ether.h declares `ether_hostton'])
444 #include <netinet/ether.h>
450 if test "$ac_cv_have_decl_ether_hostton" != yes; then
452 # No, how about <sys/ethernet.h>, as on Solaris 10
455 # This test fails if we don't have <sys/ethernet.h>
456 # or if we do but it doesn't declare ether_hostton().
458 # Unset ac_cv_have_decl_ether_hostton so we don't
459 # treat the previous failure as a cached value and
460 # suppress the next test.
462 unset ac_cv_have_decl_ether_hostton
463 AC_CHECK_DECL(ether_hostton,
465 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
466 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
469 #include <sys/ethernet.h>
475 if test "$ac_cv_have_decl_ether_hostton" != yes; then
477 # No, how about <arpa/inet.h>, as in AIX?
479 # This test fails if we don't have <arpa/inet.h>
480 # (if we have ether_hostton(), we should have
481 # networking, and if we have networking, we should
482 # have <arapa/inet.h>) or if we do but it doesn't
483 # declare ether_hostton().
485 # Unset ac_cv_have_decl_ether_hostton so we don't
486 # treat the previous failure as a cached value and
487 # suppress the next test.
489 unset ac_cv_have_decl_ether_hostton
490 AC_CHECK_DECL(ether_hostton,
492 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
493 [Define to 1 if arpa/inet.h declares `ether_hostton'])
496 #include <arpa/inet.h>
502 if test "$ac_cv_have_decl_ether_hostton" != yes; then
504 # No, how about <netinet/if_ether.h>?
505 # On some platforms, it requires <net/if.h> and
506 # <netinet/in.h>, and we always include it with
507 # both of them, so test it with both of them.
509 # This test fails if we don't have <netinet/if_ether.h>
510 # and the headers we include before it, or if we do but
511 # <netinet/if_ether.h> doesn't declare ether_hostton().
513 # Unset ac_cv_have_decl_ether_hostton so we don't
514 # treat the previous failure as a cached value and
515 # suppress the next test.
517 unset ac_cv_have_decl_ether_hostton
518 AC_CHECK_DECL(ether_hostton,
520 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
521 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
524 #include <sys/types.h>
525 #include <sys/socket.h>
527 #include <netinet/in.h>
528 #include <netinet/if_ether.h>
532 # After all that, is ether_hostton() declared?
534 if test "$ac_cv_have_decl_ether_hostton" = yes; then
538 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
539 [Define to 1 if you have the declaration of `ether_hostton'])
542 # No, we'll have to declare it ourselves.
543 # Do we have "struct ether_addr" if we include
544 # <netinet/if_ether.h>?
546 AC_CHECK_TYPES(struct ether_addr,,,
548 #include <sys/types.h>
549 #include <sys/socket.h>
551 #include <netinet/in.h>
552 #include <netinet/if_ether.h>
558 # For various things that might use pthreads.
560 AC_CHECK_HEADER(pthread.h,
563 # OK, we have pthread.h. Do we have pthread_create in the
566 AC_CHECK_FUNC(pthread_create,
571 ac_lbl_have_pthreads="found"
575 # No - do we have it in -lpthreads?
577 AC_CHECK_LIB(pthreads, pthread_create,
580 # Yes - add -lpthreads.
582 ac_lbl_have_pthreads="found"
583 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
587 # No - do we have it in -lpthread?
589 AC_CHECK_LIB(pthread, pthread_create,
592 # Yes - add -lpthread.
594 ac_lbl_have_pthreads="found"
595 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
601 ac_lbl_have_pthreads="not found"
608 # We didn't find pthread.h.
610 ac_lbl_have_pthreads="not found"
614 dnl to pacify those who hate protochain insn
615 AC_MSG_CHECKING(if --disable-protochain option is specified)
616 AC_ARG_ENABLE(protochain,
617 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
618 case "x$enable_protochain" in
619 xyes) enable_protochain=enabled ;;
620 xno) enable_protochain=disabled ;;
621 x) enable_protochain=enabled ;;
624 if test "$enable_protochain" = "disabled"; then
625 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
627 AC_MSG_RESULT(${enable_protochain})
630 # valgrindtest directly uses the native capture mechanism, but
631 # only tests with BPF and PF_PACKET sockets; only enable it if
632 # we have BPF or PF_PACKET sockets.
637 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
638 if test ! -z "$with_pcap" ; then
642 # Check for a bunch of headers for various packet
643 # capture mechanisms.
645 AC_CHECK_HEADERS(net/bpf.h)
646 if test "$ac_cv_header_net_bpf_h" = yes; then
648 # Does it define BIOCSETIF?
649 # I.e., is it a header for an LBL/BSD-style capture
650 # mechanism, or is it just a header for a BPF filter
651 # engine? Some versions of Arch Linux, for example,
652 # have a net/bpf.h that doesn't define BIOCSETIF;
653 # as it's a Linux, it should use packet sockets,
658 # sys/types.h, because FreeBSD 10's net/bpf.h
659 # requires that various BSD-style integer types
662 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
663 # doesn't include it but does use struct timeval
664 # in ioctl definitions;
666 # sys/ioctl.h and, if we have it, sys/ioccom.h,
667 # because net/bpf.h defines ioctls;
669 # net/if.h, because it defines some structures
670 # used in ioctls defined by net/bpf.h;
672 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
673 # defines some structure fields as being
676 # and net/bpf.h doesn't necessarily include all
677 # of those headers itself.
679 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
680 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
683 #include <sys/types.h>
684 #include <sys/time.h>
685 #include <sys/ioctl.h>
686 #include <sys/socket.h>
687 #ifdef HAVE_SYS_IOCCOM_H
688 #include <sys/ioccom.h>
693 [u_int i = BIOCSETIF;],
694 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
695 ac_cv_lbl_bpf_h_defines_biocsetif=no))
696 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
698 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
699 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
700 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
701 AC_CHECK_HEADERS(config/HaikuConfig.h)
703 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
706 # Check this before DLPI, so that we pick BPF on
707 # Solaris 11 and later.
712 # We have BPF, so build valgrindtest with "make test"
713 # on macOS and FreeBSD (add your OS once there's a
718 freebsd*|darwin*|linux*)
719 VALGRINDTEST_SRC=valgrindtest.c
722 elif test "$ac_cv_header_linux_socket_h" = yes; then
724 # No prizes for guessing this one.
729 # XXX - this won't work with older kernels that have
730 # SOCK_PACKET sockets but not PF_PACKET sockets.
732 VALGRINDTEST_SRC=valgrindtest.c
733 elif test "$ac_cv_header_net_pfilt_h" = yes; then
735 # DEC OSF/1, Digital UNIX, Tru64 UNIX
738 elif test "$ac_cv_header_net_enet_h" = yes; then
740 # Stanford Enetfilter.
743 elif test "$ac_cv_header_net_nit_h" = yes; then
745 # SunOS 4.x STREAMS NIT.
748 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
750 # Pre-SunOS 4.x non-STREAMS NIT.
753 elif test "$ac_cv_header_net_raw_h" = yes; then
758 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
760 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
763 elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
770 # Nothing we support.
773 AC_MSG_WARN(cannot determine packet capture interface)
774 AC_MSG_WARN((see the INSTALL doc for more info))
777 AC_MSG_CHECKING(packet capture type)
778 AC_MSG_RESULT($V_PCAP)
779 AC_SUBST(VALGRINDTEST_SRC)
782 # Handle each capture type.
787 # Checks for some header files.
789 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
792 # Checks to see if Solaris has the public libdlpi(3LIB) library.
793 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
794 # public libdlpi(3LIB) version. Before libdlpi was made public, a
795 # private version also existed, which did not have the same APIs.
796 # Due to a gcc bug, the default search path for 32-bit libraries does
797 # not include /lib, we add it explicitly here.
798 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
799 # Also, due to the bug above applications that link to libpcap with
800 # libdlpi will have to add "-L/lib" option to "configure".
802 saved_ldflags=$LDFLAGS
803 LDFLAGS="$LIBS -L/lib"
804 AC_CHECK_LIB(dlpi, dlpi_walk,
810 # Capture module plus common code needed for
811 # common functions used by pcap-[dlpi,libdlpi].c
813 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
814 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
820 # Capture module plus common code needed for
821 # common functions used by pcap-[dlpi,libdlpi].c
823 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
825 LDFLAGS=$saved_ldflags
828 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
831 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
832 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
835 #include <sys/types.h>
836 #include <sys/time.h>
837 #include <sys/dlpi.h>
839 [int i = DL_PROMISC_PHYS;],
840 ac_cv_sys_dlpi_usable=yes,
841 ac_cv_sys_dlpi_usable=no))
842 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
843 if test $ac_cv_sys_dlpi_usable = no ; then
844 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
848 # Check to see if Solaris has the dl_passive_req_t struct defined
850 # This check is for DLPI support for passive modes.
851 # See dlpi(7P) for more details.
853 AC_CHECK_TYPES(dl_passive_req_t,,,
855 #include <sys/types.h>
856 #include <sys/dlpi.h>
864 PLATFORM_C_SRC="pcap-enet.c"
871 PLATFORM_CXX_SRC="pcap-haiku.cpp"
874 # Just for the sake of it.
876 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
883 PLATFORM_C_SRC="pcap-linux.c"
886 # Do we have the wireless extensions?
888 AC_CHECK_HEADERS(linux/wireless.h, [], [],
890 #include <sys/socket.h>
891 #include <linux/if.h>
892 #include <linux/types.h>
899 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
900 with_libnl=$withval,with_libnl=if_available)
902 if test x$with_libnl != xno ; then
905 incdir=-I/usr/include/libnl3
907 case "$with_libnl" in
913 if test -d $withval; then
914 libnldir=-L${withval}/lib/.libs
915 incdir=-I${withval}/include
921 # Try libnl 3.x first.
923 AC_CHECK_LIB(nl-3, nl_socket_alloc,
926 # Yes, we have libnl 3.x.
928 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
929 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
930 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
931 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
932 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
933 V_INCLS="$V_INCLS ${incdir}"
935 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
937 if test x$have_any_nl = xno ; then
941 AC_CHECK_LIB(nl, nl_socket_alloc,
944 # Yes, we have libnl 2.x.
946 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
947 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
948 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
949 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
950 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
955 if test x$have_any_nl = xno ; then
957 # No, we don't; do we have libnl 1.x?
959 AC_CHECK_LIB(nl, nl_handle_alloc,
964 LIBS="${libnldir} -lnl $LIBS"
965 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
970 if test x$have_any_nl = xno ; then
972 # No, we don't have libnl at all.
974 if test x$with_libnl = xyes ; then
975 AC_MSG_ERROR([libnl support requested but libnl not found])
980 AC_CHECK_HEADERS(linux/ethtool.h,,,
983 #include <linux/types.h>
987 # Check to see if struct tpacket_stats is defined in
988 # <linux/if_packet.h>. If so, then pcap-linux.c can use this
989 # to report proper statistics.
993 AC_CHECK_TYPES(struct tpacket_stats,,,
995 #include <linux/if_packet.h>
999 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
1001 # NOTE: any failure means we conclude that it doesn't have that
1002 # member, so if we don't have tpacket_auxdata, we conclude it
1003 # doesn't have that member (which is OK, as either we won't be
1004 # using code that would use that member, or we wouldn't compile
1006 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
1008 #include <sys/types.h>
1009 #include <linux/if_packet.h>
1017 PLATFORM_C_SRC="pcap-bpf.c"
1020 # Check whether we have the *BSD-style ioctls.
1022 AC_CHECK_HEADERS(net/if_media.h)
1025 # Check whether we have struct BPF_TIMEVAL.
1027 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
1029 #include <sys/types.h>
1030 #include <sys/ioctl.h>
1031 #ifdef HAVE_SYS_IOCCOM_H
1032 #include <sys/ioccom.h>
1034 #include <net/bpf.h>
1042 PLATFORM_C_SRC="pcap-pf.c"
1049 PLATFORM_C_SRC="pcap-snit.c"
1056 PLATFORM_C_SRC="pcap-snoop.c"
1061 # --with-pcap=dag is the only way to get here, and it means
1062 # "DAG support but nothing else"
1064 V_DEFS="$V_DEFS -DDAG_ONLY"
1065 PLATFORM_C_SRC="pcap-dag.c"
1071 # --with-pcap=dpdk is the only way to get here, and it means
1072 # "DPDK support but nothing else"
1074 V_DEFS="$V_DEFS -DDPDK_ONLY"
1075 PLATFORM_C_SRC="pcap-dpdk.c"
1081 # --with-pcap=septel is the only way to get here, and it means
1082 # "Septel support but nothing else"
1084 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1085 PLATFORM_C_SRC="pcap-septel.c"
1091 # --with-pcap=snf is the only way to get here, and it means
1092 # "SNF support but nothing else"
1094 V_DEFS="$V_DEFS -DSNF_ONLY"
1095 PLATFORM_C_SRC="pcap-snf.c"
1103 PLATFORM_C_SRC="pcap-null.c"
1107 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1112 dnl Now figure out how we get a list of interfaces and addresses,
1113 dnl if we support capturing. Don't bother if we don't support
1116 if test "$V_PCAP" != null
1118 AC_CHECK_FUNC(getifaddrs,[
1120 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1121 # as well, just in case some platform is really weird.
1123 AC_CHECK_HEADER(ifaddrs.h,[
1125 # We have the header, so we use "getifaddrs()" to
1126 # get the list of interfaces.
1128 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1131 # We don't have the header - give up.
1132 # XXX - we could also fall back on some other
1133 # mechanism, but, for now, this'll catch this
1134 # problem so that we can at least try to figure
1135 # out something to do on systems with "getifaddrs()"
1136 # but without "ifaddrs.h", if there is something
1137 # we can do on those systems.
1139 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1143 # Well, we don't have "getifaddrs()", at least not with the
1144 # libraries with which we've decided we need to link
1145 # libpcap with, so we have to use some other mechanism.
1147 # Note that this may happen on Solaris, which has
1148 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1149 # won't find it if we link with -lxnet, which we want
1150 # to do for other reasons.
1152 # For now, we use either the SIOCGIFCONF ioctl or the
1153 # SIOCGLIFCONF ioctl, preferring the latter if we have
1154 # it; the latter is a Solarisism that first appeared
1155 # in Solaris 8. (Solaris's getifaddrs() appears to
1156 # be built atop SIOCGLIFCONF; using it directly
1157 # avoids a not-all-that-useful middleman.)
1159 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1160 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1162 [#include <sys/param.h>
1163 #include <sys/file.h>
1164 #include <sys/ioctl.h>
1165 #include <sys/socket.h>
1166 #include <sys/sockio.h>],
1167 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1168 ac_cv_lbl_have_siocglifconf=yes,
1169 ac_cv_lbl_have_siocglifconf=no))
1170 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1171 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1172 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1174 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1179 dnl check for hardware timestamp support
1182 AC_CHECK_HEADERS([linux/net_tstamp.h])
1185 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1189 AC_ARG_ENABLE([packet-ring],
1190 [AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])],
1191 ,enable_packet_ring=yes)
1193 if test "x$enable_packet_ring" != "xno" ; then
1194 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available])
1195 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1199 # Check for socklen_t.
1201 AC_CHECK_TYPES(socklen_t,,,
1203 #include <sys/types.h>
1204 #include <sys/socket.h>
1208 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1211 if test "$enable_ipv6" != "no"; then
1213 # We've already made sure we have getaddrinfo above in
1214 # AC_LBL_LIBRARY_NET.
1216 AC_DEFINE(INET6,1,[IPv6])
1220 # Do we have pkg-config?
1222 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1224 # Check for Endace DAG card support.
1226 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1228 if test "$withval" = no
1230 # User doesn't want DAG support.
1232 elif test "$withval" = yes
1234 # User wants DAG support but hasn't specified a directory.
1237 # User wants DAG support and has specified a directory, so use the provided value.
1242 if test "$V_PCAP" = dag; then
1243 # User requested DAG-only libpcap, so we'd better have
1246 elif test "xxx_only" = yes; then
1247 # User requested something-else-only pcap, so they don't
1252 # Use DAG API if present, otherwise don't
1258 AC_ARG_WITH([dag-includes],
1259 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1261 # User wants DAG support and has specified a header directory, so use the provided value.
1263 dag_include_dir=$withval
1266 AC_ARG_WITH([dag-libraries],
1267 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1269 # User wants DAG support and has specified a library directory, so use the provided value.
1271 dag_lib_dir=$withval
1274 if test "$want_dag" != no; then
1276 # If necessary, set default paths for DAG API headers and libraries.
1277 if test -z "$dag_root"; then
1281 if test -z "$dag_include_dir"; then
1282 dag_include_dir="$dag_root/include"
1285 if test -z "$dag_lib_dir"; then
1286 dag_lib_dir="$dag_root/lib"
1289 V_INCLS="$V_INCLS -I$dag_include_dir"
1291 AC_CHECK_HEADERS([dagapi.h])
1293 if test "$ac_cv_header_dagapi_h" = yes; then
1295 if test $V_PCAP != dag ; then
1296 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1299 # Check for various DAG API functions.
1300 # Don't need to save and restore LIBS to prevent -ldag being
1301 # included if there's a found-action (arg 3).
1302 saved_ldflags=$LDFLAGS
1303 LDFLAGS="-L$dag_lib_dir"
1304 AC_CHECK_LIB([dag], [dag_attach_stream],
1306 [AC_MSG_ERROR(DAG library lacks streams support)])
1307 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1308 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1309 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1310 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1311 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1313 LDFLAGS=$saved_ldflags
1316 # We assume that if we have libdag we have libdagconf,
1317 # as they're installed at the same time from the same
1320 LIBS="$LIBS -ldag -ldagconf"
1321 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1323 if test "$dag_large_streams" = 1; then
1324 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1325 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1326 if test "$ac_dag_have_vdag" = 1; then
1327 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1328 if test "$ac_lbl_have_pthreads" != "found"; then
1329 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1331 LIBS="$LIBS $PTHREAD_LIBS"
1335 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1338 if test "$V_PCAP" = dag; then
1339 # User requested "dag" capture type but we couldn't
1340 # find the DAG API support.
1341 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])
1344 if test "$want_dag" = yes; then
1345 # User wanted DAG support but we couldn't find it.
1346 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])
1352 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1354 if test "$withval" = no
1357 elif test "$withval" = yes
1363 septel_root=$withval
1366 if test "$V_PCAP" = septel; then
1367 # User requested Septel-only libpcap, so we'd better have
1370 elif test "xxx_only" = yes; then
1371 # User requested something-else-only pcap, so they don't
1372 # want Septel support.
1376 # Use Septel API if present, otherwise don't
1378 want_septel=ifpresent
1382 ac_cv_lbl_septel_api=no
1383 if test "$with_septel" != no; then
1385 AC_MSG_CHECKING([whether we have Septel API headers])
1387 # If necessary, set default paths for Septel API headers and libraries.
1388 if test -z "$septel_root"; then
1389 septel_root=$srcdir/../septel
1392 septel_tools_dir="$septel_root"
1393 septel_include_dir="$septel_root/INC"
1395 if test -r "$septel_include_dir/msg.h"; then
1396 ac_cv_lbl_septel_api=yes
1399 if test "$ac_cv_lbl_septel_api" = yes; then
1400 AC_MSG_RESULT([yes ($septel_include_dir)])
1402 V_INCLS="$V_INCLS -I$septel_include_dir"
1403 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"
1404 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"
1406 if test "$V_PCAP" != septel ; then
1407 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1410 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1414 if test "$V_PCAP" = septel; then
1415 # User requested "septel" capture type but
1416 # we couldn't find the Septel API support.
1417 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])
1420 if test "$want_septel" = yes; then
1421 # User wanted Septel support but we couldn't find it.
1422 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])
1427 # Check for Myricom SNF support.
1429 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1431 if test "$withval" = no
1433 # User explicitly doesn't want SNF
1435 elif test "$withval" = yes
1437 # User wants SNF support but hasn't specified a directory.
1440 # User wants SNF support with a specified directory.
1445 if test "$V_PCAP" = snf; then
1446 # User requested Sniffer-only libpcap, so we'd better have
1449 elif test "xxx_only" = yes; then
1450 # User requested something-else-only pcap, so they don't
1455 # Use Sniffer API if present, otherwise don't
1461 AC_ARG_WITH([snf-includes],
1462 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1464 # User wants SNF with specific header directory
1466 snf_include_dir=$withval
1469 AC_ARG_WITH([snf-libraries],
1470 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1472 # User wants SNF with specific lib directory
1474 snf_lib_dir=$withval
1477 ac_cv_lbl_snf_api=no
1478 if test "$with_snf" != no; then
1480 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1482 # If necessary, set default paths for Sniffer headers and libraries.
1483 if test -z "$snf_root"; then
1487 if test -z "$snf_include_dir"; then
1488 snf_include_dir="$snf_root/include"
1491 if test -z "$snf_lib_dir"; then
1492 snf_lib_dir="$snf_root/lib"
1495 if test -f "$snf_include_dir/snf.h"; then
1496 # We found a header; make sure we can link with the library
1497 saved_ldflags=$LDFLAGS
1498 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1499 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1500 LDFLAGS="$saved_ldflags"
1501 if test "$ac_cv_lbl_snf_api" = no; then
1502 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1506 if test "$ac_cv_lbl_snf_api" = yes; then
1507 AC_MSG_RESULT([yes ($snf_root)])
1509 V_INCLS="$V_INCLS -I$snf_include_dir"
1511 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1513 if test "$V_PCAP" != snf ; then
1514 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1517 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1521 if test "$want_snf" = yes; then
1522 # User requested "snf" capture type but
1523 # we couldn't find the Sniffer API support.
1524 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])
1527 if test "$want_snf" = yes; then
1528 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])
1533 # Check for Riverbed TurboCap support.
1534 AC_ARG_WITH([turbocap],
1535 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1537 if test "$withval" = no
1539 # User explicitly doesn't want TurboCap
1541 elif test "$withval" = yes
1543 # User wants TurboCap support but hasn't specified a directory.
1546 # User wants TurboCap support with a specified directory.
1548 turbocap_root=$withval
1551 if test "xxx_only" = yes; then
1552 # User requested something-else-only pcap, so they don't
1553 # want TurboCap support.
1557 # Use TurboCap API if present, otherwise don't
1559 want_turbocap=ifpresent
1563 ac_cv_lbl_turbocap_api=no
1564 if test "$want_turbocap" != no; then
1566 AC_MSG_CHECKING(whether TurboCap is supported)
1568 save_CFLAGS="$CFLAGS"
1570 if test ! -z "$turbocap_root"; then
1571 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1572 TURBOCAP_LIBS="-L$turbocap_root/lib"
1573 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1581 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1583 (void)TcInstanceCreateByName("foo", &i);
1585 ac_cv_lbl_turbocap_api=yes)
1587 CFLAGS="$save_CFLAGS"
1588 if test $ac_cv_lbl_turbocap_api = yes; then
1591 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1592 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1593 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1595 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1599 if test "$want_turbocap" = yes; then
1600 # User wanted Turbo support but we couldn't find it.
1601 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])
1607 dnl Allow the user to enable remote capture.
1608 dnl It's off by default, as that increases the attack surface of
1609 dnl libpcap, exposing it to malicious servers.
1611 AC_MSG_CHECKING([whether to enable remote packet capture])
1612 AC_ARG_ENABLE(remote,
1613 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1614 --disable-remote disable remote packet capture],,
1616 case "$enableval" in
1617 yes) AC_MSG_RESULT(yes)
1618 AC_WARN([Remote packet capture may expose libpcap-based applications])
1619 AC_WARN([to attacks by malicious remote capture servers!])
1621 # rpcapd requires pthreads on UN*X.
1623 if test "$ac_lbl_have_pthreads" != "found"; then
1624 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1627 # It also requires crypt().
1628 # Do we have it in the system libraries?
1630 AC_CHECK_FUNC(crypt,,
1633 # No. Do we have it in -lcrypt?
1635 AC_CHECK_LIB(crypt, crypt,
1638 # Yes; add -lcrypt to the libraries for rpcapd.
1640 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1643 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1648 # OK, we have crypt(). Do we have getspnam()?
1650 AC_CHECK_FUNCS(getspnam)
1653 # Check for various members of struct msghdr.
1655 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1657 #include "ftmacros.h"
1658 #include <sys/socket.h>
1660 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1662 #include "ftmacros.h"
1663 #include <sys/socket.h>
1667 # Optionally, we may want to support SSL.
1668 # Check for OpenSSL/libressl.
1670 # First, try looking for it as a regular system library.
1671 # Make sure we can find SSL_library_init() using the
1672 # standard headers, just in case we're running a version
1673 # of macOS that ships with the OpenSSL library but not
1674 # the OpenSSL headers, and have also installed another
1675 # version of OpenSSL with headers.
1678 LIBS="-lssl -lcrypto"
1679 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1682 #include <openssl/ssl.h>
1691 OPENSSL_LIBS="-lssl -lcrypto"
1697 # If we didn't find it, check for it with pkg-config.
1699 if test "x$HAVE_OPENSSL" != "xyes"; then
1700 if test "x$PKGCONFIG" != "xno"; then
1702 # We have pkg-config; see if we have OpenSSL/
1703 # libressl installed as a package.
1705 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1706 if "$PKGCONFIG" openssl; then
1707 AC_MSG_RESULT([found])
1709 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1710 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1712 AC_MSG_RESULT([not found])
1718 # OK, did we find it?
1720 if test "x$HAVE_OPENSSL" = "xyes"; then
1721 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1722 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1723 LIBS="$LIBS $OPENSSL_LIBS"
1725 AC_MSG_NOTICE(OpenSSL not found)
1728 AC_DEFINE(ENABLE_REMOTE,,
1729 [Define to 1 if remote packet capture is to be supported])
1730 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1731 BUILD_RPCAPD=build-rpcapd
1732 INSTALL_RPCAPD=install-rpcapd
1734 *) AC_MSG_RESULT(no)
1738 AC_MSG_CHECKING(whether to build optimizer debugging code)
1739 AC_ARG_ENABLE(optimizer-dbg,
1740 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1741 if test "$enable_optimizer_dbg" = "yes"; then
1742 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1744 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1746 AC_MSG_CHECKING(whether to build parser debugging code)
1747 AC_ARG_ENABLE(yydebug,
1748 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1749 if test "$enable_yydebug" = "yes"; then
1750 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1752 AC_MSG_RESULT(${enable_yydebug-no})
1758 if test "$LEX" = ":"; then
1759 AC_MSG_ERROR([Neither flex nor lex was found.])
1763 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1764 # and supports processing our scanner.l.
1766 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1767 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1768 tcpdump_cv_capable_lex=yes
1770 tcpdump_cv_capable_lex=insufficient
1772 if test $tcpdump_cv_capable_lex = insufficient ; then
1773 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1774 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1778 # Look for yacc/bison/byacc.
1783 # Make sure it supports the -p flag and supports processing our
1786 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1787 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1788 tcpdump_cv_capable_yacc=yes
1790 tcpdump_cv_capable_yacc=insufficient
1792 if test $tcpdump_cv_capable_yacc = insufficient ; then
1793 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1794 libpcap requires Bison, a newer version of Berkeley YACC with support
1795 for reentrant parsers, or another YACC compatible with them.])
1799 # Do various checks for various OSes and versions of those OSes.
1801 # Assume, by default, no support for shared libraries and V7/BSD
1802 # convention for man pages (devices in section 4, file formats in
1803 # section 5, miscellaneous info in section 7, administrative commands
1804 # and daemons in section 8). Individual cases can override this.
1810 MAN_ADMIN_COMMANDS=8
1814 dnl Workaround to enable certain features
1815 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1818 # AIX makes it fun to build shared and static libraries,
1819 # because they're *both* ".a" archive libraries. We
1820 # build the static library for the benefit of the traditional
1821 # scheme of building libpcap and tcpdump in subdirectories of
1822 # the same directory, with tcpdump statically linked with the
1823 # libpcap in question, but we also build a shared library as
1824 # "libpcap.shareda" and install *it*, rather than the static
1825 # library, as "libpcap.a".
1833 # If we're using DLPI, applications will need to
1834 # use /lib/pse.exp if present, as we use the
1837 pseexe="/lib/pse.exp"
1838 AC_MSG_CHECKING(for $pseexe)
1839 if test -f $pseexe ; then
1847 # If we're using BPF, we need "-lodm" and "-lcfg", as
1848 # we use them to load the BPF module.
1857 V_CCOPT="$V_CCOPT -fno-common"
1858 AC_ARG_ENABLE(universal,
1859 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1860 if test "$enable_universal" != "no"; then
1865 # Pre-Tiger. Build only for 32-bit PowerPC; no
1866 # need for any special compiler or linker flags.
1870 darwin8.[[0123]]|darwin8.[[0123]].*)
1872 # Tiger, prior to Intel support. Build
1873 # libraries and executables for 32-bit PowerPC
1874 # and 64-bit PowerPC, with 32-bit PowerPC first.
1875 # (I'm guessing that's what Apple does.)
1877 # (The double brackets are needed because
1878 # autotools/m4 use brackets as a quoting
1879 # character; the double brackets turn into
1880 # single brackets in the generated configure
1883 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1884 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1885 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1886 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1889 darwin8.[[456]]|darwin.[[456]].*)
1891 # Tiger, subsequent to Intel support but prior
1892 # to x86-64 support. Build libraries and
1893 # executables for 32-bit PowerPC, 64-bit
1894 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1895 # first. (I'm guessing that's what Apple does.)
1897 # (The double brackets are needed because
1898 # autotools/m4 use brackets as a quoting
1899 # character; the double brackets turn into
1900 # single brackets in the generated configure
1903 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1904 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1905 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1906 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1911 # All other Tiger, so subsequent to x86-64
1912 # support. Build libraries and executables for
1913 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1914 # and x86-64, with 32-bit PowerPC first. (I'm
1915 # guessing that's what Apple does.)
1917 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1918 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1919 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1920 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1925 # Leopard. Build libraries for 32-bit PowerPC,
1926 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1927 # 32-bit PowerPC first, and build executables
1928 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1929 # x86 first. (That's what Apple does.)
1931 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1932 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1933 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1934 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1939 # Snow Leopard. Build libraries for x86-64,
1940 # 32-bit x86, and 32-bit PowerPC, with x86-64
1941 # first, and build executables for x86-64 and
1942 # 32-bit x86, with x86-64 first. (That's what
1943 # Apple does, even though Snow Leopard doesn't
1944 # run on PPC, so PPC libpcap runs under Rosetta,
1945 # and Rosetta doesn't support BPF ioctls, so PPC
1946 # programs can't do live captures.)
1948 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1949 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1950 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1951 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1956 # Post-Snow Leopard. Build libraries for x86-64
1957 # and 32-bit x86, with x86-64 first, and build
1958 # executables only for x86-64. (That's what
1959 # Apple does.) This requires no special flags
1961 # XXX - update if and when Apple drops support
1962 # for 32-bit x86 code and if and when Apple adds
1963 # ARM-based Macs. (You're on your own for iOS
1966 # XXX - check whether we *can* build for
1967 # i386 and, if not, suggest that the user
1968 # install the /usr/include headers if they
1969 # want to build fat.
1971 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1972 save_CFLAGS="$CFLAGS"
1973 CFLAGS="$CFLAGS -arch i386"
1979 V_LIB_CCOPT_FAT="-arch x86_64"
1980 V_LIB_LDFLAGS_FAT="-arch x86_64"
1983 # OpenSSL installation on macOS seems
1984 # to install only the libs for 64-bit
1985 # x86 - at least that's what Brew does:
1986 # only configure 32-bit builds if we
1987 # don't have OpenSSL.
1989 if test "$HAVE_OPENSSL" != yes; then
1990 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1991 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1996 V_LIB_CCOPT_FAT="-arch x86_64"
1997 V_LIB_LDFLAGS_FAT="-arch x86_64"
2002 # Mojave; you need to install the
2003 # /usr/include headers to get
2004 # 32-bit x86 builds to work.
2006 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])
2011 # Pre-Mojave; the command-line
2012 # tools should be sufficient to
2013 # enable 32-bit x86 builds.
2015 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
2019 CFLAGS="$save_CFLAGS"
2020 if test "$HAVE_OPENSSL" = yes; then
2022 # If all else fails, look for OpenSSL in
2025 CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include"
2026 LIBS="$LIBS -L/usr/local/opt/openssl/lib"
2034 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
2037 # Use System V conventions for man pages.
2039 MAN_ADMIN_COMMANDS=1m
2047 # Use System V conventions for man pages.
2049 MAN_ADMIN_COMMANDS=1m
2057 # Use System V conventions for man pages.
2059 MAN_ADMIN_COMMANDS=1m
2065 dnl HPUX 10.20 and above is similar to HPUX 9, but
2066 dnl not the same....
2068 dnl XXX - DYEXT should be set to "sl" if this is building
2069 dnl for 32-bit PA-RISC, but should be left as "so" for
2070 dnl 64-bit PA-RISC or, I suspect, IA-64.
2071 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2072 if test "`uname -m`" = "ia64"; then
2079 # "-b" builds a shared library; "+h" sets the soname.
2085 # Use System V conventions for man pages.
2093 # Use IRIX conventions for man pages; they're the same as the
2094 # System V conventions, except that they use section 8 for
2095 # administrative commands and daemons.
2101 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*)
2105 # Compiler assumed to be GCC; run-time linker may require a -R
2108 if test "$libdir" != "/usr/lib"; then
2109 V_RFLAGS=-Wl,-R$libdir
2117 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
2118 # Use Tru64 UNIX conventions for man pages; they're the same as
2119 # the System V conventions except that they use section 8 for
2120 # administrative commands and daemons.
2128 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2129 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2133 ac_cv_cc_sinix_defined=yes,
2134 ac_cv_cc_sinix_defined=no))
2135 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2136 if test $ac_cv_cc_sinix_defined = no ; then
2137 AC_DEFINE(sinix,1,[on sinix])
2142 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2147 # Make sure errno is thread-safe, in case we're called in
2148 # a multithreaded program. We don't guarantee that two
2149 # threads can use the *same* pcap_t safely, but the
2150 # current version does guarantee that you can use different
2151 # pcap_t's in different threads, and even that pcap_compile()
2152 # is thread-safe (it wasn't thread-safe in some older versions).
2154 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2156 case "`uname -r`" in
2163 # Use System V conventions for man pages.
2165 MAN_ADMIN_COMMANDS=1m
2173 AC_ARG_ENABLE(shared,
2174 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2175 test "x$enable_shared" = "xno" && DYEXT="none"
2178 AC_CHECK_TOOL([AR], [ar])
2183 AC_LBL_DEVEL(V_CCOPT)
2186 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2188 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2190 #include <sys/types.h>
2191 #include <sys/socket.h>
2195 # Check to see if there's a sockaddr_storage structure.
2197 AC_CHECK_TYPES(struct sockaddr_storage,,,
2199 #include <sys/types.h>
2200 #include <sys/socket.h>
2204 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2205 # dl_module_id_1 member.
2207 # NOTE: any failure means we conclude that it doesn't have that member,
2208 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2209 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2210 # it doesn't have that member (which is OK, as either we won't be
2211 # using code that would use that member, or we wouldn't compile in
2214 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2216 #include <sys/types.h>
2217 #include <sys/dlpi.h>
2218 #include <sys/dlpi_ext.h>
2222 AC_SUBST(V_LIB_CCOPT_FAT)
2223 AC_SUBST(V_LIB_LDFLAGS_FAT)
2224 AC_SUBST(V_PROG_CCOPT_FAT)
2225 AC_SUBST(V_PROG_LDFLAGS_FAT)
2229 AC_SUBST(V_SHLIB_CCOPT)
2230 AC_SUBST(V_SHLIB_CMD)
2231 AC_SUBST(V_SHLIB_OPT)
2232 AC_SUBST(V_SONAME_OPT)
2233 AC_SUBST(V_RPATH_OPT)
2236 AC_SUBST(ADDLARCHIVEOBJS)
2237 AC_SUBST(PLATFORM_C_SRC)
2238 AC_SUBST(PLATFORM_CXX_SRC)
2239 AC_SUBST(MODULE_C_SRC)
2240 AC_SUBST(REMOTE_C_SRC)
2242 AC_SUBST(MAN_DEVICES)
2243 AC_SUBST(MAN_FILE_FORMATS)
2244 AC_SUBST(MAN_MISC_INFO)
2245 AC_SUBST(MAN_ADMIN_COMMANDS)
2246 AC_SUBST(PTHREAD_LIBS)
2247 AC_SUBST(BUILD_RPCAPD)
2248 AC_SUBST(INSTALL_RPCAPD)
2249 AC_SUBST(RPCAPD_LIBS)
2250 AC_SUBST(EXTRA_NETWORK_LIBS)
2252 AC_ARG_ENABLE([usb],
2253 [AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])],
2257 if test "xxx_only" = yes; then
2258 # User requested something-else-only pcap, so they don't
2263 if test "x$enable_usb" != "xno" ; then
2264 dnl check for USB sniffing support
2265 AC_MSG_CHECKING(for USB sniffing support)
2268 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
2269 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2271 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2272 if test $? -ne 0 ; then
2273 ac_usb_dev_name="usbmon"
2275 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2276 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2278 # Do we have a version of <linux/compiler.h> available?
2279 # If so, we might need it for <linux/usbdevice_fs.h>.
2281 AC_CHECK_HEADERS(linux/compiler.h)
2282 if test "$ac_cv_header_linux_compiler_h" = yes; then
2284 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2286 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2288 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2290 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2292 # OK, does it define bRequestType? Older versions of the kernel
2293 # define fields with names like "requesttype, "request", and
2294 # "value", rather than "bRequestType", "bRequest", and
2297 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2300 #ifdef HAVE_LINUX_COMPILER_H
2301 #include <linux/compiler.h>
2303 #include <linux/usbdevice_fs.h>
2309 # This just uses BPF in FreeBSD 8.4 and later; we don't need
2310 # to check for anything special for capturing.
2312 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
2320 AC_SUBST(PCAP_SUPPORT_USB)
2322 dnl check for netfilter sniffing support
2323 if test "xxx_only" != yes; then
2324 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
2329 # Life's too short to deal with trying to get this to compile
2330 # if you don't get the right types defined with
2331 # __KERNEL_STRICT_NAMES getting defined by some other include.
2333 # Check whether the includes Just Work. If not, don't turn on
2334 # netfilter support.
2336 AC_MSG_CHECKING(whether we can compile the netfilter support)
2337 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2340 #include <sys/socket.h>
2341 #include <netinet/in.h>
2342 #include <linux/types.h>
2344 #include <linux/netlink.h>
2345 #include <linux/netfilter.h>
2346 #include <linux/netfilter/nfnetlink.h>
2347 #include <linux/netfilter/nfnetlink_log.h>
2348 #include <linux/netfilter/nfnetlink_queue.h>],
2350 ac_cv_netfilter_can_compile=yes,
2351 ac_cv_netfilter_can_compile=no))
2352 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2353 if test $ac_cv_netfilter_can_compile = yes ; then
2354 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2355 [target host supports netfilter sniffing])
2356 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2364 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2366 AC_ARG_ENABLE([netmap],
2367 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2369 [enable_netmap=yes])
2371 if test "x$enable_netmap" != "xno" ; then
2373 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2374 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2375 # is defined, for example, as it includes a non-existent malloc.h
2378 AC_MSG_CHECKING(whether we can compile the netmap support)
2379 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2382 #define NETMAP_WITH_LIBS
2383 #include <net/netmap_user.h>],
2385 ac_cv_net_netmap_user_can_compile=yes,
2386 ac_cv_net_netmap_user_can_compile=no))
2387 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2388 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2389 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2390 [target host supports netmap])
2391 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2393 AC_SUBST(PCAP_SUPPORT_NETMAP)
2396 # Check for DPDK support.
2398 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2400 if test "$withval" = no
2402 # User doesn't want DPDK support.
2404 elif test "$withval" = yes
2406 # User wants DPDK support but hasn't specified a directory.
2409 # User wants DPDK support and has specified a directory,
2410 # so use the provided value.
2415 if test "$V_PCAP" = dpdk; then
2416 # User requested DPDK-only libpcap, so we'd better have
2419 elif test "xxx_only" = yes; then
2420 # User requested something-else-only pcap, so they don't
2421 # want DPDK support.
2425 # Use DPDK API if present, otherwise don't
2431 if test "$want_dpdk" != no; then
2432 if test -z "$dpdk_dir"; then
2434 # The user didn't specify a directory containing
2435 # the DPDK headers and libraries. If we find
2436 # a /usr/local/include/dpdk directory, assume
2437 # it's /usr/local, otherwise assume it's /usr.
2439 if test -d "/usr/local/include/dpdk"; then
2440 dpdk_dir="/usr/local"
2446 # The convention appears to be that 1) there's a "dpdk"
2447 # subdirectory of the include directory, containing DPDK
2448 # headers (at least in the installation on Ubuntu with
2449 # the system DPDK packages) and 2) includes of DPDK
2450 # headers don't use "dpdk/{header}" (at least from the
2451 # way the DPDK documentation is written).
2453 # So we add "/dpdk" to the include directory, and always
2454 # add that to the list of include directories to search.
2456 dpdk_inc_dir="$dpdk_dir/include/dpdk"
2457 dpdk_lib_dir="$dpdk_dir/lib"
2458 DPDK_MACHINE_CFLAGS="-march=native"
2459 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_inc_dir"
2460 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2462 save_CFLAGS="$CFLAGS"
2464 save_LDFLAGS="$LDFLAGS"
2465 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2466 LIBS="$LIBS $DPDK_LDFLAGS"
2467 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2469 AC_MSG_CHECKING(whether we can compile the DPDK support)
2470 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2473 #include <rte_common.h>],
2475 ac_cv_dpdk_can_compile=yes,
2476 ac_cv_dpdk_can_compile=no))
2477 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2480 # We include rte_bus.h, and older versions of DPDK
2481 # didn't have it, so check for it.
2483 if test "$ac_cv_dpdk_can_compile" = yes; then
2484 AC_CHECK_HEADERS(rte_bus.h)
2487 CFLAGS="$save_CFLAGS"
2489 LDFLAGS="$save_LDFLAGS"
2491 if test "$ac_cv_header_rte_bus_h" = yes; then
2492 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2493 LIBS="$LIBS $DPDK_LDFLAGS"
2494 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2495 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2496 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2497 if test $V_PCAP != dpdk ; then
2498 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2501 if test "$V_PCAP" = dpdk; then
2502 # User requested "dpdk" capture type but we couldn't
2503 # find the DPDK API support.
2504 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])
2507 if test "$want_dpdk" = yes; then
2508 # User wanted DPDK support but we couldn't find it.
2509 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])
2513 AC_SUBST(PCAP_SUPPORT_DPDK)
2515 AC_ARG_ENABLE([bluetooth],
2516 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2518 [enable_bluetooth=ifsupportavailable])
2520 if test "xxx_only" = yes; then
2521 # User requested something-else-only pcap, so they don't
2522 # want Bluetooth support.
2526 if test "x$enable_bluetooth" != "xno" ; then
2527 dnl check for Bluetooth sniffing support
2530 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2533 # We have bluetooth.h, so we support Bluetooth
2536 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2537 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2538 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2539 ac_lbl_bluetooth_available=yes
2542 # OK, does struct sockaddr_hci have an hci_channel
2545 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2548 # Yes; is HCI_CHANNEL_MONITOR defined?
2550 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2551 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2554 #include <bluetooth/bluetooth.h>
2555 #include <bluetooth/hci.h>
2558 u_int i = HCI_CHANNEL_MONITOR;
2562 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2563 [target host supports Bluetooth Monitor])
2564 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2571 #include <bluetooth/bluetooth.h>
2572 #include <bluetooth/hci.h>
2577 # We don't have bluetooth.h, so we don't support
2578 # Bluetooth sniffing.
2580 if test "x$enable_bluetooth" = "xyes" ; then
2581 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2583 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2588 if test "x$enable_bluetooth" = "xyes" ; then
2589 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2591 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2595 AC_SUBST(PCAP_SUPPORT_BT)
2598 AC_ARG_ENABLE([dbus],
2599 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2601 [enable_dbus=ifavailable])
2603 if test "xxx_only" = yes; then
2604 # User requested something-else-only pcap, so they don't
2605 # want D-Bus support.
2609 if test "x$enable_dbus" != "xno"; then
2610 if test "x$enable_dbus" = "xyes"; then
2615 # We don't support D-Bus sniffing on macOS; see
2617 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2619 # The user requested it, so fail.
2621 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2628 # We don't support D-Bus sniffing on macOS; see
2630 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2632 # The user dind't explicitly request it, so just
2633 # silently refuse to enable it.
2641 if test "x$enable_dbus" != "xno"; then
2642 if test "x$PKGCONFIG" != "xno"; then
2643 AC_MSG_CHECKING([for D-Bus])
2644 if "$PKGCONFIG" dbus-1; then
2645 AC_MSG_RESULT([yes])
2646 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2647 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2648 save_CFLAGS="$CFLAGS"
2650 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2651 LIBS="$LIBS $DBUS_LIBS"
2652 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2654 [#include <string.h>
2657 #include <sys/time.h>
2659 #include <dbus/dbus.h>],
2660 [return dbus_connection_read_write(NULL, 0);],
2662 AC_MSG_RESULT([yes])
2663 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2664 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2665 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2669 if test "x$enable_dbus" = "xyes"; then
2670 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2674 CFLAGS="$save_CFLAGS"
2677 if test "x$enable_dbus" = "xyes"; then
2678 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2682 AC_SUBST(PCAP_SUPPORT_DBUS)
2685 AC_ARG_ENABLE([rdma],
2686 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2688 [enable_rdma=ifavailable])
2690 if test "xxx_only" = yes; then
2691 # User requested something-else-only pcap, so they don't
2692 # want RDMA support.
2696 if test "x$enable_rdma" != "xno"; then
2697 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2698 AC_CHECK_HEADER(infiniband/verbs.h, [
2700 # ibv_create_flow may be defined as a static inline
2701 # function in infiniband/verbs.h, so we can't
2704 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2705 # macro that works like CMake's check_symbol_exists()
2706 # function, to check do a compile check like
2707 # this (they do a clever trick to avoid having
2708 # to know the function's signature).
2710 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2713 #include <infiniband/verbs.h>
2716 (void) ibv_create_flow((struct ibv_qp *) NULL,
2717 (struct ibv_flow_attr *) NULL);
2720 AC_MSG_RESULT([yes])
2721 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2722 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
2723 LIBS="-libverbs $LIBS"
2731 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2736 AC_CONFIG_HEADER(config.h)
2738 AC_OUTPUT_COMMANDS([if test -f .devel; then
2739 echo timestamp > stamp-h
2740 cat $srcdir/Makefile-devel-adds >> Makefile
2743 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2744 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2745 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2746 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2747 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2748 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2749 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2750 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile