2 dnl Copyright (c) 1994, 1995, 1996, 1997
3 dnl The Regents of the University of California. All rights reserved.
5 dnl Process this file with autoconf to produce a configure script.
11 # https://ftp.gnu.org/gnu/config/README
13 # for the URLs to use to fetch new versions of config.guess and
19 AC_INIT(pcap, m4_esyscmd_s([cat VERSION]))
20 AC_CONFIG_SRCDIR(pcap.c)
21 AC_SUBST(PACKAGE_NAME)
24 # These are the variables that are used in Makefile, pcap-config, and
27 # CFLAGS: inherited from the environment, not modified by us (except
28 # temporarily during tests that involve compilation). Used only when
31 # CXXFLAGS: inherited from the environment, not modified by us. Used only
32 # when compiling C++ source.
34 # LDFLAGS: inherited from the environment, not modified by us.
36 # LIBS: inherited from the environment; we add libraries required by
37 # libpcap. Librares that the core libpcap code requires are added
38 # first; libraries required by additional pcap modules are first
39 # added to ADDITIONAL_LIBS, and only added to LIBS at the end, after
40 # we're finished doing configuration tests for the modules.
42 # LIBS_STATIC: libraries with which a program using the libpcap *static*
43 # library needs to be linked. This is a superset of LIBS, used in
44 # pcap-config, so that "pcap-config --libs --static" will report them.
45 # Initialized to LIBS.
47 # REQUIRES_PRIVATE: pkg-config package names for additional libraries
48 # with which a program using the libpcap *static* library needs to be
49 # linked and for which a .pc file exists. This is used in libpcap.pc,
50 # so that "pkg-config --libs --static" will report them, and so that
51 # those libraries will be determined using the library's .pc file, not
52 # from our .pc file. Initialized to an empty string.
54 # V_CCOPT: additional compiler flags other than -I and -D flags
55 # needed when compiling libpcap. Used in Makefile for both C and
58 # V_DEFS: additional -D compiler flags needed when compiling
59 # libpcap. Used in Makefile for both C and C++ source.
61 # V_INCLS: additional -I compiler flags needed when compiling
62 # libpcap. Used in Makefile for both C and C++ source.
64 # ADDITIONAL_LIBS: additional libraries with which the libpcap dynamic
65 # library needs to be linked. Used in Makwfile; not used in pcap-config
66 # or libpcap.pc, as, in all platforms on which we run, if a dynamic
67 # library is linked with other dynamic libraries, a program using
68 # that dynamic library doesn't have to link with those libraries -
69 # they will be automatically loaded at run time. Initialized to an
72 # ADDITIONAL_LIBS_STATIC: additional libraries with which a program
73 # using the libpcap *static* library needs to be linked. This is used
74 # in pcap-config, so that "pcap-config --libs --static" will report
75 # them. Initialized to an empty string.
77 # REQUIRES_PRIVATE: pkg-config package names for additional libraries
78 # with which a program using the libpcap *static* library needs to be
79 # linked and for which a .pc file exists. This is used in libpcap.pc,
80 # so that "pkg-config --libs --static" will report them, and so that
81 # those libraries will be determined using the library's .pc file, not
82 # from our .pc file. Initialized to an empty string.
84 # LIBS_PRIVATE: pkg-config package names for additional libraries with
85 # which a program using the libpcap *static* library needs to be linked
86 # and for which a .pc file does not exist. This is used in libpcap.pc,
87 # so that "pkg-config --libs --static" will report them (those libraries
88 # cannot be determined using the library's .pc file, as there is no such
89 # file, so it has to come from our .pc file. Initialized to an empty
100 AC_SUBST(REQUIRES_PRIVATE)
101 AC_SUBST(LIBS_PRIVATE)
105 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
107 # We require C99 or later.
108 # Try to get it, which may involve adding compiler flags;
109 # if that fails, give up.
112 if test "$ac_cv_prog_cc_c99" = "no"; then
113 AC_MSG_ERROR([The C compiler does not support C99])
117 # Get the size of a void *, to determine whether this is a 32-bit
120 AC_CHECK_SIZEOF([void *])
121 ac_lbl_c_sizeof_void_p="$ac_cv_sizeof_void_p"
124 # We only need a C++ compiler for Haiku; all code except for its
125 # pcap module is in C.
132 # Make sure C and C++ have the same pointer sizes with the flags
133 # they're given; if they don't, it means that the compilers for the
134 # languages will, with those flags, not produce code that can be
137 # We have to use different data types, because the results of
138 # a test are cached, so if we test for the size of a given type
139 # in C, the subsequent test in C++ will use the cached variable.
140 # We trick autoconf by testing the size of a "void *" in C and a
141 # "const void *" in C++.
144 AC_CHECK_SIZEOF([const void *])
145 ac_lbl_cxx_sizeof_void_p="$ac_cv_sizeof_const_void_p"
147 if test "$ac_lbl_cxx_sizeof_void_p" -eq 0; then
148 AC_MSG_ERROR([No C++ compiler was found])
150 if test "$ac_lbl_c_sizeof_void_p" -ne "$ac_lbl_cxx_sizeof_void_p"; then
151 AC_MSG_ERROR([C compiler $CC produces code with $ac_lbl_c_sizeof_void_p-byte pointers
152 while C++ compiler $CXX produces code with $ac_lbl_cxx_sizeof_void_p-byte pointers. This prevents
153 code in those languages from being combined.])
158 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
164 # Try to arrange for large file support.
170 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
171 dnl include <sys/ioccom.h>, and we were to drop support for older
172 dnl releases without that fix, so that pcap-bpf.c doesn't need to
173 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
174 dnl in "aclocal.m4" uses it, so we would still have to test for it
175 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
176 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
178 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h)
179 AC_CHECK_HEADERS(netpacket/packet.h)
181 AC_LBL_SAVE_CHECK_STATE
185 # Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't use them.
187 CFLAGS="$CFLAGS -D_BSD_SOURCE"
189 # Haiku has getpass in libbsd.
191 AC_CHECK_LIB(bsd, getpass)
196 AC_LBL_RESTORE_CHECK_STATE
198 AC_CHECK_FUNCS(strerror)
199 AC_CHECK_FUNC(strerror_r,
202 # We have strerror_r; if we define _GNU_SOURCE, is it a
203 # POSIX-compliant strerror_r() or a GNU strerror_r()?
205 AC_MSG_CHECKING(whether strerror_r is GNU-style)
212 /* Define it GNU-style; that will cause an error if it's not GNU-style */
213 extern char *strerror_r(int, char *, size_t);
225 AC_DEFINE(HAVE_GNU_STRERROR_R,,
226 [Define to 1 if you have a GNU-style `strerror_r' function.])
230 AC_DEFINE(HAVE_POSIX_STRERROR_R,,
231 [Define to 1 if you have a POSIX-style `strerror_r' function.])
236 # We don't have strerror_r; do we have _wcserror_s?
238 AC_CHECK_FUNCS(_wcserror_s)
242 # Thanks, IBM, for not providing vsyslog() in AIX!
244 AC_CHECK_FUNCS(vsyslog)
247 # Make sure we have vsnprintf() and snprintf(); we require them.
249 AC_CHECK_FUNC(vsnprintf,,
250 AC_MSG_ERROR([vsnprintf() is required but wasn't found]))
251 AC_CHECK_FUNC(snprintf,,
252 AC_MSG_ERROR([snprintf() is required but wasn't found]))
255 AC_CHECK_FUNCS(vasprintf asprintf,,
257 if test $needasprintf = yes; then
258 AC_LIBOBJ([asprintf])
262 AC_CHECK_FUNCS(strlcat,,
264 if test $needstrlcat = yes; then
269 AC_CHECK_FUNCS(strlcpy,,
271 if test $needstrlcpy = yes; then
276 AC_CHECK_FUNCS(strtok_r,,
278 if test $needstrtok_r = yes; then
279 AC_LIBOBJ([strtok_r])
283 # Do we have ffs(), and is it declared in <strings.h>?
286 if test "$ac_cv_func_ffs" = yes; then
288 # We have ffs(); is it declared in <strings.h>?
290 # This test fails if we don't have <strings.h> or if we do
291 # but it doesn't declare ffs().
295 AC_DEFINE(STRINGS_H_DECLARES_FFS,,
296 [Define to 1 if strings.h declares `ffs'])
304 # Do this before checking for ether_hostton(), as it's a
305 # "getaddrinfo()-ish function".
310 # Check for reentrant versions of getnetbyname_r(), as provided by
311 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
312 # If we don't find one, we just use getnetbyname(), which uses
313 # thread-specific data on many platforms, but doesn't use it on
314 # NetBSD or OpenBSD, and may not use it on older versions of other
317 # Only do the check if we have a declaration of getnetbyname_r();
318 # without it, we can't check which API it has. (We assume that
319 # if there's a declaration, it has a prototype, so that the API
322 AC_CHECK_DECL(getnetbyname_r,
324 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
326 [#include <netdb.h>],
328 struct netent netent_buf;
330 struct netent *resultp;
333 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
337 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
338 [define if we have the Linux getnetbyname_r()])
343 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()])
345 [#include <netdb.h>],
347 struct netent netent_buf;
350 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
354 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1,
355 [define if we have the Solaris/IRIX getnetbyname_r()])
360 AC_MSG_CHECKING([for AIX getnetbyname_r()])
362 [#include <netdb.h>],
364 struct netent netent_buf;
365 struct netent_data net_data;
367 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
371 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
372 [define if we have the AIX getnetbyname_r()])
379 ],,[#include <netdb.h>])
382 # Check for reentrant versions of getprotobyname_r(), as provided by
383 # Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!).
384 # If we don't find one, we just use getprotobyname(), which uses
385 # thread-specific data on many platforms, but doesn't use it on
386 # NetBSD or OpenBSD, and may not use it on older versions of other
389 # Only do the check if we have a declaration of getprotobyname_r();
390 # without it, we can't check which API it has. (We assume that
391 # if there's a declaration, it has a prototype, so that the API
394 AC_CHECK_DECL(getprotobyname_r,
396 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
398 [#include <netdb.h>],
400 struct protoent protoent_buf;
402 struct protoent *resultp;
404 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
408 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
409 [define if we have the Linux getprotobyname_r()])
414 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()])
416 [#include <netdb.h>],
418 struct protoent protoent_buf;
421 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
425 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1,
426 [define if we have the Solaris/IRIX getprotobyname_r()])
431 AC_MSG_CHECKING([for AIX getprotobyname_r()])
433 [#include <netdb.h>],
435 struct protoent protoent_buf;
436 struct protoent_data proto_data;
438 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
442 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
443 [define if we have the AIX getprotobyname_r()])
450 ],,[#include <netdb.h>])
453 # You are in a twisty little maze of UN*Xes, all different.
454 # Some might not have ether_hostton().
455 # Some might have it and declare it in <net/ethernet.h>.
456 # Some might have it and declare it in <netinet/ether.h>
457 # Some might have it and declare it in <sys/ethernet.h>.
458 # Some might have it and declare it in <arpa/inet.h>.
459 # Some might have it and declare it in <netinet/if_ether.h>.
460 # Some might have it and not declare it in any header file.
462 # Before you is a C compiler.
464 AC_CHECK_FUNCS(ether_hostton)
465 if test "$ac_cv_func_ether_hostton" = yes; then
467 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
469 # This test fails if we don't have <net/ethernet.h> or if we do
470 # but it doesn't declare ether_hostton().
472 AC_CHECK_DECL(ether_hostton,
474 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
475 [Define to 1 if net/ethernet.h declares `ether_hostton'])
478 #include <net/ethernet.h>
483 if test "$ac_cv_have_decl_ether_hostton" != yes; then
485 # No, how about <netinet/ether.h>, as on Linux?
487 # This test fails if we don't have <netinet/ether.h>
488 # or if we do but it doesn't declare ether_hostton().
490 # Unset ac_cv_have_decl_ether_hostton so we don't
491 # treat the previous failure as a cached value and
492 # suppress the next test.
494 unset ac_cv_have_decl_ether_hostton
495 AC_CHECK_DECL(ether_hostton,
497 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
498 [Define to 1 if netinet/ether.h declares `ether_hostton'])
501 #include <netinet/ether.h>
507 if test "$ac_cv_have_decl_ether_hostton" != yes; then
509 # No, how about <sys/ethernet.h>, as on Solaris 10
512 # This test fails if we don't have <sys/ethernet.h>
513 # or if we do but it doesn't declare ether_hostton().
515 # Unset ac_cv_have_decl_ether_hostton so we don't
516 # treat the previous failure as a cached value and
517 # suppress the next test.
519 unset ac_cv_have_decl_ether_hostton
520 AC_CHECK_DECL(ether_hostton,
522 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,,
523 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
526 #include <sys/ethernet.h>
532 if test "$ac_cv_have_decl_ether_hostton" != yes; then
534 # No, how about <arpa/inet.h>, as in AIX?
536 # This test fails if we don't have <arpa/inet.h>
537 # (if we have ether_hostton(), we should have
538 # networking, and if we have networking, we should
539 # have <arpa/inet.h>) or if we do but it doesn't
540 # declare ether_hostton().
542 # Unset ac_cv_have_decl_ether_hostton so we don't
543 # treat the previous failure as a cached value and
544 # suppress the next test.
546 unset ac_cv_have_decl_ether_hostton
547 AC_CHECK_DECL(ether_hostton,
549 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,,
550 [Define to 1 if arpa/inet.h declares `ether_hostton'])
553 #include <arpa/inet.h>
559 if test "$ac_cv_have_decl_ether_hostton" != yes; then
561 # No, how about <netinet/if_ether.h>?
562 # On some platforms, it requires <net/if.h> and
563 # <netinet/in.h>, and we always include it with
564 # both of them, so test it with both of them.
566 # This test fails if we don't have <netinet/if_ether.h>
567 # and the headers we include before it, or if we do but
568 # <netinet/if_ether.h> doesn't declare ether_hostton().
570 # Unset ac_cv_have_decl_ether_hostton so we don't
571 # treat the previous failure as a cached value and
572 # suppress the next test.
574 unset ac_cv_have_decl_ether_hostton
575 AC_CHECK_DECL(ether_hostton,
577 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
578 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
581 #include <sys/types.h>
582 #include <sys/socket.h>
584 #include <netinet/in.h>
585 #include <netinet/if_ether.h>
589 # After all that, is ether_hostton() declared?
591 if test "$ac_cv_have_decl_ether_hostton" = yes; then
595 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
596 [Define to 1 if you have the declaration of `ether_hostton'])
599 # No, we'll have to declare it ourselves.
600 # Do we have "struct ether_addr" if we include
601 # <netinet/if_ether.h>?
603 AC_CHECK_TYPES(struct ether_addr,,,
605 #include <sys/types.h>
606 #include <sys/socket.h>
608 #include <netinet/in.h>
609 #include <netinet/if_ether.h>
615 # For various things that might use pthreads.
617 AC_CHECK_HEADER(pthread.h,
620 # OK, we have pthread.h. Do we have pthread_create in the
623 AC_CHECK_FUNC(pthread_create,
628 ac_lbl_have_pthreads="found"
632 # No - do we have it in -lpthreads?
634 AC_CHECK_LIB(pthreads, pthread_create,
637 # Yes - add -lpthreads.
639 ac_lbl_have_pthreads="found"
640 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
644 # No - do we have it in -lpthread?
646 AC_CHECK_LIB(pthread, pthread_create,
649 # Yes - add -lpthread.
651 ac_lbl_have_pthreads="found"
652 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
658 ac_lbl_have_pthreads="not found"
665 # We didn't find pthread.h.
667 ac_lbl_have_pthreads="not found"
671 dnl to pacify those who hate protochain insn
672 AC_MSG_CHECKING(if --disable-protochain option is specified)
673 AC_ARG_ENABLE(protochain,
674 AS_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
675 case "x$enable_protochain" in
676 xyes) enable_protochain=enabled ;;
677 xno) enable_protochain=disabled ;;
678 x) enable_protochain=enabled ;;
681 if test "$enable_protochain" = "disabled"; then
682 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
684 AC_MSG_RESULT(${enable_protochain})
687 # valgrindtest directly uses the native capture mechanism, but
688 # only tests with BPF and PF_PACKET sockets; only enable it if
689 # we have BPF or PF_PACKET sockets.
694 AS_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
695 if test ! -z "$with_pcap" ; then
699 # Check for a bunch of headers for various packet
700 # capture mechanisms.
702 AC_CHECK_HEADERS(net/bpf.h)
703 if test "$ac_cv_header_net_bpf_h" = yes; then
705 # Does it define BIOCSETIF?
706 # I.e., is it a header for an LBL/BSD-style capture
707 # mechanism, or is it just a header for a BPF filter
708 # engine? Some versions of Arch Linux, for example,
709 # have a net/bpf.h that doesn't define BIOCSETIF;
710 # as it's a Linux, it should use packet sockets,
715 # sys/types.h, because FreeBSD 10's net/bpf.h
716 # requires that various BSD-style integer types
719 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
720 # doesn't include it but does use struct timeval
721 # in ioctl definitions;
723 # sys/ioctl.h and, if we have it, sys/ioccom.h,
724 # because net/bpf.h defines ioctls;
726 # net/if.h, because it defines some structures
727 # used in ioctls defined by net/bpf.h;
729 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
730 # defines some structure fields as being
733 # and net/bpf.h doesn't necessarily include all
734 # of those headers itself.
736 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
737 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
740 #include <sys/types.h>
741 #include <sys/time.h>
742 #include <sys/ioctl.h>
743 #include <sys/socket.h>
744 #ifdef HAVE_SYS_IOCCOM_H
745 #include <sys/ioccom.h>
750 [u_int i = BIOCSETIF;],
751 ac_cv_lbl_bpf_h_defines_biocsetif=yes,
752 ac_cv_lbl_bpf_h_defines_biocsetif=no))
753 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
755 AC_CHECK_HEADERS(net/pfilt.h net/enet.h)
756 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h)
757 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h)
758 AC_CHECK_HEADERS(config/HaikuConfig.h)
760 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
763 # Check this before DLPI, so that we pick BPF on
764 # Solaris 11 and later.
769 # We have BPF, so build valgrindtest with "make test"
770 # on macOS and FreeBSD (add your OS once there's a
775 freebsd*|darwin*|linux*)
776 VALGRINDTEST_SRC=valgrindtest.c
779 elif test "$ac_cv_header_linux_socket_h" = yes; then
781 # No prizes for guessing this one.
784 VALGRINDTEST_SRC=valgrindtest.c
785 elif test "$ac_cv_header_net_pfilt_h" = yes; then
787 # DEC OSF/1, Digital UNIX, Tru64 UNIX
790 elif test "$ac_cv_header_net_enet_h" = yes; then
792 # Stanford Enetfilter.
795 elif test "$ac_cv_header_net_nit_h" = yes; then
797 # SunOS 4.x STREAMS NIT.
800 elif test "$ac_cv_header_sys_net_nit_h" = yes; then
802 # Pre-SunOS 4.x non-STREAMS NIT.
805 elif test "$ac_cv_header_net_raw_h" = yes; then
810 elif test "$ac_cv_header_sys_dlpi_h" = yes; then
812 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others.
815 elif test "$ac_cv_header_config_HaikuConfig_h" = yes; then
822 # Nothing we support.
825 AC_MSG_WARN(cannot determine packet capture interface)
826 AC_MSG_WARN((see the INSTALL.md file for more info))
829 AC_MSG_CHECKING(packet capture type)
830 AC_MSG_RESULT($V_PCAP)
831 AC_SUBST(VALGRINDTEST_SRC)
834 # Do we have pkg-config?
839 # Do we have the brew command from Homebrew?
841 AC_PATH_PROG([BREW], [brew])
844 # Solaris pkg-config is annoying. For at least one package (D-Bus, I'm
845 # looking at *you*!), there are separate include files for 32-bit and
846 # 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
847 # type on a 64-bit build is like crossing the beams or soething), and
848 # there are two separate .pc files, so if we're doing a 32-bit build we
849 # should make sure we look in /usr/lib/pkgconfig for .pc files and if
850 # we're doing a 64-bit build we should make sure we look in
851 # /usr/lib/amd64/pkgconfig for .pc files.
856 if test "$ac_cv_sizeof_void_p" -eq 8; then
858 # 64-bit build. If the path is empty, set it to
859 # /usr/lib/amd64/pkgconfig; otherwise, if
860 # /usr/lib/pkgconfig appears in the path, prepend
861 # /usr/lib/amd64/pkgconfig to it; otherwise, put
862 # /usr/lib/amd64/pkgconfig at the end.
864 if test -z "$PKG_CONFIG_PATH"; then
866 # Not set, or empty. Set it to
867 # /usr/lib/amd64/pkgconfig.
869 PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig
870 elif test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/pkgconfig"`; then
872 # It contains /usr/lib/pkgconfig. Prepend
873 # /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
875 PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/pkgconfig;/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig;"`
878 # Not empty, but doesn't contain /usr/lib/pkgconfig.
879 # Append /usr/lib/amd64/pkgconfig to it.
881 PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/amd64/pkgconfig"
883 export PKG_CONFIG_PATH
884 elif test "$ac_cv_sizeof_void_p" -eq 4; then
886 # 32-bit build. If /usr/amd64/lib/pkgconfig appears
887 # in the path, prepend /usr/lib/pkgconfig to it.
889 if test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/amd64/pkgconfig"`; then
891 # It contains /usr/lib/amd64/pkgconfig. Prepend
892 # /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
894 PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/amd64/pkgconfig;/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig;"`
895 export PKG_CONFIG_PATH
901 # Handle each capture type.
906 # Checks for some header files.
908 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
911 # Checks to see if Solaris has the public libdlpi(3LIB) library.
912 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
913 # public libdlpi(3LIB) version. Before libdlpi was made public, a
914 # private version also existed, which did not have the same APIs.
915 # Due to a gcc bug, the default search path for 32-bit libraries does
916 # not include /lib, we add it explicitly here.
917 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
918 # Also, due to the bug above applications that link to libpcap with
919 # libdlpi will have to add "-L/lib" option to "configure".
921 save_LDFLAGS="$LDFLAGS"
922 LDFLAGS="$LIBS -L/lib"
923 AC_CHECK_LIB(dlpi, dlpi_walk,
926 LIBS_STATIC="-ldlpi $LIBS_STATIC"
927 LIBS_PRIVATE="-ldlpi $LIBS_PRIVATE"
931 # Capture module plus common code needed for
932 # common functions used by pcap-[dlpi,libdlpi].c
934 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
935 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
941 # Capture module plus common code needed for
942 # common functions used by pcap-[dlpi,libdlpi].c
944 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
946 LDFLAGS="$save_LDFLAGS"
949 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
952 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
953 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
956 #include <sys/types.h>
957 #include <sys/time.h>
958 #include <sys/dlpi.h>
960 [int i = DL_PROMISC_PHYS;],
961 ac_cv_sys_dlpi_usable=yes,
962 ac_cv_sys_dlpi_usable=no))
963 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
964 if test $ac_cv_sys_dlpi_usable = no ; then
965 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
969 # Check to see if Solaris has the dl_passive_req_t struct defined
971 # This check is for DLPI support for passive modes.
972 # See dlpi(7P) for more details.
974 AC_CHECK_TYPES(dl_passive_req_t,,,
976 #include <sys/types.h>
977 #include <sys/dlpi.h>
985 PLATFORM_C_SRC="pcap-enet.c"
992 PLATFORM_CXX_SRC="pcap-haiku.cpp"
995 # Just for the sake of it.
997 AC_CHECK_HEADERS(net/if.h net/if_dl.h net/if_types.h)
1004 PLATFORM_C_SRC="pcap-linux.c"
1007 # Do we have the wireless extensions?
1009 AC_CHECK_HEADERS(linux/wireless.h, [], [],
1011 #include <sys/socket.h>
1012 #include <linux/if.h>
1013 #include <linux/types.h>
1018 # We only want version 3. Version 2 was, apparently,
1019 # short-lived, and version 1 is source and binary
1020 # incompatible with version 3, and it appears that,
1021 # these days, everybody's using version 3. We're
1022 # not supporting older versions of the Linux kernel;
1023 # let's drop support for older versions of libnl, too.
1026 AS_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
1027 with_libnl=$withval,with_libnl=if_available)
1029 if test x$with_libnl != xno ; then
1031 # Check for libnl-genl-3.0 with pkg-config.
1033 PKG_CHECK_MODULES(LIBNL, libnl-genl-3.0,
1035 pkg_config_found_libnl=yes
1036 V_INCLS="$V_INCLS $LIBNL_CFLAGS"
1037 ADDITIONAL_LIBS="$LIBNL_LIBS $ADDITIONAL_LIBS"
1038 ADDITIONAL_LIBS_STATIC="$LIBNL_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
1039 REQUIRES_PRIVATE="libnl-genl-3.0 $REQUIRES_PRIVATE"
1040 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
1043 if test x$pkg_config_found_libnl != xyes; then
1045 # OK, either we don't have pkg-config or there
1046 # wasn't a .pc file for it; Check for it directly.
1048 case "$with_libnl" in
1051 incdir=-I/usr/include/libnl3
1056 if test -d $withval; then
1057 libnldir=-L${withval}/lib
1058 incdir=-I${withval}/include
1063 AC_CHECK_LIB(nl-3, nl_socket_alloc,
1066 # Yes, we have libnl 3.x.
1068 ADDITIONAL_LIBS="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS"
1069 ADDITIONAL_LIBS_STATIC="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS_STATIC"
1070 LIBS_PRIVATE="${libnldir} -lnl-genl-3 -lnl-3 $LIBS_PRIVATE"
1071 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
1072 V_INCLS="$V_INCLS ${incdir}"
1075 # No, we don't have libnl at all.
1076 # Fail if the user explicitly requested
1079 if test x$with_libnl = xyes ; then
1080 AC_MSG_ERROR([libnl support requested but libnl not found])
1082 ], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
1087 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
1089 # NOTE: any failure means we conclude that it doesn't have that
1090 # member, so if we don't have tpacket_auxdata, we conclude it
1091 # doesn't have that member (which is OK, as either we won't be
1092 # using code that would use that member, or we wouldn't compile
1094 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
1096 #include <sys/types.h>
1097 #include <linux/if_packet.h>
1105 PLATFORM_C_SRC="pcap-bpf.c"
1108 # Check whether we have the *BSD-style ioctls.
1110 AC_CHECK_HEADERS(net/if_media.h)
1113 # Check whether we have struct BPF_TIMEVAL.
1115 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
1117 #include <sys/types.h>
1118 #include <sys/ioctl.h>
1119 #ifdef HAVE_SYS_IOCCOM_H
1120 #include <sys/ioccom.h>
1122 #include <net/bpf.h>
1130 PLATFORM_C_SRC="pcap-pf.c"
1137 PLATFORM_C_SRC="pcap-snit.c"
1144 PLATFORM_C_SRC="pcap-snoop.c"
1149 # --with-pcap=dag is the only way to get here, and it means
1150 # "DAG support but nothing else"
1152 V_DEFS="$V_DEFS -DDAG_ONLY"
1153 PLATFORM_C_SRC="pcap-dag.c"
1159 # --with-pcap=dpdk is the only way to get here, and it means
1160 # "DPDK support but nothing else"
1162 V_DEFS="$V_DEFS -DDPDK_ONLY"
1163 PLATFORM_C_SRC="pcap-dpdk.c"
1169 # --with-pcap=septel is the only way to get here, and it means
1170 # "Septel support but nothing else"
1172 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
1173 PLATFORM_C_SRC="pcap-septel.c"
1179 # --with-pcap=snf is the only way to get here, and it means
1180 # "SNF support but nothing else"
1182 V_DEFS="$V_DEFS -DSNF_ONLY"
1183 PLATFORM_C_SRC="pcap-snf.c"
1191 PLATFORM_C_SRC="pcap-null.c"
1195 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1200 dnl Now figure out how we get a list of interfaces and addresses,
1201 dnl if we support capturing. Don't bother if we don't support
1204 if test "$V_PCAP" != null
1206 AC_CHECK_FUNC(getifaddrs,[
1208 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1209 # as well, just in case some platform is really weird.
1211 AC_CHECK_HEADER(ifaddrs.h,[
1213 # We have the header, so we use "getifaddrs()" to
1214 # get the list of interfaces.
1216 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1219 # We don't have the header - give up.
1220 # XXX - we could also fall back on some other
1221 # mechanism, but, for now, this'll catch this
1222 # problem so that we can at least try to figure
1223 # out something to do on systems with "getifaddrs()"
1224 # but without "ifaddrs.h", if there is something
1225 # we can do on those systems.
1227 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1231 # Well, we don't have "getifaddrs()", at least not with the
1232 # libraries with which we've decided we need to link
1233 # libpcap with, so we have to use some other mechanism.
1235 # Note that this may happen on Solaris, which has
1236 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1237 # won't find it if we link with -lxnet, which we want
1238 # to do for other reasons.
1240 # For now, we use either the SIOCGIFCONF ioctl or the
1241 # SIOCGLIFCONF ioctl, preferring the latter if we have
1242 # it; the latter is a Solarisism that first appeared
1243 # in Solaris 8. (Solaris's getifaddrs() appears to
1244 # be built atop SIOCGLIFCONF; using it directly
1245 # avoids a not-all-that-useful middleman.)
1247 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1248 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1250 [#include <sys/param.h>
1251 #include <sys/file.h>
1252 #include <sys/ioctl.h>
1253 #include <sys/socket.h>
1254 #include <sys/sockio.h>],
1255 [ioctl(0, SIOCGLIFCONF, (char *)0);],
1256 ac_cv_lbl_have_siocglifconf=yes,
1257 ac_cv_lbl_have_siocglifconf=no))
1258 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1259 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1260 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1262 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1267 dnl check for hardware timestamp support
1270 AC_CHECK_HEADERS([linux/net_tstamp.h])
1273 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1278 # Check for socklen_t.
1280 AC_CHECK_TYPES(socklen_t,,,
1282 #include <sys/types.h>
1283 #include <sys/socket.h>
1287 AS_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]),
1290 if test "$enable_ipv6" != "no"; then
1292 # We've already made sure we have getaddrinfo above in
1293 # AC_LBL_LIBRARY_NET.
1295 AC_DEFINE(INET6,1,[IPv6])
1298 # Check for Endace DAG card support.
1300 AS_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1302 if test "$withval" = no
1304 # User doesn't want DAG support.
1306 elif test "$withval" = yes
1308 # User wants DAG support but hasn't specified a directory.
1311 # User wants DAG support and has specified a directory, so use the provided value.
1316 if test "$V_PCAP" = dag; then
1317 # User requested DAG-only libpcap, so we'd better have
1320 elif test "xxx_only" = yes; then
1321 # User requested something-else-only pcap, so they don't
1326 # Use DAG API if present, otherwise don't
1332 AC_ARG_WITH([dag-includes],
1333 AS_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1335 # User wants DAG support and has specified a header directory, so use the provided value.
1337 dag_include_dir=$withval
1340 AC_ARG_WITH([dag-libraries],
1341 AS_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1343 # User wants DAG support and has specified a library directory, so use the provided value.
1345 dag_lib_dir=$withval
1348 if test "$want_dag" != no; then
1350 # If necessary, set default paths for DAG API headers and libraries.
1351 if test -z "$dag_root"; then
1355 if test -z "$dag_include_dir"; then
1356 dag_include_dir="$dag_root/include"
1359 if test -z "$dag_lib_dir"; then
1360 dag_lib_dir="$dag_root/lib"
1362 # Handle multiarch systems.
1364 if test -d "$dag_lib_dir/$host"
1366 dag_lib_dir="$dag_lib_dir/$host"
1370 AC_LBL_SAVE_CHECK_STATE
1371 CFLAGS="$CFLAGS -I$dag_include_dir"
1372 AC_CHECK_HEADERS([dagapi.h])
1373 AC_LBL_RESTORE_CHECK_STATE
1375 if test "$ac_cv_header_dagapi_h" = yes; then
1377 V_INCLS="$V_INCLS -I$dag_include_dir"
1379 if test $V_PCAP != dag ; then
1380 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1383 # Check for various DAG API functions.
1384 # Don't need to save and restore LIBS to prevent -ldag being
1385 # included if there's a found-action (arg 3).
1386 AC_LBL_SAVE_CHECK_STATE
1387 LDFLAGS="-L$dag_lib_dir"
1388 AC_CHECK_LIB([dag], [dag_attach_stream],
1391 # We assume that if we have libdag we have
1392 # libdagconf, as they're installed at the
1393 # same time from the same package.
1395 ADDITIONAL_LIBS="-L$dag_lib_dir $ADDITIONAL_LIBS -ldag -ldagconf"
1396 ADDITIONAL_LIBS_STATIC="-L$dag_lib_dir $ADDITIONAL_LIBS_STATIC -ldag -ldagconf"
1397 LIBS_PRIVATE="-L$dag_lib_dir $LIBS_PRIVATE -ldag -ldagconf"
1399 [AC_MSG_ERROR(DAG library lacks streams support)])
1400 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
1401 AC_CHECK_LIB([dag],[dag_get_erf_types], [
1402 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
1403 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
1404 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
1405 AC_LBL_RESTORE_CHECK_STATE
1408 # We assume that if we have libdag we have libdagconf,
1409 # as they're installed at the same time from the same
1412 if test "$dag_large_streams" = 1; then
1413 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
1414 AC_LBL_SAVE_CHECK_STATE
1415 LIBS="$LIBS -ldag -ldagconf"
1416 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1417 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1418 AC_LBL_RESTORE_CHECK_STATE
1419 if test "$ac_dag_have_vdag" = 1; then
1420 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1421 if test "$ac_lbl_have_pthreads" != "found"; then
1422 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1424 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $PTHREAD_LIBS"
1425 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $PTHREAD_LIBS"
1426 LIBS_PRIVATE="$LIBS_PRIVATE $PTHREAD_LIBS"
1430 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1432 if test "$V_PCAP" = dag; then
1433 # User requested "dag" capture type but we couldn't
1434 # find the DAG API support.
1435 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])
1438 if test "$want_dag" = yes; then
1439 # User wanted DAG support but we couldn't find it.
1440 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])
1443 CFLAGS="$save_CFLAGS"
1447 AS_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1449 if test "$withval" = no
1452 elif test "$withval" = yes
1458 septel_root=$withval
1461 if test "$V_PCAP" = septel; then
1462 # User requested Septel-only libpcap, so we'd better have
1465 elif test "xxx_only" = yes; then
1466 # User requested something-else-only pcap, so they don't
1467 # want Septel support.
1471 # Use Septel API if present, otherwise don't
1473 want_septel=ifpresent
1477 ac_cv_lbl_septel_api=no
1478 if test "$with_septel" != no; then
1480 AC_MSG_CHECKING([whether we have Septel API headers])
1482 # If necessary, set default paths for Septel API headers and libraries.
1483 if test -z "$septel_root"; then
1484 septel_root=$srcdir/../septel
1487 septel_tools_dir="$septel_root"
1488 septel_include_dir="$septel_root/INC"
1490 if test -r "$septel_include_dir/msg.h"; then
1491 ac_cv_lbl_septel_api=yes
1494 if test "$ac_cv_lbl_septel_api" = yes; then
1495 AC_MSG_RESULT([yes ($septel_include_dir)])
1497 V_INCLS="$V_INCLS -I$septel_include_dir"
1498 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"
1499 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"
1501 if test "$V_PCAP" != septel ; then
1502 MODULE_C_SRC="$MODULE_C_SRC pcap-septel.c"
1505 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
1509 if test "$V_PCAP" = septel; then
1510 # User requested "septel" capture type but
1511 # we couldn't find the Septel API support.
1512 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])
1515 if test "$want_septel" = yes; then
1516 # User wanted Septel support but we couldn't find it.
1517 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])
1522 # Check for Myricom SNF support.
1524 AS_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1526 if test "$withval" = no
1528 # User explicitly doesn't want SNF
1530 elif test "$withval" = yes
1532 # User wants SNF support but hasn't specified a directory.
1535 # User wants SNF support with a specified directory.
1540 if test "$V_PCAP" = snf; then
1541 # User requested Sniffer-only libpcap, so we'd better have
1544 elif test "xxx_only" = yes; then
1545 # User requested something-else-only pcap, so they don't
1550 # Use Sniffer API if present, otherwise don't
1556 AC_ARG_WITH([snf-includes],
1557 AS_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1559 # User wants SNF with specific header directory
1561 snf_include_dir=$withval
1564 AC_ARG_WITH([snf-libraries],
1565 AS_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1567 # User wants SNF with specific lib directory
1569 snf_lib_dir=$withval
1572 ac_cv_lbl_snf_api=no
1573 if test "$with_snf" != no; then
1575 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1577 # If necessary, set default paths for Sniffer headers and libraries.
1578 if test -z "$snf_root"; then
1582 if test -z "$snf_include_dir"; then
1583 snf_include_dir="$snf_root/include"
1586 if test -z "$snf_lib_dir"; then
1587 snf_lib_dir="$snf_root/lib"
1589 # Handle multiarch systems.
1591 if test -d "$snf_lib_dir/$host"
1593 snf_lib_dir="$snf_lib_dir/$host"
1597 if test -f "$snf_include_dir/snf.h"; then
1598 # We found a header; make sure we can link with the library
1599 AC_LBL_SAVE_CHECK_STATE
1600 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1601 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1602 AC_LBL_RESTORE_CHECK_STATE
1603 if test "$ac_cv_lbl_snf_api" = no; then
1604 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1608 if test "$ac_cv_lbl_snf_api" = yes; then
1609 AC_MSG_RESULT([yes ($snf_root)])
1611 V_INCLS="$V_INCLS -I$snf_include_dir"
1612 ADDITIONAL_LIBS="$ADDITIONAL_LIBS -L$snf_lib_dir -lsnf"
1613 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC -L$snf_lib_dir -lsnf"
1614 LIBS_PRIVATE="$LIBS_PRIVATE -L$snf_lib_dir -lsnf"
1616 if test "$V_PCAP" != snf ; then
1617 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1620 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1624 if test "$want_snf" = yes; then
1625 # User requested "snf" capture type but
1626 # we couldn't find the Sniffer API support.
1627 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])
1630 if test "$want_snf" = yes; then
1631 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])
1636 # Check for Riverbed TurboCap support.
1637 AC_ARG_WITH([turbocap],
1638 AS_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1640 if test "$withval" = no
1642 # User explicitly doesn't want TurboCap
1644 elif test "$withval" = yes
1646 # User wants TurboCap support but hasn't specified a directory.
1649 # User wants TurboCap support with a specified directory.
1651 turbocap_root=$withval
1654 if test "xxx_only" = yes; then
1655 # User requested something-else-only pcap, so they don't
1656 # want TurboCap support.
1660 # Use TurboCap API if present, otherwise don't
1662 want_turbocap=ifpresent
1666 ac_cv_lbl_turbocap_api=no
1667 if test "$want_turbocap" != no; then
1669 AC_MSG_CHECKING(whether TurboCap is supported)
1671 AC_LBL_SAVE_CHECK_STATE
1672 if test ! -z "$turbocap_root"; then
1673 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1674 TURBOCAP_LDFLAGS="-L$turbocap_root/lib"
1675 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1676 LDFLAGS="$LDFLAGS $TURBOCAP_LDFLAGS"
1684 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1686 (void)TcInstanceCreateByName("foo", &i);
1688 ac_cv_lbl_turbocap_api=yes)
1690 AC_LBL_RESTORE_CHECK_STATE
1691 if test $ac_cv_lbl_turbocap_api = yes; then
1694 MODULE_C_SRC="$MODULE_C_SRC pcap-tc.c"
1695 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1696 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
1697 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
1698 LIBS_PRIVATE="$LIBS_PRIVATE $TURBOCAP_LDFLAGS -lTcApi -lpthread -lstdc++"
1700 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1704 if test "$want_turbocap" = yes; then
1705 # User wanted Turbo support but we couldn't find it.
1706 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])
1712 dnl Allow the user to enable remote capture.
1713 dnl It's off by default, as that increases the attack surface of
1714 dnl libpcap, exposing it to malicious servers.
1716 AC_MSG_CHECKING([whether to enable remote packet capture])
1717 AC_ARG_ENABLE([remote],
1718 [AS_HELP_STRING([--enable-remote],
1719 [enable remote packet capture @<:@default=no@:>@])],
1722 case "$enableval" in
1723 yes) AC_MSG_RESULT(yes)
1724 AC_WARN([Remote packet capture may expose libpcap-based applications])
1725 AC_WARN([to attacks by malicious remote capture servers!])
1727 # rpcapd requires pthreads on UN*X.
1729 if test "$ac_lbl_have_pthreads" != "found"; then
1730 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1733 # It also requires crypt().
1734 # Do we have it in the system libraries?
1736 AC_CHECK_FUNC(crypt,,
1739 # No. Do we have it in -lcrypt?
1741 AC_CHECK_LIB(crypt, crypt,
1744 # Yes; add -lcrypt to the libraries for rpcapd.
1746 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1749 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1754 # OK, we have crypt(). Do we have getspnam()?
1756 AC_CHECK_FUNCS(getspnam)
1759 # Check for various members of struct msghdr.
1761 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1763 #include "ftmacros.h"
1764 #include <sys/socket.h>
1766 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1768 #include "ftmacros.h"
1769 #include <sys/socket.h>
1773 # Optionally, we may want to support SSL.
1774 # Check for OpenSSL/libressl.
1776 # First, try looking for it with pkg-config, if we have it.
1778 # Homebrew's pkg-config does not, by default, look for
1779 # pkg-config files for packages it has installed.
1780 # Furthermore, at least for OpenSSL, they appear to be
1781 # dumped in package-specific directories whose paths are
1782 # not only package-specific but package-version-specific.
1784 # So the only way to find openssl is to get the value of
1785 # PKG_CONFIG_PATH from "brew --env openssl" and add that
1786 # to PKG_CONFIG_PATH. (No, we can't just assume it's under
1787 # /usr/local; Homebrew have conveniently chosen to put it
1788 # under /opt/homebrew on ARM.)
1790 # That's the nice thing about Homebrew - it makes things easier!
1793 save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
1794 if test -n "$BREW"; then
1795 openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
1796 PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
1798 PKG_CHECK_MODULES(OPENSSL, openssl,
1801 # We found OpenSSL/libressl.
1804 REQUIRES_PRIVATE="$REQUIRES_PRIVATE openssl"
1806 PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
1809 # If it wasn't found, and we have Homebrew installed, see
1810 # if it's in Homebrew.
1812 if test "x$HAVE_OPENSSL" != "xyes" -a -n "$BREW"; then
1813 AC_MSG_CHECKING(for openssl in Homebrew)
1815 # The brew man page lies when it speaks of
1816 # $BREW --prefix --installed <formula>
1817 # outputting nothing. In Homebrew 3.3.16,
1818 # it produces output regardless of whether
1819 # the formula is installed or not, so we
1820 # send the standard output and error to
1823 if $BREW --prefix --installed openssl >/dev/null 2>&1; then
1825 # Yes. Get the include directory and library
1826 # directory. (No, we can't just assume it's
1827 # under /usr/local; Homebrew have conveniently
1828 # chosen to put it under /opt/homebrew on ARM.)
1832 openssl_path=`$BREW --prefix openssl`
1833 OPENSSL_CFLAGS="-I$openssl_path/include"
1834 OPENSSL_LIBS="-L$openssl_path/lib -lssl -lcrypto"
1835 OPENSSL_LIBS_STATIC="-L$openssl_path/lib -lssl -lcrypto"
1836 OPENSSL_LIBS_PRIVATE="-L$openssl_path/lib -lssl -lcrypto"
1843 # If it wasn't found, and /usr/local/include and /usr/local/lib
1844 # exist, check if it's in /usr/local. (We check whether they
1845 # exist because, if they don't exist, the compiler will warn
1846 # about that and then ignore the argument, so they test
1847 # using just the system header files and libraries.)
1849 # We include the standard include file to 1) make sure that
1850 # it's installed (if it's just a shared library for the
1851 # benefit of existing programs, that's not useful) and 2)
1852 # because SSL_library_init() is a library routine in some
1853 # versions and a #defined wrapper around OPENSSL_init_ssl()
1856 if test "x$HAVE_OPENSSL" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
1857 AC_LBL_SAVE_CHECK_STATE
1858 CFLAGS="$CFLAGS -I/usr/local/include"
1859 LIBS="$LIBS -L/usr/local/lib -lssl -lcrypto"
1860 AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local that we can use)
1863 #include <openssl/ssl.h>
1872 OPENSSL_CFLAGS="-I/usr/local/include"
1873 OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto"
1874 OPENSSL_LIBS_STATIC="-L/usr/local/lib -lssl -lcrypto"
1875 OPENSSL_LIBS_PRIVATE="-L/usr/local/lib -lssl -lcrypto"
1878 AC_LBL_RESTORE_CHECK_STATE
1882 # If it wasn't found, check if it's a system library.
1884 # We include the standard include file to 1) make sure that
1885 # it's installed (if it's just a shared library for the
1886 # benefit of existing programs, that's not useful) and 2)
1887 # because SSL_library_init() is a library routine in some
1888 # versions and a #defined wrapper around OPENSSL_init_ssl()
1891 if test "x$HAVE_OPENSSL" != "xyes"; then
1892 AC_LBL_SAVE_CHECK_STATE
1893 LIBS="$LIBS -lssl -lcrypto"
1894 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1897 #include <openssl/ssl.h>
1906 OPENSSL_LIBS="-lssl -lcrypto"
1907 OPENSSL_LIBS_STATIC="-lssl -lcrypto"
1908 OPENSSL_LIBS_PRIVATE="-lssl -lcrypto"
1911 AC_LBL_RESTORE_CHECK_STATE
1915 # OK, did we find it?
1917 if test "x$HAVE_OPENSSL" = "xyes"; then
1918 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1919 V_INCLS="$V_INCLS $OPENSSL_CFLAGS"
1920 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $OPENSSL_LIBS"
1921 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $OPENSSL_LIBS_STATIC"
1922 LIBS_PRIVATE="$LIBS_PRIVATE $OPENSSL_LIBS_PRIVATE"
1923 REQUIRES_PRIVATE="$REQUIRES_PRIVATE $OPENSSL_REQUIRES_PRIVATE"
1925 AC_MSG_NOTICE(OpenSSL not found)
1928 AC_DEFINE(ENABLE_REMOTE,,
1929 [Define to 1 if remote packet capture is to be supported])
1930 REMOTE_C_SRC="$REMOTE_C_SRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c sslutils.c"
1931 BUILD_RPCAPD=build-rpcapd
1932 INSTALL_RPCAPD=install-rpcapd
1934 *) AC_MSG_RESULT(no)
1938 AC_MSG_CHECKING(whether to build optimizer debugging code)
1939 AC_ARG_ENABLE(optimizer-dbg,
1940 AS_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1941 if test "$enable_optimizer_dbg" = "yes"; then
1942 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1944 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1946 AC_MSG_CHECKING(whether to build parser debugging code)
1947 AC_ARG_ENABLE(yydebug,
1948 AS_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1949 if test "$enable_yydebug" = "yes"; then
1950 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1952 AC_MSG_RESULT(${enable_yydebug-no})
1958 if test "$LEX" = ":"; then
1959 AC_MSG_ERROR([Neither flex nor lex was found.])
1963 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1964 # and supports processing our scanner.l.
1966 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1967 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1968 tcpdump_cv_capable_lex=yes
1970 tcpdump_cv_capable_lex=insufficient
1972 if test $tcpdump_cv_capable_lex = insufficient ; then
1973 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1974 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.
1975 If a suitable version of Lex/Flex is available as a non-standard command
1976 and/or not in the PATH, you can specify it using the LEX environment
1977 variable. That said, on some systems the error can mean that Flex/Lex is
1978 actually acceptable, but m4 is not. Likewise, if a suitable version of
1979 m4 (such as GNU M4) is available but has not been detected, you can
1980 specify it using the M4 environment variable.])
1984 # Look for yacc/bison/byacc.
1985 # If it's Bison, we do not want -y, as 1) we will be using -o to cause
1986 # the output for XXX.y to be written to XXX.c and 2) we don't want
1987 # it to issue warnings about stuff not supported by POSIX YACC - we
1988 # want to use that stuff, and don't care whether plain YACC supports
1989 # it or not, we require either Bison or Berkeley YACC.
1995 AC_CHECK_PROGS(BISON_BYACC, bison)
1996 if test x"$BISON_BYACC" != x; then
2000 # Bison prior to 2.4(.1) doesn't support "%define api.pure", so use
2003 bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \(@<:@1-9@:>@@<:@0-9@:>@*\)\.@<:@0-9@:>@@<:@0-9.@:>@*/\1/p'`
2004 bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* @<:@1-9@:>@@<:@0-9@:>@*\.\(@<:@0-9@:>@+\).*/\1/p'`
2005 if test "$bison_major_version" -lt 2 -o \
2006 \( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
2008 REENTRANT_PARSER="%pure-parser"
2010 REENTRANT_PARSER="%define api.pure"
2014 # We didn't find Bison; check for Berkeley YACC, under the
2015 # names byacc and yacc.
2017 AC_CHECK_PROGS(BISON_BYACC, byacc yacc)
2018 if test x"$BISON_BYACC" != x; then
2020 # Make sure this is Berkeley YACC, not AT&T YACC;
2021 # the latter doesn't support reentrant parsers.
2022 # Run it with "-V"; that succeeds and reports the
2023 # version number with Berkeley YACC, but will
2024 # (probably) fail with various vendor flavors
2027 # Hopefully this also eliminates any versions
2028 # of Berkeley YACC that don't support reentrant
2029 # parsers, if there are any.
2031 AC_CACHE_CHECK([for capable yacc], tcpdump_cv_capable_yacc,
2032 if $BISON_BYACC -V >/dev/null 2>&1; then
2033 tcpdump_cv_capable_yacc=yes
2035 tcpdump_cv_capable_yacc=insufficient
2037 if test $tcpdump_cv_capable_yacc = insufficient ; then
2038 AC_MSG_ERROR([$BISON_BYACC is insufficient to compile libpcap.
2039 libpcap requires Bison, a newer version of Berkeley YACC with support
2040 for reentrant parsers, or another YACC compatible with them.])
2044 # OK, we found neither byacc nor yacc.
2046 AC_MSG_ERROR([Neither bison, byacc, nor yacc was found.
2047 libpcap requires Bison, a newer version of Berkeley YACC with support
2048 for reentrant parsers, or another YACC compatible with them.])
2052 # Berkeley YACC doesn't support "%define api.pure", so use
2055 REENTRANT_PARSER="%pure-parser"
2057 AC_SUBST(BISON_BYACC)
2058 AC_SUBST(REENTRANT_PARSER)
2061 # Do various checks for various OSes and versions of those OSes.
2063 # Assume, by default, no support for shared libraries and V7/BSD
2064 # convention for man pages (devices in section 4, file formats in
2065 # section 5, miscellaneous info in section 7, administrative commands
2066 # and daemons in section 8). Individual cases can override this.
2072 MAN_ADMIN_COMMANDS=8
2076 dnl Workaround to enable certain features
2077 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
2080 # AIX makes it fun to build shared and static libraries,
2081 # because they're *both* ".a" archive libraries. We
2082 # build the static library for the benefit of the traditional
2083 # scheme of building libpcap and tcpdump in subdirectories of
2084 # the same directory, with tcpdump statically linked with the
2085 # libpcap in question, but we also build a shared library as
2086 # "libpcap.shareda" and install *it*, rather than the static
2087 # library, as "libpcap.a".
2095 # If we're using DLPI, applications will need to
2096 # use /lib/pse.exp if present, as we use the
2099 pseexe="/lib/pse.exp"
2100 AC_MSG_CHECKING(for $pseexe)
2101 if test -f $pseexe ; then
2109 # If we're using BPF, we need "-lodm" and "-lcfg", as
2110 # we use them to load the BPF module.
2119 V_CCOPT="$V_CCOPT -fno-common"
2120 AC_ARG_ENABLE(universal,
2121 AS_HELP_STRING([--disable-universal],[don't build universal on macOS]))
2122 if test "$enable_universal" != "no"; then
2127 # Pre-Tiger. Build only for 32-bit PowerPC; no
2128 # need for any special compiler or linker flags.
2132 darwin8.[[0123]]|darwin8.[[0123]].*)
2134 # Tiger, prior to Intel support. Build
2135 # libraries and executables for 32-bit PowerPC
2136 # and 64-bit PowerPC, with 32-bit PowerPC first.
2137 # (I'm guessing that's what Apple does.)
2139 # (The double brackets are needed because
2140 # autotools/m4 use brackets as a quoting
2141 # character; the double brackets turn into
2142 # single brackets in the generated configure
2145 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
2146 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
2147 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
2148 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
2151 darwin8.[[456]]|darwin8.[[456]].*)
2153 # Tiger, subsequent to Intel support but prior
2154 # to x86-64 support. Build libraries and
2155 # executables for 32-bit PowerPC, 64-bit
2156 # PowerPC, and 32-bit x86, with 32-bit PowerPC
2157 # first. (I'm guessing that's what Apple does.)
2159 # (The double brackets are needed because
2160 # autotools/m4 use brackets as a quoting
2161 # character; the double brackets turn into
2162 # single brackets in the generated configure
2165 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
2166 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
2167 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
2168 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
2173 # All other Tiger, so subsequent to x86-64
2174 # support. Build libraries and executables for
2175 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
2176 # and x86-64, with 32-bit PowerPC first. (I'm
2177 # guessing that's what Apple does.)
2179 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2180 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2181 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2182 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2187 # Leopard. Build libraries for 32-bit PowerPC,
2188 # 64-bit PowerPC, 32-bit x86, and x86-64, with
2189 # 32-bit PowerPC first, and build executables
2190 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
2191 # x86 first. (That's what Apple does.)
2193 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2194 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2195 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
2196 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
2201 # Snow Leopard. Build libraries for x86-64,
2202 # 32-bit x86, and 32-bit PowerPC, with x86-64
2203 # first, and build executables for x86-64 and
2204 # 32-bit x86, with x86-64 first. (That's what
2205 # Apple does, even though Snow Leopard doesn't
2206 # run on PPC, so PPC libpcap runs under Rosetta,
2207 # and Rosetta doesn't support BPF ioctls, so PPC
2208 # programs can't do live captures.)
2210 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
2211 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
2212 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
2213 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
2218 # Post-Snow Leopard, pre-Catalina. Build
2219 # libraries for x86-64 and 32-bit x86, with
2220 # x86-64 first, and build executables only for
2221 # x86-64. (That's what Apple does.) This
2222 # requires no special flags for programs.
2224 # We check whether we *can* build for i386 and,
2225 # if not, suggest that the user install the
2226 # /usr/include headers if they want to build
2229 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
2230 AC_LBL_SAVE_CHECK_STATE
2231 CFLAGS="$CFLAGS -arch i386"
2237 V_LIB_CCOPT_FAT="-arch x86_64"
2238 V_LIB_LDFLAGS_FAT="-arch x86_64"
2241 # OpenSSL installation on macOS seems
2242 # to install only the libs for 64-bit
2243 # x86 - at least that's what Brew does:
2244 # only configure 32-bit builds if we
2245 # don't have OpenSSL.
2247 if test "$HAVE_OPENSSL" != yes; then
2248 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
2249 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
2254 V_LIB_CCOPT_FAT="-arch x86_64"
2255 V_LIB_LDFLAGS_FAT="-arch x86_64"
2260 # Mojave; you need to install the
2261 # /usr/include headers to get
2262 # 32-bit x86 builds to work.
2264 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])
2269 # Pre-Mojave; the command-line
2270 # tools should be sufficient to
2271 # enable 32-bit x86 builds.
2273 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
2277 AC_LBL_RESTORE_CHECK_STATE
2282 # Catalina. Build libraries and executables
2283 # only for x86-64. (That's what Apple does;
2284 # 32-bit x86 binaries are not supported on
2287 V_LIB_CCOPT_FAT="-arch x86_64"
2288 V_LIB_LDFLAGS_FAT="-arch x86_64"
2289 V_PROG_CCOPT_FAT="-arch x86_64"
2290 V_PROG_LDFLAGS_FAT="-arch x86_64"
2295 # Post-Catalina. Build libraries and
2296 # executables for x86-64 and ARM64.
2297 # (That's what Apple does, except they
2298 # build for arm64e, which may include
2299 # some of the pointer-checking extensions.)
2301 # If we're building with libssl, make sure
2302 # we can build fat with it (i.e., that it
2303 # was built fat); if we can't, don't set
2304 # the target architectures, and just
2305 # build for the host we're on.
2307 # Otherwise, just add both of them.
2309 if test "$HAVE_OPENSSL" = yes; then
2310 AC_MSG_CHECKING(whether building fat with libssl is supported)
2311 AC_LBL_SAVE_CHECK_STATE
2312 CFLAGS="$CFLAGS -arch x86_64 -arch arm64"
2313 LDFLAGS="$LDFLAGS $OPENSSL_LIBS"
2316 #include <openssl/ssl.h>
2324 V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
2325 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2326 V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
2327 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2331 AC_LBL_RESTORE_CHECK_STATE
2333 V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
2334 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2335 V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
2336 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2344 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
2347 # Use System V conventions for man pages.
2349 MAN_ADMIN_COMMANDS=1m
2357 # Use System V conventions for man pages.
2359 MAN_ADMIN_COMMANDS=1m
2367 # Use System V conventions for man pages.
2369 MAN_ADMIN_COMMANDS=1m
2375 dnl HPUX 10.20 and above is similar to HPUX 9, but
2376 dnl not the same....
2378 dnl XXX - DYEXT should be set to "sl" if this is building
2379 dnl for 32-bit PA-RISC, but should be left as "so" for
2380 dnl 64-bit PA-RISC or, I suspect, IA-64.
2381 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2382 if test "`uname -m`" = "ia64"; then
2389 # "-b" builds a shared library; "+h" sets the soname.
2395 # Use System V conventions for man pages.
2403 # Use IRIX conventions for man pages; they're the same as the
2404 # System V conventions, except that they use section 8 for
2405 # administrative commands and daemons.
2411 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2419 # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
2420 # Use Tru64 UNIX conventions for man pages; they're the same as
2421 # the System V conventions except that they use section 8 for
2422 # administrative commands and daemons.
2430 AC_MSG_CHECKING(if SINIX compiler defines sinix)
2431 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
2435 ac_cv_cc_sinix_defined=yes,
2436 ac_cv_cc_sinix_defined=no))
2437 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
2438 if test $ac_cv_cc_sinix_defined = no ; then
2439 AC_DEFINE(sinix,1,[on sinix])
2444 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
2449 # Make sure errno is thread-safe, in case we're called in
2450 # a multithreaded program. We don't guarantee that two
2451 # threads can use the *same* pcap_t safely, but the
2452 # current version does guarantee that you can use different
2453 # pcap_t's in different threads, and even that pcap_compile()
2454 # is thread-safe (it wasn't thread-safe in some older versions).
2456 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2458 case "`uname -r`" in
2465 # Use System V conventions for man pages.
2467 MAN_ADMIN_COMMANDS=1m
2474 AC_SUBST(V_LIB_CCOPT_FAT)
2475 AC_SUBST(V_LIB_LDFLAGS_FAT)
2476 AC_SUBST(V_PROG_CCOPT_FAT)
2477 AC_SUBST(V_PROG_LDFLAGS_FAT)
2479 AC_SUBST(MAN_DEVICES)
2480 AC_SUBST(MAN_FILE_FORMATS)
2481 AC_SUBST(MAN_MISC_INFO)
2482 AC_SUBST(MAN_ADMIN_COMMANDS)
2484 AC_ARG_ENABLE(shared,
2485 AS_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2486 test "x$enable_shared" = "xno" && DYEXT="none"
2489 AC_CHECK_TOOL([AR], [ar])
2494 AC_LBL_DEVEL(V_CCOPT)
2497 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2499 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2501 #include <sys/types.h>
2502 #include <sys/socket.h>
2506 # Check to see if there's a sockaddr_storage structure.
2508 AC_CHECK_TYPES(struct sockaddr_storage,,,
2510 #include <sys/types.h>
2511 #include <sys/socket.h>
2515 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
2516 # dl_module_id_1 member.
2518 # NOTE: any failure means we conclude that it doesn't have that member,
2519 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
2520 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
2521 # it doesn't have that member (which is OK, as either we won't be
2522 # using code that would use that member, or we wouldn't compile in
2525 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
2527 #include <sys/types.h>
2528 #include <sys/dlpi.h>
2529 #include <sys/dlpi_ext.h>
2533 # Various Linux-specific mechanisms.
2535 AC_ARG_ENABLE([usb],
2536 [AS_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
2541 # If somebody requested an XXX-only pcap, that doesn't include
2542 # additional mechanisms.
2544 if test "xxx_only" != yes; then
2547 dnl check for USB sniffing support
2548 AC_MSG_CHECKING(for Linux usbmon USB sniffing support)
2549 if test "x$enable_usb" != "xno" ; then
2550 AC_DEFINE(PCAP_SUPPORT_LINUX_USBMON, 1, [target host supports Linux usbmon for USB sniffing])
2551 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2554 # Note: if the directory for special files is *EVER* somewhere
2555 # other than the UN*X standard of /dev (which will break any
2556 # software that looks for /dev/null or /dev/tty, for example,
2557 # so doing that is *REALLY* not a good idea), please provide
2558 # some mechanism to determine that directory at *run time*,
2559 # rather than *configure time*, so that it works when doinga
2560 # a cross-build, and that works with *multiple* distributions,
2561 # with our without udev, and with multiple versions of udev,
2562 # with udevinfo or udevadm or any other mechanism to get the
2563 # special files directory.
2565 # Do we have a version of <linux/compiler.h> available?
2566 # If so, we might need it for <linux/usbdevice_fs.h>.
2568 AC_CHECK_HEADERS(linux/compiler.h)
2569 if test "$ac_cv_header_linux_compiler_h" = yes; then
2571 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2573 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2575 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2577 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2579 # OK, does it define bRequestType? Older versions of the kernel
2580 # define fields with names like "requesttype, "request", and
2581 # "value", rather than "bRequestType", "bRequest", and
2584 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2587 #ifdef HAVE_LINUX_COMPILER_H
2588 #include <linux/compiler.h>
2590 #include <linux/usbdevice_fs.h>
2598 # Life's too short to deal with trying to get this to compile
2599 # if you don't get the right types defined with
2600 # __KERNEL_STRICT_NAMES getting defined by some other include.
2602 # Check whether the includes Just Work. If not, don't turn on
2603 # netfilter support.
2605 AC_MSG_CHECKING(whether we can compile the netfilter support)
2606 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2609 #include <sys/socket.h>
2610 #include <netinet/in.h>
2611 #include <linux/types.h>
2613 #include <linux/netlink.h>
2614 #include <linux/netfilter.h>
2615 #include <linux/netfilter/nfnetlink.h>
2616 #include <linux/netfilter/nfnetlink_log.h>
2617 #include <linux/netfilter/nfnetlink_queue.h>],
2619 ac_cv_netfilter_can_compile=yes,
2620 ac_cv_netfilter_can_compile=no))
2621 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2622 if test $ac_cv_netfilter_can_compile = yes ; then
2623 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2624 [target host supports netfilter sniffing])
2625 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2630 AC_SUBST(PCAP_SUPPORT_LINUX_USBMON)
2631 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2633 AC_ARG_ENABLE([netmap],
2634 [AS_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2636 [enable_netmap=yes])
2638 if test "x$enable_netmap" != "xno" ; then
2640 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2641 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2642 # is defined, for example, as it includes a non-existent malloc.h
2645 AC_MSG_CHECKING(whether we can compile the netmap support)
2646 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2649 #define NETMAP_WITH_LIBS
2650 #include <net/netmap_user.h>],
2652 ac_cv_net_netmap_user_can_compile=yes,
2653 ac_cv_net_netmap_user_can_compile=no))
2654 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2655 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2656 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2657 [target host supports netmap])
2658 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2660 AC_SUBST(PCAP_SUPPORT_NETMAP)
2663 # Check for DPDK support.
2665 AS_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2667 if test "$withval" = no
2669 # User doesn't want DPDK support.
2671 elif test "$withval" = yes
2673 # User wants DPDK support but hasn't specified a directory.
2676 # User wants DPDK support and has specified a directory,
2677 # so use the provided value.
2682 if test "$V_PCAP" = dpdk; then
2683 # User requested DPDK-only libpcap, so we'd better have
2686 elif test "xxx_only" = yes; then
2687 # User requested something-else-only pcap, so they don't
2688 # want DPDK support.
2692 # Use DPDK API if present, otherwise don't
2698 if test "$want_dpdk" != no; then
2700 # The user didn't explicitly say they don't want DPDK,
2701 # so see if we have it.
2703 # We only try to find it using pkg-config; DPDK is *SO*
2704 # complicated - DPDK 19.02, for example, has about 117(!)
2705 # libraries, and the precise set of libraries required has
2706 # changed over time - so attempting to guess which libraries
2707 # you need, and hardcoding that in an attempt to find the
2708 # libraries without DPDK, rather than relying on DPDK to
2709 # tell you, with a .pc file, what libraries are needed,
2710 # is *EXTREMELY* fragile and has caused some bug reports,
2711 # so we're just not going to do it.
2713 # If that causes a problem, the only thing we will do is
2714 # accept an alternative way of finding the appropriate
2715 # library set for the installed version of DPDK that is
2716 # as robust as pkg-config (i.e., it had better work as well
2717 # as pkg-config with *ALL* versions of DPDK that provide a
2720 # If --with-dpdk={path} was specified, add {path}/pkgconfig
2721 # to PKG_CONFIG_PATH, so we look for the .pc file there,
2724 save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
2725 if test -n "$dpdk_dir"; then
2726 PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
2728 PKG_CHECK_MODULES(DPDK, libdpdk,
2732 PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
2737 if test "$found_dpdk" = yes; then
2741 # We call rte_eth_dev_count_avail(), and older versions
2742 # of DPDK didn't have it, so check for it.
2744 AC_LBL_SAVE_CHECK_STATE
2745 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2746 LIBS="$LIBS $DPDK_LIBS"
2747 AC_CHECK_FUNC(rte_eth_dev_count_avail)
2748 AC_LBL_RESTORE_CHECK_STATE
2751 if test "$ac_cv_func_rte_eth_dev_count_avail" = yes; then
2753 # We found a usable DPDK.
2755 # Check whether the rte_ether.h file defines
2756 # struct ether_addr or struct rte_ether_addr.
2758 # ("API compatibility? That's for losers!")
2760 AC_LBL_SAVE_CHECK_STATE
2761 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2762 LIBS="$LIBS $DPDK_LIBS"
2763 AC_CHECK_TYPES(struct rte_ether_addr,,,
2765 #include <rte_ether.h>
2767 AC_LBL_RESTORE_CHECK_STATE
2770 # We can build with DPDK.
2772 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2773 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DPDK_LIBS"
2774 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DPDK_LIBS_STATIC"
2775 REQUIRES_PRIVATE="$REQUIRES_PRIVATE libdpdk"
2776 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2777 if test $V_PCAP != dpdk ; then
2778 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2782 # We didn't find a usable DPDK.
2783 # If we required it (with --with-dpdk or --with-pcap=dpdk),
2784 # fail with an appropriate message telling the user what
2785 # the problem was, otherwise note the problem with a
2788 if test "$found_dpdk" != yes; then
2790 # Not found with pkg-config. Note that we
2791 # require that DPDK must be findable with
2794 if test "$V_PCAP" = dpdk; then
2796 # User requested DPDK-only capture support.
2799 [DPDK support requested with --with-pcap=dpdk, but
2800 we couldn't find DPDK with pkg-config. Make sure that pkg-config is
2801 installed, that DPDK 18.02.2 or later is installed, and that DPDK
2802 provides a .pc file.])
2805 if test "$want_dpdk" = yes; then
2807 # User requested that libpcap include
2808 # DPDK capture support.
2811 [DPDK support requested with --with-dpdk, but we
2812 couldn't find DPDK with pkg-config. Make sure that pkg-config
2813 is installed, that DPDK 18.02.2 or later is installed, and that
2814 DPDK provides .pc file.])
2818 # User didn't indicate whether they wanted DPDK
2819 # or not; just warn why we didn't find it.
2822 [We couldn't find DPDK with pkg-config. If
2823 you want DPDK support, make sure that pkg-config is installed,
2824 that DPDK 18.02.2 or later is installed, and that DPDK provides a
2826 elif test "$ac_cv_func_rte_eth_dev_count_avail" != yes; then
2828 # Found with pkg-config, but we couldn't compile
2829 # a program that calls rte_eth_dev_count(); we
2830 # probably have the developer package installed,
2831 # but don't have a sufficiently recent version
2832 # of DPDK. Note that we need a sufficiently
2833 # recent version of DPDK.
2835 if test "$V_PCAP" = dpdk; then
2837 # User requested DPDK-only capture support.
2840 [DPDK support requested with --with-pcap=dpdk, but we
2841 can't compile libpcap with DPDK. Make sure that DPDK 18.02.2 or later
2845 if test "$want_dpdk" = yes; then
2847 # User requested that libpcap include
2848 # DPDK capture support.
2851 [DPDK support requested with --with-dpdk, but
2852 we can't compile libpcap with DPDK. Make sure that DPDK 18.02.2
2853 or later is DPDK is installed.])
2857 # User didn't indicate whether they wanted DPDK
2858 # or not; just warn why we didn't find it.
2861 [DPDK was found, but we can't compile libpcap with it.
2862 Make sure that DPDK 18.02.2 or later is installed.])
2866 AC_SUBST(PCAP_SUPPORT_DPDK)
2868 AC_ARG_ENABLE([bluetooth],
2869 [AS_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2871 [enable_bluetooth=ifsupportavailable])
2873 if test "xxx_only" = yes; then
2874 # User requested something-else-only pcap, so they don't
2875 # want Bluetooth support.
2879 if test "x$enable_bluetooth" != "xno" ; then
2880 dnl check for Bluetooth sniffing support
2883 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2886 # We have bluetooth.h, so we support Bluetooth
2889 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2890 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2891 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2892 ac_lbl_bluetooth_available=yes
2895 # OK, does struct sockaddr_hci have an hci_channel
2898 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2901 # Yes; is HCI_CHANNEL_MONITOR defined?
2903 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2904 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2907 #include <bluetooth/bluetooth.h>
2908 #include <bluetooth/hci.h>
2911 u_int i = HCI_CHANNEL_MONITOR;
2915 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
2916 [target host supports Bluetooth Monitor])
2917 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2924 #include <bluetooth/bluetooth.h>
2925 #include <bluetooth/hci.h>
2930 # We don't have bluetooth.h, so we don't support
2931 # Bluetooth sniffing.
2933 if test "x$enable_bluetooth" = "xyes" ; then
2934 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2936 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
2941 if test "x$enable_bluetooth" = "xyes" ; then
2942 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2944 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2948 AC_SUBST(PCAP_SUPPORT_BT)
2951 AC_ARG_ENABLE([dbus],
2952 [AS_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2954 [enable_dbus=ifavailable])
2956 if test "xxx_only" = yes; then
2957 # User requested something-else-only pcap, so they don't
2958 # want D-Bus support.
2962 if test "x$enable_dbus" != "xno"; then
2963 if test "x$enable_dbus" = "xyes"; then
2968 # We don't support D-Bus sniffing on macOS; see
2970 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2972 # The user requested it, so fail.
2974 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2981 # We don't support D-Bus sniffing on macOS; see
2983 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2985 # The user dind't explicitly request it, so just
2986 # silently refuse to enable it.
2994 if test "x$enable_dbus" != "xno"; then
2995 PKG_CHECK_MODULES(DBUS, dbus-1,
2997 AC_LBL_SAVE_CHECK_STATE
2998 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2999 LIBS="$LIBS $DBUS_LIBS"
3000 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
3002 [#include <string.h>
3005 #include <sys/time.h>
3007 #include <dbus/dbus.h>],
3008 [return dbus_connection_read_write(NULL, 0);],
3010 AC_MSG_RESULT([yes])
3011 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
3012 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
3013 V_INCLS="$V_INCLS $DBUS_CFLAGS"
3014 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DBUS_LIBS"
3015 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DBUS_LIBS_STATIC"
3016 REQUIRES_PRIVATE="$REQUIRES_PRIVATE dbus-1"
3020 if test "x$enable_dbus" = "xyes"; then
3021 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
3024 AC_LBL_RESTORE_CHECK_STATE
3027 if test "x$enable_dbus" = "xyes"; then
3028 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
3031 AC_SUBST(PCAP_SUPPORT_DBUS)
3034 AC_ARG_ENABLE([rdma],
3035 [AS_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
3037 [enable_rdma=ifavailable])
3039 if test "xxx_only" = yes; then
3040 # User requested something-else-only pcap, so they don't
3041 # want RDMA support.
3045 if test "x$enable_rdma" != "xno"; then
3046 PKG_CHECK_MODULES(LIBIBVERBS, libibverbs,
3048 found_libibverbs=yes
3049 LIBIBVERBS_REQUIRES_PRIVATE="libibverbs"
3052 if test "x$found_libibverbs" != "xyes"; then
3053 AC_CHECK_LIB(ibverbs, ibv_get_device_list,
3055 found_libibverbs=yes
3056 LIBIBVERBS_CFLAGS=""
3057 LIBIBVERBS_LIBS="-libverbs"
3058 # XXX - at least on Ubuntu 20.04, there are many more
3059 # libraries needed; is there any platform where
3060 # libibverbs is available but where pkg-config isn't
3061 # available or libibverbs doesn't use it? If not,
3062 # we should only use pkg-config for it.
3063 LIBIBVERBS_LIBS_STATIC="-libverbs"
3064 LIBIBVERBS_LIBS_PRIVATE="-libverbs"
3069 if test "x$found_libibverbs" = "xyes"; then
3070 AC_LBL_SAVE_CHECK_STATE
3071 CFLAGS="$CFLAGS $LIBIBVERBS_CFLAGS"
3072 LIBS="$LIBS $LIBIBVERBS_LIBS"
3073 AC_CHECK_HEADER(infiniband/verbs.h, [
3075 # ibv_create_flow may be defined as a static inline
3076 # function in infiniband/verbs.h, so we can't
3079 # Too bad autoconf has no AC_SYMBOL_EXISTS()
3080 # macro that works like CMake's check_symbol_exists()
3081 # function, to check do a compile check like
3082 # this (they do a clever trick to avoid having
3083 # to know the function's signature).
3085 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
3088 #include <infiniband/verbs.h>
3091 (void) ibv_create_flow((struct ibv_qp *) NULL,
3092 (struct ibv_flow_attr *) NULL);
3095 AC_MSG_RESULT([yes])
3096 found_usable_libibverbs=yes
3103 AC_LBL_RESTORE_CHECK_STATE
3106 if test "x$found_usable_libibverbs" = "xyes"
3108 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
3109 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
3110 CFLAGS="$LIBIBVERBS_CFLAGS $CFLAGS"
3111 ADDITIONAL_LIBS="$LIBIBVERBS_LIBS $ADDITIONAL_LIBS"
3112 ADDITIONAL_LIBS_STATIC="$LIBIBVERBS_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
3113 LIBS_PRIVATE="$LIBIBVERBS_LIBS_PRIVATE $LIBS_PRIVATE"
3114 REQUIRES_PRIVATE="$REQUIRES_PRIVATE $LIBIBVERBS_REQUIRES_PRIVATE"
3116 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
3120 # If this is a platform where we need to have the .pc file and
3121 # pcap-config script supply an rpath option to specify the directory
3122 # in which the libpcap shared library is installed, and the install
3123 # prefix /usr (meaning we're not installing a system library), provide
3126 # (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
3127 # case - for example, Linux distributions for 64-bit platforms that
3128 # also provide support for binaries for a 32-bit version of the
3129 # platform may put the 64-bit libraries, the 32-bit libraries, or both
3130 # in directories other than /usr/lib.)
3132 # In AIX, do we have to do this?
3134 # In Darwin-based OSes, the full paths of the shared libraries with
3135 # which the program was linked are stored in the executable, so we don't
3136 # need to provide an rpath option.
3138 # With the HP-UX linker, directories specified with -L are, by default,
3139 # added to the run-time search path, so we don't need to supply them.
3141 # For Tru64 UNIX, "-rpath" works with DEC's^WCompaq's^WHP's C compiler
3142 # for Alpha, but isn't documented as working with GCC, and no GCC-
3143 # compatible option is documented as working with the DEC compiler.
3144 # If anybody needs this on Tru64/Alpha, they're welcome to figure out a
3145 # way to make it work.
3147 # This must *not* depend on the compiler, as, on platforms where there's
3148 # a GCC-compatible compiler and a vendor compiler, we need to work with
3151 if test "$prefix" != "/usr"; then
3154 freebsd*|netbsd*|openbsd*|dragonfly*|linux*|haiku*|midipix*|gnu*)
3156 # Platforms where the "native" C compiler is GCC or
3157 # accepts compatible command-line arguments, and the
3158 # "native" linker is the GNU linker or accepts
3159 # compatible command-line arguments.
3161 RPATH="-Wl,-rpath,\${libdir}"
3166 # Sun/Oracle's linker, the GNU linker, and
3167 # GNU-compatible linkers all support -R.
3169 RPATH="-Wl,-R,\${libdir}"
3176 AC_CONFIG_HEADER(config.h)
3178 AC_SUBST(V_SHLIB_CCOPT)
3179 AC_SUBST(V_SHLIB_CMD)
3180 AC_SUBST(V_SHLIB_OPT)
3181 AC_SUBST(V_SONAME_OPT)
3184 AC_SUBST(ADDLARCHIVEOBJS)
3185 AC_SUBST(PLATFORM_C_SRC)
3186 AC_SUBST(PLATFORM_CXX_SRC)
3187 AC_SUBST(MODULE_C_SRC)
3188 AC_SUBST(REMOTE_C_SRC)
3189 AC_SUBST(PTHREAD_LIBS)
3190 AC_SUBST(BUILD_RPCAPD)
3191 AC_SUBST(INSTALL_RPCAPD)
3192 AC_SUBST(RPCAPD_LIBS)
3195 # We're done with configuration operations; add ADDITIONAL_LIBS and
3196 # ADDITIONAL_LIBS_STATIC to LIBS and LIBS_STATIC, respectively.
3198 LIBS="$ADDITIONAL_LIBS $LIBS"
3199 LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $LIBS_STATIC"
3201 AC_OUTPUT_COMMANDS([if test -f .devel; then
3202 echo timestamp > stamp-h
3203 cat $srcdir/Makefile-devel-adds >> Makefile
3204 make depend || exit 1
3206 AC_OUTPUT(Makefile grammar.y pcap-filter.manmisc pcap-linktype.manmisc
3207 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
3208 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
3209 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
3210 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
3211 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
3212 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
3213 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile