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)
162 # Make sure we have vsnprintf() and snprintf(); we require them.
164 AC_CHECK_FUNC(vsnprintf,,
165 AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
166 AC_CHECK_FUNC(snprintf,,
167 AC_MSG_ERROR([snprintf() is required but wasn't found]))
170 AC_CHECK_FUNCS(vasprintf asprintf,,
172 if test $needasprintf = yes; then
173 AC_LIBOBJ([asprintf])
177 AC_CHECK_FUNCS(strlcat,,
179 if test $needstrlcat = yes; then
184 AC_CHECK_FUNCS(strlcpy,,
186 if test $needstrlcpy = yes; then
191 AC_CHECK_FUNCS(strtok_r,,
193 if test $needstrtok_r = yes; then
194 AC_LIBOBJ([strtok_r])
198 # Do we have ffs(), and is it declared in <strings.h>?
201 if test "$ac_cv_func_ffs" = yes; then
203 # We have ffs(); is it declared in <strings.h>?
205 # This test fails if we don't have <strings.h> or if we do
206 # but it doesn't declare ffs().
210 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
211 [Define to 1 if strings.h declares `ffs'])
219 # Do this before checking for ether_hostton(), as it's a
220 # "getaddrinfo()-ish function".
225 # Check for reentrant versions of getnetbyname_r(), as provided by
226 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
227 # If we don't find one, we just use getnetbyname(), which uses
228 # thread-specific data on many platforms, but doesn't use it on
229 # NetBSD or OpenBSD, and may not use it on older versions of other
232 # Only do the check if we have a declaration of getnetbyname_r();
233 # without it, we can't check which API it has. (We assume that
234 # if there's a declaration, it has a prototype, so that the API
237 AC_CHECK_DECL(getnetbyname_r,
239 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
241 [#include <netdb.h>],
243 struct netent netent_buf;
245 struct netent *resultp;
248 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
252 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
253 [define if we have the Linux getnetbyname_r()])
258 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
260 [#include <netdb.h>],
262 struct netent netent_buf;
265 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
269 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
270 [define if we have the Solaris/IRIX getnetbyname_r()])
275 AC_MSG_CHECKING([for AIX getnetbyname_r()])
277 [#include <netdb.h>],
279 struct netent netent_buf;
280 struct netent_data net_data;
282 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
286 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
287 [define if we have the AIX getnetbyname_r()])
294 ],,[#include <netdb.h>])
297 # Check for reentrant versions of getprotobyname_r(), as provided by
298 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
299 # If we don't find one, we just use getprotobyname(), which uses
300 # thread-specific data on many platforms, but doesn't use it on
301 # NetBSD or OpenBSD, and may not use it on older versions of other
304 # Only do the check if we have a declaration of getprotobyname_r();
305 # without it, we can't check which API it has. (We assume that
306 # if there's a declaration, it has a prototype, so that the API
309 AC_CHECK_DECL(getprotobyname_r,
311 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
313 [#include <netdb.h>],
315 struct protoent protoent_buf;
317 struct protoent *resultp;
319 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
323 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
324 [define if we have the Linux getprotobyname_r()])
329 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
331 [#include <netdb.h>],
333 struct protoent protoent_buf;
336 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
340 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
341 [define if we have the Solaris/IRIX getprotobyname_r()])
346 AC_MSG_CHECKING([for AIX getprotobyname_r()])
348 [#include <netdb.h>],
350 struct protoent protoent_buf;
351 struct protoent_data proto_data;
353 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
357 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
358 [define if we have the AIX getprotobyname_r()])
365 ],,[#include <netdb.h>])
368 # You are in a twisty little maze of UN*Xes, all different.
369 # Some might not have ether_hostton().
370 # Some might have it and declare it in <net/ethernet.h>.
371 # Some might have it and declare it in <netinet/ether.h>
372 # Some might have it and declare it in <sys/ethernet.h>.
373 # Some might have it and declare it in <arpa/inet.h>.
374 # Some might have it and declare it in <netinet/if_ether.h>.
375 # Some might have it and not declare it in any header file.
377 # Before you is a C compiler.
379 AC_CHECK_FUNCS(ether_hostton)
380 if test "$ac_cv_func_ether_hostton" = yes; then
382 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
384 # This test fails if we don't have <net/ethernet.h> or if we do
385 # but it doesn't declare ether_hostton().
387 AC_CHECK_DECL(ether_hostton,
389 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
390 [Define to 1 if net/ethernet.h declares `ether_hostton'])
393 #include <net/ethernet.h>
398 if test "$ac_cv_have_decl_ether_hostton" != yes; then
400 # No, how about <netinet/ether.h>, as on Linux?
402 # This test fails if we don't have <netinet/ether.h>
403 # or if we do but it doesn't declare ether_hostton().
405 # Unset ac_cv_have_decl_ether_hostton so we don't
406 # treat the previous failure as a cached value and
407 # suppress the next test.
409 unset ac_cv_have_decl_ether_hostton
410 AC_CHECK_DECL(ether_hostton,
412 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
413 [Define to 1 if netinet/ether.h declares `ether_hostton'])
416 #include <netinet/ether.h>
422 if test "$ac_cv_have_decl_ether_hostton" != yes; then
424 # No, how about <sys/ethernet.h>, as on Solaris 10
427 # This test fails if we don't have <sys/ethernet.h>
428 # or if we do but it doesn't declare ether_hostton().
430 # Unset ac_cv_have_decl_ether_hostton so we don't
431 # treat the previous failure as a cached value and
432 # suppress the next test.
434 unset ac_cv_have_decl_ether_hostton
435 AC_CHECK_DECL(ether_hostton,
437 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
438 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
441 #include <sys/ethernet.h>
447 if test "$ac_cv_have_decl_ether_hostton" != yes; then
449 # No, how about <arpa/inet.h>, as in AIX?
451 # This test fails if we don't have <arpa/inet.h>
452 # (if we have ether_hostton(), we should have
453 # networking, and if we have networking, we should
454 # have <arapa/inet.h>) or if we do but it doesn't
455 # declare ether_hostton().
457 # Unset ac_cv_have_decl_ether_hostton so we don't
458 # treat the previous failure as a cached value and
459 # suppress the next test.
461 unset ac_cv_have_decl_ether_hostton
462 AC_CHECK_DECL(ether_hostton,
464 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
465 [Define to 1 if arpa/inet.h declares `ether_hostton'])
468 #include <arpa/inet.h>
474 if test "$ac_cv_have_decl_ether_hostton" != yes; then
476 # No, how about <netinet/if_ether.h>?
477 # On some platforms, it requires <net/if.h> and
478 # <netinet/in.h>, and we always include it with
479 # both of them, so test it with both of them.
481 # This test fails if we don't have <netinet/if_ether.h>
482 # and the headers we include before it, or if we do but
483 # <netinet/if_ether.h> doesn't 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(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
493 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
496 #include <sys/types.h>
497 #include <sys/socket.h>
499 #include <netinet/in.h>
500 #include <netinet/if_ether.h>
504 # After all that, is ether_hostton() declared?
506 if test "$ac_cv_have_decl_ether_hostton" = yes; then
510 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
511 [Define to 1 if you have the declaration of `ether_hostton'])
514 # No, we'll have to declare it ourselves.
515 # Do we have "struct ether_addr" if we include
516 # <netinet/if_ether.h>?
518 AC_CHECK_TYPES(struct ether_addr,,,
520 #include <sys/types.h>
521 #include <sys/socket.h>
523 #include <netinet/in.h>
524 #include <netinet/if_ether.h>
530 # For various things that might use pthreads.
532 AC_CHECK_HEADER(pthread.h,
535 # OK, we have pthread.h. Do we have pthread_create in the
538 AC_CHECK_FUNC(pthread_create,
543 ac_lbl_have_pthreads="found"
547 # No - do we have it in -lpthreads?
549 AC_CHECK_LIB(pthreads, pthread_create,
552 # Yes - add -lpthreads.
554 ac_lbl_have_pthreads="found"
555 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
559 # No - do we have it in -lpthread?
561 AC_CHECK_LIB(pthread, pthread_create,
564 # Yes - add -lpthread.
566 ac_lbl_have_pthreads="found"
567 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
573 ac_lbl_have_pthreads="not found"
580 # We didn't find pthread.h.
582 ac_lbl_have_pthreads="not found"
586 dnl to pacify those who hate protochain insn
587 AC_MSG_CHECKING(if --disable-protochain option is specified)
588 AC_ARG_ENABLE(protochain,
589 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
590 case "x$enable_protochain" in
591 xyes) enable_protochain=enabled ;;
592 xno) enable_protochain=disabled ;;
593 x) enable_protochain=enabled ;;
596 if test "$enable_protochain" = "disabled"; then
597 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
599 AC_MSG_RESULT(${enable_protochain})
602 # valgrindtest directly uses the native capture mechanism, but
603 # only tests with BPF and PF_PACKET sockets; only enable it if
604 # we have BPF or PF_PACKET sockets.
609 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
610 if test ! -z "$with_pcap" ; then
614 # Check for a bunch of headers for various packet
615 # capture mechanisms.
617 AC_CHECK_HEADERS(net/bpf.h)
618 if test "$ac_cv_header_net_bpf_h" = yes; then
620 # Does it define BIOCSETIF?
621 # I.e., is it a header for an LBL/BSD-style capture
622 # mechanism, or is it just a header for a BPF filter
623 # engine? Some versions of Arch Linux, for example,
624 # have a net/bpf.h that doesn't define BIOCSETIF;
625 # as it's a Linux, it should use packet sockets,
630 # sys/types.h, because FreeBSD 10's net/bpf.h
631 # requires that various BSD-style integer types
634 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
635 # doesn't include it but does use struct timeval
636 # in ioctl definitions;
638 # sys/ioctl.h and, if we have it, sys/ioccom.h,
639 # because net/bpf.h defines ioctls;
641 # net/if.h, because it defines some structures
642 # used in ioctls defined by net/bpf.h;
644 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
645 # defines some structure fields as being
648 # and net/bpf.h doesn't necessarily include all
649 # of those headers itself.
651 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
652 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
655 #include <sys/types.h>
656 #include <sys/time.h>
657 #include <sys/ioctl.h>
658 #include <sys/socket.h>
659 #ifdef HAVE_SYS_IOCCOM_H
660 #include <sys/ioccom.h>
665 [u_int i = BIOCSETIF;],
666 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
667 ac_cv_lbl_bpf_h_defines_biocsetif=no))
668 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
670 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
671 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
672 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
673 AC_CHECK_HEADERS(config/HaikuConfig.h)
675 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
678 # Check this before DLPI, so that we pick BPF on
679 # Solaris 11 and later.
684 # We have BPF, so build valgrindtest with "make test"
685 # on macOS and FreeBSD (add your OS once there's a
690 freebsd*|darwin*|linux*)
691 VALGRINDTEST_SRC=valgrindtest.c
694 elif test "$ac_cv_header_linux_socket_h" = yes; then
696 # No prizes for guessing this one.
701 # XXX - this won't work with older kernels that have
702 # SOCK_PACKET sockets but not PF_PACKET sockets.
704 VALGRINDTEST_SRC=valgrindtest.c
705 elif test "$ac_cv_header_net_pfilt_h" = yes; then
707 # DEC OSF/1, Digital UNIX, Tru64 UNIX
710 elif test "$ac_cv_header_net_enet_h" = yes; then
712 # Stanford Enetfilter.
715 elif test "$ac_cv_header_net_nit_h" = yes; then
717 # SunOS 4.x STREAMS NIT.
720 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
722 # Pre-SunOS 4.x non-STREAMS NIT.
725 elif test "$ac_cv_header_net_raw_h" = yes; then
730 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
732 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
735 elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
742 # Nothing we support.
745 AC_MSG_WARN(cannot determine packet capture interface)
746 AC_MSG_WARN((see the INSTALL doc for more info))
749 AC_MSG_CHECKING(packet capture type)
750 AC_MSG_RESULT($V_PCAP)
751 AC_SUBST(VALGRINDTEST_SRC)
754 # Handle each capture type.
759 # Checks for some header files.
761 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
764 # Checks to see if Solaris has the public libdlpi(3LIB) library.
765 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
766 # public libdlpi(3LIB) version. Before libdlpi was made public, a
767 # private version also existed, which did not have the same APIs.
768 # Due to a gcc bug, the default search path for 32-bit libraries does
769 # not include /lib, we add it explicitly here.
770 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
771 # Also, due to the bug above applications that link to libpcap with
772 # libdlpi will have to add "-L/lib" option to "configure".
774 saved_ldflags=$LDFLAGS
775 LDFLAGS="$LIBS -L/lib"
776 AC_CHECK_LIB(dlpi, dlpi_walk,
782 # Capture module plus common code needed for
783 # common functions used by pcap-[dlpi,libdlpi].c
785 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
786 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
792 # Capture module plus common code needed for
793 # common functions used by pcap-[dlpi,libdlpi].c
795 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
797 LDFLAGS=$saved_ldflags
800 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
803 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
804 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
807 #include <sys/types.h>
808 #include <sys/time.h>
809 #include <sys/dlpi.h>
811 [int i = DL_PROMISC_PHYS;],
812 ac_cv_sys_dlpi_usable=yes,
813 ac_cv_sys_dlpi_usable=no))
814 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
815 if test $ac_cv_sys_dlpi_usable = no ; then
816 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
820 # Check to see if Solaris has the dl_passive_req_t struct defined
822 # This check is for DLPI support for passive modes.
823 # See dlpi(7P) for more details.
825 AC_CHECK_TYPES(dl_passive_req_t,,,
827 #include <sys/types.h>
828 #include <sys/dlpi.h>
836 PLATFORM_C_SRC="pcap-enet.c"
843 PLATFORM_CXX_SRC="pcap-haiku.cpp"
846 # Just for the sake of it.
848 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
855 PLATFORM_C_SRC="pcap-linux.c"
858 # Do we have the wireless extensions?
860 AC_CHECK_HEADERS(linux/wireless.h, [], [],
862 #include <sys/socket.h>
863 #include <linux/if.h>
864 #include <linux/types.h>
871 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
872 with_libnl=$withval,with_libnl=if_available)
874 if test x$with_libnl != xno ; then
877 incdir=-I/usr/include/libnl3
879 case "$with_libnl" in
885 if test -d $withval; then
886 libnldir=-L${withval}/lib/.libs
887 incdir=-I${withval}/include
893 # Try libnl 3.x first.
895 AC_CHECK_LIB(nl-3, nl_socket_alloc,
898 # Yes, we have libnl 3.x.
900 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
901 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
902 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
903 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
904 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
905 V_INCLS="$V_INCLS ${incdir}"
907 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
909 if test x$have_any_nl = xno ; then
913 AC_CHECK_LIB(nl, nl_socket_alloc,
916 # Yes, we have libnl 2.x.
918 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
919 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
920 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
921 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
922 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
927 if test x$have_any_nl = xno ; then
929 # No, we don't; do we have libnl 1.x?
931 AC_CHECK_LIB(nl, nl_handle_alloc,
936 LIBS="${libnldir} -lnl $LIBS"
937 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
942 if test x$have_any_nl = xno ; then
944 # No, we don't have libnl at all.
946 if test x$with_libnl = xyes ; then
947 AC_MSG_ERROR([libnl support requested but libnl not found])
952 AC_CHECK_HEADERS(linux/ethtool.h,,,
955 #include <linux/types.h>
959 # Check to see if struct tpacket_stats is defined in
960 # <linux/if_packet.h>. If so, then pcap-linux.c can use this
961 # to report proper statistics.
965 AC_CHECK_TYPES(struct tpacket_stats,,,
967 #include <linux/if_packet.h>
971 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
973 # NOTE: any failure means we conclude that it doesn't have that
974 # member, so if we don't have tpacket_auxdata, we conclude it
975 # doesn't have that member (which is OK, as either we won't be
976 # using code that would use that member, or we wouldn't compile
978 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
980 #include <sys/types.h>
981 #include <linux/if_packet.h>
989 PLATFORM_C_SRC="pcap-bpf.c"
992 # Check whether we have the *BSD-style ioctls.
994 AC_CHECK_HEADERS(net/if_media.h)
997 # Check whether we have struct BPF_TIMEVAL.
999 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
1001 #include <sys/types.h>
1002 #include <sys/ioctl.h>
1003 #ifdef HAVE_SYS_IOCCOM_H
1004 #include <sys/ioccom.h>
1006 #include <net/bpf.h>
1014 PLATFORM_C_SRC="pcap-pf.c"
1021 PLATFORM_C_SRC="pcap-snit.c"
1028 PLATFORM_C_SRC="pcap-snoop.c"
1033 # --with-pcap=dag is the only way to get here, and it means
1034 # "DAG support but nothing else"
1036 V_DEFS="$V_DEFS -DDAG_ONLY"
1037 PLATFORM_C_SRC="pcap-dag.c"
1043 # --with-pcap=dpdk is the only way to get here, and it means
1044 # "DPDK support but nothing else"
1046 V_DEFS="$V_DEFS -DDPDK_ONLY"
1047 PLATFORM_C_SRC="pcap-dpdk.c"
1053 # --with-pcap=septel is the only way to get here, and it means
1054 # "Septel support but nothing else"
1056 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1057 PLATFORM_C_SRC="pcap-septel.c"
1063 # --with-pcap=snf is the only way to get here, and it means
1064 # "SNF support but nothing else"
1066 V_DEFS="$V_DEFS -DSNF_ONLY"
1067 PLATFORM_C_SRC="pcap-snf.c"
1075 PLATFORM_C_SRC="pcap-null.c"
1079 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1084 dnl Now figure out how we get a list of interfaces and addresses,
1085 dnl if we support capturing. Don't bother if we don't support
1088 if test "$V_PCAP" != null
1090 AC_CHECK_FUNC(getifaddrs,[
1092 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1093 # as well, just in case some platform is really weird.
1095 AC_CHECK_HEADER(ifaddrs.h,[
1097 # We have the header, so we use "getifaddrs()" to
1098 # get the list of interfaces.
1100 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1103 # We don't have the header - give up.
1104 # XXX - we could also fall back on some other
1105 # mechanism, but, for now, this'll catch this
1106 # problem so that we can at least try to figure
1107 # out something to do on systems with "getifaddrs()"
1108 # but without "ifaddrs.h", if there is something
1109 # we can do on those systems.
1111 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1115 # Well, we don't have "getifaddrs()", at least not with the
1116 # libraries with which we've decided we need to link
1117 # libpcap with, so we have to use some other mechanism.
1119 # Note that this may happen on Solaris, which has
1120 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1121 # won't find it if we link with -lxnet, which we want
1122 # to do for other reasons.
1124 # For now, we use either the SIOCGIFCONF ioctl or the
1125 # SIOCGLIFCONF ioctl, preferring the latter if we have
1126 # it; the latter is a Solarisism that first appeared
1127 # in Solaris 8. (Solaris's getifaddrs() appears to
1128 # be built atop SIOCGLIFCONF; using it directly
1129 # avoids a not-all-that-useful middleman.)
1131 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1132 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1134 [#include <sys/param.h>
1135 #include <sys/file.h>
1136 #include <sys/ioctl.h>
1137 #include <sys/socket.h>
1138 #include <sys/sockio.h>],
1139 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1140 ac_cv_lbl_have_siocglifconf=yes,
1141 ac_cv_lbl_have_siocglifconf=no))
1142 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1143 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1144 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1146 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1151 dnl check for hardware timestamp support
1154 AC_CHECK_HEADERS([linux/net_tstamp.h])
1157 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1161 AC_ARG_ENABLE([packet-ring],
1162 [AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])],
1163 ,enable_packet_ring=yes)
1165 if test "x$enable_packet_ring" != "xno" ; then
1166 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available])
1167 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1171 # Check for socklen_t.
1173 AC_CHECK_TYPES(socklen_t,,,
1175 #include <sys/types.h>
1176 #include <sys/socket.h>
1180 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1183 if test "$enable_ipv6" != "no"; then
1185 # We've already made sure we have getaddrinfo above in
1186 # AC_LBL_LIBRARY_NET.
1188 AC_DEFINE(INET6,1,[IPv6])
1192 # Do we have pkg-config?
1194 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1196 # Check for Endace DAG card support.
1198 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1200 if test "$withval" = no
1202 # User doesn't want DAG support.
1204 elif test "$withval" = yes
1206 # User wants DAG support but hasn't specified a directory.
1209 # User wants DAG support and has specified a directory, so use the provided value.
1214 if test "$V_PCAP" = dag; then
1215 # User requested DAG-only libpcap, so we'd better have
1218 elif test "xxx_only" = yes; then
1219 # User requested something-else-only pcap, so they don't
1224 # Use DAG API if present, otherwise don't
1230 AC_ARG_WITH([dag-includes],
1231 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1233 # User wants DAG support and has specified a header directory, so use the provided value.
1235 dag_include_dir=$withval
1238 AC_ARG_WITH([dag-libraries],
1239 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1241 # User wants DAG support and has specified a library directory, so use the provided value.
1243 dag_lib_dir=$withval
1246 if test "$want_dag" != no; then
1248 # If necessary, set default paths for DAG API headers and libraries.
1249 if test -z "$dag_root"; then
1253 if test -z "$dag_include_dir"; then
1254 dag_include_dir="$dag_root/include"
1257 if test -z "$dag_lib_dir"; then
1258 dag_lib_dir="$dag_root/lib"
1261 V_INCLS="$V_INCLS -I$dag_include_dir"
1263 AC_CHECK_HEADERS([dagapi.h])
1265 if test "$ac_cv_header_dagapi_h" = yes; then
1267 if test $V_PCAP != dag ; then
1268 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1271 # Check for various DAG API functions.
1272 # Don't need to save and restore LIBS to prevent -ldag being
1273 # included if there's a found-action (arg 3).
1274 saved_ldflags=$LDFLAGS
1275 LDFLAGS="-L$dag_lib_dir"
1276 AC_CHECK_LIB([dag], [dag_attach_stream],
1278 [AC_MSG_ERROR(DAG library lacks streams support)])
1279 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1280 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1281 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1282 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1283 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1285 LDFLAGS=$saved_ldflags
1288 # We assume that if we have libdag we have libdagconf,
1289 # as they're installed at the same time from the same
1292 LIBS="$LIBS -ldag -ldagconf"
1293 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1295 if test "$dag_large_streams" = 1; then
1296 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1297 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1298 if test "$ac_dag_have_vdag" = 1; then
1299 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1300 if test "$ac_lbl_have_pthreads" != "found"; then
1301 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1303 LIBS="$LIBS $PTHREAD_LIBS"
1307 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1310 if test "$V_PCAP" = dag; then
1311 # User requested "dag" capture type but we couldn't
1312 # find the DAG API support.
1313 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])
1316 if test "$want_dag" = yes; then
1317 # User wanted DAG support but we couldn't find it.
1318 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])
1324 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1326 if test "$withval" = no
1329 elif test "$withval" = yes
1335 septel_root=$withval
1338 if test "$V_PCAP" = septel; then
1339 # User requested Septel-only libpcap, so we'd better have
1342 elif test "xxx_only" = yes; then
1343 # User requested something-else-only pcap, so they don't
1344 # want Septel support.
1348 # Use Septel API if present, otherwise don't
1350 want_septel=ifpresent
1354 ac_cv_lbl_septel_api=no
1355 if test "$with_septel" != no; then
1357 AC_MSG_CHECKING([whether we have Septel API headers])
1359 # If necessary, set default paths for Septel API headers and libraries.
1360 if test -z "$septel_root"; then
1361 septel_root=$srcdir/../septel
1364 septel_tools_dir="$septel_root"
1365 septel_include_dir="$septel_root/INC"
1367 if test -r "$septel_include_dir/msg.h"; then
1368 ac_cv_lbl_septel_api=yes
1371 if test "$ac_cv_lbl_septel_api" = yes; then
1372 AC_MSG_RESULT([yes ($septel_include_dir)])
1374 V_INCLS="$V_INCLS -I$septel_include_dir"
1375 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"
1376 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"
1378 if test "$V_PCAP" != septel ; then
1379 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1382 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1386 if test "$V_PCAP" = septel; then
1387 # User requested "septel" capture type but
1388 # we couldn't find the Septel API support.
1389 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])
1392 if test "$want_septel" = yes; then
1393 # User wanted Septel support but we couldn't find it.
1394 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])
1399 # Check for Myricom SNF support.
1401 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1403 if test "$withval" = no
1405 # User explicitly doesn't want SNF
1407 elif test "$withval" = yes
1409 # User wants SNF support but hasn't specified a directory.
1412 # User wants SNF support with a specified directory.
1417 if test "$V_PCAP" = snf; then
1418 # User requested Sniffer-only libpcap, so we'd better have
1421 elif test "xxx_only" = yes; then
1422 # User requested something-else-only pcap, so they don't
1427 # Use Sniffer API if present, otherwise don't
1433 AC_ARG_WITH([snf-includes],
1434 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1436 # User wants SNF with specific header directory
1438 snf_include_dir=$withval
1441 AC_ARG_WITH([snf-libraries],
1442 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1444 # User wants SNF with specific lib directory
1446 snf_lib_dir=$withval
1449 ac_cv_lbl_snf_api=no
1450 if test "$with_snf" != no; then
1452 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1454 # If necessary, set default paths for Sniffer headers and libraries.
1455 if test -z "$snf_root"; then
1459 if test -z "$snf_include_dir"; then
1460 snf_include_dir="$snf_root/include"
1463 if test -z "$snf_lib_dir"; then
1464 snf_lib_dir="$snf_root/lib"
1467 if test -f "$snf_include_dir/snf.h"; then
1468 # We found a header; make sure we can link with the library
1469 saved_ldflags=$LDFLAGS
1470 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1471 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1472 LDFLAGS="$saved_ldflags"
1473 if test "$ac_cv_lbl_snf_api" = no; then
1474 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1478 if test "$ac_cv_lbl_snf_api" = yes; then
1479 AC_MSG_RESULT([yes ($snf_root)])
1481 V_INCLS="$V_INCLS -I$snf_include_dir"
1483 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1485 if test "$V_PCAP" != snf ; then
1486 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1489 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1493 if test "$want_snf" = yes; then
1494 # User requested "snf" capture type but
1495 # we couldn't find the Sniffer API support.
1496 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])
1499 if test "$want_snf" = yes; then
1500 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])
1505 # Check for Riverbed TurboCap support.
1506 AC_ARG_WITH([turbocap],
1507 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1509 if test "$withval" = no
1511 # User explicitly doesn't want TurboCap
1513 elif test "$withval" = yes
1515 # User wants TurboCap support but hasn't specified a directory.
1518 # User wants TurboCap support with a specified directory.
1520 turbocap_root=$withval
1523 if test "xxx_only" = yes; then
1524 # User requested something-else-only pcap, so they don't
1525 # want TurboCap support.
1529 # Use TurboCap API if present, otherwise don't
1531 want_turbocap=ifpresent
1535 ac_cv_lbl_turbocap_api=no
1536 if test "$want_turbocap" != no; then
1538 AC_MSG_CHECKING(whether TurboCap is supported)
1540 save_CFLAGS="$CFLAGS"
1542 if test ! -z "$turbocap_root"; then
1543 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1544 TURBOCAP_LIBS="-L$turbocap_root/lib"
1545 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1553 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1555 (void)TcInstanceCreateByName("foo", &i);
1557 ac_cv_lbl_turbocap_api=yes)
1559 CFLAGS="$save_CFLAGS"
1560 if test $ac_cv_lbl_turbocap_api = yes; then
1563 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1564 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1565 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1567 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1571 if test "$want_turbocap" = yes; then
1572 # User wanted Turbo support but we couldn't find it.
1573 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])
1579 dnl Allow the user to enable remote capture.
1580 dnl It's off by default, as that increases the attack surface of
1581 dnl libpcap, exposing it to malicious servers.
1583 AC_MSG_CHECKING([whether to enable remote packet capture])
1584 AC_ARG_ENABLE(remote,
1585 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1586 --disable-remote disable remote packet capture],,
1588 case "$enableval" in
1589 yes) AC_MSG_RESULT(yes)
1590 AC_WARN([Remote packet capture may expose libpcap-based applications])
1591 AC_WARN([to attacks by malicious remote capture servers!])
1593 # rpcapd requires pthreads on UN*X.
1595 if test "$ac_lbl_have_pthreads" != "found"; then
1596 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1599 # It also requires crypt().
1600 # Do we have it in the system libraries?
1602 AC_CHECK_FUNC(crypt,,
1605 # No. Do we have it in -lcrypt?
1607 AC_CHECK_LIB(crypt, crypt,
1610 # Yes; add -lcrypt to the libraries for rpcapd.
1612 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1615 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1620 # OK, we have crypt(). Do we have getspnam()?
1622 AC_CHECK_FUNCS(getspnam)
1625 # Check for various members of struct msghdr.
1627 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1629 #include "ftmacros.h"
1630 #include <sys/socket.h>
1632 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1634 #include "ftmacros.h"
1635 #include <sys/socket.h>
1639 # Optionally, we may want to support SSL.
1640 # Check for OpenSSL/libressl.
1642 # First, try looking for it as a regular system library.
1643 # Make sure we can find SSL_library_init() using the
1644 # standard headers, just in case we're running a version
1645 # of macOS that ships with the OpenSSL library but not
1646 # the OpenSSL headers, and have also installed another
1647 # version of OpenSSL with headers.
1650 LIBS="-lssl -lcrypto"
1651 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1654 #include <openssl/ssl.h>
1663 OPENSSL_LIBS="-lssl -lcrypto"
1669 # If we didn't find it, check for it with pkg-config.
1671 if test "x$HAVE_OPENSSL" != "xyes"; then
1672 if test "x$PKGCONFIG" != "xno"; then
1674 # We have pkg-config; see if we have OpenSSL/
1675 # libressl installed as a package.
1677 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1678 if "$PKGCONFIG" openssl; then
1679 AC_MSG_RESULT([found])
1681 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1682 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1684 AC_MSG_RESULT([not found])
1690 # OK, did we find it?
1692 if test "x$HAVE_OPENSSL" = "xyes"; then
1693 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1694 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1695 LIBS="$LIBS $OPENSSL_LIBS"
1697 AC_MSG_NOTICE(OpenSSL not found)
1700 AC_DEFINE(ENABLE_REMOTE,,
1701 [Define to 1 if remote packet capture is to be supported])
1702 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1703 BUILD_RPCAPD=build-rpcapd
1704 INSTALL_RPCAPD=install-rpcapd
1706 *) AC_MSG_RESULT(no)
1710 AC_MSG_CHECKING(whether to build optimizer debugging code)
1711 AC_ARG_ENABLE(optimizer-dbg,
1712 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1713 if test "$enable_optimizer_dbg" = "yes"; then
1714 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1716 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1718 AC_MSG_CHECKING(whether to build parser debugging code)
1719 AC_ARG_ENABLE(yydebug,
1720 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1721 if test "$enable_yydebug" = "yes"; then
1722 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1724 AC_MSG_RESULT(${enable_yydebug-no})
1730 if test "$LEX" = ":"; then
1731 AC_MSG_ERROR([Neither flex nor lex was found.])
1735 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1736 # and supports processing our scanner.l.
1738 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1739 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1740 tcpdump_cv_capable_lex=yes
1742 tcpdump_cv_capable_lex=insufficient
1744 if test $tcpdump_cv_capable_lex = insufficient ; then
1745 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1746 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1750 # Look for yacc/bison/byacc.
1755 # Make sure it supports the -p flag and supports processing our
1758 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1759 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1760 tcpdump_cv_capable_yacc=yes
1762 tcpdump_cv_capable_yacc=insufficient
1764 if test $tcpdump_cv_capable_yacc = insufficient ; then
1765 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1766 libpcap requires Bison, a newer version of Berkeley YACC with support
1767 for reentrant parsers, or another YACC compatible with them.])
1771 # Do various checks for various OSes and versions of those OSes.
1773 # Assume, by default, no support for shared libraries and V7/BSD
1774 # convention for man pages (devices in section 4, file formats in
1775 # section 5, miscellaneous info in section 7, administrative commands
1776 # and daemons in section 8). Individual cases can override this.
1782 MAN_ADMIN_COMMANDS=8
1786 dnl Workaround to enable certain features
1787 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1790 # AIX makes it fun to build shared and static libraries,
1791 # because they're *both* ".a" archive libraries. We
1792 # build the static library for the benefit of the traditional
1793 # scheme of building libpcap and tcpdump in subdirectories of
1794 # the same directory, with tcpdump statically linked with the
1795 # libpcap in question, but we also build a shared library as
1796 # "libpcap.shareda" and install *it*, rather than the static
1797 # library, as "libpcap.a".
1805 # If we're using DLPI, applications will need to
1806 # use /lib/pse.exp if present, as we use the
1809 pseexe="/lib/pse.exp"
1810 AC_MSG_CHECKING(for $pseexe)
1811 if test -f $pseexe ; then
1819 # If we're using BPF, we need "-lodm" and "-lcfg", as
1820 # we use them to load the BPF module.
1829 V_CCOPT="$V_CCOPT -fno-common"
1830 AC_ARG_ENABLE(universal,
1831 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1832 if test "$enable_universal" != "no"; then
1837 # Pre-Tiger. Build only for 32-bit PowerPC; no
1838 # need for any special compiler or linker flags.
1842 darwin8.[[0123]]|darwin8.[[0123]].*)
1844 # Tiger, prior to Intel support. Build
1845 # libraries and executables for 32-bit PowerPC
1846 # and 64-bit PowerPC, with 32-bit PowerPC first.
1847 # (I'm guessing that's what Apple does.)
1849 # (The double brackets are needed because
1850 # autotools/m4 use brackets as a quoting
1851 # character; the double brackets turn into
1852 # single brackets in the generated configure
1855 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1856 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1857 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1858 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1861 darwin8.[[456]]|darwin.[[456]].*)
1863 # Tiger, subsequent to Intel support but prior
1864 # to x86-64 support. Build libraries and
1865 # executables for 32-bit PowerPC, 64-bit
1866 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1867 # first. (I'm guessing that's what Apple does.)
1869 # (The double brackets are needed because
1870 # autotools/m4 use brackets as a quoting
1871 # character; the double brackets turn into
1872 # single brackets in the generated configure
1875 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1876 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1877 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1878 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1883 # All other Tiger, so subsequent to x86-64
1884 # support. Build libraries and executables for
1885 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1886 # and x86-64, with 32-bit PowerPC first. (I'm
1887 # guessing that's what Apple does.)
1889 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1890 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1891 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1892 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1897 # Leopard. Build libraries for 32-bit PowerPC,
1898 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1899 # 32-bit PowerPC first, and build executables
1900 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1901 # x86 first. (That's what Apple does.)
1903 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1904 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1905 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1906 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1911 # Snow Leopard. Build libraries for x86-64,
1912 # 32-bit x86, and 32-bit PowerPC, with x86-64
1913 # first, and build executables for x86-64 and
1914 # 32-bit x86, with x86-64 first. (That's what
1915 # Apple does, even though Snow Leopard doesn't
1916 # run on PPC, so PPC libpcap runs under Rosetta,
1917 # and Rosetta doesn't support BPF ioctls, so PPC
1918 # programs can't do live captures.)
1920 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1921 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1922 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1923 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1928 # Post-Snow Leopard. Build libraries for x86-64
1929 # and 32-bit x86, with x86-64 first, and build
1930 # executables only for x86-64. (That's what
1931 # Apple does.) This requires no special flags
1933 # XXX - update if and when Apple drops support
1934 # for 32-bit x86 code and if and when Apple adds
1935 # ARM-based Macs. (You're on your own for iOS
1938 # XXX - check whether we *can* build for
1939 # i386 and, if not, suggest that the user
1940 # install the /usr/include headers if they
1941 # want to build fat.
1943 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1944 save_CFLAGS="$CFLAGS"
1945 CFLAGS="$CFLAGS -arch i386"
1951 V_LIB_CCOPT_FAT="-arch x86_64"
1952 V_LIB_LDFLAGS_FAT="-arch x86_64"
1955 # OpenSSL installation on macOS seems
1956 # to install only the libs for 64-bit
1957 # x86 - at least that's what Brew does:
1958 # only configure 32-bit builds if we
1959 # don't have OpenSSL.
1961 if test "$HAVE_OPENSSL" != yes; then
1962 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1963 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1968 V_LIB_CCOPT_FAT="-arch x86_64"
1969 V_LIB_LDFLAGS_FAT="-arch x86_64"
1974 # Mojave; you need to install the
1975 # /usr/include headers to get
1976 # 32-bit x86 builds to work.
1978 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])
1983 # Pre-Mojave; the command-line
1984 # tools should be sufficient to
1985 # enable 32-bit x86 builds.
1987 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
1991 CFLAGS="$save_CFLAGS"
1992 if test "$HAVE_OPENSSL" = yes; then
1994 # If all else fails, look for OpenSSL in
1997 CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include"
1998 LIBS="$LIBS -L/usr/local/opt/openssl/lib"
2006 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
2009 # Use System V conventions for man pages.
2011 MAN_ADMIN_COMMANDS=1m
2019 # Use System V conventions for man pages.
2021 MAN_ADMIN_COMMANDS=1m
2029 # Use System V conventions for man pages.
2031 MAN_ADMIN_COMMANDS=1m
2037 dnl HPUX 10.20 and above is similar to HPUX 9, but
2038 dnl not the same....
2040 dnl XXX - DYEXT should be set to "sl" if this is building
2041 dnl for 32-bit PA-RISC, but should be left as "so" for
2042 dnl 64-bit PA-RISC or, I suspect, IA-64.
2043 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2044 if test "`uname -m`" = "ia64"; then
2051 # "-b" builds a shared library; "+h" sets the soname.
2057 # Use System V conventions for man pages.
2065 # Use IRIX conventions for man pages; they're the same as the
2066 # System V conventions, except that they use section 8 for
2067 # administrative commands and daemons.
2073 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2077 # Compiler assumed to be GCC; run-time linker may require a -R
2080 if test "$libdir" != "/usr/lib"; then
2081 V_RFLAGS=-Wl,-R$libdir
2089 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
2090 # Use Tru64 UNIX conventions for man pages; they're the same as
2091 # the System V conventions except that they use section 8 for
2092 # administrative commands and daemons.
2100 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2101 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2105 ac_cv_cc_sinix_defined=yes,
2106 ac_cv_cc_sinix_defined=no))
2107 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2108 if test $ac_cv_cc_sinix_defined = no ; then
2109 AC_DEFINE(sinix,1,[on sinix])
2114 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2119 # Make sure errno is thread-safe, in case we're called in
2120 # a multithreaded program. We don't guarantee that two
2121 # threads can use the *same* pcap_t safely, but the
2122 # current version does guarantee that you can use different
2123 # pcap_t's in different threads, and even that pcap_compile()
2124 # is thread-safe (it wasn't thread-safe in some older versions).
2126 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2128 case "`uname -r`" in
2135 # Use System V conventions for man pages.
2137 MAN_ADMIN_COMMANDS=1m
2145 AC_ARG_ENABLE(shared,
2146 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2147 test "x$enable_shared" = "xno" && DYEXT="none"
2150 AC_CHECK_TOOL([AR], [ar])
2155 AC_LBL_DEVEL(V_CCOPT)
2158 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2160 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2162 #include <sys/types.h>
2163 #include <sys/socket.h>
2167 # Check to see if there's a sockaddr_storage structure.
2169 AC_CHECK_TYPES(struct sockaddr_storage,,,
2171 #include <sys/types.h>
2172 #include <sys/socket.h>
2176 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2177 # dl_module_id_1 member.
2179 # NOTE: any failure means we conclude that it doesn't have that member,
2180 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2181 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2182 # it doesn't have that member (which is OK, as either we won't be
2183 # using code that would use that member, or we wouldn't compile in
2186 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2188 #include <sys/types.h>
2189 #include <sys/dlpi.h>
2190 #include <sys/dlpi_ext.h>
2194 AC_SUBST(V_LIB_CCOPT_FAT)
2195 AC_SUBST(V_LIB_LDFLAGS_FAT)
2196 AC_SUBST(V_PROG_CCOPT_FAT)
2197 AC_SUBST(V_PROG_LDFLAGS_FAT)
2201 AC_SUBST(V_SHLIB_CCOPT)
2202 AC_SUBST(V_SHLIB_CMD)
2203 AC_SUBST(V_SHLIB_OPT)
2204 AC_SUBST(V_SONAME_OPT)
2205 AC_SUBST(V_RPATH_OPT)
2208 AC_SUBST(ADDLARCHIVEOBJS)
2209 AC_SUBST(PLATFORM_C_SRC)
2210 AC_SUBST(PLATFORM_CXX_SRC)
2211 AC_SUBST(MODULE_C_SRC)
2212 AC_SUBST(REMOTE_C_SRC)
2214 AC_SUBST(MAN_DEVICES)
2215 AC_SUBST(MAN_FILE_FORMATS)
2216 AC_SUBST(MAN_MISC_INFO)
2217 AC_SUBST(MAN_ADMIN_COMMANDS)
2218 AC_SUBST(PTHREAD_LIBS)
2219 AC_SUBST(BUILD_RPCAPD)
2220 AC_SUBST(INSTALL_RPCAPD)
2221 AC_SUBST(RPCAPD_LIBS)
2222 AC_SUBST(EXTRA_NETWORK_LIBS)
2224 AC_ARG_ENABLE([usb],
2225 [AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])],
2229 if test "xxx_only" = yes; then
2230 # User requested something-else-only pcap, so they don't
2235 if test "x$enable_usb" != "xno" ; then
2236 dnl check for USB sniffing support
2237 AC_MSG_CHECKING(for USB sniffing support)
2240 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
2241 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2243 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2244 if test $? -ne 0 ; then
2245 ac_usb_dev_name="usbmon"
2247 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2248 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2250 # Do we have a version of <linux/compiler.h> available?
2251 # If so, we might need it for <linux/usbdevice_fs.h>.
2253 AC_CHECK_HEADERS(linux/compiler.h)
2254 if test "$ac_cv_header_linux_compiler_h" = yes; then
2256 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2258 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2260 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2262 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2264 # OK, does it define bRequestType? Older versions of the kernel
2265 # define fields with names like "requesttype, "request", and
2266 # "value", rather than "bRequestType", "bRequest", and
2269 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2272 #ifdef HAVE_LINUX_COMPILER_H
2273 #include <linux/compiler.h>
2275 #include <linux/usbdevice_fs.h>
2281 # This just uses BPF in FreeBSD 8.4 and later; we don't need
2282 # to check for anything special for capturing.
2284 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
2292 AC_SUBST(PCAP_SUPPORT_USB)
2294 dnl check for netfilter sniffing support
2295 if test "xxx_only" != yes; then
2296 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
2301 # Life's too short to deal with trying to get this to compile
2302 # if you don't get the right types defined with
2303 # __KERNEL_STRICT_NAMES getting defined by some other include.
2305 # Check whether the includes Just Work. If not, don't turn on
2306 # netfilter support.
2308 AC_MSG_CHECKING(whether we can compile the netfilter support)
2309 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2312 #include <sys/socket.h>
2313 #include <netinet/in.h>
2314 #include <linux/types.h>
2316 #include <linux/netlink.h>
2317 #include <linux/netfilter.h>
2318 #include <linux/netfilter/nfnetlink.h>
2319 #include <linux/netfilter/nfnetlink_log.h>
2320 #include <linux/netfilter/nfnetlink_queue.h>],
2322 ac_cv_netfilter_can_compile=yes,
2323 ac_cv_netfilter_can_compile=no))
2324 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2325 if test $ac_cv_netfilter_can_compile = yes ; then
2326 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2327 [target host supports netfilter sniffing])
2328 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2336 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2338 AC_ARG_ENABLE([netmap],
2339 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2341 [enable_netmap=yes])
2343 if test "x$enable_netmap" != "xno" ; then
2345 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2346 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2347 # is defined, for example, as it includes a non-existent malloc.h
2350 AC_MSG_CHECKING(whether we can compile the netmap support)
2351 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2354 #define NETMAP_WITH_LIBS
2355 #include <net/netmap_user.h>],
2357 ac_cv_net_netmap_user_can_compile=yes,
2358 ac_cv_net_netmap_user_can_compile=no))
2359 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2360 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2361 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2362 [target host supports netmap])
2363 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2365 AC_SUBST(PCAP_SUPPORT_NETMAP)
2368 # Check for DPDK support.
2370 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2372 if test "$withval" = no
2374 # User doesn't want DPDK support.
2376 elif test "$withval" = yes
2378 # User wants DPDK support but hasn't specified a directory.
2381 # User wants DPDK support and has specified a directory,
2382 # so use the provided value.
2387 if test "$V_PCAP" = dpdk; then
2388 # User requested DPDK-only libpcap, so we'd better have
2391 elif test "xxx_only" = yes; then
2392 # User requested something-else-only pcap, so they don't
2393 # want DPDK support.
2397 # Use DPDK API if present, otherwise don't
2403 if test "$want_dpdk" != no; then
2404 if test -z "$dpdk_dir"; then
2406 # The user didn't specify a directory containing
2407 # the DPDK headers and libraries. If we find
2408 # a /usr/local/include/dpdk directory, assume
2409 # it's /usr/local, otherwise assume it's /usr.
2411 if test -d "/usr/local/include/dpdk"; then
2412 dpdk_dir="/usr/local"
2418 # The convention appears to be that 1) there's a "dpdk"
2419 # subdirectory of the include directory, containing DPDK
2420 # headers (at least in the installation on Ubuntu with
2421 # the system DPDK packages) and 2) includes of DPDK
2422 # headers don't use "dpdk/{header}" (at least from the
2423 # way the DPDK documentation is written).
2425 # So we add "/dpdk" to the include directory, and always
2426 # add that to the list of include directories to search.
2428 dpdk_inc_dir="$dpdk_dir/include/dpdk"
2429 dpdk_lib_dir="$dpdk_dir/lib"
2430 DPDK_MACHINE_CFLAGS="-march=native"
2431 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_inc_dir"
2432 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2434 save_CFLAGS="$CFLAGS"
2436 save_LDFLAGS="$LDFLAGS"
2437 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2438 LIBS="$LIBS $DPDK_LDFLAGS"
2439 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2441 AC_MSG_CHECKING(whether we can compile the DPDK support)
2442 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2445 #include <rte_common.h>],
2447 ac_cv_dpdk_can_compile=yes,
2448 ac_cv_dpdk_can_compile=no))
2449 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2452 # We include rte_bus.h, and older versions of DPDK
2453 # didn't have it, so check for it.
2455 if test "$ac_cv_dpdk_can_compile" = yes; then
2456 AC_CHECK_HEADERS(rte_bus.h)
2459 CFLAGS="$save_CFLAGS"
2461 LDFLAGS="$save_LDFLAGS"
2463 if test "$ac_cv_header_rte_bus_h" = yes; then
2464 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2465 LIBS="$LIBS $DPDK_LDFLAGS"
2466 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2467 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2468 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2469 if test $V_PCAP != dpdk ; then
2470 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2473 if test "$V_PCAP" = dpdk; then
2474 # User requested "dpdk" capture type but we couldn't
2475 # find the DPDK API support.
2476 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])
2479 if test "$want_dpdk" = yes; then
2480 # User wanted DPDK support but we couldn't find it.
2481 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])
2485 AC_SUBST(PCAP_SUPPORT_DPDK)
2487 AC_ARG_ENABLE([bluetooth],
2488 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2490 [enable_bluetooth=ifsupportavailable])
2492 if test "xxx_only" = yes; then
2493 # User requested something-else-only pcap, so they don't
2494 # want Bluetooth support.
2498 if test "x$enable_bluetooth" != "xno" ; then
2499 dnl check for Bluetooth sniffing support
2502 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2505 # We have bluetooth.h, so we support Bluetooth
2508 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2509 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2510 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2511 ac_lbl_bluetooth_available=yes
2514 # OK, does struct sockaddr_hci have an hci_channel
2517 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2520 # Yes; is HCI_CHANNEL_MONITOR defined?
2522 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2523 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2526 #include <bluetooth/bluetooth.h>
2527 #include <bluetooth/hci.h>
2530 u_int i = HCI_CHANNEL_MONITOR;
2534 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2535 [target host supports Bluetooth Monitor])
2536 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2543 #include <bluetooth/bluetooth.h>
2544 #include <bluetooth/hci.h>
2549 # We don't have bluetooth.h, so we don't support
2550 # Bluetooth sniffing.
2552 if test "x$enable_bluetooth" = "xyes" ; then
2553 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2555 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2560 if test "x$enable_bluetooth" = "xyes" ; then
2561 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2563 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2567 AC_SUBST(PCAP_SUPPORT_BT)
2570 AC_ARG_ENABLE([dbus],
2571 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2573 [enable_dbus=ifavailable])
2575 if test "xxx_only" = yes; then
2576 # User requested something-else-only pcap, so they don't
2577 # want D-Bus support.
2581 if test "x$enable_dbus" != "xno"; then
2582 if test "x$enable_dbus" = "xyes"; then
2587 # We don't support D-Bus sniffing on macOS; see
2589 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2591 # The user requested it, so fail.
2593 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2600 # We don't support D-Bus sniffing on macOS; see
2602 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2604 # The user dind't explicitly request it, so just
2605 # silently refuse to enable it.
2613 if test "x$enable_dbus" != "xno"; then
2614 if test "x$PKGCONFIG" != "xno"; then
2615 AC_MSG_CHECKING([for D-Bus])
2616 if "$PKGCONFIG" dbus-1; then
2617 AC_MSG_RESULT([yes])
2618 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2619 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2620 save_CFLAGS="$CFLAGS"
2622 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2623 LIBS="$LIBS $DBUS_LIBS"
2624 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2626 [#include <string.h>
2629 #include <sys/time.h>
2631 #include <dbus/dbus.h>],
2632 [return dbus_connection_read_write(NULL, 0);],
2634 AC_MSG_RESULT([yes])
2635 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2636 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2637 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2641 if test "x$enable_dbus" = "xyes"; then
2642 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2646 CFLAGS="$save_CFLAGS"
2649 if test "x$enable_dbus" = "xyes"; then
2650 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2654 AC_SUBST(PCAP_SUPPORT_DBUS)
2657 AC_ARG_ENABLE([rdma],
2658 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2660 [enable_rdma=ifavailable])
2662 if test "xxx_only" = yes; then
2663 # User requested something-else-only pcap, so they don't
2664 # want RDMA support.
2668 if test "x$enable_rdma" != "xno"; then
2669 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2670 AC_CHECK_HEADER(infiniband/verbs.h, [
2672 # ibv_create_flow may be defined as a static inline
2673 # function in infiniband/verbs.h, so we can't
2676 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2677 # macro that works like CMake's check_symbol_exists()
2678 # function, to check do a compile check like
2679 # this (they do a clever trick to avoid having
2680 # to know the function's signature).
2682 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2685 #include <infiniband/verbs.h>
2688 (void) ibv_create_flow((struct ibv_qp *) NULL,
2689 (struct ibv_flow_attr *) NULL);
2692 AC_MSG_RESULT([yes])
2693 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2694 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
2695 LIBS="-libverbs $LIBS"
2703 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2708 AC_CONFIG_HEADER(config.h)
2710 AC_OUTPUT_COMMANDS([if test -f .devel; then
2711 echo timestamp > stamp-h
2712 cat $srcdir/Makefile-devel-adds >> Makefile
2715 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2716 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2717 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2718 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2719 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2720 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2721 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2722 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile