1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL)
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
6 dnl Process this file with autoconf to produce a configure script.
12 # http://ftp.gnu.org/gnu/config/README
14 # for the URLs to use to fetch new versions of config.guess and
18 AC_REVISION($Revision: 1.168 $)
24 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
26 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
31 AC_CHECK_HEADERS(sys/bitypes.h)
33 AC_CHECK_TYPE([int8_t], ,
34 [AC_DEFINE([int8_t], [signed char],
35 [Define to `signed char' if int8_t not defined.])],
37 #ifdef HAVE_SYS_BITYPES_H
38 #include <sys/bitypes.h>
40 AC_CHECK_TYPE([u_int8_t], ,
41 [AC_DEFINE([u_int8_t], [unsigned char],
42 [Define to `unsigned char' if u_int8_t not defined.])],
44 #ifdef HAVE_SYS_BITYPES_H
45 #include <sys/bitypes.h>
47 AC_CHECK_TYPE([int16_t], ,
48 [AC_DEFINE([int16_t], [short],
49 [Define to `short' if int16_t not defined.])]
51 #ifdef HAVE_SYS_BITYPES_H
52 #include <sys/bitypes.h>
54 AC_CHECK_TYPE([u_int16_t], ,
55 [AC_DEFINE([u_int16_t], [unsigned short],
56 [Define to `unsigned short' if u_int16_t not defined.])],
58 #ifdef HAVE_SYS_BITYPES_H
59 #include <sys/bitypes.h>
61 AC_CHECK_TYPE([int32_t], ,
62 [AC_DEFINE([int32_t], [int],
63 [Define to `int' if int32_t not defined.])],
65 #ifdef HAVE_SYS_BITYPES_H
66 #include <sys/bitypes.h>
68 AC_CHECK_TYPE([u_int32_t], ,
69 [AC_DEFINE([u_int32_t], [unsigned int],
70 [Define to `unsigned int' if u_int32_t not defined.])],
72 #ifdef HAVE_SYS_BITYPES_H
73 #include <sys/bitypes.h>
75 AC_CHECK_TYPE([int64_t], ,
76 [AC_DEFINE([int64_t], [long long],
77 [Define to `long long' if int64_t not defined.])],
79 #ifdef HAVE_SYS_BITYPES_H
80 #include <sys/bitypes.h>
82 AC_CHECK_TYPE([u_int64_t], ,
83 [AC_DEFINE([u_int64_t], [unsigned long long],
84 [Define to `unsigned long long' if u_int64_t not defined.])],
86 #ifdef HAVE_SYS_BITYPES_H
87 #include <sys/bitypes.h>
91 # Try to arrange for large file support.
97 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
98 dnl include <sys/ioccom.h>, and we were to drop support for older
99 dnl releases without that fix, so that pcap-bpf.c doesn't need to
100 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
101 dnl in "aclocal.m4" uses it, so we would still have to test for it
102 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
103 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
105 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
106 AC_CHECK_HEADERS(linux/types.h)
107 AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_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_FUNCS(strerror strlcpy)
154 AC_CHECK_FUNCS(vsnprintf snprintf,,
156 if test $needsnprintf = yes; then
157 AC_LIBOBJ([snprintf])
161 # Do this before checking for ether_hostton(), as it's a
162 # "gethostbyname() -ish function".
167 # You are in a twisty little maze of UN*Xes, all different.
168 # Some might not have ether_hostton().
169 # Some might have it, but not declare it in any header file.
170 # Some might have it, but declare it in <netinet/if_ether.h>.
171 # Some might have it, but declare it in <netinet/ether.h>
172 # (And some might have it but document it as something declared in
173 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
175 # Before you is a C compiler.
177 AC_CHECK_FUNCS(ether_hostton)
178 if test "$ac_cv_func_ether_hostton" = yes; then
180 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
182 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
184 # Yes. Does it declare ether_hostton()?
186 AC_CHECK_DECL(ether_hostton,
188 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
189 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
192 #include <sys/types.h>
193 #include <sys/socket.h>
194 #include <netinet/in.h>
195 #include <arpa/inet.h>
199 #include <netinet/if_ether.h>
205 if test "$ac_cv_have_decl_ether_hostton" != yes; then
207 # No, how about <netinet/ether.h>, as on Linux?
209 AC_CHECK_HEADERS(netinet/ether.h)
210 if test "$ac_cv_header_netinet_ether_h" = yes; then
212 # We have it - does it declare ether_hostton()?
213 # Unset ac_cv_have_decl_ether_hostton so we don't
214 # treat the previous failure as a cached value and
215 # suppress the next test.
217 unset ac_cv_have_decl_ether_hostton
218 AC_CHECK_DECL(ether_hostton,
220 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
221 [Define to 1 if netinet/ether.h declares `ether_hostton'])
224 #include <netinet/ether.h>
229 # Is ether_hostton() declared?
231 if test "$ac_cv_have_decl_ether_hostton" != yes; then
233 # No, we'll have to declare it ourselves.
234 # Do we have "struct ether_addr"?
236 AC_CHECK_TYPES(struct ether_addr,,,
238 #include <sys/types.h>
239 #include <sys/socket.h>
240 #include <netinet/in.h>
241 #include <arpa/inet.h>
245 #include <netinet/if_ether.h>
247 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
248 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
251 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
252 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
257 dnl to pacify those who hate protochain insn
258 AC_MSG_CHECKING(if --disable-protochain option is specified)
259 AC_ARG_ENABLE(protochain,
260 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
261 case "x$enable_protochain" in
262 xyes) enable_protochain=enabled ;;
263 xno) enable_protochain=disabled ;;
264 x) enable_protochain=enabled ;;
267 if test "$enable_protochain" = "disabled"; then
268 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
270 AC_MSG_RESULT(${enable_protochain})
273 # SITA support is mutually exclusive with native capture support;
274 # "--with-sita" selects SITA support.
277 AC_HELP_STRING([--with-sita],[include SITA support]),
279 if test ! "x$withval" = "xno" ; then
280 AC_DEFINE(SITA,1,[include ACN support])
281 AC_MSG_NOTICE(Enabling SITA ACN support)
288 dnl Not all versions of test support -c (character special) but it's a
289 dnl better way of testing since the device might be protected. So we
290 dnl check in our normal order using -r and then check the for the /dev
291 dnl guys again using -c.
293 dnl XXX This could be done for cross-compiling, but for now it's not.
295 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
296 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
299 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
300 AC_MSG_CHECKING(packet capture type)
301 if test ! -z "$with_pcap" ; then
303 elif test -r /dev/bpf -o -h /dev/bpf ; then
305 # Cloning BPF device.
308 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
309 elif test -r /dev/bpf0 ; then
311 elif test -r /usr/include/net/pfilt.h ; then
313 elif test -r /dev/enet ; then
315 elif test -r /dev/nit ; then
317 elif test -r /usr/include/sys/net/nit.h ; then
319 elif test -r /usr/include/linux/socket.h ; then
321 elif test -r /usr/include/net/raw.h ; then
323 elif test -r /usr/include/odmi.h ; then
325 # On AIX, the BPF devices might not yet be present - they're
326 # created the first time libpcap runs after booting.
327 # We check for odmi.h instead.
330 elif test -c /dev/bpf0 ; then # check again in case not readable
332 elif test -r /usr/include/sys/dlpi.h ; then
334 elif test -c /dev/enet ; then # check again in case not readable
336 elif test -c /dev/nit ; then # check again in case not readable
341 AC_MSG_RESULT($V_PCAP)
344 # Do capture-mechanism-dependent tests.
349 # Checks to see if Solaris has the public libdlpi(3LIB) library.
350 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
351 # public libdlpi(3LIB) version. Before libdlpi was made public, a
352 # private version also existed, which did not have the same APIs.
353 # Due to a gcc bug, the default search path for 32-bit libraries does
354 # not include /lib, we add it explicitly here.
355 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
356 # Also, due to the bug above applications that link to libpcap with
357 # libdlpi will have to add "-L/lib" option to "configure".
359 saved_ldflags=$LDFLAGS
360 LDFLAGS="$LIBS -L/lib"
361 AC_CHECK_LIB(dlpi, dlpi_walk,
364 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
366 LDFLAGS=$saved_ldflags
369 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
372 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
373 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
376 #include <sys/types.h>
377 #include <sys/time.h>
378 #include <sys/dlpi.h>
380 [int i = DL_PROMISC_PHYS;],
381 ac_cv_sys_dlpi_usable=yes,
382 ac_cv_sys_dlpi_usable=no))
383 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
384 if test $ac_cv_sys_dlpi_usable = no ; then
385 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
389 # Check whether we have a /dev/dlpi device or have multiple devices.
391 AC_MSG_CHECKING(for /dev/dlpi device)
392 if test -c /dev/dlpi ; then
394 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
398 AC_MSG_CHECKING(for $dir directory)
399 if test -d $dir ; then
401 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
408 # This check is for Solaris with DLPI support for passive modes.
409 # See dlpi(7P) for more details.
411 AC_LBL_DL_PASSIVE_REQ_T
416 # Do we have the wireless extensions?
418 AC_CHECK_HEADERS(linux/wireless.h, [], [],
420 #include <sys/socket.h>
421 #include <linux/if.h>
422 #include <linux/types.h>
429 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
430 with_libnl=$withval,,)
432 if test x$with_libnl != xno ; then
436 # Try libnl 3.x first.
438 AC_CHECK_LIB(nl-3, nl_socket_alloc,
441 # Yes, we have libnl 3.x.
443 LIBS="-lnl-genl-3 -lnl-3 $LIBS"
444 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
445 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
446 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
447 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
448 V_INCLS="$V_INCLS -I/usr/include/libnl3"
452 if test x$have_any_nl = xno ; then
456 AC_CHECK_LIB(nl, nl_socket_alloc,
459 # Yes, we have libnl 2.x.
461 LIBS="-lnl-genl -lnl $LIBS"
462 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
463 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
464 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
465 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
470 if test x$have_any_nl = xno ; then
472 # No, we don't; do we have libnl 1.x?
474 AC_CHECK_LIB(nl, nl_handle_alloc,
480 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
485 if test x$have_any_nl = xno ; then
487 # No, we don't have libnl at all.
489 if test x$with_libnl = xyes ; then
490 AC_MSG_ERROR([libnl support requested but libnl not found])
495 AC_CHECK_HEADERS(linux/ethtool.h,,,
498 #include <linux/types.h>
501 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
506 # Check whether we have the *BSD-style ioctls.
508 AC_CHECK_HEADERS(net/if_media.h)
510 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
512 [#include <sys/socket.h>
513 #include <sys/ioctl.h>
515 #include <net/bpf.h>],
516 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
519 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
520 [define if the system supports zerocopy BPF])
525 # Check whether we have struct BPF_TIMEVAL.
527 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
529 #include <sys/types.h>
530 #include <sys/ioctl.h>
531 #ifdef HAVE_SYS_IOCCOM_H
532 #include <sys/ioccom.h>
539 V_DEFS="$V_DEFS -DDAG_ONLY"
543 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
547 V_DEFS="$V_DEFS -DSNF_ONLY"
551 AC_MSG_WARN(cannot determine packet capture interface)
552 AC_MSG_WARN((see the INSTALL doc for more info))
557 dnl Now figure out how we get a list of interfaces and addresses,
558 dnl if we support capturing. Don't bother if we don't support
561 if test "$V_PCAP" = null
564 # We can't capture, so we can't open any capture
565 # devices, so we won't return any interfaces.
569 AC_CHECK_FUNC(getifaddrs,[
571 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
572 # as well, just in case some platform is really weird.
574 AC_CHECK_HEADER(ifaddrs.h,[
576 # We have the header, so we use "getifaddrs()" to
577 # get the list of interfaces.
582 # We don't have the header - give up.
583 # XXX - we could also fall back on some other
584 # mechanism, but, for now, this'll catch this
585 # problem so that we can at least try to figure
586 # out something to do on systems with "getifaddrs()"
587 # but without "ifaddrs.h", if there is something
588 # we can do on those systems.
590 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
594 # Well, we don't have "getifaddrs()", so we have to use
595 # some other mechanism; determine what that mechanism is.
597 # The first thing we use is the type of capture mechanism,
598 # which is somewhat of a proxy for the OS we're using.
603 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
605 # This might be Solaris 8 or later, with
606 # SIOCGLIFCONF, or it might be some other OS
607 # or some older version of Solaris, with
610 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
611 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
613 [#include <sys/param.h>
614 #include <sys/file.h>
615 #include <sys/ioctl.h>
616 #include <sys/socket.h>
617 #include <sys/sockio.h>],
618 [ioctl(0, SIOCGLIFCONF, (char *)0);],
619 ac_cv_lbl_have_siocglifconf=yes,
620 ac_cv_lbl_have_siocglifconf=no))
621 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
622 if test $ac_cv_lbl_have_siocglifconf = yes ; then
628 # Needed for common functions used by pcap-[dlpi,libdlpi].c
635 # Assume we just have SIOCGIFCONF.
636 # (XXX - on at least later Linux kernels, there's
637 # another mechanism, and we should be using that
646 AC_MSG_CHECKING(for socklen_t)
648 #include <sys/types.h>
649 #include <sys/socket.h>
654 if test "x$have_socklen_t" = "xyes"; then
655 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
657 AC_MSG_RESULT($have_socklen_t)
660 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
662 [enable_ipv6=ifavailable])
663 if test "$enable_ipv6" != "no"; then
664 AC_CHECK_FUNC(getaddrinfo,
666 AC_DEFINE(INET6,1,[IPv6])
669 if test "$enable_ipv6" != "ifavailable"; then
670 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
675 AC_MSG_CHECKING(whether to build optimizer debugging code)
676 AC_ARG_ENABLE(optimizer-dbg,
677 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
678 if test "$enable_optimizer_dbg" = "yes"; then
679 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
681 AC_MSG_RESULT(${enable_optimizer_dbg-no})
683 AC_MSG_CHECKING(whether to build parser debugging code)
684 AC_ARG_ENABLE(yydebug,
685 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
686 if test "$enable_yydebug" = "yes"; then
687 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
689 AC_MSG_RESULT(${enable_yydebug-no})
691 # Check for Endace DAG card support.
693 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
695 if test "$withval" = no
697 # User doesn't want DAG support.
699 elif test "$withval" = yes
701 # User wants DAG support but hasn't specified a directory.
704 # User wants DAG support and has specified a directory, so use the provided value.
710 # Use DAG API if present, otherwise don't
715 AC_ARG_WITH([dag-includes],
716 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
718 # User wants DAG support and has specified a header directory, so use the provided value.
720 dag_include_dir=$withval
723 AC_ARG_WITH([dag-libraries],
724 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
726 # User wants DAG support and has specified a library directory, so use the provided value.
734 # We support the DAG API if we're on Linux or BSD, or if we're
735 # building a DAG-only libpcap.
740 # If the user explicitly requested DAG, tell them it's not
743 # If they expressed no preference, don't include it.
745 if test $want_dag = yes; then
746 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
747 elif test $want_dag = yes; then
754 if test "$want_dag" != no; then
756 AC_MSG_CHECKING([whether we have DAG API headers])
758 # If necessary, set default paths for DAG API headers and libraries.
759 if test -z "$dag_root"; then
763 if test -z "$dag_include_dir"; then
764 dag_include_dir="$dag_root/include"
767 if test -z "$dag_lib_dir"; then
768 dag_lib_dir="$dag_root/lib"
771 if test -z "$dag_tools_dir"; then
772 dag_tools_dir="$dag_root/tools"
775 if test -r $dag_include_dir/dagapi.h; then
776 ac_cv_lbl_dag_api=yes
778 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
781 if test $ac_cv_lbl_dag_api = yes; then
782 V_INCLS="$V_INCLS -I$dag_include_dir"
784 if test $V_PCAP != dag ; then
788 # See if we can find a general version string.
789 # Don't need to save and restore LIBS to prevent -ldag being
790 # included if there's a found-action (arg 3).
791 saved_ldflags=$LDFLAGS
792 LDFLAGS="-L$dag_lib_dir"
793 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
794 AC_CHECK_LIB([dag],[dag_get_erf_types], [
795 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
796 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
797 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
799 LDFLAGS=$saved_ldflags
801 if test "$dag_streams" = 1; then
802 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
804 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
806 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
807 if test "$ac_dag_have_vdag" = 1; then
808 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
809 LIBS="$LIBS -lpthread"
813 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
816 AC_MSG_CHECKING(whether we have the DAG API)
818 if test $ac_cv_lbl_dag_api = no; then
820 if test "$want_dag" = yes; then
821 # User wanted DAG support but we couldn't find it.
822 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
825 if test "$V_PCAP" = dag; then
826 # User requested "dag" capture type but the DAG API wasn't
828 AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)])
835 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
837 if test "$withval" = no
840 elif test "$withval" = yes
850 # Use Septel API if present, otherwise don't
852 want_septel=ifpresent
853 septel_root=./../septel
855 ac_cv_lbl_septel_api=no
859 # We support the Septel API if we're on Linux, or if we're building
860 # a Septel-only libpcap.
865 # If the user explicitly requested Septel, tell them it's not
868 # If they expressed no preference, don't include it.
870 if test $want_septel = yes; then
871 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
872 elif test $want_septel = yes; then
878 if test "$with_septel" != no; then
879 AC_MSG_CHECKING(whether we have Septel API)
881 if test -z "$septel_root"; then
882 septel_root=$srcdir/../septel
885 septel_tools_dir="$septel_root"
886 septel_include_dir="$septel_root/INC"
888 ac_cv_lbl_septel_api=no
889 if test -r "$septel_include_dir/msg.h"; then
890 V_INCLS="$V_INCLS -I$septel_include_dir"
891 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"
892 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"
894 if test "$V_PCAP" != septel ; then
897 ac_cv_lbl_septel_api=yes
900 AC_MSG_RESULT($ac_cv_lbl_septel_api)
901 if test $ac_cv_lbl_septel_api = no; then
902 if test "$want_septel" = yes; then
903 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
906 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
910 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
911 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
914 # Check for Myricom SNF support.
916 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
918 if test "$withval" = no
920 # User explicitly doesn't want SNF
922 elif test "$withval" = yes
924 # User wants SNF support but hasn't specific a directory.
927 # User wants SNF support with a specified directory.
933 # Use Sniffer API if present, otherwise don't
938 AC_ARG_WITH([snf-includes],
939 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
941 # User wants SNF with specific header directory
943 snf_include_dir=$withval
946 AC_ARG_WITH([snf-libraries],
947 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
949 # User wants SNF with specific lib directory
957 # We support the Sniffer API if we're on BSD, Linux, or if we're
958 # building a Sniffer-only libpcap.
963 # If the user explicitly requested Sniffer, tell them it's not
966 # If they expressed no preference, don't include it.
968 if test $want_snf = yes; then
969 AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
970 elif test $want_snf = yes; then
977 if test "$with_snf" != no; then
979 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
981 if test -z "$snf_root"; then
985 if test -z "$snf_include_dir"; then
986 snf_include_dir="$snf_root/include"
989 if test -z "$snf_lib_dir"; then
990 snf_lib_dir="$snf_root/lib"
993 if test -f "$snf_include_dir/snf.h"; then
994 ac_cv_lbl_snf_api=yes
996 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
998 if test $ac_cv_lbl_snf_api = no; then
999 if test "$want_snf" = yes; then
1000 AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
1003 saved_ldflags=$LDFLAGS
1004 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1005 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
1006 LDFLAGS="$saved_ldflags"
1008 if test $ac_cv_lbl_snf_api = no; then
1009 if test "$want_snf" = yes; then
1010 AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
1013 V_INCLS="$V_INCLS -I$snf_include_dir"
1015 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1016 if test "$V_PCAP" != snf ; then
1019 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
1024 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
1025 AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
1028 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
1029 if test "$V_LEX" = lex ; then
1030 # Some versions of lex can't handle the definitions section of scanner.l .
1031 # Try lexing it and complain if it can't deal.
1032 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1033 if lex -t scanner.l > /dev/null 2>&1; then
1034 tcpdump_cv_capable_lex=yes
1036 tcpdump_cv_capable_lex=insufficient
1038 if test $tcpdump_cv_capable_lex = insufficient ; then
1039 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1040 libpcap. flex is a lex replacement that has many advantages, including
1041 being able to compile libpcap. For more information, see
1042 http://www.gnu.org/software/flex/flex.html .])
1047 # Assume, by default, no support for shared libraries and V7/BSD convention
1048 # for man pages (file formats in section 5, miscellaneous info in section 7).
1049 # Individual cases can override this.
1057 dnl Workaround to enable certain features
1058 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1061 # AIX makes it fun to build shared and static libraries,
1062 # because they're *both* ".a" archive libraries. We
1063 # build the static library for the benefit of the traditional
1064 # scheme of building libpcap and tcpdump in subdirectories of
1065 # the same directory, with tcpdump statically linked with the
1066 # libpcap in question, but we also build a shared library as
1067 # "libpcap.shareda" and install *it*, rather than the static
1068 # library, as "libpcap.a".
1076 # If we're using DLPI, applications will need to
1077 # use /lib/pse.exp if present, as we use the
1080 pseexe="/lib/pse.exp"
1081 AC_MSG_CHECKING(for $pseexe)
1082 if test -f $pseexe ; then
1090 # If we're using BPF, we need "-lodm" and "-lcfg", as
1091 # we use them to load the BPF module.
1100 V_CCOPT="$V_CCOPT -fno-common"
1101 AC_ARG_ENABLE(universal,
1102 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
1103 if test "$enable_universal" != "no"; then
1108 # Leopard. Build for 32-bit PowerPC, 64-bit
1109 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1110 # first. (That's what Apple does.)
1112 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1113 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1118 # Snow Leopard. Build for x86-64, x86, and
1119 # 32-bit PowerPC, with x86-64 first. (That's
1120 # what Apple does, even though Snow Leopard
1121 # doesn't run on PPC, so PPC libpcap runs under
1122 # Rosetta, and Rosetta doesn't support BPF
1123 # ioctls, so PPC programs can't do live
1126 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1127 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1132 # Lion. Build for x86-64 and x86, with x86-64
1133 # first. (That's probably what Apple does,
1134 # given that Rosetta is gone.)
1136 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1137 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1144 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1147 # Use System V conventions for man pages.
1156 # Use System V conventions for man pages.
1165 # Use System V conventions for man pages.
1172 dnl HPUX 10.20 and above is similar to HPUX 9, but
1173 dnl not the same....
1175 dnl XXX - DYEXT should be set to "sl" if this is building
1176 dnl for 32-bit PA-RISC, but should be left as "so" for
1177 dnl 64-bit PA-RISC or, I suspect, IA-64.
1178 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1179 if test "`uname -m`" = "ia64"; then
1186 # "-b" builds a shared library; "+h" sets the soname.
1192 # Use System V conventions for man pages.
1200 # Use System V conventions for man pages.
1206 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1210 # Compiler assumed to be GCC; run-time linker may require a -R
1213 if test "$libdir" != "/usr/lib"; then
1214 V_RFLAGS=-Wl,-R$libdir
1222 # Use System V conventions for man pages.
1229 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1230 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1234 ac_cv_cc_sinix_defined=yes,
1235 ac_cv_cc_sinix_defined=no))
1236 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1237 if test $ac_cv_cc_sinix_defined = no ; then
1238 AC_DEFINE(sinix,1,[on sinix])
1243 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1247 # Use System V conventions for man pages.
1254 AC_ARG_ENABLE(shared,
1255 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1256 test "x$enable_shared" = "xno" && DYEXT="none"
1259 AC_CHECK_TOOL([AR], [ar])
1261 AC_LBL_DEVEL(V_CCOPT)
1263 AC_LBL_SOCKADDR_SA_LEN
1265 AC_LBL_SOCKADDR_STORAGE
1267 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1269 AC_LBL_UNALIGNED_ACCESS
1272 # Makefile.in includes rules to generate version.h, so we assume
1273 # that it will be generated if autoconf is used.
1275 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1278 ln -s ${srcdir}/bpf/net net
1282 AC_SUBST(V_FINDALLDEVS)
1286 AC_SUBST(V_SHLIB_CMD)
1287 AC_SUBST(V_SHLIB_OPT)
1288 AC_SUBST(V_SONAME_OPT)
1289 AC_SUBST(V_RPATH_OPT)
1292 AC_SUBST(ADDLARCHIVEOBJS)
1295 AC_SUBST(MAN_FILE_FORMATS)
1296 AC_SUBST(MAN_MISC_INFO)
1298 dnl check for USB sniffing support
1299 AC_MSG_CHECKING(for USB sniffing support)
1302 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1303 USB_SRC=pcap-usb-linux.c
1305 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1306 if test $? -ne 0 ; then
1307 ac_usb_dev_name="usbmon"
1309 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1310 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1312 # Do we have a version of <linux/compiler.h> available?
1313 # If so, we might need it for <linux/usbdevice_fs.h>.
1315 AC_CHECK_HEADERS(linux/compiler.h)
1316 if test "$ac_cv_header_linux_compiler_h" = yes; then
1318 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1320 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1322 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1324 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1326 # OK, does it define bRequestType? Older versions of the kernel
1327 # define fields with names like "requesttype, "request", and
1328 # "value", rather than "bRequestType", "bRequest", and
1331 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1332 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1335 #ifdef HAVE_SYS_BITYPES_H
1336 #include <sys/bitypes.h>
1338 #ifdef HAVE_LINUX_COMPILER_H
1339 #include <linux/compiler.h>
1341 #include <linux/usbdevice_fs.h>],
1342 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1343 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1344 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1345 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1346 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1347 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1348 [if struct usbdevfs_ctrltransfer has bRequestType])
1356 AC_SUBST(PCAP_SUPPORT_USB)
1359 dnl check for netfilter sniffing support
1360 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1365 # Life's too short to deal with trying to get this to compile
1366 # if you don't get the right types defined with
1367 # __KERNEL_STRICT_NAMES getting defined by some other include.
1369 # Check whether the includes Just Work. If not, don't turn on
1370 # netfilter support.
1372 AC_MSG_CHECKING(whether we can compile the netfilter support)
1373 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1376 #include <sys/socket.h>
1377 #include <netinet/in.h>
1378 #include <linux/types.h>
1380 #include <linux/netlink.h>
1381 #include <linux/netfilter.h>
1382 #include <linux/netfilter/nfnetlink.h>
1383 #include <linux/netfilter/nfnetlink_log.h>
1384 #include <linux/netfilter/nfnetlink_queue.h>],
1386 ac_cv_netfilter_can_compile=yes,
1387 ac_cv_netfilter_can_compile=no))
1388 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1389 if test $ac_cv_netfilter_can_compile = yes ; then
1390 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1391 [target host supports netfilter sniffing])
1392 NETFILTER_SRC=pcap-netfilter-linux.c
1399 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1400 AC_SUBST(NETFILTER_SRC)
1402 AC_ARG_ENABLE([bluetooth],
1403 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1405 [enable_bluetooth=yes])
1407 if test "x$enable_bluetooth" != "xno" ; then
1408 dnl check for Bluetooth sniffing support
1411 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1413 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1414 BT_SRC=pcap-bt-linux.c
1415 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1418 # OK, does struct sockaddr_hci have an hci_channel
1421 AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
1422 AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
1425 #include <bluetooth/bluetooth.h>
1426 #include <bluetooth/hci.h>
1428 [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
1429 ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
1430 ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
1431 AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
1432 if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
1433 AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
1434 [if struct sockaddr_hci has hci_channel member])
1437 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1441 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1444 AC_SUBST(PCAP_SUPPORT_BT)
1448 AC_ARG_ENABLE([canusb],
1449 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
1451 [enable_canusb=yes])
1453 if test "x$enable_canusb" != "xno" ; then
1454 dnl check for canusb support
1457 AC_CHECK_HEADER(libusb-1.0/libusb.h,
1459 AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
1460 CANUSB_SRC=pcap-canusb-linux.c
1461 LIBS="-lusb-1.0 -lpthread $LIBS"
1462 AC_MSG_NOTICE(canusb sniffing is supported)
1464 AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
1468 AC_MSG_NOTICE(no canusb support implemented for $host_os)
1471 AC_SUBST(PCAP_SUPPORT_CANUSB)
1472 AC_SUBST(CANUSB_SRC)
1475 AC_ARG_ENABLE([can],
1476 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
1480 if test "x$enable_can" != "xno" ; then
1481 dnl check for CAN sniffing support
1484 AC_CHECK_HEADER(linux/can.h,
1485 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
1486 CAN_SRC=pcap-can-linux.c
1487 AC_MSG_NOTICE(CAN sniffing is supported)],
1488 AC_MSG_NOTICE(CAN sniffing is not supported),
1489 [#include <sys/socket.h>]
1493 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
1496 AC_SUBST(PCAP_SUPPORT_CAN)
1500 dnl check for hardware timestamp support
1503 AC_CHECK_HEADERS([linux/net_tstamp.h])
1506 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1512 AC_CONFIG_HEADER(config.h)
1514 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1515 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1516 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1517 pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap
1518 pcap_open_dead.3pcap pcap_open_offline.3pcap
1519 pcap_set_tstamp_type.3pcap)
1521 if test -f .devel ; then