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
21 [m4_esyscmd_s(cat VERSION)],
22 [https://github.com/the-tcpdump-group/libpcap/issues],
24 [https://www.tcpdump.org/])
25 AC_CONFIG_SRCDIR(pcap.c)
26 AC_SUBST(PACKAGE_NAME)
29 # These are the variables that are used in Makefile, pcap-config, and
32 # CFLAGS: inherited from the environment, not modified by us except
33 # for flags required for the platform for which we're building (and
34 # except temporarily during tests that involve compilation). Used only
35 # when compiling C source.
37 # LDFLAGS: inherited from the environment, not modified by us.
39 # LIBS: inherited from the environment; we add libraries required by
40 # libpcap. Libraries that the core libpcap code requires are added
41 # first; libraries required by additional pcap modules are first
42 # added to ADDITIONAL_LIBS, and only added to LIBS at the end, after
43 # we're finished doing configuration tests for the modules.
45 # LIBS_STATIC: libraries with which a program using the libpcap *static*
46 # library needs to be linked. This is a superset of LIBS, used in
47 # pcap-config, so that "pcap-config --libs --static" will report them.
48 # Initialized to LIBS.
50 # REQUIRES_PRIVATE: pkg-config package names for additional libraries
51 # with which a program using the libpcap *static* library needs to be
52 # linked and for which a .pc file exists. This is used in libpcap.pc,
53 # so that "pkg-config --libs --static" will report them, and so that
54 # those libraries will be determined using the library's .pc file, not
55 # from our .pc file. Initialized to an empty string.
57 # V_CCOPT: additional compiler flags other than -I and -D flags
58 # needed when compiling libpcap. Used in Makefile for both C and
61 # V_DEFS: additional -D compiler flags needed when compiling
62 # libpcap. Used in Makefile for both C and C++ source.
64 # V_INCLS: additional -I compiler flags needed when compiling
65 # libpcap. Used in Makefile for both C and C++ source.
67 # ADDITIONAL_LIBS: additional libraries with which the libpcap dynamic
68 # library needs to be linked. Used in Makefile; not used in pcap-config
69 # or libpcap.pc, as, in all platforms on which we run, if a dynamic
70 # library is linked with other dynamic libraries, a program using
71 # that dynamic library doesn't have to link with those libraries -
72 # they will be automatically loaded at run time. Initialized to an
75 # ADDITIONAL_LIBS_STATIC: additional libraries with which a program
76 # using the libpcap *static* library needs to be linked. This is used
77 # in pcap-config, so that "pcap-config --libs --static" will report
78 # them. Initialized to an empty string.
80 # REQUIRES_PRIVATE: pkg-config package names for additional libraries
81 # with which a program using the libpcap *static* library needs to be
82 # linked and for which a .pc file exists. This is used in libpcap.pc,
83 # so that "pkg-config --libs --static" will report them, and so that
84 # those libraries will be determined using the library's .pc file, not
85 # from our .pc file. Initialized to an empty string.
87 # LIBS_PRIVATE: pkg-config package names for additional libraries with
88 # which a program using the libpcap *static* library needs to be linked
89 # and for which a .pc file does not exist. This is used in libpcap.pc,
90 # so that "pkg-config --libs --static" will report them (those libraries
91 # cannot be determined using the library's .pc file, as there is no such
92 # file, so it has to come from our .pc file. Initialized to an empty
102 AC_SUBST(LIBS_STATIC)
103 AC_SUBST(REQUIRES_PRIVATE)
104 AC_SUBST(LIBS_PRIVATE)
108 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
110 # We require C99 or later.
111 # Try to get it, which may involve adding compiler flags;
112 # if that fails, give up.
115 if test "$ac_cv_prog_cc_c99" = "no"; then
116 AC_MSG_WARN([The C compiler does not support C99; there may be compiler errors])
120 # Try to arrange for large file support.
126 # Get the size of a void *, to determine whether this is a 32-bit
129 AC_CHECK_SIZEOF([void *])
130 ac_lbl_c_sizeof_void_p="$ac_cv_sizeof_void_p"
133 # Get the size of a time_t, to know whether it's 32-bit or 64-bit.
135 AC_CHECK_SIZEOF([time_t],,[#include <time.h>])
137 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
142 # Check whether the platform for which we're compiling requires extra
143 # defines and libraries. If so, add them to CFLAGS and LIBS, as we want
144 # all subsequent tests to be done with those defines and libraries.
149 # Haiku needs _BSD_SOURCE for the _IO* macros because it doesn't
152 CFLAGS="$CFLAGS -D_BSD_SOURCE"
155 # Haiku has getpass() in libbsd.
161 # Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
162 # dl_module_id_1 member.
163 # (This is the case on HP-UX B.11.31.)
165 # NOTE: any failure means we conclude that it doesn't have that member,
166 # so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or
167 # have one that doesn't declare a dl_hp_ppa_info_t type, we conclude
168 # it doesn't have that member (which is OK, as either we won't be
169 # using code that would use that member, or we wouldn't compile in
172 AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,,
174 #include <sys/types.h>
175 #include <sys/dlpi.h>
176 #include <sys/dlpi_ext.h>
180 # On HP-UX DLPI needs putmsg(), which previously was in libstr, but in
181 # HP-UX B.11.31 this is no longer the case.
182 # AC_SEARCH_LIBS() accounts for that.
184 AC_SEARCH_LIBS([putmsg], [str])
188 AC_CHECK_FUNC(strerror_r,
191 # We have strerror_r; if we define _GNU_SOURCE, is it a
192 # POSIX-compliant strerror_r() or a GNU strerror_r()?
194 AC_MSG_CHECKING(whether strerror_r is GNU-style)
201 /* Define it GNU-style; that will cause an error if it's not GNU-style */
202 extern char *strerror_r(int, char *, size_t);
214 AC_DEFINE(HAVE_GNU_STRERROR_R, 1,
215 [Define to 1 if you have a GNU-style `strerror_r' function.])
219 AC_DEFINE(HAVE_POSIX_STRERROR_R, 1,
220 [Define to 1 if you have a POSIX-style `strerror_r' function.])
225 # We don't have strerror_r; do we have _wcserror_s?
227 AC_CHECK_FUNCS(_wcserror_s)
231 # Require a proof of suitable snprintf(3), same as in tcpdump.
233 AC_MSG_CHECKING([whether snprintf is suitable])
239 #include <inttypes.h>
240 #include <sys/types.h>
242 #if defined(_WIN32) && !defined(_SSIZE_T_DEFINED)
244 * On UN*Xes, this is a signed integer type of the same size as size_t.
246 * It's not defined by Visual Studio; we assume that ptrdiff_t will
247 * be a type that is a signed integer type of the same size as size_t.
249 typedef ptrdiff_t ssize_t;
253 * Avoid trying to cast negative values to unsigned types, or doing
254 * shifts of signed types, in order not to have the test program fail
255 * if we're building with undefined-behavior sanitizers enabled.
260 unsigned int ui = sizeof(buf);
262 int64_t i64 = INT64_C(0x100000000);
263 uint64_t ui64 = UINT64_C(0x100000000);
265 snprintf(buf, sizeof(buf), "%zu", (size_t)ui);
266 if (strncmp(buf, "100", sizeof(buf)))
269 snprintf(buf, sizeof(buf), "%zd", (ssize_t)(-i));
270 if (strncmp(buf, "-100", sizeof(buf)))
273 snprintf(buf, sizeof(buf), "%" PRId64, -i64);
274 if (strncmp(buf, "-4294967296", sizeof(buf)))
277 snprintf(buf, sizeof(buf), "0o%" PRIo64, ui64);
278 if (strncmp(buf, "0o40000000000", sizeof(buf)))
281 snprintf(buf, sizeof(buf), "0x%" PRIx64, ui64);
282 if (strncmp(buf, "0x100000000", sizeof(buf)))
285 snprintf(buf, sizeof(buf), "%" PRIu64, ui64);
286 if (strncmp(buf, "4294967296", sizeof(buf)))
299 [The snprintf(3) implementation in this libc is not suitable,
300 libpcap would not work correctly even if it managed to compile.])
303 AC_MSG_RESULT(not while cross-compiling)
308 AC_CHECK_FUNCS(vasprintf asprintf,,
310 if test $needasprintf = yes; then
311 AC_LIBOBJ([asprintf])
315 AC_CHECK_FUNCS(strlcat,,
317 if test $needstrlcat = yes; then
322 AC_CHECK_FUNCS(strlcpy,,
324 if test $needstrlcpy = yes; then
329 AC_CHECK_FUNCS(strtok_r,,
331 if test $needstrtok_r = yes; then
332 AC_LIBOBJ([strtok_r])
336 # Do this before checking for ether_hostton(), as it's a
337 # "getaddrinfo()-ish function".
342 # Check for reentrant versions of getnetbyname_r(), as provided by
343 # Linux (glibc), Solaris, and AIX (with three different APIs!).
344 # If we don't find one, we just use getnetbyname(), which uses
345 # thread-specific data on many platforms, but doesn't use it on
346 # NetBSD or OpenBSD, and may not use it on older versions of other
349 # Only do the check if we have a declaration of getnetbyname_r();
350 # without it, we can't check which API it has. (We assume that
351 # if there's a declaration, it has a prototype, so that the API
354 AC_CHECK_DECL(getnetbyname_r,
356 AC_MSG_CHECKING([for the Linux getnetbyname_r()])
357 AC_LINK_IFELSE([AC_LANG_PROGRAM(
358 [[#include <netdb.h>]],
360 struct netent netent_buf;
362 struct netent *resultp;
365 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval);
369 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1,
370 [define if we have the Linux getnetbyname_r()])
375 AC_MSG_CHECKING([for Solaris getnetbyname_r()])
376 AC_LINK_IFELSE([AC_LANG_PROGRAM(
377 [[#include <netdb.h>]],
379 struct netent netent_buf;
382 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL;
386 AC_DEFINE(HAVE_SOLARIS_GETNETBYNAME_R, 1,
387 [define if we have the Solaris getnetbyname_r()])
392 AC_MSG_CHECKING([for AIX getnetbyname_r()])
393 AC_LINK_IFELSE([AC_LANG_PROGRAM(
394 [[#include <netdb.h>]],
396 struct netent netent_buf;
397 struct netent_data net_data;
399 return getnetbyname_r((const char *)0, &netent_buf, &net_data);
403 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1,
404 [define if we have the AIX getnetbyname_r()])
411 ],,[#include <netdb.h>])
414 # Check for reentrant versions of getprotobyname_r(), as provided by
415 # Linux (glibc), Solaris, and AIX (with three different APIs!).
416 # If we don't find one, we just use getprotobyname(), which uses
417 # thread-specific data on many platforms, but doesn't use it on
418 # NetBSD or OpenBSD, and may not use it on older versions of other
421 # Only do the check if we have a declaration of getprotobyname_r();
422 # without it, we can't check which API it has. (We assume that
423 # if there's a declaration, it has a prototype, so that the API
426 AC_CHECK_DECL(getprotobyname_r,
428 AC_MSG_CHECKING([for the Linux getprotobyname_r()])
429 AC_LINK_IFELSE([AC_LANG_PROGRAM(
430 [[#include <netdb.h>]],
432 struct protoent protoent_buf;
434 struct protoent *resultp;
436 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp);
440 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1,
441 [define if we have the Linux getprotobyname_r()])
446 AC_MSG_CHECKING([for Solaris getprotobyname_r()])
447 AC_LINK_IFELSE([AC_LANG_PROGRAM(
448 [[#include <netdb.h>]],
450 struct protoent protoent_buf;
453 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL;
457 AC_DEFINE(HAVE_SOLARIS_GETPROTOBYNAME_R, 1,
458 [define if we have the Solaris getprotobyname_r()])
463 AC_MSG_CHECKING([for AIX getprotobyname_r()])
464 AC_LINK_IFELSE([AC_LANG_PROGRAM(
465 [[#include <netdb.h>]],
467 struct protoent protoent_buf;
468 struct protoent_data proto_data;
470 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data);
474 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1,
475 [define if we have the AIX getprotobyname_r()])
482 ],,[#include <netdb.h>])
485 # You are in a twisty little maze of UN*Xes, all different.
486 # Some might not have ether_hostton().
487 # Some might have it and declare it in <net/ethernet.h>.
488 # Some might have it and declare it in <netinet/ether.h>
489 # Some might have it and declare it in <sys/ethernet.h>.
490 # Some might have it and declare it in <arpa/inet.h>.
491 # Some might have it and declare it in <netinet/if_ether.h>.
492 # Some might have it and not declare it in any header file.
494 # Before you is a C compiler.
496 AC_CHECK_FUNCS(ether_hostton)
497 if test "$ac_cv_func_ether_hostton" = yes; then
499 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>?
501 # This test fails if we don't have <net/ethernet.h> or if we do
502 # but it doesn't declare ether_hostton().
504 AC_CHECK_DECL(ether_hostton,
506 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON, 1,
507 [Define to 1 if net/ethernet.h declares `ether_hostton'])
510 #include <net/ethernet.h>
515 if test "$ac_cv_have_decl_ether_hostton" != yes; then
517 # No, how about <netinet/ether.h>, as on Linux?
519 # This test fails if we don't have <netinet/ether.h>
520 # or if we do but it doesn't declare ether_hostton().
522 # Unset ac_cv_have_decl_ether_hostton so we don't
523 # treat the previous failure as a cached value and
524 # suppress the next test.
526 unset ac_cv_have_decl_ether_hostton
527 AC_CHECK_DECL(ether_hostton,
529 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON, 1,
530 [Define to 1 if netinet/ether.h declares `ether_hostton'])
533 #include <netinet/ether.h>
539 if test "$ac_cv_have_decl_ether_hostton" != yes; then
541 # No, how about <sys/ethernet.h>, as on Solaris 10
544 # This test fails if we don't have <sys/ethernet.h>
545 # or if we do but it doesn't declare ether_hostton().
547 # Unset ac_cv_have_decl_ether_hostton so we don't
548 # treat the previous failure as a cached value and
549 # suppress the next test.
551 unset ac_cv_have_decl_ether_hostton
552 AC_CHECK_DECL(ether_hostton,
554 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON, 1,
555 [Define to 1 if sys/ethernet.h declares `ether_hostton'])
558 #include <sys/ethernet.h>
564 if test "$ac_cv_have_decl_ether_hostton" != yes; then
566 # No, how about <arpa/inet.h>, as in AIX?
568 # This test fails if we don't have <arpa/inet.h>
569 # (if we have ether_hostton(), we should have
570 # networking, and if we have networking, we should
571 # have <arpa/inet.h>) or if we do but it doesn't
572 # declare ether_hostton().
574 # Unset ac_cv_have_decl_ether_hostton so we don't
575 # treat the previous failure as a cached value and
576 # suppress the next test.
578 unset ac_cv_have_decl_ether_hostton
579 AC_CHECK_DECL(ether_hostton,
581 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON, 1,
582 [Define to 1 if arpa/inet.h declares `ether_hostton'])
585 #include <arpa/inet.h>
591 if test "$ac_cv_have_decl_ether_hostton" != yes; then
593 # No, how about <netinet/if_ether.h>?
594 # On some platforms, it requires <net/if.h> and
595 # <netinet/in.h>, and we always include it with
596 # both of them, so test it with both of them.
598 # This test fails if we don't have <netinet/if_ether.h>
599 # and the headers we include before it, or if we do but
600 # <netinet/if_ether.h> doesn't declare ether_hostton().
602 # Unset ac_cv_have_decl_ether_hostton so we don't
603 # treat the previous failure as a cached value and
604 # suppress the next test.
606 unset ac_cv_have_decl_ether_hostton
607 AC_CHECK_DECL(ether_hostton,
609 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON, 1,
610 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
613 #include <sys/types.h>
614 #include <sys/socket.h>
616 #include <netinet/in.h>
617 #include <netinet/if_ether.h>
621 # After all that, is ether_hostton() declared?
623 if test "$ac_cv_have_decl_ether_hostton" = yes; then
627 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
628 [Define to 1 if you have the declaration of `ether_hostton'])
631 # No, we'll have to declare it ourselves.
632 # Do we have "struct ether_addr" if we include
633 # <netinet/if_ether.h>?
635 AC_CHECK_TYPES(struct ether_addr,,,
637 #include <sys/types.h>
638 #include <sys/socket.h>
640 #include <netinet/in.h>
641 #include <netinet/if_ether.h>
646 if expr "$host_os" : linux >/dev/null; then
648 # On Linux there is a couple more factors to consider together with
649 # HAVE_ETHER_HOSTTON. C code can test for __GLIBC__ and __UCLIBC__
650 # trivially, make it nearly as trivial for TESTrun.
652 AC_MSG_CHECKING([if features.h defines __GLIBC__])
656 [[#include <features.h>]],
657 [[int i = __GLIBC__;]]
661 AC_DEFINE([HAVE_GLIBC], [1], [Define to 1 if using GNU libc.])
666 AC_MSG_CHECKING([if features.h defines __UCLIBC__])
670 [[#include <features.h>]],
671 [[int i = __UCLIBC__;]]
675 AC_DEFINE([HAVE_UCLIBC], [1], [Define to 1 if using uclibc(-ng).])
687 # For various things that might use pthreads.
689 AC_CHECK_HEADER(pthread.h,
692 # OK, we have pthread.h. Do we have pthread_create in the
695 AC_CHECK_FUNC(pthread_create,
700 ac_lbl_have_pthreads="found"
704 # No - do we have it in -lpthreads?
706 AC_CHECK_LIB(pthreads, pthread_create,
709 # Yes - add -lpthreads.
711 ac_lbl_have_pthreads="found"
712 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads"
716 # No - do we have it in -lpthread?
718 AC_CHECK_LIB(pthread, pthread_create,
721 # Yes - add -lpthread.
723 ac_lbl_have_pthreads="found"
724 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread"
730 ac_lbl_have_pthreads="not found"
737 # We didn't find pthread.h.
739 ac_lbl_have_pthreads="not found"
743 AC_MSG_CHECKING([whether to enable the instrument functions code])
744 AC_ARG_ENABLE([instrument-functions],
745 [AS_HELP_STRING([--enable-instrument-functions],
746 [enable instrument functions code [default=no]])],
750 yes) AC_MSG_RESULT(yes)
751 AC_DEFINE(ENABLE_INSTRUMENT_FUNCTIONS, 1,
752 [define if you want to build the instrument functions code])
753 # Add '-finstrument-functions' instrumentation option to generate
754 # instrumentation calls for entry and exit to functions.
755 # Use '--enable-instrument-functions' also with tcpdump (or tcpslice)
756 # to see the output. See also https://www.tcpdump.org/faq.html#q17.
757 CFLAGS="$CFLAGS -O0 -ggdb -finstrument-functions"
763 dnl to pacify those who hate protochain insn
764 AC_MSG_CHECKING(if --disable-protochain option is specified)
765 AC_ARG_ENABLE(protochain,
766 AS_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
767 case "x$enable_protochain" in
768 xyes) enable_protochain=enabled ;;
769 xno) enable_protochain=disabled ;;
770 x) enable_protochain=enabled ;;
773 if test "$enable_protochain" = "disabled"; then
774 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
776 AC_MSG_RESULT(${enable_protochain})
779 AS_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
780 if test ! -z "$with_pcap" ; then
784 # Try auto-detecting the obvious types first.
799 if test -z "$V_PCAP"; then
801 # It is not one of the above obvious types, let's see if it is BPF.
802 # Check this before DLPI to pick BPF on Solaris 11 and later.
804 AC_CHECK_HEADERS(net/bpf.h)
805 if test "$ac_cv_header_net_bpf_h" = yes; then
807 # HAVE_SYS_IOCCOM_H will be required for a few workarounds until all
808 # supported OSes that use BPF have <net/bpf.h> that includes <sys/ioccom.h>
809 # (this might have already happened).
811 AC_CHECK_HEADERS([sys/ioccom.h])
814 # Does it define BIOCSETIF?
815 # I.e., is it a header for an LBL/BSD-style capture
816 # mechanism, or is it just a header for a BPF filter
817 # engine? Some versions of Arch Linux, for example,
818 # have a net/bpf.h that doesn't define BIOCSETIF;
819 # as it's a Linux, it should use packet sockets,
824 # sys/types.h, because FreeBSD 10's net/bpf.h
825 # requires that various BSD-style integer types
828 # sys/time.h, because AIX 5.2 and 5.3's net/bpf.h
829 # doesn't include it but does use struct timeval
830 # in ioctl definitions;
832 # sys/ioctl.h and, if we have it, sys/ioccom.h,
833 # because net/bpf.h defines ioctls;
835 # net/if.h, because it defines some structures
836 # used in ioctls defined by net/bpf.h;
838 # sys/socket.h, because OpenBSD 5.9's net/bpf.h
839 # defines some structure fields as being
842 # and net/bpf.h doesn't necessarily include all
843 # of those headers itself.
845 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF)
846 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif,
847 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
849 #include <sys/types.h>
850 #include <sys/time.h>
851 #include <sys/ioctl.h>
852 #include <sys/socket.h>
853 #ifdef HAVE_SYS_IOCCOM_H
854 #include <sys/ioccom.h>
859 [[u_int i = BIOCSETIF;]])],
860 [ac_cv_lbl_bpf_h_defines_biocsetif=yes],
861 [ac_cv_lbl_bpf_h_defines_biocsetif=no]))
862 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif)
865 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then
870 if test -z "$V_PCAP"; then
872 # It is not BPF either, let's see if it is DLPI on pre-Solaris 11
873 # SunOS 5, HP-UX, possibly others. Otherwise fail properly.
875 AC_CHECK_HEADERS([sys/dlpi.h])
876 if test "$ac_cv_header_sys_dlpi_h" = yes; then
880 # We don't have any capture type we know about.
881 # Report an error, and tell the user to configure with
882 # --with-pcap=null if they want a libpcap that can't
883 # capture but that can read capture files. That way,
884 # nobody gets surprised by getting a no-capture
885 # libpcap without asking for that.
887 AC_MSG_ERROR([No supported packet capture interface was found.
888 See the INSTALL.md file for information on packet capture support in
889 various operating systems.
890 If you want a libpcap that cannot capture packets but that can read
891 pcap and pcapng files, run configure with --with-pcap=null.])
894 AC_MSG_CHECKING(packet capture type)
895 AC_MSG_RESULT($V_PCAP)
898 # valgrindtest directly uses the native capture mechanism, but
899 # only tests with BPF and PF_PACKET sockets; enable it for OSes
900 # that have both the type of sockets and a working Valgrind.
903 freebsd*|darwin*|linux*)
904 VALGRINDTEST_SRC=valgrindtest.c
910 AC_SUBST(VALGRINDTEST_SRC)
913 # Do we have pkg-config?
918 # Do we have the brew command from Homebrew?
922 AC_PATH_PROG([BREW], [brew])
927 # Solaris pkg-config is annoying. For at least one package (D-Bus, I'm
928 # looking at *you*!), there are separate include files for 32-bit and
929 # 64-bit builds (I guess using "unsigned long long" as a 64-bit integer
930 # type on a 64-bit build is like crossing the beams or something), and
931 # there are two separate .pc files, so if we're doing a 32-bit build we
932 # should make sure we look in /usr/lib/pkgconfig for .pc files and if
933 # we're doing a 64-bit build we should make sure we look in
934 # /usr/lib/amd64/pkgconfig for .pc files.
939 if test "$ac_cv_sizeof_void_p" -eq 8; then
941 # 64-bit build. If the path is empty, set it to
942 # /usr/lib/amd64/pkgconfig; otherwise, if
943 # /usr/lib/pkgconfig appears in the path, prepend
944 # /usr/lib/amd64/pkgconfig to it; otherwise, put
945 # /usr/lib/amd64/pkgconfig at the end.
947 if test -z "$PKG_CONFIG_PATH"; then
949 # Not set, or empty. Set it to
950 # /usr/lib/amd64/pkgconfig.
952 PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig
953 elif test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/pkgconfig"`; then
955 # It contains /usr/lib/pkgconfig. Prepend
956 # /usr/lib/amd64/pkgconfig to /usr/lib/pkgconfig.
958 PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/pkgconfig;/usr/lib/amd64/pkgconfig:/usr/lib/pkgconfig;"`
961 # Not empty, but doesn't contain /usr/lib/pkgconfig.
962 # Append /usr/lib/amd64/pkgconfig to it.
964 PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/lib/amd64/pkgconfig"
966 export PKG_CONFIG_PATH
967 elif test "$ac_cv_sizeof_void_p" -eq 4; then
969 # 32-bit build. If /usr/amd64/lib/pkgconfig appears
970 # in the path, prepend /usr/lib/pkgconfig to it.
972 if test ! -z `echo "$PKG_CONFIG_PATH" | grep "/usr/lib/amd64/pkgconfig"`; then
974 # It contains /usr/lib/amd64/pkgconfig. Prepend
975 # /usr/lib/pkgconfig to /usr/lib/amd64/pkgconfig.
977 PKG_CONFIG_PATH=`echo "$PKG_CONFIG_PATH" | sed "s;/usr/lib/amd64/pkgconfig;/usr/lib/pkgconfig:/usr/lib/amd64/pkgconfig;"`
978 export PKG_CONFIG_PATH
984 # Handle each capture type.
989 # Checks for some header files.
991 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
994 # Checks to see if Solaris has the public libdlpi(3LIB) library.
995 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
996 # public libdlpi(3LIB) version. Before libdlpi was made public, a
997 # private version also existed, which did not have the same APIs.
998 # Due to a gcc bug, the default search path for 32-bit libraries does
999 # not include /lib, we add it explicitly here.
1000 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
1001 # Also, due to the bug above applications that link to libpcap with
1002 # libdlpi will have to add "-L/lib" option to "configure".
1004 save_LDFLAGS="$LDFLAGS"
1005 LDFLAGS="$LIBS -L/lib"
1006 AC_CHECK_LIB(dlpi, dlpi_walk,
1009 LIBS_STATIC="-ldlpi $LIBS_STATIC"
1010 LIBS_PRIVATE="-ldlpi $LIBS_PRIVATE"
1014 # Capture module plus common code needed for
1015 # common functions used by pcap-[dlpi,libdlpi].c
1017 PLATFORM_C_SRC="pcap-libdlpi.c dlpisubs.c"
1018 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
1024 # Capture module plus common code needed for
1025 # common functions used by pcap-[dlpi,libdlpi].c
1027 PLATFORM_C_SRC="pcap-dlpi.c dlpisubs.c"
1029 LDFLAGS="$save_LDFLAGS"
1032 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
1035 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
1036 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
1037 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1039 #include <sys/types.h>
1040 #include <sys/time.h>
1041 #include <sys/dlpi.h>
1043 [[int i = DL_PROMISC_PHYS;]])],
1044 [ac_cv_sys_dlpi_usable=yes],
1045 [ac_cv_sys_dlpi_usable=no]))
1046 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
1047 if test $ac_cv_sys_dlpi_usable = no ; then
1048 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
1052 # Check to see if Solaris has the dl_passive_req_t struct defined
1054 # This check is for DLPI support for passive modes.
1055 # See dlpi(7P) for more details.
1057 AC_CHECK_TYPES(dl_passive_req_t,,,
1059 #include <sys/types.h>
1060 #include <sys/dlpi.h>
1068 PLATFORM_C_SRC="pcap-haiku.c"
1075 PLATFORM_C_SRC="pcap-linux.c"
1079 # We only want version 3. Version 2 was, apparently,
1080 # short-lived, and version 1 is source and binary
1081 # incompatible with version 3, and it appears that,
1082 # these days, everybody's using version 3. We're
1083 # not supporting older versions of the Linux kernel;
1084 # let's drop support for older versions of libnl, too.
1087 AS_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
1088 with_libnl=$withval,with_libnl=if_available)
1090 if test x$with_libnl != xno ; then
1092 # Check for libnl-genl-3.0 with pkg-config.
1094 PKG_CHECK_MODULE(LIBNL, libnl-genl-3.0,
1096 pkg_config_found_libnl=yes
1097 V_INCLS="$V_INCLS $LIBNL_CFLAGS"
1098 ADDITIONAL_LIBS="$LIBNL_LIBS $ADDITIONAL_LIBS"
1099 ADDITIONAL_LIBS_STATIC="$LIBNL_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
1100 REQUIRES_PRIVATE="libnl-genl-3.0 $REQUIRES_PRIVATE"
1101 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
1104 if test x$pkg_config_found_libnl != xyes; then
1106 # Check for libnl-tiny with pkg-config.
1108 PKG_CHECK_MODULE(LIBNL, libnl-tiny,
1110 pkg_config_found_libnl=yes
1111 V_INCLS="$V_INCLS $LIBNL_CFLAGS"
1112 ADDITIONAL_LIBS="$LIBNL_LIBS $ADDITIONAL_LIBS"
1113 ADDITIONAL_LIBS_STATIC="$LIBNL_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
1114 REQUIRES_PRIVATE="libnl-tiny $REQUIRES_PRIVATE"
1115 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
1119 if test x$pkg_config_found_libnl != xyes; then
1121 # OK, either we don't have pkg-config or there
1122 # wasn't a .pc file for it; Check for it directly.
1124 case "$with_libnl" in
1127 incdir=-I/usr/include/libnl3
1132 if test -d $withval; then
1133 libnldir=-L${withval}/lib
1134 incdir=-I${withval}/include
1139 AC_CHECK_LIB(nl-3, nl_socket_alloc,
1142 # Yes, we have libnl 3.x.
1144 ADDITIONAL_LIBS="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS"
1145 ADDITIONAL_LIBS_STATIC="${libnldir} -lnl-genl-3 -lnl-3 $ADDITIONAL_LIBS_STATIC"
1146 LIBS_PRIVATE="${libnldir} -lnl-genl-3 -lnl-3 $LIBS_PRIVATE"
1147 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
1148 V_INCLS="$V_INCLS ${incdir}"
1151 # No, we don't have libnl at all.
1152 # Fail if the user explicitly requested
1155 if test x$with_libnl = xyes ; then
1156 AC_MSG_ERROR([libnl support requested but libnl not found])
1158 ], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
1163 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member.
1165 # NOTE: any failure means we conclude that it doesn't have that
1166 # member, so if we don't have tpacket_auxdata, we conclude it
1167 # doesn't have that member (which is OK, as either we won't be
1168 # using code that would use that member, or we wouldn't compile
1170 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,,
1172 #include <sys/types.h>
1173 #include <linux/if_packet.h>
1176 # This check is for TESTrun purposes, not for the C code.
1177 AC_CHECK_DECLS([SKF_AD_VLAN_TAG_PRESENT], [], [], [[#include <linux/filter.h>]])
1184 PLATFORM_C_SRC="pcap-bpf.c"
1187 # Check whether we have the *BSD-style ioctls.
1189 AC_CHECK_HEADERS(net/if_media.h)
1192 # Check whether we have struct BPF_TIMEVAL.
1194 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
1196 #include <sys/types.h>
1197 #include <sys/ioctl.h>
1198 #ifdef HAVE_SYS_IOCCOM_H
1199 #include <sys/ioccom.h>
1201 #include <net/bpf.h>
1204 if expr "$host_os" : solaris >/dev/null; then
1206 # Check whether there's a net/ipnet.h header and,
1207 # if so, whether it defines IPNET_ANY_LINK - if so,
1208 # we assume we have the "any" device (that's a
1209 # Solaris header, and later versions of Solaris
1210 # have an "any" device).
1212 # Attempting to include it at compile time could
1213 # be a pain, as it's a kernel header.
1215 AC_MSG_CHECKING(whether the Solaris "any" device is supported)
1216 if test -e /usr/include/inet/ipnet.h &&
1217 grep -q IPNET_ANY_LINK /usr/include/inet/ipnet.h; then
1219 AC_DEFINE(HAVE_SOLARIS_ANY_DEVICE, 1, [target host supports Solaris "any" device])
1227 PLATFORM_C_SRC="pcap-hurd.c"
1233 # --with-pcap=dag is the only way to get here, and it means
1234 # "DAG support but nothing else"
1236 V_DEFS="$V_DEFS -DDAG_ONLY"
1237 PLATFORM_C_SRC="pcap-dag.c"
1243 # --with-pcap=dpdk is the only way to get here, and it means
1244 # "DPDK support but nothing else"
1246 V_DEFS="$V_DEFS -DDPDK_ONLY"
1247 PLATFORM_C_SRC="pcap-dpdk.c"
1253 # --with-pcap=snf is the only way to get here, and it means
1254 # "SNF support but nothing else"
1256 V_DEFS="$V_DEFS -DSNF_ONLY"
1257 PLATFORM_C_SRC="pcap-snf.c"
1265 PLATFORM_C_SRC="pcap-null.c"
1269 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
1274 dnl Now figure out how we get a list of interfaces and addresses,
1275 dnl if we support capturing. Don't bother if we don't support
1278 if test "$V_PCAP" != null
1280 AC_CHECK_FUNC(getifaddrs,[
1282 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
1283 # as well, just in case some platform is really weird.
1285 AC_CHECK_HEADER(ifaddrs.h,[
1287 # We have the header, so we use "getifaddrs()" to
1288 # get the list of interfaces.
1290 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-getad.c"
1293 # We don't have the header - give up.
1294 # XXX - we could also fall back on some other
1295 # mechanism, but, for now, this'll catch this
1296 # problem so that we can at least try to figure
1297 # out something to do on systems with "getifaddrs()"
1298 # but without "ifaddrs.h", if there is something
1299 # we can do on those systems.
1301 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
1305 # Well, we don't have "getifaddrs()", at least not with the
1306 # libraries with which we've decided we need to link
1307 # libpcap with, so we have to use some other mechanism.
1309 # Note that this may happen on Solaris, which has
1310 # getifaddrs(), but in -lsocket, not in -lxnet, so we
1311 # won't find it if we link with -lxnet, which we want
1312 # to do for other reasons.
1314 # For now, we use either the SIOCGIFCONF ioctl or the
1315 # SIOCGLIFCONF ioctl, preferring the latter if we have
1316 # it; the latter is a Solarisism that first appeared
1317 # in Solaris 8. (Solaris's getifaddrs() appears to
1318 # be built atop SIOCGLIFCONF; using it directly
1319 # avoids a not-all-that-useful middleman.)
1321 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
1322 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
1323 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1324 [[#include <sys/param.h>
1325 #include <sys/file.h>
1326 #include <sys/ioctl.h>
1327 #include <sys/socket.h>
1328 #include <sys/sockio.h>]],
1329 [[ioctl(0, SIOCGLIFCONF, (char *)0);]])],
1330 [ac_cv_lbl_have_siocglifconf=yes],
1331 [ac_cv_lbl_have_siocglifconf=no]))
1332 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
1333 if test $ac_cv_lbl_have_siocglifconf = yes ; then
1334 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-glifc.c"
1336 PLATFORM_C_SRC="$PLATFORM_C_SRC fad-gifc.c"
1341 dnl check for hardware timestamp support
1344 AC_CHECK_HEADERS([linux/net_tstamp.h])
1347 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1352 # Check for socklen_t.
1354 AC_CHECK_TYPES(socklen_t,,,
1356 #include <sys/types.h>
1357 #include <sys/socket.h>
1360 # Check for Endace DAG card support.
1362 AS_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1364 if test "$withval" = no
1366 # User doesn't want DAG support.
1368 elif test "$withval" = yes
1370 # User wants DAG support but hasn't specified a directory.
1373 # User wants DAG support and has specified a directory, so use the provided value.
1378 if test "$V_PCAP" = dag; then
1379 # User requested DAG-only libpcap, so we'd better have
1382 elif test "$xxx_only" = yes; then
1383 # User requested something-else-only pcap, so they don't
1388 # Use DAG API if present, otherwise don't
1394 AC_ARG_WITH([dag-includes],
1395 AS_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
1397 # User wants DAG support and has specified a header directory, so use the provided value.
1399 dag_include_dir=$withval
1402 AC_ARG_WITH([dag-libraries],
1403 AS_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
1405 # User wants DAG support and has specified a library directory, so use the provided value.
1407 dag_lib_dir=$withval
1410 if ! expr "$host_os" : linux >/dev/null; then
1413 # Replace one default value with another silently and move on.
1417 # Fail hard: this is a user request and it cannot be done.
1418 AC_MSG_ERROR([cannot enable DAG support (not Linux)])
1423 if test "$want_dag" != no; then
1425 # If necessary, set default paths for DAG API headers and libraries.
1426 if test -z "$dag_root"; then
1430 if test -z "$dag_include_dir"; then
1431 dag_include_dir="$dag_root/include"
1434 if test -z "$dag_lib_dir"; then
1435 dag_lib_dir="$dag_root/lib"
1437 # Handle multiarch systems.
1439 if test -d "$dag_lib_dir/$host"
1441 dag_lib_dir="$dag_lib_dir/$host"
1445 AC_LBL_SAVE_CHECK_STATE
1446 CFLAGS="$CFLAGS -I$dag_include_dir"
1447 AC_CHECK_HEADERS([dagapi.h])
1448 AC_LBL_RESTORE_CHECK_STATE
1450 if test "$ac_cv_header_dagapi_h" = yes; then
1452 V_INCLS="$V_INCLS -I$dag_include_dir"
1454 if test $V_PCAP != dag ; then
1455 MODULE_C_SRC="$MODULE_C_SRC pcap-dag.c"
1458 # Check for various DAG API functions.
1459 # Don't need to save and restore LIBS to prevent -ldag being
1460 # included if there's a found-action (arg 3).
1461 AC_LBL_SAVE_CHECK_STATE
1462 LDFLAGS="-L$dag_lib_dir"
1463 AC_CHECK_LIB([dag], [dag_attach_stream64],
1466 # We assume that if we have libdag we have
1467 # libdagconf, as they're installed at the
1468 # same time from the same package.
1470 ADDITIONAL_LIBS="-L$dag_lib_dir $ADDITIONAL_LIBS -ldag -ldagconf"
1471 ADDITIONAL_LIBS_STATIC="-L$dag_lib_dir $ADDITIONAL_LIBS_STATIC -ldag -ldagconf"
1472 LIBS_PRIVATE="-L$dag_lib_dir $LIBS_PRIVATE -ldag -ldagconf"
1474 [AC_MSG_ERROR(DAG library lacks 64-bit streams support)])
1475 AC_LBL_RESTORE_CHECK_STATE
1478 # We assume that if we have libdag we have libdagconf,
1479 # as they're installed at the same time from the same
1482 AC_LBL_SAVE_CHECK_STATE
1483 LIBS="$LIBS -ldag -ldagconf"
1484 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
1485 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
1486 AC_LBL_RESTORE_CHECK_STATE
1487 if test "$ac_dag_have_vdag" = 1; then
1488 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
1489 if test "$ac_lbl_have_pthreads" != "found"; then
1490 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them])
1492 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $PTHREAD_LIBS"
1493 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $PTHREAD_LIBS"
1494 LIBS_PRIVATE="$LIBS_PRIVATE $PTHREAD_LIBS"
1497 AC_MSG_NOTICE([using Endace DAG API headers from $dag_include_dir])
1498 AC_MSG_NOTICE([using Endace DAG API libraries from $dag_lib_dir])
1499 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
1501 AC_MSG_CHECKING([whether to enable Endace DAG transmit support (EXPERIMENTAL)])
1502 AC_ARG_ENABLE(dag-tx,
1503 AS_HELP_STRING([--enable-dag-tx],
1504 [enable Endace DAG transmit support (EXPERIMENTAL) @<:@default=no@:>@]
1507 if test "$enable_dag_tx" = "yes"; then
1508 AC_DEFINE(ENABLE_DAG_TX, 1, [Define to 1 if DAG transmit support is enabled])
1510 AC_MSG_RESULT(${enable_dag_tx-no})
1512 if test "$V_PCAP" = dag; then
1513 # User requested "dag" capture type but we couldn't
1514 # find the DAG API support.
1515 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])
1518 if test "$want_dag" = yes; then
1519 # User wanted DAG support but we couldn't find it.
1520 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])
1525 # Check for Myricom SNF support.
1527 AS_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1529 if test "$withval" = no
1531 # User explicitly doesn't want SNF
1533 elif test "$withval" = yes
1535 # User wants SNF support but hasn't specified a directory.
1538 # User wants SNF support with a specified directory.
1543 if test "$V_PCAP" = snf; then
1544 # User requested Sniffer-only libpcap, so we'd better have
1547 elif test "$xxx_only" = yes; then
1548 # User requested something-else-only pcap, so they don't
1553 # Use Sniffer API if present, otherwise don't
1559 AC_ARG_WITH([snf-includes],
1560 AS_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
1562 # User wants SNF with specific header directory
1564 snf_include_dir=$withval
1567 AC_ARG_WITH([snf-libraries],
1568 AS_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
1570 # User wants SNF with specific lib directory
1572 snf_lib_dir=$withval
1575 # Same as for DAG above.
1576 if ! expr "$host_os" : linux >/dev/null; then
1582 AC_MSG_ERROR([cannot enable SNF support (not Linux)])
1587 if test "$want_snf" != no; then
1588 # If necessary, set default paths for Sniffer headers and libraries.
1589 if test -z "$snf_root"; then
1593 if test -z "$snf_include_dir"; then
1594 snf_include_dir="$snf_root/include"
1597 if test -z "$snf_lib_dir"; then
1598 snf_lib_dir="$snf_root/lib"
1600 # Handle multiarch systems.
1602 if test -d "$snf_lib_dir/$host"
1604 snf_lib_dir="$snf_lib_dir/$host"
1608 AC_LBL_SAVE_CHECK_STATE
1609 CFLAGS="$CFLAGS -I$snf_include_dir"
1610 # Do not define a symbol.
1611 AC_CHECK_HEADER(snf.h)
1612 AC_LBL_RESTORE_CHECK_STATE
1614 if test "$ac_cv_header_snf_h" = yes; then
1615 # We found a header; make sure we can link with the library
1616 AC_LBL_SAVE_CHECK_STATE
1617 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1618 # Do not define a symbol.
1619 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1620 AC_LBL_RESTORE_CHECK_STATE
1623 if test "$ac_cv_lbl_snf_api" = yes; then
1624 AC_MSG_NOTICE([using Myricom SNF API headers from $snf_include_dir])
1625 AC_MSG_NOTICE([using Myricom SNF API libraries from $snf_lib_dir])
1627 V_INCLS="$V_INCLS -I$snf_include_dir"
1628 ADDITIONAL_LIBS="$ADDITIONAL_LIBS -L$snf_lib_dir -lsnf"
1629 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC -L$snf_lib_dir -lsnf"
1630 LIBS_PRIVATE="$LIBS_PRIVATE -L$snf_lib_dir -lsnf"
1632 if test "$V_PCAP" != snf ; then
1633 MODULE_C_SRC="$MODULE_C_SRC pcap-snf.c"
1636 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1638 if test "$V_PCAP" = snf; then
1639 # User requested "snf" capture type but
1640 # we couldn't find the Sniffer API support.
1641 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])
1644 if test "$want_snf" = yes; then
1645 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])
1651 dnl Allow the user to enable remote capture.
1652 dnl It's off by default, as that increases the attack surface of
1653 dnl libpcap, exposing it to malicious servers.
1655 AC_MSG_CHECKING([whether to enable remote packet capture])
1656 AC_ARG_ENABLE([remote],
1657 [AS_HELP_STRING([--enable-remote],
1658 [enable remote packet capture @<:@default=no@:>@])],
1661 case "$enableval" in
1662 yes) AC_MSG_RESULT(yes)
1663 AC_MSG_WARN(Remote packet capture may expose libpcap-based applications)
1664 AC_MSG_WARN(to attacks by malicious remote capture servers!)
1666 # rpcapd requires pthreads on UN*X.
1668 if test "$ac_lbl_have_pthreads" != "found"; then
1669 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them])
1672 # It also requires crypt().
1673 # Do we have it in the system libraries?
1675 AC_CHECK_FUNC(crypt,,
1678 # No. Do we have it in -lcrypt?
1680 AC_CHECK_LIB(crypt, crypt,
1683 # Yes; add -lcrypt to the libraries for rpcapd.
1685 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt"
1688 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it])
1693 # OK, we have crypt(). Do we have getspnam()?
1695 AC_CHECK_FUNCS(getspnam)
1698 # Thanks, IBM, for not providing vsyslog() in AIX!
1700 AC_CHECK_FUNCS(vsyslog)
1703 # Check for various members of struct msghdr.
1705 AC_CHECK_MEMBERS([struct msghdr.msg_control],,,
1707 #include "ftmacros.h"
1708 #include <sys/socket.h>
1710 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,,
1712 #include "ftmacros.h"
1713 #include <sys/socket.h>
1717 # Optionally, we may want to support SSL.
1718 # Check for OpenSSL/libressl.
1720 # First, try looking for it with pkg-config, if we have it.
1722 # Homebrew's pkg-config does not, by default, look for
1723 # pkg-config files for packages it has installed.
1724 # Furthermore, at least for OpenSSL, they appear to be
1725 # dumped in package-specific directories whose paths are
1726 # not only package-specific but package-version-specific.
1728 # So the only way to find openssl is to get the value of
1729 # PKG_CONFIG_PATH from "brew --env openssl" and add that
1730 # to PKG_CONFIG_PATH. (No, we can't just assume it's under
1731 # /usr/local; Homebrew have conveniently chosen to put it
1732 # under /opt/homebrew on ARM.)
1734 # That's the nice thing about Homebrew - it makes things easier!
1737 save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
1738 if test -n "$BREW"; then
1739 openssl_pkgconfig_dir=`$BREW --env --plain openssl | sed -n 's/PKG_CONFIG_PATH: //p'`
1740 PKG_CONFIG_PATH="$openssl_pkgconfig_dir:$PKG_CONFIG_PATH"
1742 PKG_CHECK_MODULE(OPENSSL, openssl,
1745 # We found OpenSSL/libressl.
1748 REQUIRES_PRIVATE="$REQUIRES_PRIVATE openssl"
1750 PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
1753 # If it wasn't found, and we have Homebrew installed, see
1754 # if it's in Homebrew.
1756 if test "x$HAVE_OPENSSL" != "xyes" -a -n "$BREW"; then
1757 AC_MSG_CHECKING(for openssl in Homebrew)
1759 # The brew man page lies when it speaks of
1760 # $BREW --prefix --installed <formula>
1761 # outputting nothing. In Homebrew 3.3.16,
1762 # it produces output regardless of whether
1763 # the formula is installed or not, so we
1764 # send the standard output and error to
1767 if $BREW --prefix --installed openssl >/dev/null 2>&1; then
1769 # Yes. Get the include directory and library
1770 # directory. (No, we can't just assume it's
1771 # under /usr/local; Homebrew have conveniently
1772 # chosen to put it under /opt/homebrew on ARM.)
1776 openssl_path=`$BREW --prefix openssl`
1777 OPENSSL_CFLAGS="-I$openssl_path/include"
1778 OPENSSL_LIBS="-L$openssl_path/lib -lssl -lcrypto"
1779 OPENSSL_LIBS_STATIC="-L$openssl_path/lib -lssl -lcrypto"
1780 OPENSSL_LIBS_PRIVATE="-L$openssl_path/lib -lssl -lcrypto"
1787 # If it wasn't found, and /usr/local/include and /usr/local/lib
1788 # exist, check if it's in /usr/local. (We check whether they
1789 # exist because, if they don't exist, the compiler will warn
1790 # about that and then ignore the argument, so they test
1791 # using just the system header files and libraries.)
1793 # We include the standard include file to 1) make sure that
1794 # it's installed (if it's just a shared library for the
1795 # benefit of existing programs, that's not useful) and 2)
1796 # because SSL_library_init() is a library routine in some
1797 # versions and a #defined wrapper around OPENSSL_init_ssl()
1800 if test "x$HAVE_OPENSSL" != "xyes" -a -d "/usr/local/include" -a -d "/usr/local/lib"; then
1801 AC_LBL_SAVE_CHECK_STATE
1802 CFLAGS="$CFLAGS -I/usr/local/include"
1803 LIBS="$LIBS -L/usr/local/lib -lssl -lcrypto"
1804 AC_MSG_CHECKING(whether we have OpenSSL/libressl in /usr/local that we can use)
1805 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1807 #include <openssl/ssl.h>
1816 OPENSSL_CFLAGS="-I/usr/local/include"
1817 OPENSSL_LIBS="-L/usr/local/lib -lssl -lcrypto"
1818 OPENSSL_LIBS_STATIC="-L/usr/local/lib -lssl -lcrypto"
1819 OPENSSL_LIBS_PRIVATE="-L/usr/local/lib -lssl -lcrypto"
1822 AC_LBL_RESTORE_CHECK_STATE
1826 # If it wasn't found, check if it's a system library.
1828 # We include the standard include file to 1) make sure that
1829 # it's installed (if it's just a shared library for the
1830 # benefit of existing programs, that's not useful) and 2)
1831 # because SSL_library_init() is a library routine in some
1832 # versions and a #defined wrapper around OPENSSL_init_ssl()
1835 if test "x$HAVE_OPENSSL" != "xyes"; then
1836 AC_LBL_SAVE_CHECK_STATE
1837 LIBS="$LIBS -lssl -lcrypto"
1838 AC_MSG_CHECKING(whether we have a system OpenSSL/libressl that we can use)
1839 AC_LINK_IFELSE([AC_LANG_PROGRAM(
1841 #include <openssl/ssl.h>
1850 OPENSSL_LIBS="-lssl -lcrypto"
1851 OPENSSL_LIBS_STATIC="-lssl -lcrypto"
1852 OPENSSL_LIBS_PRIVATE="-lssl -lcrypto"
1855 AC_LBL_RESTORE_CHECK_STATE
1859 # OK, did we find it?
1861 if test "x$HAVE_OPENSSL" = "xyes"; then
1862 AC_DEFINE([HAVE_OPENSSL], [1], [Use OpenSSL])
1863 V_INCLS="$V_INCLS $OPENSSL_CFLAGS"
1864 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $OPENSSL_LIBS"
1865 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $OPENSSL_LIBS_STATIC"
1866 LIBS_PRIVATE="$LIBS_PRIVATE $OPENSSL_LIBS_PRIVATE"
1867 REQUIRES_PRIVATE="$REQUIRES_PRIVATE $OPENSSL_REQUIRES_PRIVATE"
1868 REMOTE_C_SRC="$REMOTE_C_SRC sslutils.c"
1870 AC_MSG_NOTICE(OpenSSL not found)
1873 AC_DEFINE(ENABLE_REMOTE, 1,
1874 [Define to 1 if remote packet capture is to be supported])
1875 REMOTE_C_SRC="$REMOTE_C_SRC pcap-rpcap.c rpcap-protocol.c sockutils.c"
1876 BUILD_RPCAPD=build-rpcapd
1877 INSTALL_RPCAPD=install-rpcapd
1879 *) AC_MSG_RESULT(no)
1883 AC_MSG_CHECKING(whether to build optimizer debugging code)
1884 AC_ARG_ENABLE(optimizer-dbg,
1885 AS_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
1886 if test "$enable_optimizer_dbg" = "yes"; then
1887 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
1889 AC_MSG_RESULT(${enable_optimizer_dbg-no})
1891 AC_MSG_CHECKING(whether to build parser debugging code)
1892 AC_ARG_ENABLE(yydebug,
1893 AS_HELP_STRING([--enable-yydebug],[build parser debugging code]))
1894 if test "$enable_yydebug" = "yes"; then
1895 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
1897 AC_MSG_RESULT(${enable_yydebug-no})
1902 AC_PROG_LEX(noyywrap)
1903 if test "$LEX" = ":"; then
1904 AC_MSG_ERROR([Neither flex nor lex was found.])
1908 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1909 # and supports processing our scanner.l.
1911 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1912 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1913 tcpdump_cv_capable_lex=yes
1915 tcpdump_cv_capable_lex=insufficient
1917 if test $tcpdump_cv_capable_lex = insufficient ; then
1918 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1919 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.
1920 If a suitable version of Lex/Flex is available as a non-standard command
1921 and/or not in the PATH, you can specify it using the LEX environment
1922 variable. That said, on some systems the error can mean that Flex/Lex is
1923 actually acceptable, but m4 is not. Likewise, if a suitable version of
1924 m4 (such as GNU M4) is available but has not been detected, you can
1925 specify it using the M4 environment variable.])
1929 # Look for yacc/bison/byacc.
1930 # If it's Bison, we do not want -y, as 1) we will be using -o to cause
1931 # the output for XXX.y to be written to XXX.c and 2) we don't want
1932 # it to issue warnings about stuff not supported by POSIX YACC - we
1933 # want to use that stuff, and don't care whether plain YACC supports
1934 # it or not, we require either Bison or Berkeley YACC.
1940 AC_CHECK_PROGS(BISON_BYACC, bison)
1941 if test x"$BISON_BYACC" != x; then
1945 # Bison prior to 2.4(.1) doesn't support "%define api.pure", so use
1948 bison_major_version=`$BISON_BYACC -V | sed -n 's/.* \(@<:@1-9@:>@@<:@0-9@:>@*\)\.@<:@0-9@:>@@<:@0-9.@:>@*/\1/p'`
1949 bison_minor_version=`$BISON_BYACC -V | sed -n 's/.* @<:@1-9@:>@@<:@0-9@:>@*\.\(@<:@0-9@:>@+\).*/\1/p'`
1950 if test "$bison_major_version" -lt 2 -o \
1951 \( "$bison_major_version" -eq 2 -a "$bison_major_version" -lt 4 \)
1953 REENTRANT_PARSER="%pure-parser"
1955 REENTRANT_PARSER="%define api.pure"
1959 # We didn't find Bison; check for Berkeley YACC, under the
1960 # names byacc and yacc.
1962 AC_CHECK_PROGS(BISON_BYACC, byacc yacc)
1963 if test x"$BISON_BYACC" != x; then
1965 # Make sure this is Berkeley YACC, not AT&T YACC;
1966 # the latter doesn't support reentrant parsers.
1967 # Run it with "-V"; that succeeds and reports the
1968 # version number with Berkeley YACC, but will
1969 # (probably) fail with various vendor flavors
1972 # Hopefully this also eliminates any versions
1973 # of Berkeley YACC that don't support reentrant
1974 # parsers, if there are any.
1976 AC_CACHE_CHECK([for capable yacc], tcpdump_cv_capable_yacc,
1977 if $BISON_BYACC -V >/dev/null 2>&1; then
1978 tcpdump_cv_capable_yacc=yes
1980 tcpdump_cv_capable_yacc=insufficient
1982 if test $tcpdump_cv_capable_yacc = insufficient ; then
1983 AC_MSG_ERROR([$BISON_BYACC is insufficient to compile libpcap.
1984 libpcap requires Bison, a newer version of Berkeley YACC with support
1985 for reentrant parsers, or another YACC compatible with them.])
1989 # OK, we found neither byacc nor yacc.
1991 AC_MSG_ERROR([Neither bison, byacc, nor yacc was found.
1992 libpcap requires Bison, a newer version of Berkeley YACC with support
1993 for reentrant parsers, or another YACC compatible with them.])
1997 # Berkeley YACC doesn't support "%define api.pure", so use
2000 REENTRANT_PARSER="%pure-parser"
2002 AC_SUBST(BISON_BYACC)
2003 AC_SUBST(REENTRANT_PARSER)
2006 # Do various checks for various OSes and versions of those OSes.
2008 # Assume, by default, no support for shared libraries and V7/BSD
2009 # convention for man pages (devices in section 4, file formats in
2010 # section 5, miscellaneous info in section 7, administrative commands
2011 # and daemons in section 8). Individual cases can override this.
2017 MAN_ADMIN_COMMANDS=8
2022 # AIX makes it fun to build shared and static libraries,
2023 # because they're *both* ".a" archive libraries. We
2024 # build the static library for the benefit of the traditional
2025 # scheme of building libpcap and tcpdump in subdirectories of
2026 # the same directory, with tcpdump statically linked with the
2027 # libpcap in question, but we also build a shared library as
2028 # "libpcap.shareda" and install *it*, rather than the static
2029 # library, as "libpcap.a".
2037 # If we're using DLPI, applications will need to
2038 # use /lib/pse.exp if present, as we use the
2041 pseexe="/lib/pse.exp"
2042 AC_MSG_CHECKING(for $pseexe)
2043 if test -f $pseexe ; then
2051 # If we're using BPF, we need "-lodm" and "-lcfg", as
2052 # we use them to load the BPF module.
2061 V_CCOPT="$V_CCOPT -fno-common"
2062 AC_ARG_ENABLE(universal,
2063 AS_HELP_STRING([--disable-universal],[don't build universal on macOS]))
2064 if test "$enable_universal" != "no"; then
2069 # Pre-Tiger. Build only for 32-bit PowerPC; no
2070 # need for any special compiler or linker flags.
2074 darwin8.[[0123]]|darwin8.[[0123]].*)
2076 # Tiger, prior to Intel support. Build
2077 # libraries and executables for 32-bit PowerPC
2078 # and 64-bit PowerPC, with 32-bit PowerPC first.
2079 # (I'm guessing that's what Apple does.)
2081 # (The double brackets are needed because
2082 # autotools/m4 use brackets as a quoting
2083 # character; the double brackets turn into
2084 # single brackets in the generated configure
2087 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64"
2088 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64"
2089 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64"
2090 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64"
2093 darwin8.[[456]]|darwin8.[[456]].*)
2095 # Tiger, subsequent to Intel support but prior
2096 # to x86-64 support. Build libraries and
2097 # executables for 32-bit PowerPC, 64-bit
2098 # PowerPC, and 32-bit x86, with 32-bit PowerPC
2099 # first. (I'm guessing that's what Apple does.)
2101 # (The double brackets are needed because
2102 # autotools/m4 use brackets as a quoting
2103 # character; the double brackets turn into
2104 # single brackets in the generated configure
2107 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
2108 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
2109 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386"
2110 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386"
2115 # All other Tiger, so subsequent to x86-64
2116 # support. Build libraries and executables for
2117 # 32-bit PowerPC, 64-bit PowerPC, 32-bit x86,
2118 # and x86-64, with 32-bit PowerPC first. (I'm
2119 # guessing that's what Apple does.)
2121 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2122 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2123 V_PROG_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2124 V_PROG_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2129 # Leopard. Build libraries for 32-bit PowerPC,
2130 # 64-bit PowerPC, 32-bit x86, and x86-64, with
2131 # 32-bit PowerPC first, and build executables
2132 # for 32-bit x86 and 32-bit PowerPC, with 32-bit
2133 # x86 first. (That's what Apple does.)
2135 V_LIB_CCOPT_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2136 V_LIB_LDFLAGS_FAT="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
2137 V_PROG_CCOPT_FAT="-arch i386 -arch ppc"
2138 V_PROG_LDFLAGS_FAT="-arch i386 -arch ppc"
2143 # Snow Leopard. Build libraries for x86-64,
2144 # 32-bit x86, and 32-bit PowerPC, with x86-64
2145 # first, and build executables for x86-64 and
2146 # 32-bit x86, with x86-64 first. (That's what
2147 # Apple does, even though Snow Leopard doesn't
2148 # run on PPC, so PPC libpcap runs under Rosetta,
2149 # and Rosetta doesn't support BPF ioctls, so PPC
2150 # programs can't do live captures.)
2152 V_LIB_CCOPT_FAT="-arch x86_64 -arch i386 -arch ppc"
2153 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch i386 -arch ppc"
2154 V_PROG_CCOPT_FAT="-arch x86_64 -arch i386"
2155 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch i386"
2160 # Post-Snow Leopard, pre-Catalina. Build
2161 # libraries for x86-64 and 32-bit x86, with
2162 # x86-64 first, and build executables only for
2163 # x86-64. (That's what Apple does.) This
2164 # requires no special flags for programs.
2166 # We check whether we *can* build for i386 and,
2167 # if not, suggest that the user install the
2168 # /usr/include headers if they want to build
2171 AC_MSG_CHECKING(whether building for 32-bit x86 is supported)
2172 AC_LBL_SAVE_CHECK_STATE
2173 CFLAGS="$CFLAGS -arch i386"
2174 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2179 V_LIB_CCOPT_FAT="-arch x86_64"
2180 V_LIB_LDFLAGS_FAT="-arch x86_64"
2183 # OpenSSL installation on macOS seems
2184 # to install only the libs for 64-bit
2185 # x86 - at least that's what Brew does:
2186 # only configure 32-bit builds if we
2187 # don't have OpenSSL.
2189 if test "$HAVE_OPENSSL" != yes; then
2190 V_LIB_CCOPT_FAT="$V_LIB_CCOPT_FAT -arch i386"
2191 V_LIB_LDFLAGS_FAT="$V_LIB_LDFLAGS_FAT -arch i386"
2196 V_LIB_CCOPT_FAT="-arch x86_64"
2197 V_LIB_LDFLAGS_FAT="-arch x86_64"
2202 # Mojave; you need to install the
2203 # /usr/include headers to get
2204 # 32-bit x86 builds to work.
2206 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])
2211 # Pre-Mojave; the command-line
2212 # tools should be sufficient to
2213 # enable 32-bit x86 builds.
2215 AC_MSG_WARN([Compiling for 32-bit x86 gives an error; try installing the command-line tools])
2219 AC_LBL_RESTORE_CHECK_STATE
2224 # Catalina. Build libraries and executables
2225 # only for x86-64. (That's what Apple does;
2226 # 32-bit x86 binaries are not supported on
2229 V_LIB_CCOPT_FAT="-arch x86_64"
2230 V_LIB_LDFLAGS_FAT="-arch x86_64"
2231 V_PROG_CCOPT_FAT="-arch x86_64"
2232 V_PROG_LDFLAGS_FAT="-arch x86_64"
2237 # Post-Catalina. Build libraries and
2238 # executables for x86-64 and ARM64.
2239 # (That's what Apple does, except they
2240 # build for arm64e, which may include
2241 # some of the pointer-checking extensions.)
2243 # If we're building with libssl, make sure
2244 # we can build fat with it (i.e., that it
2245 # was built fat); if we can't, don't set
2246 # the target architectures, and just
2247 # build for the host we're on.
2249 # Otherwise, just add both of them.
2251 if test "$HAVE_OPENSSL" = yes; then
2252 AC_MSG_CHECKING(whether building fat with libssl is supported)
2253 AC_LBL_SAVE_CHECK_STATE
2254 CFLAGS="$CFLAGS -arch x86_64 -arch arm64"
2255 LDFLAGS="$LDFLAGS $OPENSSL_LIBS"
2256 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2258 #include <openssl/ssl.h>
2266 V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
2267 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2268 V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
2269 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2273 AC_LBL_RESTORE_CHECK_STATE
2275 V_LIB_CCOPT_FAT="-arch x86_64 -arch arm64"
2276 V_LIB_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2277 V_PROG_CCOPT_FAT="-arch x86_64 -arch arm64"
2278 V_PROG_LDFLAGS_FAT="-arch x86_64 -arch arm64"
2285 hpux9*|hpux10.[01]*)
2286 AC_MSG_ERROR([HP-UX version must be 10.20 or later, not $host_os])
2290 dnl HPUX 10.20 and above is similar to HPUX 9, but
2291 dnl not the same....
2293 dnl XXX - DYEXT should be set to "sl" if this is building
2294 dnl for 32-bit PA-RISC, but should be left as "so" for
2295 dnl 64-bit PA-RISC or, I suspect, IA-64.
2296 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
2297 if test "`uname -m`" = "ia64"; then
2304 # "-b" builds a shared library; "+h" sets the soname.
2310 # Use System V conventions for man pages.
2316 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*|haiku*|midipix*)
2321 AC_DEFINE(HAVE_SOLARIS,1,[On Solaris])
2326 # Make sure errno is thread-safe, in case we're called in
2327 # a multithreaded program. We don't guarantee that two
2328 # threads can use the *same* pcap_t safely, but the
2329 # current version does guarantee that you can use different
2330 # pcap_t's in different threads, and even that pcap_compile()
2331 # is thread-safe (it wasn't thread-safe in some older versions).
2333 V_CCOPT="$V_CCOPT -D_TS_ERRNO"
2335 case "`uname -r`" in
2342 # Use System V conventions for man pages.
2344 MAN_ADMIN_COMMANDS=1m
2351 AC_SUBST(V_LIB_CCOPT_FAT)
2352 AC_SUBST(V_LIB_LDFLAGS_FAT)
2353 AC_SUBST(V_PROG_CCOPT_FAT)
2354 AC_SUBST(V_PROG_LDFLAGS_FAT)
2356 AC_SUBST(MAN_DEVICES)
2357 AC_SUBST(MAN_FILE_FORMATS)
2358 AC_SUBST(MAN_MISC_INFO)
2359 AC_SUBST(MAN_ADMIN_COMMANDS)
2361 AC_ARG_ENABLE(shared,
2362 AS_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
2363 test "x$enable_shared" = "xno" && DYEXT="none"
2366 AC_CHECK_TOOL([AR], [ar])
2371 AC_LBL_DEVEL(V_CCOPT)
2374 # Check to see if the sockaddr struct has the 4.4 BSD sa_len member.
2376 AC_CHECK_MEMBERS([struct sockaddr.sa_len],,,
2378 #include <sys/types.h>
2379 #include <sys/socket.h>
2383 # Various Linux-specific mechanisms.
2385 AC_ARG_ENABLE([usb],
2386 [AS_HELP_STRING([--enable-usb],[enable Linux usbmon USB capture support @<:@default=yes, if support available@:>@])],
2391 # If somebody requested an XXX-only pcap, that doesn't include
2392 # additional mechanisms.
2394 if test "$xxx_only" != yes; then
2397 dnl check for USB sniffing support
2398 AC_MSG_CHECKING(for Linux usbmon USB sniffing support)
2399 if test "x$enable_usb" != "xno" ; then
2400 AC_DEFINE(PCAP_SUPPORT_LINUX_USBMON, 1, [target host supports Linux usbmon for USB sniffing])
2401 MODULE_C_SRC="$MODULE_C_SRC pcap-usb-linux.c"
2404 # Note: if the directory for special files is *EVER* somewhere
2405 # other than the UN*X standard of /dev (which will break any
2406 # software that looks for /dev/null or /dev/tty, for example,
2407 # so doing that is *REALLY* not a good idea), please provide
2408 # some mechanism to determine that directory at *run time*,
2409 # rather than *configure time*, so that it works when doing
2410 # a cross-build, and that works with *multiple* distributions,
2411 # with our without udev, and with multiple versions of udev,
2412 # with udevinfo or udevadm or any other mechanism to get the
2413 # special files directory.
2415 # Do we have a version of <linux/compiler.h> available?
2416 # If so, we might need it for <linux/usbdevice_fs.h>.
2418 AC_CHECK_HEADERS(linux/compiler.h)
2419 if test "$ac_cv_header_linux_compiler_h" = yes; then
2421 # Yes - include it when testing for <linux/usbdevice_fs.h>.
2423 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
2425 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
2427 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
2429 # OK, does it define bRequestType? Older versions of the kernel
2430 # define fields with names like "requesttype, "request", and
2431 # "value", rather than "bRequestType", "bRequest", and
2434 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,,
2437 #ifdef HAVE_LINUX_COMPILER_H
2438 #include <linux/compiler.h>
2440 #include <linux/usbdevice_fs.h>
2448 # Life's too short to deal with trying to get this to compile
2449 # if you don't get the right types defined with
2450 # __KERNEL_STRICT_NAMES getting defined by some other include.
2452 # Check whether the includes Just Work. If not, don't turn on
2453 # netfilter support.
2455 AC_MSG_CHECKING(whether we can compile the netfilter support)
2456 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
2457 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2459 #include <sys/socket.h>
2460 #include <netinet/in.h>
2461 #include <linux/types.h>
2463 #include <linux/netlink.h>
2464 #include <linux/netfilter.h>
2465 #include <linux/netfilter/nfnetlink.h>
2466 #include <linux/netfilter/nfnetlink_log.h>
2467 #include <linux/netfilter/nfnetlink_queue.h>]],
2469 [ac_cv_netfilter_can_compile=yes],
2470 [ac_cv_netfilter_can_compile=no]))
2471 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
2472 if test $ac_cv_netfilter_can_compile = yes ; then
2473 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
2474 [target host supports netfilter sniffing])
2475 MODULE_C_SRC="$MODULE_C_SRC pcap-netfilter-linux.c"
2480 AC_SUBST(PCAP_SUPPORT_LINUX_USBMON)
2481 AC_SUBST(PCAP_SUPPORT_NETFILTER)
2483 AC_ARG_ENABLE([netmap],
2484 [AS_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
2486 [enable_netmap=yes])
2488 # In this block "yes" means the same as "ifpresent" in the DAG block above.
2489 # Windows is CMake-only.
2498 if test "x$enable_netmap" != "xno" ; then
2500 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is
2501 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS
2502 # is defined, for example, as it includes a nonexistent malloc.h
2505 AC_MSG_CHECKING(whether we can compile the netmap support)
2506 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile,
2507 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
2509 #define NETMAP_WITH_LIBS
2510 #include <net/netmap_user.h>]],
2512 [ac_cv_net_netmap_user_can_compile=yes],
2513 [ac_cv_net_netmap_user_can_compile=no]))
2514 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile)
2515 if test $ac_cv_net_netmap_user_can_compile = yes ; then
2516 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1,
2517 [target host supports netmap])
2518 MODULE_C_SRC="$MODULE_C_SRC pcap-netmap.c"
2520 AC_SUBST(PCAP_SUPPORT_NETMAP)
2523 # Check for DPDK support.
2525 AS_HELP_STRING([--with-dpdk@<:@=DIR@:>@],[include DPDK support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
2527 if test "$withval" = no
2529 # User doesn't want DPDK support.
2531 elif test "$withval" = yes
2533 # User wants DPDK support but hasn't specified a directory.
2536 # User wants DPDK support and has specified a directory,
2537 # so use the provided value.
2542 if test "$V_PCAP" = dpdk; then
2543 # User requested DPDK-only libpcap, so we'd better have
2546 elif test "$xxx_only" = yes; then
2547 # User requested something-else-only pcap, so they don't
2548 # want DPDK support.
2552 # User didn't explicitly request DPDK; don't give it
2553 # to them without their consent, as the code is
2554 # immensely hard to keep compiling for every random
2555 # API change the DPDK folks make.
2561 # Same as for DAG above.
2566 case "$want_dpdk" in
2571 AC_MSG_ERROR([cannot enable DPDK support (neither Linux nor FreeBSD)])
2577 if test "$want_dpdk" != no; then
2579 # The user didn't explicitly say they don't want DPDK,
2580 # so see if we have it.
2582 # We only try to find it using pkg-config; DPDK is *SO*
2583 # complicated - DPDK 19.02, for example, has about 117(!)
2584 # libraries, and the precise set of libraries required has
2585 # changed over time - so attempting to guess which libraries
2586 # you need, and hardcoding that in an attempt to find the
2587 # libraries without DPDK, rather than relying on DPDK to
2588 # tell you, with a .pc file, what libraries are needed,
2589 # is *EXTREMELY* fragile and has caused some bug reports,
2590 # so we're just not going to do it.
2592 # If that causes a problem, the only thing we will do is
2593 # accept an alternative way of finding the appropriate
2594 # library set for the installed version of DPDK that is
2595 # as robust as pkg-config (i.e., it had better work as well
2596 # as pkg-config with *ALL* versions of DPDK that provide a
2599 # If --with-dpdk={path} was specified, add {path}/pkgconfig
2600 # to PKG_CONFIG_PATH, so we look for the .pc file there,
2603 save_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
2604 if test -n "$dpdk_dir"; then
2605 PKG_CONFIG_PATH="$dpdk_dir:$PKG_CONFIG_PATH"
2607 PKG_CHECK_MODULE(DPDK, libdpdk,
2611 PKG_CONFIG_PATH="$save_PKG_CONFIG_PATH"
2616 if test "$found_dpdk" = yes; then
2620 # We call rte_eth_dev_count_avail(), and older versions
2621 # of DPDK didn't have it, so check for it.
2623 AC_LBL_SAVE_CHECK_STATE
2624 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2625 LIBS="$LIBS $DPDK_LIBS"
2626 AC_CHECK_FUNC(rte_eth_dev_count_avail)
2627 AC_LBL_RESTORE_CHECK_STATE
2630 if test "$ac_cv_func_rte_eth_dev_count_avail" = yes; then
2632 # We found a usable DPDK.
2634 # Check whether the rte_ether.h file defines
2635 # struct ether_addr or struct rte_ether_addr.
2637 # ("API compatibility? That's for losers!")
2639 AC_LBL_SAVE_CHECK_STATE
2640 CFLAGS="$CFLAGS $DPDK_CFLAGS"
2641 LIBS="$LIBS $DPDK_LIBS"
2642 AC_CHECK_TYPES(struct rte_ether_addr,,,
2644 #include <rte_ether.h>
2646 AC_LBL_RESTORE_CHECK_STATE
2649 # We can build with DPDK.
2651 V_INCLS="$V_INCLS $DPDK_CFLAGS"
2652 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DPDK_LIBS"
2653 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DPDK_LIBS_STATIC"
2654 REQUIRES_PRIVATE="$REQUIRES_PRIVATE libdpdk"
2655 AC_DEFINE(PCAP_SUPPORT_DPDK, 1, [target host supports DPDK])
2656 if test $V_PCAP != dpdk ; then
2657 MODULE_C_SRC="$MODULE_C_SRC pcap-dpdk.c"
2661 # The last line of the output is:
2662 # "checking for struct rte_ether_addr... yes"
2663 # Make it clear what it means for the final result.
2665 AC_MSG_NOTICE([building with DPDK])
2668 # We didn't find a usable DPDK.
2669 # If we required it (with --with-dpdk or --with-pcap=dpdk),
2670 # fail with an appropriate message telling the user what
2673 if test "$found_dpdk" != yes; then
2675 # Not found with pkg-config. Note that we
2676 # require that DPDK must be findable with
2679 if test "$V_PCAP" = dpdk; then
2681 # User requested DPDK-only capture support.
2684 [DPDK support requested with --with-pcap=dpdk, but
2685 we couldn't find DPDK with pkg-config. Make sure that pkg-config is
2686 installed, that DPDK 18.02.2 or later is installed, and that DPDK
2687 provides a .pc file.])
2690 if test "$want_dpdk" = yes; then
2692 # User requested that libpcap include
2693 # DPDK capture support.
2696 [DPDK support requested with --with-dpdk, but we
2697 couldn't find DPDK with pkg-config. Make sure that pkg-config
2698 is installed, that DPDK 18.02.2 or later is installed, and that
2699 DPDK provides .pc file.])
2703 # User didn't indicate whether they wanted DPDK
2704 # or not; the last line of the output is one of:
2705 # "checking for libdpdk with pkg-config... pkg-config not found"
2706 # "checking for libdpdk with pkg-config... not found"
2707 # This conveys the point and is the right amount of
2708 # output when auto-detecting an optional module, so do
2709 # not print anything else.
2711 elif test "$ac_cv_func_rte_eth_dev_count_avail" != yes; then
2713 # Found with pkg-config, but we couldn't compile
2714 # a program that calls rte_eth_dev_count(); we
2715 # probably have the developer package installed,
2716 # but don't have a sufficiently recent version
2717 # of DPDK. Note that we need a sufficiently
2718 # recent version of DPDK.
2720 if test "$V_PCAP" = dpdk; then
2722 # User requested DPDK-only capture support.
2725 [DPDK support requested with --with-pcap=dpdk, but we
2726 can't compile libpcap with DPDK. Make sure that DPDK 18.02.2 or later
2730 if test "$want_dpdk" = yes; then
2732 # User requested that libpcap include
2733 # DPDK capture support.
2736 [DPDK support requested with --with-dpdk, but
2737 we can't compile libpcap with DPDK. Make sure that DPDK 18.02.2
2738 or later is DPDK is installed.])
2742 # User didn't indicate whether they wanted DPDK
2743 # or not; the last line of the output is:
2744 # "checking for rte_eth_dev_count_avail... no"
2745 # Make it clear what it means for the final result.
2747 AC_MSG_NOTICE([building without DPDK (present, but cannot be used)])
2751 AC_SUBST(PCAP_SUPPORT_DPDK)
2753 AC_ARG_ENABLE([bluetooth],
2754 [AS_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
2756 [enable_bluetooth=ifsupportavailable])
2758 if test "$xxx_only" = yes; then
2759 # User requested something-else-only pcap, so they don't
2760 # want Bluetooth support.
2764 if test "x$enable_bluetooth" != "xno" ; then
2765 dnl check for Bluetooth sniffing support
2768 AC_CHECK_HEADER(bluetooth/bluetooth.h,
2771 # We have bluetooth.h, so we support Bluetooth
2774 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
2775 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-linux.c"
2776 AC_MSG_NOTICE(Bluetooth sniffing is supported)
2777 ac_lbl_bluetooth_available=yes
2780 # OK, does struct sockaddr_hci have an hci_channel
2783 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel],
2786 # Yes; is HCI_CHANNEL_MONITOR defined?
2788 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
2789 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
2790 AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
2792 #include <bluetooth/bluetooth.h>
2793 #include <bluetooth/hci.h>
2796 int i = HCI_CHANNEL_MONITOR;
2800 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR, 1,
2801 [target host supports Bluetooth Monitor])
2802 MODULE_C_SRC="$MODULE_C_SRC pcap-bt-monitor-linux.c"
2809 #include <bluetooth/bluetooth.h>
2810 #include <bluetooth/hci.h>
2815 # We don't have bluetooth.h, so we don't support
2816 # Bluetooth sniffing.
2818 if test "x$enable_bluetooth" = "xyes" ; then
2819 AC_MSG_ERROR(Bluetooth sniffing is not supported; install a Bluetooth devel library (libbluetooth-dev|bluez-libs-devel|bluez-dev|libbluetooth-devel|...) to enable it)
2821 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install a Bluetooth devel library (libbluetooth-dev|bluez-libs-devel|bluez-dev|libbluetooth-devel|...) to enable it)
2826 if test "x$enable_bluetooth" = "xyes" ; then
2827 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
2829 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
2833 AC_SUBST(PCAP_SUPPORT_BT)
2836 AC_ARG_ENABLE([dbus],
2837 [AS_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
2839 [enable_dbus=ifavailable])
2841 if test "$xxx_only" = yes; then
2842 # User requested something-else-only pcap, so they don't
2843 # want D-Bus support.
2847 if test "x$enable_dbus" != "xno"; then
2848 if test "x$enable_dbus" = "xyes"; then
2853 # We don't support D-Bus sniffing on macOS; see
2855 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2857 # The user requested it, so fail.
2859 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
2866 # We don't support D-Bus sniffing on macOS; see
2868 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
2870 # The user didn't explicitly request it, so just
2871 # silently refuse to enable it.
2879 if test "x$enable_dbus" != "xno"; then
2880 PKG_CHECK_MODULE(DBUS, dbus-1,
2882 AC_LBL_SAVE_CHECK_STATE
2883 CFLAGS="$CFLAGS $DBUS_CFLAGS"
2884 LIBS="$LIBS $DBUS_LIBS"
2885 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
2886 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2887 [[#include <string.h>
2890 #include <sys/time.h>
2892 #include <dbus/dbus.h>]],
2893 [[return dbus_connection_read_write(NULL, 0);]])],
2895 AC_MSG_RESULT([yes])
2896 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
2897 MODULE_C_SRC="$MODULE_C_SRC pcap-dbus.c"
2898 V_INCLS="$V_INCLS $DBUS_CFLAGS"
2899 ADDITIONAL_LIBS="$ADDITIONAL_LIBS $DBUS_LIBS"
2900 ADDITIONAL_LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $DBUS_LIBS_STATIC"
2901 REQUIRES_PRIVATE="$REQUIRES_PRIVATE dbus-1"
2905 if test "x$enable_dbus" = "xyes"; then
2906 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
2909 AC_LBL_RESTORE_CHECK_STATE
2912 if test "x$enable_dbus" = "xyes"; then
2913 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
2916 AC_SUBST(PCAP_SUPPORT_DBUS)
2919 AC_ARG_ENABLE([rdma],
2920 [AS_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
2922 [enable_rdma=ifavailable])
2924 if test "$xxx_only" = yes; then
2925 # User requested something-else-only pcap, so they don't
2926 # want RDMA support.
2930 # Same as for DAG above.
2931 if ! expr "$host_os" : linux >/dev/null; then
2932 case "$enable_rdma" in
2937 AC_MSG_ERROR([cannot enable RDMA support (not Linux)])
2942 if test "x$enable_rdma" != "xno"; then
2943 PKG_CHECK_MODULE(LIBIBVERBS, libibverbs,
2945 found_libibverbs=yes
2946 LIBIBVERBS_REQUIRES_PRIVATE="libibverbs"
2949 if test "x$found_libibverbs" != "xyes"; then
2950 AC_CHECK_LIB(ibverbs, ibv_get_device_list,
2952 found_libibverbs=yes
2953 LIBIBVERBS_CFLAGS=""
2954 LIBIBVERBS_LIBS="-libverbs"
2955 # XXX - at least on Ubuntu 20.04, there are many more
2956 # libraries needed; is there any platform where
2957 # libibverbs is available but where pkg-config isn't
2958 # available or libibverbs doesn't use it? If not,
2959 # we should only use pkg-config for it.
2960 LIBIBVERBS_LIBS_STATIC="-libverbs"
2961 LIBIBVERBS_LIBS_PRIVATE="-libverbs"
2966 if test "x$found_libibverbs" = "xyes"; then
2967 AC_LBL_SAVE_CHECK_STATE
2968 CFLAGS="$CFLAGS $LIBIBVERBS_CFLAGS"
2969 LIBS="$LIBS $LIBIBVERBS_LIBS"
2970 AC_CHECK_HEADER(infiniband/verbs.h, [
2972 # ibv_create_flow may be defined as a static inline
2973 # function in infiniband/verbs.h, so we can't
2976 # Too bad autoconf has no AC_SYMBOL_EXISTS()
2977 # macro that works like CMake's check_symbol_exists()
2978 # function, to check do a compile check like
2979 # this (they do a clever trick to avoid having
2980 # to know the function's signature).
2982 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
2983 AC_LINK_IFELSE([AC_LANG_PROGRAM(
2985 #include <infiniband/verbs.h>
2988 (void) ibv_create_flow((struct ibv_qp *) NULL,
2989 (struct ibv_flow_attr *) NULL);
2992 AC_MSG_RESULT([yes])
2993 found_usable_libibverbs=yes
3000 AC_LBL_RESTORE_CHECK_STATE
3003 if test "x$found_usable_libibverbs" = "xyes"
3005 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, 1, [target host supports RDMA sniffing])
3006 MODULE_C_SRC="$MODULE_C_SRC pcap-rdmasniff.c"
3007 CFLAGS="$LIBIBVERBS_CFLAGS $CFLAGS"
3008 ADDITIONAL_LIBS="$LIBIBVERBS_LIBS $ADDITIONAL_LIBS"
3009 ADDITIONAL_LIBS_STATIC="$LIBIBVERBS_LIBS_STATIC $ADDITIONAL_LIBS_STATIC"
3010 LIBS_PRIVATE="$LIBIBVERBS_LIBS_PRIVATE $LIBS_PRIVATE"
3011 REQUIRES_PRIVATE="$REQUIRES_PRIVATE $LIBIBVERBS_REQUIRES_PRIVATE"
3013 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
3017 # If this is a platform where we need to have the .pc file and
3018 # pcap-config script supply an rpath option to specify the directory
3019 # in which the libpcap shared library is installed, and the install
3020 # prefix /usr (meaning we're not installing a system library), provide
3023 # (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
3024 # case - for example, Linux distributions for 64-bit platforms that
3025 # also provide support for binaries for a 32-bit version of the
3026 # platform may put the 64-bit libraries, the 32-bit libraries, or both
3027 # in directories other than /usr/lib.)
3029 # In AIX, do we have to do this?
3031 # In Darwin-based OSes, the full paths of the shared libraries with
3032 # which the program was linked are stored in the executable, so we don't
3033 # need to provide an rpath option.
3035 # With the HP-UX linker, directories specified with -L are, by default,
3036 # added to the run-time search path, so we don't need to supply them.
3038 # This must *not* depend on the compiler, as, on platforms where there's
3039 # a GCC-compatible compiler and a vendor compiler, we need to work with
3042 if test "$prefix" != "/usr"; then
3045 freebsd*|netbsd*|openbsd*|dragonfly*|linux*|haiku*|midipix*|gnu*)
3047 # Platforms where the "native" C compiler is GCC or
3048 # accepts compatible command-line arguments, and the
3049 # "native" linker is the GNU linker or accepts
3050 # compatible command-line arguments.
3052 RPATH="-Wl,-rpath,\${libdir}"
3057 # Sun/Oracle's linker, the GNU linker, and
3058 # GNU-compatible linkers all support -R.
3060 RPATH="-Wl,-R,\${libdir}"
3067 AC_CONFIG_HEADERS([config.h])
3069 AC_SUBST(V_SHLIB_CCOPT)
3070 AC_SUBST(V_SHLIB_CMD)
3071 AC_SUBST(V_SHLIB_OPT)
3072 AC_SUBST(V_SONAME_OPT)
3075 AC_SUBST(ADDLARCHIVEOBJS)
3076 AC_SUBST(PLATFORM_C_SRC)
3077 AC_SUBST(MODULE_C_SRC)
3078 AC_SUBST(REMOTE_C_SRC)
3079 AC_SUBST(PTHREAD_LIBS)
3080 AC_SUBST(BUILD_RPCAPD)
3081 AC_SUBST(INSTALL_RPCAPD)
3082 AC_SUBST(RPCAPD_LIBS)
3085 # We're done with configuration operations; add ADDITIONAL_LIBS and
3086 # ADDITIONAL_LIBS_STATIC to LIBS and LIBS_STATIC, respectively.
3088 LIBS="$ADDITIONAL_LIBS $LIBS"
3089 LIBS_STATIC="$ADDITIONAL_LIBS_STATIC $LIBS_STATIC"
3091 AC_CONFIG_COMMANDS([.devel],[[if test -f .devel; then
3092 echo timestamp > stamp-h
3093 cat $srcdir/Makefile-devel-adds >> Makefile
3094 make depend || exit 1
3096 AC_CONFIG_FILES([Makefile grammar.y pcap-filter.manmisc pcap-linktype.manmisc
3097 pcap-tstamp.manmisc cbpf-savefile.manfile pcap-savefile.manfile pcap.3pcap
3098 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
3099 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
3100 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
3101 pcap_open_offline.3pcap pcap_set_immediate_mode.3pcap
3102 pcap_set_tstamp_precision.3pcap pcap_set_tstamp_type.3pcap
3103 rpcapd/Makefile rpcapd/rpcapd.manadmin rpcapd/rpcapd-config.manfile
3104 testprogs/Makefile])