2 dnl Copyright (c) 1994, 1995, 1996, 1997
3 dnl The Regents of the University of California. All rights reserved.
5 dnl Process this file with autoconf to produce a configure script.
11 # http://ftp.gnu.org/gnu/config/README
13 # for the URLs to use to fetch new versions of config.guess and
22 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
24 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
28 if test "$ac_cv___attribute__" = "yes"; then
29 AC_C___ATTRIBUTE___UNUSED
32 AC_CHECK_HEADERS(sys/bitypes.h)
34 AC_CHECK_TYPE([int8_t], ,
35 [AC_DEFINE([int8_t], [signed char],
36 [Define to `signed char' if int8_t not defined.])],
38 #ifdef HAVE_SYS_BITYPES_H
39 #include <sys/bitypes.h>
41 AC_CHECK_TYPE([u_int8_t], ,
42 [AC_DEFINE([u_int8_t], [unsigned char],
43 [Define to `unsigned char' if u_int8_t not defined.])],
45 #ifdef HAVE_SYS_BITYPES_H
46 #include <sys/bitypes.h>
48 AC_CHECK_TYPE([int16_t], ,
49 [AC_DEFINE([int16_t], [short],
50 [Define to `short' if int16_t not defined.])]
52 #ifdef HAVE_SYS_BITYPES_H
53 #include <sys/bitypes.h>
55 AC_CHECK_TYPE([u_int16_t], ,
56 [AC_DEFINE([u_int16_t], [unsigned short],
57 [Define to `unsigned short' if u_int16_t not defined.])],
59 #ifdef HAVE_SYS_BITYPES_H
60 #include <sys/bitypes.h>
62 AC_CHECK_TYPE([int32_t], ,
63 [AC_DEFINE([int32_t], [int],
64 [Define to `int' if int32_t not defined.])],
66 #ifdef HAVE_SYS_BITYPES_H
67 #include <sys/bitypes.h>
69 AC_CHECK_TYPE([u_int32_t], ,
70 [AC_DEFINE([u_int32_t], [unsigned int],
71 [Define to `unsigned int' if u_int32_t not defined.])],
73 #ifdef HAVE_SYS_BITYPES_H
74 #include <sys/bitypes.h>
76 AC_CHECK_TYPE([int64_t], ,
77 [AC_DEFINE([int64_t], [long long],
78 [Define to `long long' if int64_t not defined.])],
80 #ifdef HAVE_SYS_BITYPES_H
81 #include <sys/bitypes.h>
83 AC_CHECK_TYPE([u_int64_t], ,
84 [AC_DEFINE([u_int64_t], [unsigned long long],
85 [Define to `unsigned long long' if u_int64_t not defined.])],
87 #ifdef HAVE_SYS_BITYPES_H
88 #include <sys/bitypes.h>
92 # Try to arrange for large file support.
98 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
99 dnl include <sys/ioccom.h>, and we were to drop support for older
100 dnl releases without that fix, so that pcap-bpf.c doesn't need to
101 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
102 dnl in "aclocal.m4" uses it, so we would still have to test for it
103 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
104 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
106 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h)
107 AC_CHECK_HEADERS(netpacket/packet.h)
108 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
109 #include <sys/socket.h>
110 #include <net/if.h>])
111 if test "$ac_cv_header_net_pfvar_h" = yes; then
113 # Check for various PF actions.
115 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
117 [#include <sys/types.h>
118 #include <sys/socket.h>
120 #include <net/pfvar.h>],
121 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
124 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
125 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
129 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
130 #include <sys/socket.h>])
131 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
133 # The simple test didn't work.
134 # Do we need to include <net/if.h> first?
135 # Unset ac_cv_header_netinet_if_ether_h so we don't
136 # treat the previous failure as a cached value and
137 # suppress the next test.
139 AC_MSG_NOTICE([Rechecking with some additional includes])
140 unset ac_cv_header_netinet_if_ether_h
141 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
142 #include <sys/socket.h>
143 #include <netinet/in.h>
146 #include <net/if.h>])
151 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
153 #include <sys/socket.h>
154 #include <linux/if.h>
161 AC_CHECK_FUNCS(strerror strlcpy strlcat)
164 AC_CHECK_FUNCS(vsnprintf snprintf,,
166 if test $needsnprintf = yes; then
167 AC_LIBOBJ([snprintf])
171 AC_CHECK_FUNCS(strtok_r,,
173 if test $needstrtok_r = yes; then
174 AC_LIBOBJ([strtok_r])
178 # Do this before checking for ether_hostton(), as it's a
179 # "gethostbyname() -ish function".
184 # You are in a twisty little maze of UN*Xes, all different.
185 # Some might not have ether_hostton().
186 # Some might have it, but not declare it in any header file.
187 # Some might have it, but declare it in <netinet/if_ether.h>.
188 # Some might have it, but declare it in <netinet/ether.h>
189 # (And some might have it but document it as something declared in
190 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
192 # Before you is a C compiler.
194 AC_CHECK_FUNCS(ether_hostton)
195 if test "$ac_cv_func_ether_hostton" = yes; then
197 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
199 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
201 # Yes. Does it declare ether_hostton()?
203 AC_CHECK_DECL(ether_hostton,
205 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
206 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
209 #include <sys/types.h>
210 #include <sys/socket.h>
211 #include <netinet/in.h>
212 #include <arpa/inet.h>
216 #include <netinet/if_ether.h>
222 if test "$ac_cv_have_decl_ether_hostton" != yes; then
224 # No, how about <netinet/ether.h>, as on Linux?
226 AC_CHECK_HEADERS(netinet/ether.h)
227 if test "$ac_cv_header_netinet_ether_h" = yes; then
229 # We have it - does it declare ether_hostton()?
230 # Unset ac_cv_have_decl_ether_hostton so we don't
231 # treat the previous failure as a cached value and
232 # suppress the next test.
234 unset ac_cv_have_decl_ether_hostton
235 AC_CHECK_DECL(ether_hostton,
237 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
238 [Define to 1 if netinet/ether.h declares `ether_hostton'])
241 #include <netinet/ether.h>
246 # Is ether_hostton() declared?
248 if test "$ac_cv_have_decl_ether_hostton" != yes; then
250 # No, we'll have to declare it ourselves.
251 # Do we have "struct ether_addr"?
253 AC_CHECK_TYPES(struct ether_addr,,,
255 #include <sys/types.h>
256 #include <sys/socket.h>
257 #include <netinet/in.h>
258 #include <arpa/inet.h>
262 #include <netinet/if_ether.h>
264 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
265 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
268 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
269 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
274 dnl to pacify those who hate protochain insn
275 AC_MSG_CHECKING(if --disable-protochain option is specified)
276 AC_ARG_ENABLE(protochain,
277 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
278 case "x$enable_protochain" in
279 xyes) enable_protochain=enabled ;;
280 xno) enable_protochain=disabled ;;
281 x) enable_protochain=enabled ;;
284 if test "$enable_protochain" = "disabled"; then
285 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
287 AC_MSG_RESULT(${enable_protochain})
290 # valgrindtest directly uses the native capture mechanism, but
291 # only tests with BPF and PF_PACKET sockets; only enable it if
292 # we have BPF or PF_PACKET sockets.
297 # SITA support is mutually exclusive with native capture support;
298 # "--with-sita" selects SITA support.
301 AC_HELP_STRING([--with-sita],[include SITA support]),
303 if test ! "x$withval" = "xno" ; then
304 AC_DEFINE(SITA,1,[include ACN support])
305 AC_MSG_NOTICE(Enabling SITA ACN support)
311 dnl Not all versions of test support -c (character special) but it's a
312 dnl better way of testing since the device might be protected. So we
313 dnl check in our normal order using -r and then check the for the /dev
314 dnl guys again using -c.
316 dnl XXX This could be done for cross-compiling, but for now it's not.
318 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
319 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
322 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
323 AC_MSG_CHECKING(packet capture type)
324 if test ! -z "$with_pcap" ; then
326 elif test -r /dev/bpf -o -h /dev/bpf ; then
328 # Cloning BPF device.
331 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
334 # We have BPF, so build valgrindtest with "make test".
336 VALGRINDTEST=valgrindtest
337 elif test -r /dev/bpf0 ; then
341 # We have BPF, so build valgrindtest with "make test".
343 VALGRINDTEST=valgrindtest
344 elif test -r /usr/include/net/pfilt.h ; then
346 elif test -r /dev/enet ; then
348 elif test -r /dev/nit ; then
350 elif test -r /usr/include/sys/net/nit.h ; then
352 elif test -r /usr/include/linux/socket.h ; then
356 # XXX - this won't work with older kernels that have SOCK_PACKET
357 # sockets but not PF_PACKET sockets.
359 VALGRINDTEST=valgrindtest
360 elif test -r /usr/include/net/raw.h ; then
362 elif test -r /usr/include/odmi.h ; then
364 # On AIX, the BPF devices might not yet be present - they're
365 # created the first time libpcap runs after booting.
366 # We check for odmi.h instead.
369 elif test -c /dev/bpf0 ; then # check again in case not readable
373 # We have BPF, so build valgrindtest with "make test".
375 VALGRINDTEST=valgrindtest
376 elif test -r /usr/include/sys/dlpi.h ; then
378 elif test -c /dev/enet ; then # check again in case not readable
380 elif test -c /dev/nit ; then # check again in case not readable
385 AC_MSG_RESULT($V_PCAP)
386 AC_SUBST(VALGRINDTEST)
389 # Do capture-mechanism-dependent tests.
394 # Needed for common functions used by pcap-[dlpi,libdlpi].c
399 # Checks for some header files.
401 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
404 # Checks to see if Solaris has the public libdlpi(3LIB) library.
405 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
406 # public libdlpi(3LIB) version. Before libdlpi was made public, a
407 # private version also existed, which did not have the same APIs.
408 # Due to a gcc bug, the default search path for 32-bit libraries does
409 # not include /lib, we add it explicitly here.
410 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
411 # Also, due to the bug above applications that link to libpcap with
412 # libdlpi will have to add "-L/lib" option to "configure".
414 saved_ldflags=$LDFLAGS
415 LDFLAGS="$LIBS -L/lib"
416 AC_CHECK_LIB(dlpi, dlpi_walk,
420 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
423 LDFLAGS=$saved_ldflags
426 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
429 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
430 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
433 #include <sys/types.h>
434 #include <sys/time.h>
435 #include <sys/dlpi.h>
437 [int i = DL_PROMISC_PHYS;],
438 ac_cv_sys_dlpi_usable=yes,
439 ac_cv_sys_dlpi_usable=no))
440 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
441 if test $ac_cv_sys_dlpi_usable = no ; then
442 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
446 # Check whether we have a /dev/dlpi device or have multiple devices.
448 AC_MSG_CHECKING(for /dev/dlpi device)
449 if test -c /dev/dlpi ; then
451 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
455 AC_MSG_CHECKING(for $dir directory)
456 if test -d $dir ; then
458 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
465 # This check is for Solaris with DLPI support for passive modes.
466 # See dlpi(7P) for more details.
468 AC_LBL_DL_PASSIVE_REQ_T
473 # Do we have the wireless extensions?
475 AC_CHECK_HEADERS(linux/wireless.h, [], [],
477 #include <sys/socket.h>
478 #include <linux/if.h>
479 #include <linux/types.h>
486 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
487 with_libnl=$withval,,)
489 if test x$with_libnl != xno ; then
492 incdir=-I/usr/include/libnl3
494 if test x$withval != x ; then
495 libnldir=-L${withval}/lib/.libs
496 incdir=-I${withval}/include
500 # Try libnl 3.x first.
502 AC_CHECK_LIB(nl-3, nl_socket_alloc,
505 # Yes, we have libnl 3.x.
507 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
508 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
509 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
510 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
511 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
512 V_INCLS="$V_INCLS ${incdir}"
514 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
516 if test x$have_any_nl = xno ; then
520 AC_CHECK_LIB(nl, nl_socket_alloc,
523 # Yes, we have libnl 2.x.
525 LIBS="${libnldir} -lnl-genl -lnl $LIBS"
526 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
527 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
528 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
529 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
534 if test x$have_any_nl = xno ; then
536 # No, we don't; do we have libnl 1.x?
538 AC_CHECK_LIB(nl, nl_handle_alloc,
543 LIBS="${libnldir} -lnl $LIBS"
544 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
549 if test x$have_any_nl = xno ; then
551 # No, we don't have libnl at all.
553 if test x$with_libnl = xyes ; then
554 AC_MSG_ERROR([libnl support requested but libnl not found])
559 AC_CHECK_HEADERS(linux/ethtool.h,,,
562 #include <linux/types.h>
565 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
570 # Check whether we have the *BSD-style ioctls.
572 AC_CHECK_HEADERS(net/if_media.h)
575 # Check whether we have struct BPF_TIMEVAL.
577 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
579 #include <sys/types.h>
580 #include <sys/ioctl.h>
581 #ifdef HAVE_SYS_IOCCOM_H
582 #include <sys/ioccom.h>
590 # --with-pcap=dag is the only way to get here, and it means
591 # "DAG support but nothing else"
593 V_DEFS="$V_DEFS -DDAG_ONLY"
599 # --with-pcap=septel is the only way to get here, and it means
600 # "Septel support but nothing else"
602 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
608 # --with-pcap=snf is the only way to get here, and it means
609 # "SNF support but nothing else"
611 V_DEFS="$V_DEFS -DSNF_ONLY"
616 AC_MSG_WARN(cannot determine packet capture interface)
617 AC_MSG_WARN((see the INSTALL doc for more info))
621 AC_MSG_ERROR($V_PCAP is not a valid pcap type)
626 dnl Now figure out how we get a list of interfaces and addresses,
627 dnl if we support capturing. Don't bother if we don't support
630 if test "$V_PCAP" != null
632 AC_CHECK_FUNC(getifaddrs,[
634 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
635 # as well, just in case some platform is really weird.
637 AC_CHECK_HEADER(ifaddrs.h,[
639 # We have the header, so we use "getifaddrs()" to
640 # get the list of interfaces.
642 V_FINDALLDEVS=fad-getad.c
645 # We don't have the header - give up.
646 # XXX - we could also fall back on some other
647 # mechanism, but, for now, this'll catch this
648 # problem so that we can at least try to figure
649 # out something to do on systems with "getifaddrs()"
650 # but without "ifaddrs.h", if there is something
651 # we can do on those systems.
653 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
657 # Well, we don't have "getifaddrs()", so we have to use
658 # some other mechanism; determine what that mechanism is.
660 # The first thing we use is the type of capture mechanism,
661 # which is somewhat of a proxy for the OS we're using.
667 # This might be Solaris 8 or later, with
668 # SIOCGLIFCONF, or it might be some other OS
669 # or some older version of Solaris, with
672 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
673 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
675 [#include <sys/param.h>
676 #include <sys/file.h>
677 #include <sys/ioctl.h>
678 #include <sys/socket.h>
679 #include <sys/sockio.h>],
680 [ioctl(0, SIOCGLIFCONF, (char *)0);],
681 ac_cv_lbl_have_siocglifconf=yes,
682 ac_cv_lbl_have_siocglifconf=no))
683 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
684 if test $ac_cv_lbl_have_siocglifconf = yes ; then
685 V_FINDALLDEVS=fad-glifc.c
687 V_FINDALLDEVS=fad-gifc.c
693 # Assume we just have SIOCGIFCONF.
694 # (XXX - on at least later Linux kernels, there's
695 # another mechanism, and we should be using that
698 V_FINDALLDEVS=fad-gifc.c
704 AC_MSG_CHECKING(for socklen_t)
706 #include <sys/types.h>
707 #include <sys/socket.h>
712 if test "x$have_socklen_t" = "xyes"; then
713 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
715 AC_MSG_RESULT($have_socklen_t)
718 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
720 [enable_ipv6=ifavailable])
721 if test "$enable_ipv6" != "no"; then
722 AC_CHECK_FUNC(getaddrinfo,
724 AC_DEFINE(INET6,1,[IPv6])
727 if test "$enable_ipv6" != "ifavailable"; then
728 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
733 AC_MSG_CHECKING(whether to build optimizer debugging code)
734 AC_ARG_ENABLE(optimizer-dbg,
735 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
736 if test "$enable_optimizer_dbg" = "yes"; then
737 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
739 AC_MSG_RESULT(${enable_optimizer_dbg-no})
741 AC_MSG_CHECKING(whether to build parser debugging code)
742 AC_ARG_ENABLE(yydebug,
743 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
744 if test "$enable_yydebug" = "yes"; then
745 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
747 AC_MSG_RESULT(${enable_yydebug-no})
749 # Check for Endace DAG card support.
751 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
753 if test "$withval" = no
755 # User doesn't want DAG support.
757 elif test "$withval" = yes
759 # User wants DAG support but hasn't specified a directory.
762 # User wants DAG support and has specified a directory, so use the provided value.
767 if test "$V_PCAP" = dag; then
768 # User requested DAG-only libpcap, so we'd better have
771 elif test "xxx_only" = yes; then
772 # User requested something-else-only pcap, so they don't
777 # Use DAG API if present, otherwise don't
783 AC_ARG_WITH([dag-includes],
784 AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]),
786 # User wants DAG support and has specified a header directory, so use the provided value.
788 dag_include_dir=$withval
791 AC_ARG_WITH([dag-libraries],
792 AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]),
794 # User wants DAG support and has specified a library directory, so use the provided value.
800 if test "$want_dag" != no; then
802 AC_MSG_CHECKING([whether we have DAG API headers])
804 # If necessary, set default paths for DAG API headers and libraries.
805 if test -z "$dag_root"; then
809 if test -z "$dag_include_dir"; then
810 dag_include_dir="$dag_root/include"
813 if test -z "$dag_lib_dir"; then
814 dag_lib_dir="$dag_root/lib"
817 if test -z "$dag_tools_dir"; then
818 dag_tools_dir="$dag_root/tools"
821 if test -r $dag_include_dir/dagapi.h; then
822 ac_cv_lbl_dag_api=yes
825 if test "$ac_cv_lbl_dag_api" = yes; then
826 AC_MSG_RESULT([yes ($dag_include_dir)])
828 V_INCLS="$V_INCLS -I$dag_include_dir"
830 if test $V_PCAP != dag ; then
831 SSRC="$SSRC pcap-dag.c"
834 # See if we can find a general version string.
835 # Don't need to save and restore LIBS to prevent -ldag being
836 # included if there's a found-action (arg 3).
837 saved_ldflags=$LDFLAGS
838 LDFLAGS="-L$dag_lib_dir"
839 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"])
840 AC_CHECK_LIB([dag],[dag_get_erf_types], [
841 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
842 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
843 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
845 LDFLAGS=$saved_ldflags
847 if test "$dag_large_streams" = 1; then
848 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API])
850 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
852 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
853 if test "$ac_dag_have_vdag" = 1; then
854 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
855 LIBS="$LIBS -lpthread"
859 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
863 if test "$V_PCAP" = dag; then
864 # User requested "dag" capture type but we couldn't
865 # find the DAG API support.
866 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])
869 if test "$want_dag" = yes; then
870 # User wanted DAG support but we couldn't find it.
871 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])
877 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
879 if test "$withval" = no
882 elif test "$withval" = yes
891 if test "$V_PCAP" = septel; then
892 # User requested Septel-only libpcap, so we'd better have
895 elif test "xxx_only" = yes; then
896 # User requested something-else-only pcap, so they don't
897 # want Septel support.
901 # Use Septel API if present, otherwise don't
903 want_septel=ifpresent
907 ac_cv_lbl_septel_api=no
908 if test "$with_septel" != no; then
910 AC_MSG_CHECKING([whether we have Septel API headers])
912 # If necessary, set default paths for Septel API headers and libraries.
913 if test -z "$septel_root"; then
914 septel_root=$srcdir/../septel
917 septel_tools_dir="$septel_root"
918 septel_include_dir="$septel_root/INC"
920 if test -r "$septel_include_dir/msg.h"; then
921 ac_cv_lbl_septel_api=yes
924 if test "$ac_cv_lbl_septel_api" = yes; then
925 AC_MSG_RESULT([yes ($septel_include_dir)])
927 V_INCLS="$V_INCLS -I$septel_include_dir"
928 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"
929 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"
931 if test "$V_PCAP" != septel ; then
932 SSRC="$SSRC pcap-septel.c"
935 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API])
939 if test "$V_PCAP" = septel; then
940 # User requested "septel" capture type but
941 # we couldn't find the Septel API support.
942 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])
945 if test "$want_septel" = yes; then
946 # User wanted Septel support but we couldn't find it.
947 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])
952 # Check for Myricom SNF support.
954 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
956 if test "$withval" = no
958 # User explicitly doesn't want SNF
960 elif test "$withval" = yes
962 # User wants SNF support but hasn't specified a directory.
965 # User wants SNF support with a specified directory.
970 if test "$V_PCAP" = snf; then
971 # User requested Sniffer-only libpcap, so we'd better have
974 elif test "xxx_only" = yes; then
975 # User requested something-else-only pcap, so they don't
980 # Use Sniffer API if present, otherwise don't
986 AC_ARG_WITH([snf-includes],
987 AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]),
989 # User wants SNF with specific header directory
991 snf_include_dir=$withval
994 AC_ARG_WITH([snf-libraries],
995 AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]),
997 # User wants SNF with specific lib directory
1002 ac_cv_lbl_snf_api=no
1003 if test "$with_snf" != no; then
1005 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1007 # If necessary, set default paths for Sniffer headers and libraries.
1008 if test -z "$snf_root"; then
1012 if test -z "$snf_include_dir"; then
1013 snf_include_dir="$snf_root/include"
1016 if test -z "$snf_lib_dir"; then
1017 snf_lib_dir="$snf_root/lib"
1020 if test -f "$snf_include_dir/snf.h"; then
1021 # We found a header; make sure we can link with the library
1022 saved_ldflags=$LDFLAGS
1023 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1024 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"])
1025 LDFLAGS="$saved_ldflags"
1026 if test "$ac_cv_lbl_snf_api" = no; then
1027 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log)
1031 if test "$ac_cv_lbl_snf_api" = yes; then
1032 AC_MSG_RESULT([yes ($snf_root)])
1034 V_INCLS="$V_INCLS -I$snf_include_dir"
1036 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1038 if test "$V_PCAP" != snf ; then
1039 SSRC="$SSRC pcap-snf.c"
1042 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API])
1046 if test "$want_snf" = yes; then
1047 # User requested "snf" capture type but
1048 # we couldn't find the Sniffer API support.
1049 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])
1052 if test "$want_snf" = yes; then
1053 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])
1058 # Check for Riverbed TurboCap support.
1059 AC_ARG_WITH([turbocap],
1060 AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]),
1062 if test "$withval" = no
1064 # User explicitly doesn't want TurboCap
1066 elif test "$withval" = yes
1068 # User wants TurboCap support but hasn't specified a directory.
1071 # User wants TurboCap support with a specified directory.
1073 turbocap_root=$withval
1076 if test "xxx_only" = yes; then
1077 # User requested something-else-only pcap, so they don't
1078 # want TurboCap support.
1082 # Use TurboCap API if present, otherwise don't
1084 want_turbocap=ifpresent
1088 ac_cv_lbl_turbocap_api=no
1089 if test "$want_turbocap" != no; then
1091 AC_MSG_CHECKING(whether TurboCap is supported)
1093 save_CFLAGS="$CFLAGS"
1095 if test ! -z "$turbocap_root"; then
1096 TURBOCAP_CFLAGS="-I$turbocap_root/include"
1097 TURBOCAP_LIBS="-L$turbocap_root/lib"
1098 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS"
1106 TC_INSTANCE a; TC_PORT b; TC_BOARD c;
1108 (void)TcInstanceCreateByName("foo", &i);
1110 ac_cv_lbl_turbocap_api=yes)
1112 CFLAGS="$save_CFLAGS"
1113 if test $ac_cv_lbl_turbocap_api = yes; then
1116 SSRC="$SSRC pcap-tc.c"
1117 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS"
1118 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++"
1120 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API])
1124 if test "$want_turbocap" = yes; then
1125 # User wanted Turbo support but we couldn't find it.
1126 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])
1135 if test "$LEX" = ":"; then
1136 AC_MSG_ERROR([Neither flex nor lex was found.])
1140 # Make sure {f}lex supports the -P, --header-file, and --nounput flags
1141 # and supports processing our scanner.l.
1143 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1144 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then
1145 tcpdump_cv_capable_lex=yes
1147 tcpdump_cv_capable_lex=insufficient
1149 if test $tcpdump_cv_capable_lex = insufficient ; then
1150 AC_MSG_ERROR([$LEX is insufficient to compile libpcap.
1151 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.])
1155 # Look for yacc/bison/byacc.
1160 # Make sure it supports the -p flag and supports processing our
1163 AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc,
1164 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then
1165 tcpdump_cv_capable_yacc=yes
1167 tcpdump_cv_capable_yacc=insufficient
1169 if test $tcpdump_cv_capable_yacc = insufficient ; then
1170 AC_MSG_ERROR([$YACC is insufficient to compile libpcap.
1171 libpcap requires Bison, Berkeley YACC, or another YACC compatible with them.])
1175 dnl Allow the user to enable remote capture.
1176 dnl It's off by default, as that increases the attack surface of
1177 dnl libpcap, exposing it to malicious servers.
1179 AC_MSG_CHECKING([whether to enable remote packet capture])
1180 AC_ARG_ENABLE(remote,
1181 [ --enable-remote enable remote packet capture @<:@default=no@:>@
1182 --disable-remote disable remote packet capture],,
1184 case "$enableval" in
1185 yes) AC_MSG_RESULT(yes)
1186 AC_WARN([Remote packet capture may expose libpcap-based applications])
1187 AC_WARN([to attacks by malicious remote capture servers!])
1188 AC_DEFINE(HAVE_REMOTE,,
1189 [Define to 1 if remote packet capture is to be supported])
1190 SSRC="$SSRC pcap-new.c pcap-rpcap.c sockutils.c"
1192 INSTALL_RPCAPD=install-rpcapd
1194 *) AC_MSG_RESULT(no)
1199 # Assume, by default, no support for shared libraries and V7/BSD convention
1200 # for man pages (file formats in section 5, miscellaneous info in section 7).
1201 # Individual cases can override this.
1206 MAN_USERMOD_SECTION=8
1210 dnl Workaround to enable certain features
1211 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1214 # AIX makes it fun to build shared and static libraries,
1215 # because they're *both* ".a" archive libraries. We
1216 # build the static library for the benefit of the traditional
1217 # scheme of building libpcap and tcpdump in subdirectories of
1218 # the same directory, with tcpdump statically linked with the
1219 # libpcap in question, but we also build a shared library as
1220 # "libpcap.shareda" and install *it*, rather than the static
1221 # library, as "libpcap.a".
1229 # If we're using DLPI, applications will need to
1230 # use /lib/pse.exp if present, as we use the
1233 pseexe="/lib/pse.exp"
1234 AC_MSG_CHECKING(for $pseexe)
1235 if test -f $pseexe ; then
1243 # If we're using BPF, we need "-lodm" and "-lcfg", as
1244 # we use them to load the BPF module.
1253 V_CCOPT="$V_CCOPT -fno-common"
1254 AC_ARG_ENABLE(universal,
1255 AC_HELP_STRING([--disable-universal],[don't build universal on macOS]))
1256 if test "$enable_universal" != "no"; then
1261 # Pre-Tiger. Build only for 32-bit PowerPC; no
1262 # need for any special compiler or linker flags.
1268 # Tiger, prior to Intel support. Build for 32-bit
1269 # PowerPC and 64-bit PowerPC, with 32-bit PowerPC
1270 # first. (I'm guessing that's what Apple does.)
1272 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
1273 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
1278 # Tiger, subsequent to Intel support but prior to
1279 # x86-64 support. Build for 32-bit PowerPC, 64-bit
1280 # PowerPC, and x86, with 32-bit PowerPC first.
1281 # (I'm guessing that's what Apple does.)
1283 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
1284 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
1289 # All other Tiger, so subsequent to x86-64
1290 # support. Build for 32-bit PowerPC, 64-bit
1291 # PowerPC, x86, and x86-64, and with 32-bit PowerPC
1292 # first. (I'm guessing that's what Apple does.)
1294 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1295 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1300 # Leopard. Build for 32-bit PowerPC, 64-bit
1301 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1302 # first. (That's what Apple does.)
1304 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1305 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1310 # Snow Leopard. Build for x86-64, x86, and
1311 # 32-bit PowerPC, with x86-64 first. (That's
1312 # what Apple does, even though Snow Leopard
1313 # doesn't run on PPC, so PPC libpcap runs under
1314 # Rosetta, and Rosetta doesn't support BPF
1315 # ioctls, so PPC programs can't do live
1318 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1319 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1324 # Post-Snow Leopard. Build for x86-64 and
1325 # x86, with x86-64 first. (That's probably what
1326 # Apple does, given that Rosetta is gone.)
1327 # XXX - update if and when Apple drops support
1328 # for 32-bit x86 code.
1330 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1331 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1338 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1341 # Use System V conventions for man pages.
1350 # Use System V conventions for man pages.
1359 # Use System V conventions for man pages.
1366 dnl HPUX 10.20 and above is similar to HPUX 9, but
1367 dnl not the same....
1369 dnl XXX - DYEXT should be set to "sl" if this is building
1370 dnl for 32-bit PA-RISC, but should be left as "so" for
1371 dnl 64-bit PA-RISC or, I suspect, IA-64.
1372 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1373 if test "`uname -m`" = "ia64"; then
1380 # "-b" builds a shared library; "+h" sets the soname.
1386 # Use System V conventions for man pages.
1394 # Use System V conventions for man pages.
1400 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1404 # Compiler assumed to be GCC; run-time linker may require a -R
1407 if test "$libdir" != "/usr/lib"; then
1408 V_RFLAGS=-Wl,-R$libdir
1416 # Use System V conventions for man pages.
1423 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1424 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1428 ac_cv_cc_sinix_defined=yes,
1429 ac_cv_cc_sinix_defined=no))
1430 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1431 if test $ac_cv_cc_sinix_defined = no ; then
1432 AC_DEFINE(sinix,1,[on sinix])
1437 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1441 case "`uname -r`" in
1448 # Use System V conventions for man pages.
1450 MAN_USERMOD_SECTION=1m
1457 AC_ARG_ENABLE(shared,
1458 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1459 test "x$enable_shared" = "xno" && DYEXT="none"
1462 AC_CHECK_TOOL([AR], [ar])
1467 AC_LBL_DEVEL(V_CCOPT)
1469 AC_LBL_SOCKADDR_SA_LEN
1471 AC_LBL_SOCKADDR_STORAGE
1473 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1475 AC_LBL_UNALIGNED_ACCESS
1478 ln -s ${srcdir}/bpf/net net
1482 AC_SUBST(V_FINDALLDEVS)
1486 AC_SUBST(V_SHLIB_CMD)
1487 AC_SUBST(V_SHLIB_OPT)
1488 AC_SUBST(V_SONAME_OPT)
1489 AC_SUBST(V_RPATH_OPT)
1492 AC_SUBST(ADDLARCHIVEOBJS)
1495 AC_SUBST(MAN_FILE_FORMATS)
1496 AC_SUBST(MAN_MISC_INFO)
1497 AC_SUBST(MAN_USERMOD_SECTION)
1499 AC_SUBST(INSTALL_RPCAPD)
1501 AC_ARG_ENABLE([usb],
1502 [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
1506 if test "xxx_only" = yes; then
1507 # User requested something-else-only pcap, so they don't
1512 if test "x$enable_usb" != "xno" ; then
1513 dnl check for USB sniffing support
1514 AC_MSG_CHECKING(for USB sniffing support)
1517 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1518 USB_SRC=pcap-usb-linux.c
1520 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1521 if test $? -ne 0 ; then
1522 ac_usb_dev_name="usbmon"
1524 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1525 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1527 # Do we have a version of <linux/compiler.h> available?
1528 # If so, we might need it for <linux/usbdevice_fs.h>.
1530 AC_CHECK_HEADERS(linux/compiler.h)
1531 if test "$ac_cv_header_linux_compiler_h" = yes; then
1533 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1535 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1537 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1539 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1541 # OK, does it define bRequestType? Older versions of the kernel
1542 # define fields with names like "requesttype, "request", and
1543 # "value", rather than "bRequestType", "bRequest", and
1546 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1547 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1550 #ifdef HAVE_SYS_BITYPES_H
1551 #include <sys/bitypes.h>
1553 #ifdef HAVE_LINUX_COMPILER_H
1554 #include <linux/compiler.h>
1556 #include <linux/usbdevice_fs.h>],
1557 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1558 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1559 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1560 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1561 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1562 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1563 [if struct usbdevfs_ctrltransfer has bRequestType])
1569 # This just uses BPF in FreeBSD 8.4 and later; we don't need
1570 # to check for anything special for capturing.
1572 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later])
1580 AC_SUBST(PCAP_SUPPORT_USB)
1583 dnl check for netfilter sniffing support
1584 if test "xxx_only" != yes; then
1585 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1590 # Life's too short to deal with trying to get this to compile
1591 # if you don't get the right types defined with
1592 # __KERNEL_STRICT_NAMES getting defined by some other include.
1594 # Check whether the includes Just Work. If not, don't turn on
1595 # netfilter support.
1597 AC_MSG_CHECKING(whether we can compile the netfilter support)
1598 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1601 #include <sys/socket.h>
1602 #include <netinet/in.h>
1603 #include <linux/types.h>
1605 #include <linux/netlink.h>
1606 #include <linux/netfilter.h>
1607 #include <linux/netfilter/nfnetlink.h>
1608 #include <linux/netfilter/nfnetlink_log.h>
1609 #include <linux/netfilter/nfnetlink_queue.h>],
1611 ac_cv_netfilter_can_compile=yes,
1612 ac_cv_netfilter_can_compile=no))
1613 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1614 if test $ac_cv_netfilter_can_compile = yes ; then
1615 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1616 [target host supports netfilter sniffing])
1617 NETFILTER_SRC=pcap-netfilter-linux.c
1625 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1626 AC_SUBST(NETFILTER_SRC)
1628 AC_ARG_ENABLE([netmap],
1629 [AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])],
1631 [enable_netmap=yes])
1633 if test "x$enable_netmap" != "xno" ; then
1634 dnl check for netmap support
1635 AC_CHECK_HEADER(net/netmap_user.h,
1636 [ AC_DEFINE(PCAP_SUPPORT_NETMAP, 1, [target host supports netmap])
1637 NETMAP_SRC=pcap-netmap.c
1638 AC_MSG_NOTICE(netmap is supported)],
1639 AC_MSG_NOTICE(netmap is not supported),
1642 AC_SUBST(PCAP_SUPPORT_NETMAP)
1643 AC_SUBST(NETMAP_SRC)
1647 AC_ARG_ENABLE([bluetooth],
1648 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1650 [enable_bluetooth=ifsupportavailable])
1652 if test "xxx_only" = yes; then
1653 # User requested something-else-only pcap, so they don't
1654 # want Bluetooth support.
1658 if test "x$enable_bluetooth" != "xno" ; then
1659 dnl check for Bluetooth sniffing support
1662 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1664 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1665 BT_SRC=pcap-bt-linux.c
1666 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1669 # OK, does struct sockaddr_hci have an hci_channel
1672 AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
1673 AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
1676 #include <bluetooth/bluetooth.h>
1677 #include <bluetooth/hci.h>
1679 [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
1680 ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
1681 ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
1682 AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
1683 if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
1684 AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
1685 [if struct sockaddr_hci has hci_channel member])
1688 # OK, is HCI_CHANNEL_MONITOR defined?
1690 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
1691 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
1694 #include <bluetooth/bluetooth.h>
1695 #include <bluetooth/hci.h>
1697 [u_int i = HCI_CHANNEL_MONITOR],
1698 ac_cv_lbl_hci_channel_monitor_is_defined=yes,
1699 ac_cv_lbl_hci_channel_monitor_is_defined=no))
1700 AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
1701 if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
1702 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
1703 [target host supports Bluetooth Monitor])
1704 BT_MONITOR_SRC=pcap-bt-monitor-linux.c
1707 ac_lbl_bluetooth_available=yes
1709 ac_lbl_bluetooth_available=no
1711 if test "x$ac_lbl_bluetooth_available" == "xno" ; then
1712 if test "x$enable_bluetooth" = "xyes" ; then
1713 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1715 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1720 if test "x$enable_bluetooth" = "xyes" ; then
1721 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
1723 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1727 AC_SUBST(PCAP_SUPPORT_BT)
1729 AC_SUBST(BT_MONITOR_SRC)
1732 AC_ARG_ENABLE([dbus],
1733 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
1735 [enable_dbus=ifavailable])
1737 if test "xxx_only" = yes; then
1738 # User requested something-else-only pcap, so they don't
1739 # want D-Bus support.
1743 if test "x$enable_dbus" != "xno"; then
1744 if test "x$enable_dbus" = "xyes"; then
1749 # We don't support D-Bus sniffing on macOS; see
1751 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1753 # The user requested it, so fail.
1755 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS])
1762 # We don't support D-Bus sniffing on macOS; see
1764 # https://bugs.freedesktop.org/show_bug.cgi?id=74029
1766 # The user dind't explicitly request it, so just
1767 # silently refuse to enable it.
1775 if test "x$enable_dbus" != "xno"; then
1776 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
1777 if test "x$PKGCONFIG" != "xno"; then
1778 AC_MSG_CHECKING([for D-Bus])
1779 if "$PKGCONFIG" dbus-1; then
1780 AC_MSG_RESULT([yes])
1781 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
1782 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
1783 save_CFLAGS="$CFLAGS"
1785 CFLAGS="$CFLAGS $DBUS_CFLAGS"
1786 LIBS="$LIBS $DBUS_LIBS"
1787 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
1789 [#include <string.h>
1792 #include <sys/time.h>
1794 #include <dbus/dbus.h>],
1795 [return dbus_connection_read_write(NULL, 0);],
1797 AC_MSG_RESULT([yes])
1798 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
1799 DBUS_SRC=pcap-dbus.c
1800 V_INCLS="$V_INCLS $DBUS_CFLAGS"
1804 if test "x$enable_dbus" = "xyes"; then
1805 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
1809 CFLAGS="$save_CFLAGS"
1812 if test "x$enable_dbus" = "xyes"; then
1813 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
1817 AC_SUBST(PCAP_SUPPORT_DBUS)
1821 dnl check for hardware timestamp support
1824 AC_CHECK_HEADERS([linux/net_tstamp.h])
1827 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1831 dnl The packet ring capture facility of Linux, described in
1832 dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
1833 dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
1834 dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
1835 dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
1836 dnl kernel struct). This problem was solved in Linux 2.6.27. Use
1837 dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
1838 dnl target host, and either the build host or the target host run Linux 2.6.26
1840 AC_ARG_ENABLE([packet-ring],
1841 [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
1842 ,enable_packet_ring=yes)
1844 if test "x$enable_packet_ring" != "xno" ; then
1845 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
1846 AC_SUBST(PCAP_SUPPORT_PACKET_RING)
1849 AC_ARG_ENABLE([rdma],
1850 [AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])],
1852 [enable_rdmasniff=ifavailable])
1854 if test "xxx_only" = yes; then
1855 # User requested something-else-only pcap, so they don't
1856 # want RDMA support.
1860 if test "x$enable_rdmasniff" != "xno"; then
1861 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [
1862 AC_CHECK_HEADER(infiniband/verbs.h, [
1863 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow)
1866 #include <infiniband/verbs.h>
1869 (void) ibv_create_flow((struct ibv_qp *) NULL,
1870 (struct ibv_flow_attr *) NULL);
1873 AC_MSG_RESULT([yes])
1874 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing])
1875 RDMA_SRC=pcap-rdmasniff.c
1876 LIBS="-libverbs $LIBS"
1884 AC_SUBST(PCAP_SUPPORT_RDMASNIFF)
1890 AC_CONFIG_HEADER(config.h)
1892 AC_OUTPUT_COMMANDS([if test -f .devel; then
1893 echo timestamp > stamp-h
1894 cat Makefile-devel-adds >> Makefile
1897 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1898 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1899 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1900 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
1901 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
1902 pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
1903 pcap_set_tstamp_type.3pcap rpcapd/Makefile)