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
434 # Try libnl 2.x first.
436 AC_CHECK_LIB(nl, nl_socket_alloc,
439 # Yes, we have libnl 2.x.
441 LIBS="-lnl-genl -lnl $LIBS"
442 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
443 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
447 # No, we don't; do we have libnl 1.x?
449 AC_CHECK_LIB(nl, nl_handle_alloc,
455 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
459 # No, we don't have libnl at all.
461 if test x$with_libnl = xyes ; then
462 AC_MSG_ERROR([libnl support requested but libnl not found])
468 AC_CHECK_HEADERS(linux/ethtool.h,,,
471 #include <linux/types.h>
474 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
479 # Check whether we have the *BSD-style ioctls.
481 AC_CHECK_HEADERS(net/if_media.h)
483 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
485 [#include <sys/socket.h>
486 #include <sys/ioctl.h>
488 #include <net/bpf.h>],
489 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
492 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
493 [define if the system supports zerocopy BPF])
498 # Check whether we have struct BPF_TIMEVAL.
500 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
502 #include <sys/types.h>
503 #include <sys/ioctl.h>
504 #ifdef HAVE_SYS_IOCCOM_H
505 #include <sys/ioccom.h>
512 V_DEFS="$V_DEFS -DDAG_ONLY"
516 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
520 V_DEFS="$V_DEFS -DSNF_ONLY"
524 AC_MSG_WARN(cannot determine packet capture interface)
525 AC_MSG_WARN((see the INSTALL doc for more info))
530 dnl Now figure out how we get a list of interfaces and addresses,
531 dnl if we support capturing. Don't bother if we don't support
534 if test "$V_PCAP" = null
537 # We can't capture, so we can't open any capture
538 # devices, so we won't return any interfaces.
542 AC_CHECK_FUNC(getifaddrs,[
544 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
545 # as well, just in case some platform is really weird.
547 AC_CHECK_HEADER(ifaddrs.h,[
549 # We have the header, so we use "getifaddrs()" to
550 # get the list of interfaces.
555 # We don't have the header - give up.
556 # XXX - we could also fall back on some other
557 # mechanism, but, for now, this'll catch this
558 # problem so that we can at least try to figure
559 # out something to do on systems with "getifaddrs()"
560 # but without "ifaddrs.h", if there is something
561 # we can do on those systems.
563 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
567 # Well, we don't have "getifaddrs()", so we have to use
568 # some other mechanism; determine what that mechanism is.
570 # The first thing we use is the type of capture mechanism,
571 # which is somewhat of a proxy for the OS we're using.
576 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
578 # This might be Solaris 8 or later, with
579 # SIOCGLIFCONF, or it might be some other OS
580 # or some older version of Solaris, with
583 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
584 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
586 [#include <sys/param.h>
587 #include <sys/file.h>
588 #include <sys/ioctl.h>
589 #include <sys/socket.h>
590 #include <sys/sockio.h>],
591 [ioctl(0, SIOCGLIFCONF, (char *)0);],
592 ac_cv_lbl_have_siocglifconf=yes,
593 ac_cv_lbl_have_siocglifconf=no))
594 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
595 if test $ac_cv_lbl_have_siocglifconf = yes ; then
601 # Needed for common functions used by pcap-[dlpi,libdlpi].c
608 # Assume we just have SIOCGIFCONF.
609 # (XXX - on at least later Linux kernels, there's
610 # another mechanism, and we should be using that
619 AC_MSG_CHECKING(for socklen_t)
621 #include <sys/types.h>
622 #include <sys/socket.h>
627 if test "x$have_socklen_t" = "xyes"; then
628 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
630 AC_MSG_RESULT($have_socklen_t)
633 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
635 [enable_ipv6=ifavailable])
636 if test "$enable_ipv6" != "no"; then
637 AC_CHECK_FUNC(getaddrinfo,
639 AC_DEFINE(INET6,1,[IPv6])
642 if test "$enable_ipv6" != "ifavailable"; then
643 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
648 AC_MSG_CHECKING(whether to build optimizer debugging code)
649 AC_ARG_ENABLE(optimizer-dbg,
650 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
651 if test "$enable_optimizer_dbg" = "yes"; then
652 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
654 AC_MSG_RESULT(${enable_optimizer_dbg-no})
656 AC_MSG_CHECKING(whether to build parser debugging code)
657 AC_ARG_ENABLE(yydebug,
658 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
659 if test "$enable_yydebug" = "yes"; then
660 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
662 AC_MSG_RESULT(${enable_yydebug-no})
664 # Check for Endace DAG card support.
666 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
668 if test "$withval" = no
670 # User doesn't want DAG support.
672 elif test "$withval" = yes
674 # User wants DAG support but hasn't specified a directory.
677 # User wants DAG support and has specified a directory, so use the provided value.
683 # Use DAG API if present, otherwise don't
688 AC_ARG_WITH([dag-includes],
689 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
691 # User wants DAG support and has specified a header directory, so use the provided value.
693 dag_include_dir=$withval
696 AC_ARG_WITH([dag-libraries],
697 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
699 # User wants DAG support and has specified a library directory, so use the provided value.
707 # We support the DAG API if we're on Linux or BSD, or if we're
708 # building a DAG-only libpcap.
713 # If the user explicitly requested DAG, tell them it's not
716 # If they expressed no preference, don't include it.
718 if test $want_dag = yes; then
719 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
720 elif test $want_dag = yes; then
727 if test "$want_dag" != no; then
729 AC_MSG_CHECKING([whether we have DAG API headers])
731 # If necessary, set default paths for DAG API headers and libraries.
732 if test -z "$dag_root"; then
736 if test -z "$dag_include_dir"; then
737 dag_include_dir="$dag_root/include"
740 if test -z "$dag_lib_dir"; then
741 dag_lib_dir="$dag_root/lib"
744 if test -z "$dag_tools_dir"; then
745 dag_tools_dir="$dag_root/tools"
748 if test -r $dag_include_dir/dagapi.h; then
749 ac_cv_lbl_dag_api=yes
751 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
754 if test $ac_cv_lbl_dag_api = yes; then
755 V_INCLS="$V_INCLS -I$dag_include_dir"
757 if test $V_PCAP != dag ; then
761 # See if we can find a general version string.
762 # Don't need to save and restore LIBS to prevent -ldag being
763 # included if there's a found-action (arg 3).
764 saved_ldflags=$LDFLAGS
765 LDFLAGS="-L$dag_lib_dir"
766 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
767 AC_CHECK_LIB([dag],[dag_get_erf_types], [
768 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
769 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
770 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
772 LDFLAGS=$saved_ldflags
774 if test "$dag_streams" = 1; then
775 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
777 LDFLAGS="$LDFLAGS -L$dag_lib_dir"
779 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
780 if test "$ac_dag_have_vdag" = 1; then
781 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
782 LIBS="$LIBS -lpthread"
786 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
789 AC_MSG_CHECKING(whether we have the DAG API)
791 if test $ac_cv_lbl_dag_api = no; then
793 if test "$want_dag" = yes; then
794 # User wanted DAG support but we couldn't find it.
795 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
798 if test "$V_PCAP" = dag; then
799 # User requested "dag" capture type but the DAG API wasn't
801 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.)])
808 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
810 if test "$withval" = no
813 elif test "$withval" = yes
823 # Use Septel API if present, otherwise don't
825 want_septel=ifpresent
826 septel_root=./../septel
828 ac_cv_lbl_septel_api=no
832 # We support the Septel API if we're on Linux, or if we're building
833 # a Septel-only libpcap.
838 # If the user explicitly requested Septel, tell them it's not
841 # If they expressed no preference, don't include it.
843 if test $want_septel = yes; then
844 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
845 elif test $want_septel = yes; then
851 if test "$with_septel" != no; then
852 AC_MSG_CHECKING(whether we have Septel API)
854 if test -z "$septel_root"; then
855 septel_root=$srcdir/../septel
858 septel_tools_dir="$septel_root"
859 septel_include_dir="$septel_root/INC"
861 ac_cv_lbl_septel_api=no
862 if test -r "$septel_include_dir/msg.h"; then
863 V_INCLS="$V_INCLS -I$septel_include_dir"
864 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"
865 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"
867 if test "$V_PCAP" != septel ; then
870 ac_cv_lbl_septel_api=yes
873 AC_MSG_RESULT($ac_cv_lbl_septel_api)
874 if test $ac_cv_lbl_septel_api = no; then
875 if test "$want_septel" = yes; then
876 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
879 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
883 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
884 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
887 # Check for Myricom SNF support.
889 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
891 if test "$withval" = no
893 # User explicitly doesn't want SNF
895 elif test "$withval" = yes
897 # User wants SNF support but hasn't specific a directory.
900 # User wants SNF support with a specified directory.
906 # Use Sniffer API if present, otherwise don't
911 AC_ARG_WITH([snf-includes],
912 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
914 # User wants SNF with specific header directory
916 snf_include_dir=$withval
919 AC_ARG_WITH([snf-libraries],
920 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
922 # User wants SNF with specific lib directory
930 # We support the Sniffer API if we're on BSD, Linux, or if we're
931 # building a Sniffer-only libpcap.
936 # If the user explicitly requested Sniffer, tell them it's not
939 # If they expressed no preference, don't include it.
941 if test $want_snf = yes; then
942 AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
943 elif test $want_snf = yes; then
950 if test "$with_snf" != no; then
952 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
954 if test -z "$snf_root"; then
958 if test -z "$snf_include_dir"; then
959 snf_include_dir="$snf_root/include"
962 if test -z "$snf_lib_dir"; then
963 snf_lib_dir="$snf_root/lib"
966 if test -f "$snf_include_dir/snf.h"; then
967 ac_cv_lbl_snf_api=yes
969 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
971 if test $ac_cv_lbl_snf_api = no; then
972 if test "$want_snf" = yes; then
973 AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
976 saved_ldflags=$LDFLAGS
977 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
978 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
979 LDFLAGS="$saved_ldflags"
981 if test $ac_cv_lbl_snf_api = no; then
982 if test "$want_snf" = yes; then
983 AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
986 V_INCLS="$V_INCLS -I$snf_include_dir"
988 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
989 if test "$V_PCAP" != snf ; then
992 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
997 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
998 AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
1001 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
1002 if test "$V_LEX" = lex ; then
1003 # Some versions of lex can't handle the definitions section of scanner.l .
1004 # Try lexing it and complain if it can't deal.
1005 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1006 if lex -t scanner.l > /dev/null 2>&1; then
1007 tcpdump_cv_capable_lex=yes
1009 tcpdump_cv_capable_lex=insufficient
1011 if test $tcpdump_cv_capable_lex = insufficient ; then
1012 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1013 libpcap. flex is a lex replacement that has many advantages, including
1014 being able to compile libpcap. For more information, see
1015 http://www.gnu.org/software/flex/flex.html .])
1020 # Assume, by default, no support for shared libraries and V7/BSD convention
1021 # for man pages (file formats in section 5, miscellaneous info in section 7).
1022 # Individual cases can override this.
1030 dnl Workaround to enable certain features
1031 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1034 # AIX makes it fun to build shared and static libraries,
1035 # because they're *both* ".a" archive libraries. We
1036 # build the static library for the benefit of the traditional
1037 # scheme of building libpcap and tcpdump in subdirectories of
1038 # the same directory, with tcpdump statically linked with the
1039 # libpcap in question, but we also build a shared library as
1040 # "libpcap.shareda" and install *it*, rather than the static
1041 # library, as "libpcap.a".
1049 # If we're using DLPI, applications will need to
1050 # use /lib/pse.exp if present, as we use the
1053 pseexe="/lib/pse.exp"
1054 AC_MSG_CHECKING(for $pseexe)
1055 if test -f $pseexe ; then
1063 # If we're using BPF, we need "-lodm" and "-lcfg", as
1064 # we use them to load the BPF module.
1073 V_CCOPT="$V_CCOPT -fno-common"
1074 AC_ARG_ENABLE(universal,
1075 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
1076 if test "$enable_universal" != "no"; then
1081 # Leopard. Build for 32-bit PowerPC, 64-bit
1082 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1083 # first. (That's what Apple does.)
1085 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1086 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1091 # Snow Leopard. Build for x86-64, x86, and
1092 # 32-bit PowerPC, with x86-64 first. (That's
1093 # what Apple does, even though Snow Leopard
1094 # doesn't run on PPC, so PPC libpcap runs under
1095 # Rosetta, and Rosetta doesn't support BPF
1096 # ioctls, so PPC programs can't do live
1099 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1100 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1105 # Lion. Build for x86-64 and x86, with x86-64
1106 # first. (That's probably what Apple does,
1107 # given that Rosetta is gone.)
1109 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
1110 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
1117 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1120 # Use System V conventions for man pages.
1129 # Use System V conventions for man pages.
1138 # Use System V conventions for man pages.
1145 dnl HPUX 10.20 and above is similar to HPUX 9, but
1146 dnl not the same....
1148 dnl XXX - DYEXT should be set to "sl" if this is building
1149 dnl for 32-bit PA-RISC, but should be left as "so" for
1150 dnl 64-bit PA-RISC or, I suspect, IA-64.
1151 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1152 if test "`uname -m`" = "ia64"; then
1159 # "-b" builds a shared library; "+h" sets the soname.
1165 # Use System V conventions for man pages.
1173 # Use System V conventions for man pages.
1179 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
1183 # Compiler assumed to be GCC; run-time linker may require a -R
1186 if test "$libdir" != "/usr/lib"; then
1187 V_RFLAGS=-Wl,-R$libdir
1195 # Use System V conventions for man pages.
1202 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1203 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1207 ac_cv_cc_sinix_defined=yes,
1208 ac_cv_cc_sinix_defined=no))
1209 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1210 if test $ac_cv_cc_sinix_defined = no ; then
1211 AC_DEFINE(sinix,1,[on sinix])
1216 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1220 # Use System V conventions for man pages.
1227 AC_ARG_ENABLE(shared,
1228 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
1229 test "x$enable_shared" = "xno" && DYEXT="none"
1232 AC_CHECK_TOOL([AR], [ar])
1234 AC_LBL_DEVEL(V_CCOPT)
1236 AC_LBL_SOCKADDR_SA_LEN
1238 AC_LBL_SOCKADDR_STORAGE
1240 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1242 AC_LBL_UNALIGNED_ACCESS
1245 # Makefile.in includes rules to generate version.h, so we assume
1246 # that it will be generated if autoconf is used.
1248 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1251 ln -s ${srcdir}/bpf/net net
1255 AC_SUBST(V_FINDALLDEVS)
1259 AC_SUBST(V_SHLIB_CMD)
1260 AC_SUBST(V_SHLIB_OPT)
1261 AC_SUBST(V_SONAME_OPT)
1262 AC_SUBST(V_RPATH_OPT)
1265 AC_SUBST(ADDLARCHIVEOBJS)
1268 AC_SUBST(MAN_FILE_FORMATS)
1269 AC_SUBST(MAN_MISC_INFO)
1271 dnl check for USB sniffing support
1272 AC_MSG_CHECKING(for USB sniffing support)
1275 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1276 USB_SRC=pcap-usb-linux.c
1278 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1279 if test $? -ne 0 ; then
1280 ac_usb_dev_name="usbmon"
1282 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1283 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1285 # Do we have a version of <linux/compiler.h> available?
1286 # If so, we might need it for <linux/usbdevice_fs.h>.
1288 AC_CHECK_HEADERS(linux/compiler.h)
1289 if test "$ac_cv_header_linux_compiler_h" = yes; then
1291 # Yes - include it when testing for <linux/usbdevice_fs.h>.
1293 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
1295 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1297 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1299 # OK, does it define bRequestType? Older versions of the kernel
1300 # define fields with names like "requesttype, "request", and
1301 # "value", rather than "bRequestType", "bRequest", and
1304 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1305 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1308 #ifdef HAVE_SYS_BITYPES_H
1309 #include <sys/bitypes.h>
1311 #ifdef HAVE_LINUX_COMPILER_H
1312 #include <linux/compiler.h>
1314 #include <linux/usbdevice_fs.h>],
1315 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1316 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1317 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1318 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1319 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1320 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1321 [if struct usbdevfs_ctrltransfer has bRequestType])
1329 AC_SUBST(PCAP_SUPPORT_USB)
1332 dnl check for netfilter sniffing support
1333 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
1338 # Life's too short to deal with trying to get this to compile
1339 # if you don't get the right types defined with
1340 # __KERNEL_STRICT_NAMES getting defined by some other include.
1342 # Check whether the includes Just Work. If not, don't turn on
1343 # netfilter support.
1345 AC_MSG_CHECKING(whether we can compile the netfilter support)
1346 AC_CACHE_VAL(ac_cv_netfilter_can_compile,
1349 #include <sys/socket.h>
1350 #include <linux/types.h>
1352 #include <linux/netlink.h>
1353 #include <linux/netfilter/nfnetlink.h>
1354 #include <linux/netfilter/nfnetlink_log.h>],
1356 ac_cv_netfilter_can_compile=yes,
1357 ac_cv_netfilter_can_compile=no))
1358 AC_MSG_RESULT($ac_cv_netfilter_can_compile)
1359 if test $ac_cv_netfilter_can_compile = yes ; then
1360 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
1361 [target host supports netfilter sniffing])
1362 NETFILTER_SRC=pcap-netfilter-linux.c
1369 AC_SUBST(PCAP_SUPPORT_NETFILTER)
1370 AC_SUBST(NETFILTER_SRC)
1372 AC_ARG_ENABLE([bluetooth],
1373 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1374 ,enable_bluetooth=yes)
1376 if test "x$enable_bluetooth" != "xno" ; then
1377 dnl check for Bluetooth sniffing support
1380 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1382 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1383 BT_SRC=pcap-bt-linux.c
1384 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1386 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1390 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1393 AC_SUBST(PCAP_SUPPORT_BT)
1397 AC_ARG_ENABLE([canusb],
1398 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
1401 if test "x$enable_canusb" != "xno" ; then
1402 dnl check for canusb support
1405 AC_CHECK_HEADER(libusb-1.0/libusb.h,
1407 AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
1408 CANUSB_SRC=pcap-canusb-linux.c
1409 LIBS="-lusb-1.0 $LIBS"
1410 AC_MSG_NOTICE(canusb sniffing is supported)
1412 AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
1416 AC_MSG_NOTICE(no canusb support implemented for $host_os)
1419 AC_SUBST(PCAP_SUPPORT_CANUSB)
1420 AC_SUBST(CANUSB_SRC)
1423 AC_ARG_ENABLE([can],
1424 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
1427 if test "x$enable_can" != "xno" ; then
1428 dnl check for CAN sniffing support
1431 AC_CHECK_HEADER(linux/can.h,
1432 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
1433 CAN_SRC=pcap-can-linux.c
1434 AC_MSG_NOTICE(CAN sniffing is supported)],
1435 AC_MSG_NOTICE(CAN sniffing is not supported),
1436 [#include <sys/socket.h>]
1440 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
1443 AC_SUBST(PCAP_SUPPORT_CAN)
1447 dnl check for hardware timestamp support
1450 AC_CHECK_HEADERS([linux/net_tstamp.h])
1453 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
1459 AC_CONFIG_HEADER(config.h)
1461 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1462 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
1463 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
1464 pcap_list_datalinks.3pcap pcap_list_tstamp_types.3pcap
1465 pcap_open_dead.3pcap pcap_open_offline.3pcap
1466 pcap_set_tstamp_type.3pcap)
1468 if test -f .devel ; then