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])
34 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
39 # Try to arrange for large file support.
45 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
46 dnl include <sys/ioccom.h>, and we were to drop support for older
47 dnl releases without that fix, so that pcap-bpf.c doesn't need to
48 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
49 dnl in "aclocal.m4" uses it, so we would still have to test for it
50 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
51 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
53 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
54 AC_CHECK_HEADERS(netpacket/packet.h)
55 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
56 #include <sys/socket.h>
58 if test "$ac_cv_header_net_pfvar_h" = yes; then
60 # Check for various PF actions.
62 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
64 [#include <sys/types.h>
65 #include <sys/socket.h>
67 #include <net/pfvar.h>],
68 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
71 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
72 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
80 # linux/if_bonding.h requires sys/socket.h.
82 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
84 #include <sys/socket.h>
89 # Check for the eventfd header.
91 AC_CHECK_HEADERS(sys/eventfd.h)
97 AC_CHECK_FUNCS(strerror strerror_r strerror_s)
100 # Thanks, IBM, for not providing vsyslog() in AIX!
102 AC_CHECK_FUNCS(vsyslog)
105 AC_CHECK_FUNCS(vsnprintf snprintf,,
107 if test $needsnprintf = yes; then
108 AC_LIBOBJ([snprintf])
112 AC_CHECK_FUNCS(strlcat,,
114 if test $needstrlcat = yes; then
119 AC_CHECK_FUNCS(strlcpy,,
121 if test $needstrlcpy = yes; then
126 AC_CHECK_FUNCS(strtok_r,,
128 if test $needstrtok_r = yes; then
129 AC_LIBOBJ([strtok_r])
133 # Do we have ffs(), and is it declared in <strings.h>?
136 if test "$ac_cv_func_ffs" = yes; then
138 # We have ffs(); is it declared in <strings.h>?
140 # This test fails if we don't have <strings.h> or if we do
141 # but it doesn't declare ffs().
145 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
146 [Define to 1 if strings.h declares `ffs'])
154 # Do this before checking for ether_hostton(), as it's a
155 # "getaddrinfo()-ish function".
160 # Check for reentrant versions of getnetbyname_r(), as provided by
161 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
162 # If we don't find one, we just use getnetbyname(), which uses
163 # thread-specific data on many platforms, but doesn't use it on
164 # NetBSD or OpenBSD, and may not use it on older versions of other
167 # Only do the check if we have a declaration of getnetbyname_r();
168 # without it, we can't check which API it has. (We assume that
169 # if there's a declaration, it has a prototype, so that the API
172 AC_CHECK_DECL(getnetbyname_r,
174 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
176 [#include <netdb.h>],
178 struct netent netent_buf;
180 struct netent *resultp;
183 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
187 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
188 [define if we have the Linux getnetbyname_r()])
193 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
195 [#include <netdb.h>],
197 struct netent netent_buf;
200 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
204 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
205 [define if we have the Solaris/IRIX getnetbyname_r()])
210 AC_MSG_CHECKING([for AIX getnetbyname_r()])
212 [#include <netdb.h>],
214 struct netent netent_buf;
215 struct netent_data net_data;
217 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
221 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
222 [define if we have the AIX getnetbyname_r()])
229 ],,[#include <netdb.h>])
232 # Check for reentrant versions of getprotobyname_r(), as provided by
233 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
234 # If we don't find one, we just use getprotobyname(), which uses
235 # thread-specific data on many platforms, but doesn't use it on
236 # NetBSD or OpenBSD, and may not use it on older versions of other
239 # Only do the check if we have a declaration of getprotobyname_r();
240 # without it, we can't check which API it has. (We assume that
241 # if there's a declaration, it has a prototype, so that the API
244 AC_CHECK_DECL(getprotobyname_r,
246 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
248 [#include <netdb.h>],
250 struct protoent protoent_buf;
252 struct protoent *resultp;
254 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
258 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
259 [define if we have the Linux getprotobyname_r()])
264 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
266 [#include <netdb.h>],
268 struct protoent protoent_buf;
271 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
275 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
276 [define if we have the Solaris/IRIX getprotobyname_r()])
281 AC_MSG_CHECKING([for AIX getprotobyname_r()])
283 [#include <netdb.h>],
285 struct protoent protoent_buf;
286 struct protoent_data proto_data;
288 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
292 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
293 [define if we have the AIX getprotobyname_r()])
300 ],,[#include <netdb.h>])
303 # You are in a twisty little maze of UN*Xes, all different.
304 # Some might not have ether_hostton().
305 # Some might have it and declare it in <net/ethernet.h>.
306 # Some might have it and declare it in <netinet/ether.h>
307 # Some might have it and declare it in <sys/ethernet.h>.
308 # Some might have it and declare it in <arpa/inet.h>.
309 # Some might have it and declare it in <netinet/if_ether.h>.
310 # Some might have it and not declare it in any header file.
312 # Before you is a C compiler.
314 AC_CHECK_FUNCS(ether_hostton)
315 if test "$ac_cv_func_ether_hostton" = yes; then
317 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
319 # This test fails if we don't have <net/ethernet.h> or if we do
320 # but it doesn't declare ether_hostton().
322 AC_CHECK_DECL(ether_hostton,
324 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
325 [Define to 1 if net/ethernet.h declares `ether_hostton'])
328 #include <net/ethernet.h>
333 if test "$ac_cv_have_decl_ether_hostton" != yes; then
335 # No, how about <netinet/ether.h>, as on Linux?
337 # This test fails if we don't have <netinet/ether.h>
338 # or if we do but it doesn't declare ether_hostton().
340 # Unset ac_cv_have_decl_ether_hostton so we don't
341 # treat the previous failure as a cached value and
342 # suppress the next test.
344 unset ac_cv_have_decl_ether_hostton
345 AC_CHECK_DECL(ether_hostton,
347 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
348 [Define to 1 if netinet/ether.h declares `ether_hostton'])
351 #include <netinet/ether.h>
357 if test "$ac_cv_have_decl_ether_hostton" != yes; then
359 # No, how about <sys/ethernet.h>, as on Solaris 10
362 # This test fails if we don't have <sys/ethernet.h>
363 # or if we do but it doesn't declare ether_hostton().
365 # Unset ac_cv_have_decl_ether_hostton so we don't
366 # treat the previous failure as a cached value and
367 # suppress the next test.
369 unset ac_cv_have_decl_ether_hostton
370 AC_CHECK_DECL(ether_hostton,
372 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
373 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
376 #include <sys/ethernet.h>
382 if test "$ac_cv_have_decl_ether_hostton" != yes; then
384 # No, how about <arpa/inet.h>, as in AIX?
386 # This test fails if we don't have <arpa/inet.h>
387 # (if we have ether_hostton(), we should have
388 # networking, and if we have networking, we should
389 # have <arapa/inet.h>) or if we do but it doesn't
390 # declare ether_hostton().
392 # Unset ac_cv_have_decl_ether_hostton so we don't
393 # treat the previous failure as a cached value and
394 # suppress the next test.
396 unset ac_cv_have_decl_ether_hostton
397 AC_CHECK_DECL(ether_hostton,
399 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
400 [Define to 1 if arpa/inet.h declares `ether_hostton'])
403 #include <arpa/inet.h>
409 if test "$ac_cv_have_decl_ether_hostton" != yes; then
411 # No, how about <netinet/if_ether.h>?
412 # On some platforms, it requires <net/if.h> and
413 # <netinet/in.h>, and we always include it with
414 # both of them, so test it with both of them.
416 # This test fails if we don't have <netinet/if_ether.h>
417 # and the headers we include before it, or if we do but
418 # <netinet/if_ether.h> doesn't declare ether_hostton().
420 # Unset ac_cv_have_decl_ether_hostton so we don't
421 # treat the previous failure as a cached value and
422 # suppress the next test.
424 unset ac_cv_have_decl_ether_hostton
425 AC_CHECK_DECL(ether_hostton,
427 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
428 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
431 #include <sys/types.h>
432 #include <sys/socket.h>
434 #include <netinet/in.h>
435 #include <netinet/if_ether.h>
439 # After all that, is ether_hostton() declared?
441 if test "$ac_cv_have_decl_ether_hostton" = yes; then
445 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
446 [Define to 1 if you have the declaration of `ether_hostton'])
449 # No, we'll have to declare it ourselves.
450 # Do we have "struct ether_addr" if we include
451 # <netinet/if_ether.h>?
453 AC_CHECK_TYPES(struct ether_addr,,,
455 #include <sys/types.h>
456 #include <sys/socket.h>
458 #include <netinet/in.h>
459 #include <netinet/if_ether.h>
465 # For various things that might use pthreads.
467 AC_CHECK_HEADER(pthread.h,
470 # OK, we have pthread.h. Do we have pthread_create in the
473 AC_CHECK_FUNC(pthread_create,
478 ac_lbl_have_pthreads="found"
482 # No - do we have it in -lpthreads?
484 AC_CHECK_LIB(pthreads, pthread_create,
487 # Yes - add -lpthreads.
489 ac_lbl_have_pthreads="found"
490 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
494 # No - do we have it in -lpthread?
496 AC_CHECK_LIB(pthread, pthread_create,
499 # Yes - add -lpthread.
501 ac_lbl_have_pthreads="found"
502 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
508 ac_lbl_have_pthreads="not found"
515 # We didn't find pthread.h.
517 ac_lbl_have_pthreads="not found"
521 dnl to pacify those who hate protochain insn
522 AC_MSG_CHECKING(if --disable-protochain option is specified)
523 AC_ARG_ENABLE(protochain,
524 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
525 case "x$enable_protochain" in
526 xyes) enable_protochain=enabled ;;
527 xno) enable_protochain=disabled ;;
528 x) enable_protochain=enabled ;;
531 if test "$enable_protochain" = "disabled"; then
532 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
534 AC_MSG_RESULT(${enable_protochain})
537 # valgrindtest directly uses the native capture mechanism, but
538 # only tests with BPF and PF_PACKET sockets; only enable it if
539 # we have BPF or PF_PACKET sockets.
544 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
545 if test ! -z "$with_pcap" ; then
549 # Check for a bunch of headers for various packet
550 # capture mechanisms.
552 AC_CHECK_HEADERS(net/bpf.h)
553 if test "$ac_cv_header_net_bpf_h" = yes; then
555 # Does it define BIOCSETIF?
556 # I.e., is it a header for an LBL/BSD-style capture
557 # mechanism, or is it just a header for a BPF filter
558 # engine? Some versions of Arch Linux, for example,
559 # have a net/bpf.h that doesn't define BIOCSETIF;
560 # as it's a Linux, it should use packet sockets,
565 # sys/types.h, because FreeBSD 10's net/bpf.h
566 # requires that various BSD-style integer types
569 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
570 # doesn't include it but does use struct timeval
571 # in ioctl definitions;
573 # sys/ioctl.h and, if we have it, sys/ioccom.h,
574 # because net/bpf.h defines ioctls;
576 # net/if.h, because it defines some structures
577 # used in ioctls defined by net/bpf.h;
579 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
580 # defines some structure fields as being
583 # and net/bpf.h doesn't necessarily include all
584 # of those headers itself.
586 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
587 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
590 #include <sys/types.h>
591 #include <sys/time.h>
592 #include <sys/ioctl.h>
593 #include <sys/socket.h>
594 #ifdef HAVE_SYS_IOCCOM_H
595 #include <sys/ioccom.h>
600 [u_int i = BIOCSETIF;],
601 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
602 ac_cv_lbl_bpf_h_defines_biocsetif=no))
603 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
605 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
606 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
607 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
609 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
612 # Check this before DLPI, so that we pick BPF on
613 # Solaris 11 and later.
618 # We have BPF, so build valgrindtest with "make test"
619 # on macOS and FreeBSD (add your OS once there's a
624 freebsd*|darwin*|linux*)
625 VALGRINDTEST_SRC=valgrindtest.c
628 elif test "$ac_cv_header_linux_socket_h" = yes; then
630 # No prizes for guessing this one.
635 # XXX - this won't work with older kernels that have
636 # SOCK_PACKET sockets but not PF_PACKET sockets.
638 VALGRINDTEST_SRC=valgrindtest.c
639 elif test "$ac_cv_header_net_pfilt_h" = yes; then
641 # DEC OSF/1, Digital UNIX, Tru64 UNIX
644 elif test "$ac_cv_header_net_enet_h" = yes; then
646 # Stanford Enetfilter.
649 elif test "$ac_cv_header_net_nit_h" = yes; then
651 # SunOS 4.x STREAMS NIT.
654 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
656 # Pre-SunOS 4.x non-STREAMS NIT.
659 elif test "$ac_cv_header_net_raw_h" = yes; then
664 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
666 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
671 # Nothing we support.
674 AC_MSG_WARN(cannot determine packet capture interface)
675 AC_MSG_WARN((see the INSTALL doc for more info))
678 AC_MSG_CHECKING(packet capture type)
679 AC_MSG_RESULT($V_PCAP)
680 AC_SUBST(VALGRINDTEST_SRC)
683 # Do capture-mechanism-dependent tests.
688 # Needed for common functions used by pcap-[dlpi,libdlpi].c
693 # Checks for some header files.
695 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
698 # Checks to see if Solaris has the public libdlpi(3LIB) library.
699 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
700 # public libdlpi(3LIB) version. Before libdlpi was made public, a
701 # private version also existed, which did not have the same APIs.
702 # Due to a gcc bug, the default search path for 32-bit libraries does
703 # not include /lib, we add it explicitly here.
704 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
705 # Also, due to the bug above applications that link to libpcap with
706 # libdlpi will have to add "-L/lib" option to "configure".
708 saved_ldflags=$LDFLAGS
709 LDFLAGS="$LIBS -L/lib"
710 AC_CHECK_LIB(dlpi, dlpi_walk,
714 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
717 LDFLAGS=$saved_ldflags
720 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
723 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
724 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
727 #include <sys/types.h>
728 #include <sys/time.h>
729 #include <sys/dlpi.h>
731 [int i = DL_PROMISC_PHYS;],
732 ac_cv_sys_dlpi_usable=yes,
733 ac_cv_sys_dlpi_usable=no))
734 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
735 if test $ac_cv_sys_dlpi_usable = no ; then
736 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
740 # Check to see if Solaris has the dl_passive_req_t struct defined
742 # This check is for DLPI support for passive modes.
743 # See dlpi(7P) for more details.
745 AC_CHECK_TYPES(dl_passive_req_t,,,
747 #include <sys/types.h>
748 #include <sys/dlpi.h>
754 # Do we have the wireless extensions?
756 AC_CHECK_HEADERS(linux/wireless.h, [], [],
758 #include <sys/socket.h>
759 #include <linux/if.h>
760 #include <linux/types.h>
767 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
768 with_libnl=$withval,with_libnl=if_available)
770 if test x$with_libnl != xno ; then
773 incdir=-I/usr/include/libnl3
775 case "$with_libnl" in
781 if test -d $withval; then
782 libnldir=-L${withval}/lib/.libs
783 incdir=-I${withval}/include
789 # Try libnl 3.x first.
791 AC_CHECK_LIB(nl-3, nl_socket_alloc,
794 # Yes, we have libnl 3.x.
796 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
797 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
798 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
799 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
800 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
801 V_INCLS="$V_INCLS ${incdir}"
803 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
805 if test x$have_any_nl = xno ; then
809 AC_CHECK_LIB(nl, nl_socket_alloc,
812 # Yes, we have libnl 2.x.
814 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
815 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
816 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
817 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
818 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
823 if test x$have_any_nl = xno ; then
825 # No, we don't; do we have libnl 1.x?
827 AC_CHECK_LIB(nl, nl_handle_alloc,
832 LIBS="${libnldir} -lnl $LIBS"
833 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
838 if test x$have_any_nl = xno ; then
840 # No, we don't have libnl at all.
842 if test x$with_libnl = xyes ; then
843 AC_MSG_ERROR([libnl support requested but libnl not found])
848 AC_CHECK_HEADERS(linux/ethtool.h,,,
851 #include <linux/types.h>
855 # Check to see if struct tpacket_stats is defined in
856 # <linux/if_packet.h>. If so, then pcap-linux.c can use this
857 # to report proper statistics.
861 AC_CHECK_TYPES(struct tpacket_stats,,,
863 #include <linux/if_packet.h>
867 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
869 # NOTE: any failure means we conclude that it doesn't have that
870 # member, so if we don't have tpacket_auxdata, we conclude it
871 # doesn't have that member (which is OK, as either we won't be
872 # using code that would use that member, or we wouldn't compile
874 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
876 #include <sys/types.h>
877 #include <linux/if_packet.h>
883 # Check whether we have the *BSD-style ioctls.
885 AC_CHECK_HEADERS(net/if_media.h)
888 # Check whether we have struct BPF_TIMEVAL.
890 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
892 #include <sys/types.h>
893 #include <sys/ioctl.h>
894 #ifdef HAVE_SYS_IOCCOM_H
895 #include <sys/ioccom.h>
903 # --with-pcap=dag is the only way to get here, and it means
904 # "DAG support but nothing else"
906 V_DEFS="$V_DEFS -DDAG_ONLY"
912 # --with-pcap=dpdk is the only way to get here, and it means
913 # "DPDK support but nothing else"
915 V_DEFS="$V_DEFS -DDPDK_ONLY"
921 # --with-pcap=septel is the only way to get here, and it means
922 # "Septel support but nothing else"
924 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
930 # --with-pcap=snf is the only way to get here, and it means
931 # "SNF support but nothing else"
933 V_DEFS="$V_DEFS -DSNF_ONLY"
941 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
946 dnl Now figure out how we get a list of interfaces and addresses,
947 dnl if we support capturing. Don't bother if we don't support
950 if test "$V_PCAP" != null
952 AC_CHECK_FUNC(getifaddrs,[
954 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
955 # as well, just in case some platform is really weird.
957 AC_CHECK_HEADER(ifaddrs.h,[
959 # We have the header, so we use "getifaddrs()" to
960 # get the list of interfaces.
962 V_FINDALLDEVS=fad-getad.c
965 # We don't have the header - give up.
966 # XXX - we could also fall back on some other
967 # mechanism, but, for now, this'll catch this
968 # problem so that we can at least try to figure
969 # out something to do on systems with "getifaddrs()"
970 # but without "ifaddrs.h", if there is something
971 # we can do on those systems.
973 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
977 # Well, we don't have "getifaddrs()", at least not with the
978 # libraries with which we've decided we need to link
979 # libpcap with, so we have to use some other mechanism.
981 # Note that this may happen on Solaris, which has
982 # getifaddrs(), but in -lsocket, not in -lxnet, so we
983 # won't find it if we link with -lxnet, which we want
984 # to do for other reasons.
986 # For now, we use either the SIOCGIFCONF ioctl or the
987 # SIOCGLIFCONF ioctl, preferring the latter if we have
988 # it; the latter is a Solarisism that first appeared
989 # in Solaris 8. (Solaris's getifaddrs() appears to
990 # be built atop SIOCGLIFCONF; using it directly
991 # avoids a not-all-that-useful middleman.)
993 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
994 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
996 [#include <sys/param.h>
997 #include <sys/file.h>
998 #include <sys/ioctl.h>
999 #include <sys/socket.h>
1000 #include <sys/sockio.h>],
1001 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1002 ac_cv_lbl_have_siocglifconf=yes,
1003 ac_cv_lbl_have_siocglifconf=no))
1004 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1005 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1006 V_FINDALLDEVS=fad-glifc.c
1008 V_FINDALLDEVS=fad-gifc.c
1013 dnl check for hardware timestamp support
1016 AC_CHECK_HEADERS([linux/net_tstamp.h])
1019 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1023 AC_ARG_ENABLE([packet-ring],
1024 [AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])],
1025 ,enable_packet_ring=yes)
1027 if test "x$enable_packet_ring" != "xno" ; then
1028 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available])
1029 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1033 # Check for socklen_t.
1035 AC_CHECK_TYPES(socklen_t,,,
1037 #include <sys/types.h>
1038 #include <sys/socket.h>
1042 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1045 if test "$enable_ipv6" != "no"; then
1047 # We've already made sure we have getaddrinfo above in
1048 # AC_LBL_LIBRARY_NET.
1050 AC_DEFINE(INET6,1,[IPv6])
1054 # Do we have pkg-config?
1056 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1058 # Check for Endace DAG card support.
1060 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1062 if test "$withval" = no
1064 # User doesn't want DAG support.
1066 elif test "$withval" = yes
1068 # User wants DAG support but hasn't specified a directory.
1071 # User wants DAG support and has specified a directory, so use the provided value.
1076 if test "$V_PCAP" = dag; then
1077 # User requested DAG-only libpcap, so we'd better have
1080 elif test "xxx_only" = yes; then
1081 # User requested something-else-only pcap, so they don't
1086 # Use DAG API if present, otherwise don't
1092 AC_ARG_WITH([dag-includes],
1093 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1095 # User wants DAG support and has specified a header directory, so use the provided value.
1097 dag_include_dir=$withval
1100 AC_ARG_WITH([dag-libraries],
1101 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1103 # User wants DAG support and has specified a library directory, so use the provided value.
1105 dag_lib_dir=$withval
1108 if test "$want_dag" != no; then
1110 # If necessary, set default paths for DAG API headers and libraries.
1111 if test -z "$dag_root"; then
1115 if test -z "$dag_include_dir"; then
1116 dag_include_dir="$dag_root/include"
1119 if test -z "$dag_lib_dir"; then
1120 dag_lib_dir="$dag_root/lib"
1123 V_INCLS="$V_INCLS -I$dag_include_dir"
1125 AC_CHECK_HEADERS([dagapi.h])
1127 if test "$ac_cv_header_dagapi_h" = yes; then
1129 if test $V_PCAP != dag ; then
1130 MSRC="$MSRC pcap-dag.c"
1133 # Check for various DAG API functions.
1134 # Don't need to save and restore LIBS to prevent -ldag being
1135 # included if there's a found-action (arg 3).
1136 saved_ldflags=$LDFLAGS
1137 LDFLAGS="-L$dag_lib_dir"
1138 AC_CHECK_LIB([dag], [dag_attach_stream],
1140 [AC_MSG_ERROR(DAG library lacks streams support)])
1141 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1142 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1143 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1144 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1145 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1147 LDFLAGS=$saved_ldflags
1150 # We assume that if we have libdag we have libdagconf,
1151 # as they're installed at the same time from the same
1154 LIBS="$LIBS -ldag -ldagconf"
1155 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1157 if test "$dag_large_streams" = 1; then
1158 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1159 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1160 if test "$ac_dag_have_vdag" = 1; then
1161 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1162 if test "$ac_lbl_have_pthreads" != "found"; then
1163 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1165 LIBS="$LIBS $PTHREAD_LIBS"
1169 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1172 if test "$V_PCAP" = dag; then
1173 # User requested "dag" capture type but we couldn't
1174 # find the DAG API support.
1175 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])
1178 if test "$want_dag" = yes; then
1179 # User wanted DAG support but we couldn't find it.
1180 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])
1186 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1188 if test "$withval" = no
1191 elif test "$withval" = yes
1197 septel_root=$withval
1200 if test "$V_PCAP" = septel; then
1201 # User requested Septel-only libpcap, so we'd better have
1204 elif test "xxx_only" = yes; then
1205 # User requested something-else-only pcap, so they don't
1206 # want Septel support.
1210 # Use Septel API if present, otherwise don't
1212 want_septel=ifpresent
1216 ac_cv_lbl_septel_api=no
1217 if test "$with_septel" != no; then
1219 AC_MSG_CHECKING([whether we have Septel API headers])
1221 # If necessary, set default paths for Septel API headers and libraries.
1222 if test -z "$septel_root"; then
1223 septel_root=$srcdir/../septel
1226 septel_tools_dir="$septel_root"
1227 septel_include_dir="$septel_root/INC"
1229 if test -r "$septel_include_dir/msg.h"; then
1230 ac_cv_lbl_septel_api=yes
1233 if test "$ac_cv_lbl_septel_api" = yes; then
1234 AC_MSG_RESULT([yes ($septel_include_dir)])
1236 V_INCLS="$V_INCLS -I$septel_include_dir"
1237 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"
1238 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"
1240 if test "$V_PCAP" != septel ; then
1241 MSRC="$MSRC pcap-septel.c"
1244 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1248 if test "$V_PCAP" = septel; then
1249 # User requested "septel" capture type but
1250 # we couldn't find the Septel API support.
1251 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])
1254 if test "$want_septel" = yes; then
1255 # User wanted Septel support but we couldn't find it.
1256 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])
1261 # Check for Myricom SNF support.
1263 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1265 if test "$withval" = no
1267 # User explicitly doesn't want SNF
1269 elif test "$withval" = yes
1271 # User wants SNF support but hasn't specified a directory.
1274 # User wants SNF support with a specified directory.
1279 if test "$V_PCAP" = snf; then
1280 # User requested Sniffer-only libpcap, so we'd better have
1283 elif test "xxx_only" = yes; then
1284 # User requested something-else-only pcap, so they don't
1289 # Use Sniffer API if present, otherwise don't
1295 AC_ARG_WITH([snf-includes],
1296 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1298 # User wants SNF with specific header directory
1300 snf_include_dir=$withval
1303 AC_ARG_WITH([snf-libraries],
1304 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1306 # User wants SNF with specific lib directory
1308 snf_lib_dir=$withval
1311 ac_cv_lbl_snf_api=no
1312 if test "$with_snf" != no; then
1314 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1316 # If necessary, set default paths for Sniffer headers and libraries.
1317 if test -z "$snf_root"; then
1321 if test -z "$snf_include_dir"; then
1322 snf_include_dir="$snf_root/include"
1325 if test -z "$snf_lib_dir"; then
1326 snf_lib_dir="$snf_root/lib"
1329 if test -f "$snf_include_dir/snf.h"; then
1330 # We found a header; make sure we can link with the library
1331 saved_ldflags=$LDFLAGS
1332 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1333 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1334 LDFLAGS="$saved_ldflags"
1335 if test "$ac_cv_lbl_snf_api" = no; then
1336 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1340 if test "$ac_cv_lbl_snf_api" = yes; then
1341 AC_MSG_RESULT([yes ($snf_root)])
1343 V_INCLS="$V_INCLS -I$snf_include_dir"
1345 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1347 if test "$V_PCAP" != snf ; then
1348 MSRC="$MSRC pcap-snf.c"
1351 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1355 if test "$want_snf" = yes; then
1356 # User requested "snf" capture type but
1357 # we couldn't find the Sniffer API support.
1358 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])
1361 if test "$want_snf" = yes; then
1362 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])
1367 # Check for Riverbed TurboCap support.
1368 AC_ARG_WITH([turbocap],
1369 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1371 if test "$withval" = no
1373 # User explicitly doesn't want TurboCap
1375 elif test "$withval" = yes
1377 # User wants TurboCap support but hasn't specified a directory.
1380 # User wants TurboCap support with a specified directory.
1382 turbocap_root=$withval
1385 if test "xxx_only" = yes; then
1386 # User requested something-else-only pcap, so they don't
1387 # want TurboCap support.
1391 # Use TurboCap API if present, otherwise don't
1393 want_turbocap=ifpresent
1397 ac_cv_lbl_turbocap_api=no
1398 if test "$want_turbocap" != no; then
1400 AC_MSG_CHECKING(whether TurboCap is supported)
1402 save_CFLAGS="$CFLAGS"
1404 if test ! -z "$turbocap_root"; then
1405 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1406 TURBOCAP_LIBS="-L$turbocap_root/lib"
1407 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1415 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1417 (void)TcInstanceCreateByName("foo", &i);
1419 ac_cv_lbl_turbocap_api=yes)
1421 CFLAGS="$save_CFLAGS"
1422 if test $ac_cv_lbl_turbocap_api = yes; then
1425 MSRC="$MSRC pcap-tc.c"
1426 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1427 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1429 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1433 if test "$want_turbocap" = yes; then
1434 # User wanted Turbo support but we couldn't find it.
1435 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])
1441 dnl Allow the user to enable remote capture.
1442 dnl It's off by default, as that increases the attack surface of
1443 dnl libpcap, exposing it to malicious servers.
1445 AC_MSG_CHECKING([whether to enable remote packet capture])
1446 AC_ARG_ENABLE(remote,
1447 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1448 --disable-remote disable remote packet capture],,
1450 case "$enableval" in
1451 yes) AC_MSG_RESULT(yes)
1452 AC_WARN([Remote packet capture may expose libpcap-based applications])
1453 AC_WARN([to attacks by malicious remote capture servers!])
1455 # rpcapd requires pthreads on UN*X.
1457 if test "$ac_lbl_have_pthreads" != "found"; then
1458 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1461 # It also requires crypt().
1462 # Do we have it in the system libraries?
1464 AC_CHECK_FUNC(crypt,,
1467 # No. Do we have it in -lcrypt?
1469 AC_CHECK_LIB(crypt, crypt,
1472 # Yes; add -lcrypt to the libraries for rpcapd.
1474 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1477 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1482 # OK, we have crypt(). Do we have getspnam()?
1484 AC_CHECK_FUNCS(getspnam)
1487 # Check for various members of struct msghdr.
1489 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1491 #include "ftmacros.h"
1492 #include <sys/socket.h>
1494 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1496 #include "ftmacros.h"
1497 #include <sys/socket.h>
1501 # Optionally, we may want to support SSL.
1502 # Check for OpenSSL/libressl.
1504 # First, try looking for it as a regular system library.
1505 # Make sure we can find SSL_library_init() using the
1506 # standard headers, just in case we're running a version
1507 # of macOS that ships with the OpenSSL library but not
1508 # the OpenSSL headers, and have also installed another
1509 # version of OpenSSL with headers.
1512 LIBS="-lssl -lcrypto"
1513 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1516 #include <openssl/ssl.h>
1525 OPENSSL_LIBS="-lssl -lcrypto"
1531 # If we didn't find it, check for it with pkg-config.
1533 if test "x$HAVE_OPENSSL" != "xyes"; then
1534 if test "x$PKGCONFIG" != "xno"; then
1536 # We have pkg-config; see if we have OpenSSL/
1537 # libressl installed as a package.
1539 AC_MSG_CHECKING([for OpenSSL/libressl with pkg-config])
1540 if "$PKGCONFIG" openssl; then
1541 AC_MSG_RESULT([found])
1543 OPENSSL_CFLAGS=`"$PKGCONFIG" --cflags openssl`
1544 OPENSSL_LIBS=`"$PKGCONFIG" --libs openssl`
1546 AC_MSG_RESULT([not found])
1552 # OK, did we find it?
1554 if test "x$HAVE_OPENSSL" = "xyes"; then
1555 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1556 CFLAGS="$CFLAGS $OPENSSL_CFLAGS"
1557 LIBS="$LIBS $OPENSSL_LIBS"
1559 AC_MSG_NOTICE(OpenSSL not found)
1562 AC_DEFINE(ENABLE_REMOTE,,
1563 [Define to 1 if remote packet capture is to be supported])
1564 MSRC="$MSRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1565 BUILD_RPCAPD=build-rpcapd
1566 INSTALL_RPCAPD=install-rpcapd
1568 *) AC_MSG_RESULT(no)
1572 AC_MSG_CHECKING(whether to build optimizer debugging code)
1573 AC_ARG_ENABLE(optimizer-dbg,
1574 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1575 if test "$enable_optimizer_dbg" = "yes"; then
1576 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1578 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1580 AC_MSG_CHECKING(whether to build parser debugging code)
1581 AC_ARG_ENABLE(yydebug,
1582 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1583 if test "$enable_yydebug" = "yes"; then
1584 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1586 AC_MSG_RESULT(${enable_yydebug-no})
1592 if test "$LEX" = ":"; then
1593 AC_MSG_ERROR([Neither flex nor lex was found.])
1597 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1598 # and supports processing our scanner.l.
1600 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1601 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1602 tcpdump_cv_capable_lex=yes
1604 tcpdump_cv_capable_lex=insufficient
1606 if test $tcpdump_cv_capable_lex = insufficient ; then
1607 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1608 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1612 # Look for yacc/bison/byacc.
1617 # Make sure it supports the -p flag and supports processing our
1620 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1621 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1622 tcpdump_cv_capable_yacc=yes
1624 tcpdump_cv_capable_yacc=insufficient
1626 if test $tcpdump_cv_capable_yacc = insufficient ; then
1627 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1628 libpcap requires Bison, a newer version of Berkeley YACC with support
1629 for reentrant parsers, or another YACC compatible with them.])
1633 # Do various checks for various OSes and versions of those OSes.
1635 # Assume, by default, no support for shared libraries and V7/BSD
1636 # convention for man pages (devices in section 4, file formats in
1637 # section 5, miscellaneous info in section 7, administrative commands
1638 # and daemons in section 8). Individual cases can override this.
1644 MAN_ADMIN_COMMANDS=8
1648 dnl Workaround to enable certain features
1649 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1652 # AIX makes it fun to build shared and static libraries,
1653 # because they're *both* ".a" archive libraries. We
1654 # build the static library for the benefit of the traditional
1655 # scheme of building libpcap and tcpdump in subdirectories of
1656 # the same directory, with tcpdump statically linked with the
1657 # libpcap in question, but we also build a shared library as
1658 # "libpcap.shareda" and install *it*, rather than the static
1659 # library, as "libpcap.a".
1667 # If we're using DLPI, applications will need to
1668 # use /lib/pse.exp if present, as we use the
1671 pseexe="/lib/pse.exp"
1672 AC_MSG_CHECKING(for $pseexe)
1673 if test -f $pseexe ; then
1681 # If we're using BPF, we need "-lodm" and "-lcfg", as
1682 # we use them to load the BPF module.
1691 V_CCOPT="$V_CCOPT -fno-common"
1692 AC_ARG_ENABLE(universal,
1693 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1694 if test "$enable_universal" != "no"; then
1699 # Pre-Tiger. Build only for 32-bit PowerPC; no
1700 # need for any special compiler or linker flags.
1704 darwin8.[[0123]]|darwin8.[[0123]].*)
1706 # Tiger, prior to Intel support. Build
1707 # libraries and executables for 32-bit PowerPC
1708 # and 64-bit PowerPC, with 32-bit PowerPC first.
1709 # (I'm guessing that's what Apple does.)
1711 # (The double brackets are needed because
1712 # autotools/m4 use brackets as a quoting
1713 # character; the double brackets turn into
1714 # single brackets in the generated configure
1717 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
1718 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
1719 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
1720 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
1723 darwin8.[[456]]|darwin.[[456]].*)
1725 # Tiger, subsequent to Intel support but prior
1726 # to x86-64 support. Build libraries and
1727 # executables for 32-bit PowerPC, 64-bit
1728 # PowerPC, and 32-bit x86, with 32-bit PowerPC
1729 # first. (I'm guessing that's what Apple does.)
1731 # (The double brackets are needed because
1732 # autotools/m4 use brackets as a quoting
1733 # character; the double brackets turn into
1734 # single brackets in the generated configure
1737 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1738 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1739 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
1740 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
1745 # All other Tiger, so subsequent to x86-64
1746 # support. Build libraries and executables for
1747 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
1748 # and x86-64, with 32-bit PowerPC first. (I'm
1749 # guessing that's what Apple does.)
1751 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1752 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1753 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1754 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1759 # Leopard. Build libraries for 32-bit PowerPC,
1760 # 64-bit PowerPC, 32-bit x86, and x86-64, with
1761 # 32-bit PowerPC first, and build executables
1762 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
1763 # x86 first. (That's what Apple does.)
1765 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1766 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
1767 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
1768 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
1773 # Snow Leopard. Build libraries for x86-64,
1774 # 32-bit x86, and 32-bit PowerPC, with x86-64
1775 # first, and build executables for x86-64 and
1776 # 32-bit x86, with x86-64 first. (That's what
1777 # Apple does, even though Snow Leopard doesn't
1778 # run on PPC, so PPC libpcap runs under Rosetta,
1779 # and Rosetta doesn't support BPF ioctls, so PPC
1780 # programs can't do live captures.)
1782 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
1783 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
1784 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
1785 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
1790 # Post-Snow Leopard. Build libraries for x86-64
1791 # and 32-bit x86, with x86-64 first, and build
1792 # executables only for x86-64. (That's what
1793 # Apple does.) This requires no special flags
1795 # XXX - update if and when Apple drops support
1796 # for 32-bit x86 code and if and when Apple adds
1797 # ARM-based Macs. (You're on your own for iOS
1800 # XXX - check whether we *can* build for
1801 # i386 and, if not, suggest that the user
1802 # install the /usr/include headers if they
1803 # want to build fat.
1805 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
1806 save_CFLAGS="$CFLAGS"
1807 CFLAGS="$CFLAGS -arch i386"
1813 V_LIB_CCOPT_FAT="-arch x86_64"
1814 V_LIB_LDFLAGS_FAT="-arch x86_64"
1817 # OpenSSL installation on macOS seems
1818 # to install only the libs for 64-bit
1819 # x86 - at least that's what Brew does:
1820 # only configure 32-bit builds if we
1821 # don't have OpenSSL.
1823 if test "$HAVE_OPENSSL" != yes; then
1824 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
1825 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
1830 V_LIB_CCOPT_FAT="-arch x86_64"
1831 V_LIB_LDFLAGS_FAT="-arch x86_64"
1836 # Mojave; you need to install the
1837 # /usr/include headers to get
1838 # 32-bit x86 builds to work.
1840 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])
1845 # Pre-Mojave; the command-line
1846 # tools should be sufficient to
1847 # enable 32-bit x86 builds.
1849 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
1853 CFLAGS="$save_CFLAGS"
1854 if test "$HAVE_OPENSSL" = yes; then
1856 # If all else fails, look for OpenSSL in
1859 CFLAGS="$CFLAGS -I/usr/local/opt/openssl/include"
1860 LIBS="$LIBS -L/usr/local/opt/openssl/lib"
1868 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1871 # Use System V conventions for man pages.
1873 MAN_ADMIN_COMMANDS=1m
1881 # Use System V conventions for man pages.
1883 MAN_ADMIN_COMMANDS=1m
1891 # Use System V conventions for man pages.
1893 MAN_ADMIN_COMMANDS=1m
1899 dnl HPUX 10.20 and above is similar to HPUX 9, but
1900 dnl not the same....
1902 dnl XXX - DYEXT should be set to "sl" if this is building
1903 dnl for 32-bit PA-RISC, but should be left as "so" for
1904 dnl 64-bit PA-RISC or, I suspect, IA-64.
1905 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1906 if test "`uname -m`" = "ia64"; then
1913 # "-b" builds a shared library; "+h" sets the soname.
1919 # Use System V conventions for man pages.
1927 # Use IRIX conventions for man pages; they're the same as the
1928 # System V conventions, except that they use section 8 for
1929 # administrative commands and daemons.
1935 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1939 # Compiler assumed to be GCC; run-time linker may require a -R
1942 if test "$libdir" != "/usr/lib"; then
1943 V_RFLAGS=-Wl,-R$libdir
1951 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX.
1952 # Use Tru64 UNIX conventions for man pages; they're the same as
1953 # the System V conventions except that they use section 8 for
1954 # administrative commands and daemons.
1962 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1963 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1967 ac_cv_cc_sinix_defined=yes,
1968 ac_cv_cc_sinix_defined=no))
1969 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1970 if test $ac_cv_cc_sinix_defined = no ; then
1971 AC_DEFINE(sinix,1,[on sinix])
1976 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1981 # Make sure errno is thread-safe, in case we're called in
1982 # a multithreaded program. We don't guarantee that two
1983 # threads can use the *same* pcap_t safely, but the
1984 # current version does guarantee that you can use different
1985 # pcap_t's in different threads, and even that pcap_compile()
1986 # is thread-safe (it wasn't thread-safe in some older versions).
1988 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
1990 case "`uname -r`" in
1997 # Use System V conventions for man pages.
1999 MAN_ADMIN_COMMANDS=1m
2007 AC_ARG_ENABLE(shared,
2008 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2009 test "x$enable_shared" = "xno" && DYEXT="none"
2012 AC_CHECK_TOOL([AR], [ar])
2017 AC_LBL_DEVEL(V_CCOPT)
2020 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2022 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2024 #include <sys/types.h>
2025 #include <sys/socket.h>
2029 # Check to see if there's a sockaddr_storage structure.
2031 AC_CHECK_TYPES(struct sockaddr_storage,,,
2033 #include <sys/types.h>
2034 #include <sys/socket.h>
2038 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2039 # dl_module_id_1 member.
2041 # NOTE: any failure means we conclude that it doesn't have that member,
2042 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2043 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2044 # it doesn't have that member (which is OK, as either we won't be
2045 # using code that would use that member, or we wouldn't compile in
2048 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2050 #include <sys/types.h>
2051 #include <sys/dlpi.h>
2052 #include <sys/dlpi_ext.h>
2056 AC_SUBST(V_LIB_CCOPT_FAT)
2057 AC_SUBST(V_LIB_LDFLAGS_FAT)
2058 AC_SUBST(V_PROG_CCOPT_FAT)
2059 AC_SUBST(V_PROG_LDFLAGS_FAT)
2061 AC_SUBST(V_FINDALLDEVS)
2065 AC_SUBST(V_SHLIB_CCOPT)
2066 AC_SUBST(V_SHLIB_CMD)
2067 AC_SUBST(V_SHLIB_OPT)
2068 AC_SUBST(V_SONAME_OPT)
2069 AC_SUBST(V_RPATH_OPT)
2072 AC_SUBST(ADDLARCHIVEOBJS)
2076 AC_SUBST(MAN_DEVICES)
2077 AC_SUBST(MAN_FILE_FORMATS)
2078 AC_SUBST(MAN_MISC_INFO)
2079 AC_SUBST(MAN_ADMIN_COMMANDS)
2080 AC_SUBST(PTHREAD_LIBS)
2081 AC_SUBST(BUILD_RPCAPD)
2082 AC_SUBST(INSTALL_RPCAPD)
2083 AC_SUBST(RPCAPD_LIBS)
2084 AC_SUBST(EXTRA_NETWORK_LIBS)
2086 AC_ARG_ENABLE([usb],
2087 [AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])],
2091 if test "xxx_only" = yes; then
2092 # User requested something-else-only pcap, so they don't
2097 if test "x$enable_usb" != "xno" ; then
2098 dnl check for USB sniffing support
2099 AC_MSG_CHECKING(for USB sniffing support)
2102 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
2103 MSRC="$MSRC pcap-usb-linux.c"
2105 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
2106 if test $? -ne 0 ; then
2107 ac_usb_dev_name="usbmon"
2109 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
2110 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
2112 # Do we have a version of <linux/compiler.h> available?
2113 # If so, we might need it for <linux/usbdevice_fs.h>.
2115 AC_CHECK_HEADERS(linux/compiler.h)
2116 if test "$ac_cv_header_linux_compiler_h" = yes; then
2118 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2120 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2122 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2124 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2126 # OK, does it define bRequestType? Older versions of the kernel
2127 # define fields with names like "requesttype, "request", and
2128 # "value", rather than "bRequestType", "bRequest", and
2131 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2134 #ifdef HAVE_LINUX_COMPILER_H
2135 #include <linux/compiler.h>
2137 #include <linux/usbdevice_fs.h>
2143 # This just uses BPF in FreeBSD 8.4 and later; we don't need
2144 # to check for anything special for capturing.
2146 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
2154 AC_SUBST(PCAP_SUPPORT_USB)
2156 dnl check for netfilter sniffing support
2157 if test "xxx_only" != yes; then
2158 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
2163 # Life's too short to deal with trying to get this to compile
2164 # if you don't get the right types defined with
2165 # __KERNEL_STRICT_NAMES getting defined by some other include.
2167 # Check whether the includes Just Work. If not, don't turn on
2168 # netfilter support.
2170 AC_MSG_CHECKING(whether we can compile the netfilter support)
2171 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2174 #include <sys/socket.h>
2175 #include <netinet/in.h>
2176 #include <linux/types.h>
2178 #include <linux/netlink.h>
2179 #include <linux/netfilter.h>
2180 #include <linux/netfilter/nfnetlink.h>
2181 #include <linux/netfilter/nfnetlink_log.h>
2182 #include <linux/netfilter/nfnetlink_queue.h>],
2184 ac_cv_netfilter_can_compile=yes,
2185 ac_cv_netfilter_can_compile=no))
2186 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2187 if test $ac_cv_netfilter_can_compile = yes ; then
2188 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2189 [target host supports netfilter sniffing])
2190 MSRC="$MSRC pcap-netfilter-linux.c"
2198 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2200 AC_ARG_ENABLE([netmap],
2201 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2203 [enable_netmap=yes])
2205 if test "x$enable_netmap" != "xno" ; then
2207 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2208 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2209 # is defined, for example, as it includes a non-existent malloc.h
2212 AC_MSG_CHECKING(whether we can compile the netmap support)
2213 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2216 #define NETMAP_WITH_LIBS
2217 #include <net/netmap_user.h>],
2219 ac_cv_net_netmap_user_can_compile=yes,
2220 ac_cv_net_netmap_user_can_compile=no))
2221 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2222 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2223 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2224 [target host supports netmap])
2225 MSRC="$MSRC pcap-netmap.c"
2227 AC_SUBST(PCAP_SUPPORT_NETMAP)
2230 # Check for DPDK support.
2232 AC_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2234 if test "$withval" = no
2236 # User doesn't want DPDK support.
2238 elif test "$withval" = yes
2240 # User wants DPDK support but hasn't specified a directory.
2243 # User wants DPDK support and has specified a directory, so use the provided value.
2246 dpdk_inc_dir="$dpdk_dir/include"
2247 dpdk_lib_dir="$dpdk_dir/lib"
2250 if test "$V_PCAP" = dpdk; then
2251 # User requested DPDK-only libpcap, so we'd better have
2254 elif test "xxx_only" = yes; then
2255 # User requested something-else-only pcap, so they don't
2256 # want DPDK support.
2260 # Use DPDK API if present, otherwise don't
2266 if test "$want_dpdk" != no; then
2267 if test -z "$dpdk_dir"; then
2268 dpdk_inc_dir="/usr/local/include/dpdk"
2269 dpdk_lib_dir="/usr/local/lib"
2271 DPDK_MACHINE_CFLAGS="-march=native"
2272 DPDK_CFLAGS="$DPDK_MACHINE_CFLAGS -I$dpdk_inc_dir"
2273 DPDK_LDFLAGS="-L$dpdk_lib_dir -ldpdk -lrt -lm -lnuma -ldl -pthread"
2275 save_CFLAGS="$CFLAGS"
2277 save_LDFLAGS="$LDFLAGS"
2278 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2279 LIBS="$LIBS $DPDK_LDFLAGS"
2280 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2282 AC_MSG_CHECKING(whether we can compile the DPDK support)
2283 AC_CACHE_VAL(ac_cv_dpdk_can_compile,
2286 #include <rte_common.h>],
2288 ac_cv_dpdk_can_compile=yes,
2289 ac_cv_dpdk_can_compile=no))
2290 AC_MSG_RESULT($ac_cv_dpdk_can_compile)
2292 CFLAGS="$save_CFLAGS"
2294 LDFLAGS="$save_LDFLAGS"
2296 if test "$ac_cv_dpdk_can_compile" = yes; then
2297 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2298 LIBS="$LIBS $DPDK_LDFLAGS"
2299 LDFLAGS="$LDFLAGS $DPDK_LDFLAGS"
2300 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2301 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2302 if test $V_PCAP != dpdk ; then
2303 MSRC="$MSRC pcap-dpdk.c"
2306 if test "$V_PCAP" = dpdk; then
2307 # User requested "dpdk" capture type but we couldn't
2308 # find the DPDK API support.
2309 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])
2312 if test "$want_dpdk" = yes; then
2313 # User wanted DPDK support but we couldn't find it.
2314 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])
2318 AC_SUBST(PCAP_SUPPORT_DPDK)
2320 AC_ARG_ENABLE([bluetooth],
2321 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2323 [enable_bluetooth=ifsupportavailable])
2325 if test "xxx_only" = yes; then
2326 # User requested something-else-only pcap, so they don't
2327 # want Bluetooth support.
2331 if test "x$enable_bluetooth" != "xno" ; then
2332 dnl check for Bluetooth sniffing support
2335 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2338 # We have bluetooth.h, so we support Bluetooth
2341 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2342 MSRC="$MSRC pcap-bt-linux.c"
2343 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2344 ac_lbl_bluetooth_available=yes
2347 # OK, does struct sockaddr_hci have an hci_channel
2350 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2353 # Yes; is HCI_CHANNEL_MONITOR defined?
2355 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2356 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2359 #include <bluetooth/bluetooth.h>
2360 #include <bluetooth/hci.h>
2363 u_int i = HCI_CHANNEL_MONITOR;
2367 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2368 [target host supports Bluetooth Monitor])
2369 MSRC="$MSRC pcap-bt-monitor-linux.c"
2376 #include <bluetooth/bluetooth.h>
2377 #include <bluetooth/hci.h>
2382 # We don't have bluetooth.h, so we don't support
2383 # Bluetooth sniffing.
2385 if test "x$enable_bluetooth" = "xyes" ; then
2386 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2388 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2393 if test "x$enable_bluetooth" = "xyes" ; then
2394 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2396 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2400 AC_SUBST(PCAP_SUPPORT_BT)
2403 AC_ARG_ENABLE([dbus],
2404 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2406 [enable_dbus=ifavailable])
2408 if test "xxx_only" = yes; then
2409 # User requested something-else-only pcap, so they don't
2410 # want D-Bus support.
2414 if test "x$enable_dbus" != "xno"; then
2415 if test "x$enable_dbus" = "xyes"; then
2420 # We don't support D-Bus sniffing on macOS; see
2422 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2424 # The user requested it, so fail.
2426 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2433 # We don't support D-Bus sniffing on macOS; see
2435 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2437 # The user dind't explicitly request it, so just
2438 # silently refuse to enable it.
2446 if test "x$enable_dbus" != "xno"; then
2447 if test "x$PKGCONFIG" != "xno"; then
2448 AC_MSG_CHECKING([for D-Bus])
2449 if "$PKGCONFIG" dbus-1; then
2450 AC_MSG_RESULT([yes])
2451 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
2452 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
2453 save_CFLAGS="$CFLAGS"
2455 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2456 LIBS="$LIBS $DBUS_LIBS"
2457 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2459 [#include <string.h>
2462 #include <sys/time.h>
2464 #include <dbus/dbus.h>],
2465 [return dbus_connection_read_write(NULL, 0);],
2467 AC_MSG_RESULT([yes])
2468 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2469 MSRC="$MSRC pcap-dbus.c"
2470 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2474 if test "x$enable_dbus" = "xyes"; then
2475 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2479 CFLAGS="$save_CFLAGS"
2482 if test "x$enable_dbus" = "xyes"; then
2483 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2487 AC_SUBST(PCAP_SUPPORT_DBUS)
2490 AC_ARG_ENABLE([rdma],
2491 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2493 [enable_rdma=ifavailable])
2495 if test "xxx_only" = yes; then
2496 # User requested something-else-only pcap, so they don't
2497 # want RDMA support.
2501 if test "x$enable_rdma" != "xno"; then
2502 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
2503 AC_CHECK_HEADER(infiniband/verbs.h, [
2505 # ibv_create_flow may be defined as a static inline
2506 # function in infiniband/verbs.h, so we can't
2509 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2510 # macro that works like CMake's check_symbol_exists()
2511 # function, to check do a compile check like
2512 # this (they do a clever trick to avoid having
2513 # to know the function's signature).
2515 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2518 #include <infiniband/verbs.h>
2521 (void) ibv_create_flow((struct ibv_qp *) NULL,
2522 (struct ibv_flow_attr *) NULL);
2525 AC_MSG_RESULT([yes])
2526 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
2527 MSRC="$MSRC pcap-rdmasniff.c"
2528 LIBS="-libverbs $LIBS"
2536 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
2541 AC_CONFIG_HEADER(config.h)
2543 AC_OUTPUT_COMMANDS([if test -f .devel; then
2544 echo timestamp > stamp-h
2545 cat $srcdir/Makefile-devel-adds >> Makefile
2548 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
2549 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
2550 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
2551 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
2552 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
2553 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
2554 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
2555 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile