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(V_CCOPT, V_INCLS)
28 AC_CHECK_HEADERS(sys/bitypes.h)
30 AC_CHECK_TYPE([int8_t], ,
31 [AC_DEFINE([int8_t], [signed char],
32 [Define to `signed char' if int8_t not defined.])],
34 #ifdef HAVE_SYS_BITYPES_H
35 #include <sys/bitypes.h>
37 AC_CHECK_TYPE([u_int8_t], ,
38 [AC_DEFINE([u_int8_t], [unsigned char],
39 [Define to `unsigned char' if u_int8_t not defined.])],
41 #ifdef HAVE_SYS_BITYPES_H
42 #include <sys/bitypes.h>
44 AC_CHECK_TYPE([int16_t], ,
45 [AC_DEFINE([int16_t], [short],
46 [Define to `short' if int16_t not defined.])]
48 #ifdef HAVE_SYS_BITYPES_H
49 #include <sys/bitypes.h>
51 AC_CHECK_TYPE([u_int16_t], ,
52 [AC_DEFINE([u_int16_t], [unsigned short],
53 [Define to `unsigned short' if u_int16_t not defined.])],
55 #ifdef HAVE_SYS_BITYPES_H
56 #include <sys/bitypes.h>
58 AC_CHECK_TYPE([int32_t], ,
59 [AC_DEFINE([int32_t], [int],
60 [Define to `int' if int32_t not defined.])],
62 #ifdef HAVE_SYS_BITYPES_H
63 #include <sys/bitypes.h>
65 AC_CHECK_TYPE([u_int32_t], ,
66 [AC_DEFINE([u_int32_t], [unsigned int],
67 [Define to `unsigned int' if u_int32_t not defined.])],
69 #ifdef HAVE_SYS_BITYPES_H
70 #include <sys/bitypes.h>
72 AC_CHECK_TYPE([int64_t], ,
73 [AC_DEFINE([int64_t], [long long],
74 [Define to `long long' if int64_t not defined.])],
76 #ifdef HAVE_SYS_BITYPES_H
77 #include <sys/bitypes.h>
79 AC_CHECK_TYPE([u_int64_t], ,
80 [AC_DEFINE([u_int64_t], [unsigned long long],
81 [Define to `unsigned long long' if u_int64_t not defined.])],
83 #ifdef HAVE_SYS_BITYPES_H
84 #include <sys/bitypes.h>
88 # Try to arrange for large file support.
94 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
95 dnl include <sys/ioccom.h>, and we were to drop support for older
96 dnl releases without that fix, so that pcap-bpf.c doesn't need to
97 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
98 dnl in "aclocal.m4" uses it, so we would still have to test for it
99 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
100 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
102 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
103 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
104 #include <sys/socket.h>
105 #include <net/if.h>])
106 if test "$ac_cv_header_net_pfvar_h" = yes; then
108 # Check for various PF actions.
110 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
112 [#include <sys/types.h>
113 #include <sys/socket.h>
115 #include <net/pfvar.h>],
116 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
119 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
120 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
124 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
125 #include <sys/socket.h>])
126 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
128 # The simple test didn't work.
129 # Do we need to include <net/if.h> first?
130 # Unset ac_cv_header_netinet_if_ether_h so we don't
131 # treat the previous failure as a cached value and
132 # suppress the next test.
134 AC_MSG_NOTICE([Rechecking with some additional includes])
135 unset ac_cv_header_netinet_if_ether_h
136 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
137 #include <sys/socket.h>
138 #include <netinet/in.h>
141 #include <net/if.h>])
146 AC_CHECK_FUNCS(strerror strlcpy)
149 AC_CHECK_FUNCS(vsnprintf snprintf,,
151 if test $needsnprintf = yes; then
156 # Do this before checking for ether_hostton(), as it's a
157 # "gethostbyname() -ish function".
162 # You are in a twisty little maze of UN*Xes, all different.
163 # Some might not have ether_hostton().
164 # Some might have it, but not declare it in any header file.
165 # Some might have it, but declare it in <netinet/if_ether.h>.
166 # Some might have it, but declare it in <netinet/ether.h>
167 # (And some might have it but document it as something declared in
168 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
170 # Before you is a C compiler.
172 AC_CHECK_FUNCS(ether_hostton)
173 if test "$ac_cv_func_ether_hostton" = yes; then
175 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
177 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
179 # Yes. Does it declare ether_hostton()?
181 AC_CHECK_DECL(ether_hostton,
183 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
184 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
187 #include <sys/types.h>
188 #include <sys/socket.h>
189 #include <netinet/in.h>
190 #include <arpa/inet.h>
194 #include <netinet/if_ether.h>
200 if test "$ac_cv_have_decl_ether_hostton" != yes; then
202 # No, how about <netinet/ether.h>, as on Linux?
204 AC_CHECK_HEADERS(netinet/ether.h)
205 if test "$ac_cv_header_netinet_ether_h" = yes; then
207 # We have it - does it declare ether_hostton()?
208 # Unset ac_cv_have_decl_ether_hostton so we don't
209 # treat the previous failure as a cached value and
210 # suppress the next test.
212 unset ac_cv_have_decl_ether_hostton
213 AC_CHECK_DECL(ether_hostton,
215 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
216 [Define to 1 if netinet/ether.h declares `ether_hostton'])
219 #include <netinet/ether.h>
224 # Is ether_hostton() declared?
226 if test "$ac_cv_have_decl_ether_hostton" != yes; then
228 # No, we'll have to declare it ourselves.
229 # Do we have "struct ether_addr"?
231 AC_CHECK_TYPES(struct ether_addr,,,
233 #include <sys/types.h>
234 #include <sys/socket.h>
235 #include <netinet/in.h>
236 #include <arpa/inet.h>
240 #include <netinet/if_ether.h>
242 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
243 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
246 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
247 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
252 dnl to pacify those who hate protochain insn
253 AC_MSG_CHECKING(if --disable-protochain option is specified)
254 AC_ARG_ENABLE(protochain,
255 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
256 case "x$enable_protochain" in
257 xyes) enable_protochain=enabled ;;
258 xno) enable_protochain=disabled ;;
259 x) enable_protochain=enabled ;;
262 if test "$enable_protochain" = "disabled"; then
263 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
265 AC_MSG_RESULT(${enable_protochain})
268 # SITA support is mutually exclusive with native capture support;
269 # "--with-sita" selects SITA support.
272 AC_HELP_STRING([--with-sita],[include SITA support]),
274 if test ! "x$withval" = "xno" ; then
275 AC_DEFINE(SITA,1,[include ACN support])
276 AC_MSG_NOTICE(Enabling SITA ACN support)
283 dnl Not all versions of test support -c (character special) but it's a
284 dnl better way of testing since the device might be protected. So we
285 dnl check in our normal order using -r and then check the for the /dev
286 dnl guys again using -c.
288 dnl XXX This could be done for cross-compiling, but for now it's not.
290 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
291 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
294 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
295 AC_MSG_CHECKING(packet capture type)
296 if test ! -z "$with_pcap" ; then
298 elif test -r /dev/bpf ; then
300 # Cloning BPF device.
303 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
304 elif test -r /dev/bpf0 ; then
306 elif test -r /usr/include/net/pfilt.h ; then
308 elif test -r /dev/enet ; then
310 elif test -r /dev/nit ; then
312 elif test -r /usr/include/sys/net/nit.h ; then
314 elif test -r /usr/include/linux/socket.h ; then
316 elif test -r /usr/include/net/raw.h ; then
318 elif test -r /usr/include/odmi.h ; then
320 # On AIX, the BPF devices might not yet be present - they're
321 # created the first time libpcap runs after booting.
322 # We check for odmi.h instead.
325 elif test -c /dev/bpf0 ; then # check again in case not readable
327 elif test -r /usr/include/sys/dlpi.h ; then
329 elif test -c /dev/enet ; then # check again in case not readable
331 elif test -c /dev/nit ; then # check again in case not readable
336 AC_MSG_RESULT($V_PCAP)
339 # Do capture-mechanism-dependent tests.
344 # Checks to see if Solaris has the public libdlpi(3LIB) library.
345 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
346 # public libdlpi(3LIB) version. Before libdlpi was made public, a
347 # private version also existed, which did not have the same APIs.
348 # Due to a gcc bug, the default search path for 32-bit libraries does
349 # not include /lib, we add it explicitly here.
350 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
351 # Also, due to the bug above applications that link to libpcap with
352 # libdlpi will have to add "-L/lib" option to "configure".
354 saved_ldflags=$LDFLAGS
355 LDFLAGS="$LIBS -L/lib"
356 AC_CHECK_LIB(dlpi, dlpi_walk,
359 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
361 LDFLAGS=$saved_ldflags
364 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
367 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
368 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
371 #include <sys/types.h>
372 #include <sys/time.h>
373 #include <sys/dlpi.h>
375 [int i = DL_PROMISC_PHYS;],
376 ac_cv_sys_dlpi_usable=yes,
377 ac_cv_sys_dlpi_usable=no))
378 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
379 if test $ac_cv_sys_dlpi_usable = no ; then
380 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
384 # Check whether we have a /dev/dlpi device or have multiple devices.
386 AC_MSG_CHECKING(for /dev/dlpi device)
387 if test -c /dev/dlpi ; then
389 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
393 AC_MSG_CHECKING(for $dir directory)
394 if test -d $dir ; then
396 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
403 # This check is for Solaris with DLPI support for passive modes.
404 # See dlpi(7P) for more details.
406 AC_LBL_DL_PASSIVE_REQ_T
410 AC_MSG_CHECKING(Linux kernel version)
411 if test "$cross_compiling" = yes; then
412 AC_CACHE_VAL(ac_cv_linux_vers,
413 ac_cv_linux_vers=unknown)
415 AC_CACHE_VAL(ac_cv_linux_vers,
416 ac_cv_linux_vers=`uname -r 2>&1 | \
417 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
419 AC_MSG_RESULT($ac_cv_linux_vers)
420 if test $ac_cv_linux_vers = unknown ; then
421 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
423 if test $ac_cv_linux_vers -lt 2 ; then
424 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
428 # Do we have the wireless extensions?
430 AC_CHECK_HEADERS(linux/wireless.h, [], [],
432 #include <sys/socket.h>
433 #include <linux/if.h>
434 #include <linux/types.h>
441 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
442 with_libnl=$withval,,)
444 if test x$with_libnl != xno ; then
445 AC_CHECK_LIB(nl, nl_handle_alloc,
447 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]),
448 if test x$with_libnl = xyes ; then
449 AC_MSG_ERROR([libnl support requested but libnl not found])
455 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
460 # Check whether we have the *BSD-style ioctls.
462 AC_CHECK_HEADERS(net/if_media.h)
464 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
466 [#include <sys/socket.h>
467 #include <sys/ioctl.h>
469 #include <net/bpf.h>],
470 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
473 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
474 [define if the system supports zerocopy BPF])
479 # Check whether we have struct BPF_TIMEVAL.
481 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
483 #include <sys/types.h>
484 #include <sys/ioctl.h>
485 #ifdef HAVE_SYS_IOCCOM_H
486 #include <sys/ioccom.h>
493 V_DEFS="$V_DEFS -DDAG_ONLY"
497 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
501 AC_MSG_WARN(cannot determine packet capture interface)
502 AC_MSG_WARN((see the INSTALL doc for more info))
507 dnl Now figure out how we get a list of interfaces and addresses,
508 dnl if we support capturing. Don't bother if we don't support
511 if test "$V_PCAP" = null
514 # We can't capture, so we can't open any capture
515 # devices, so we won't return any interfaces.
519 AC_CHECK_FUNC(getifaddrs,[
521 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
522 # as well, just in case some platform is really weird.
524 AC_CHECK_HEADER(ifaddrs.h,[
526 # We have the header, so we use "getifaddrs()" to
527 # get the list of interfaces.
532 # We don't have the header - give up.
533 # XXX - we could also fall back on some other
534 # mechanism, but, for now, this'll catch this
535 # problem so that we can at least try to figure
536 # out something to do on systems with "getifaddrs()"
537 # but without "ifaddrs.h", if there is something
538 # we can do on those systems.
540 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
544 # Well, we don't have "getifaddrs()", so we have to use
545 # some other mechanism; determine what that mechanism is.
547 # The first thing we use is the type of capture mechanism,
548 # which is somewhat of a proxy for the OS we're using.
553 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
555 # This might be Solaris 8 or later, with
556 # SIOCGLIFCONF, or it might be some other OS
557 # or some older version of Solaris, with
560 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
561 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
563 [#include <sys/param.h>
564 #include <sys/file.h>
565 #include <sys/ioctl.h>
566 #include <sys/socket.h>
567 #include <sys/sockio.h>],
568 [ioctl(0, SIOCGLIFCONF, (char *)0);],
569 ac_cv_lbl_have_siocglifconf=yes,
570 ac_cv_lbl_have_siocglifconf=no))
571 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
572 if test $ac_cv_lbl_have_siocglifconf = yes ; then
578 # Needed for common functions used by pcap-[dlpi,libdlpi].c
585 # Assume we just have SIOCGIFCONF.
586 # (XXX - on at least later Linux kernels, there's
587 # another mechanism, and we should be using that
596 AC_MSG_CHECKING(for socklen_t)
598 #include <sys/types.h>
599 #include <sys/socket.h>
604 if test "x$have_socklen_t" = "xyes"; then
605 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
607 AC_MSG_RESULT($have_socklen_t)
610 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
612 [enable_ipv6=ifavailable])
613 if test "$enable_ipv6" != "no"; then
614 AC_CHECK_FUNC(getaddrinfo,
616 AC_DEFINE(INET6,1,[IPv6])
619 if test "$enable_ipv6" != "ifavailable"; then
620 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
625 AC_MSG_CHECKING(whether to build optimizer debugging code)
626 AC_ARG_ENABLE(optimizer-dbg,
627 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
628 if test "$enable_optimizer_dbg" = "yes"; then
629 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
631 AC_MSG_RESULT(${enable_optimizer_dbg-no})
633 AC_MSG_CHECKING(whether to build parser debugging code)
634 AC_ARG_ENABLE(yydebug,
635 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
636 if test "$enable_yydebug" = "yes"; then
637 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
639 AC_MSG_RESULT(${enable_yydebug-no})
641 AC_MSG_CHECKING(whether we have /proc/net/dev)
642 if test -r /proc/net/dev ; then
643 ac_cv_lbl_proc_net_dev=yes
645 ac_cv_lbl_proc_net_dev=no
647 if test $ac_cv_lbl_proc_net_dev = yes; then
648 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
650 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
652 # Check for Endace DAG card support.
654 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
656 if test "$withval" = no
658 # User doesn't want DAG support.
660 elif test "$withval" = yes
662 # User wants DAG support but hasn't specified a directory.
665 # User wants DAG support and has specified a directory, so use the provided value.
671 # Use DAG API if present, otherwise don't
676 AC_ARG_WITH([dag-includes],
677 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
679 # User wants DAG support and has specified a header directory, so use the provided value.
681 dag_include_dir=$withval
684 AC_ARG_WITH([dag-libraries],
685 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
687 # User wants DAG support and has specified a library directory, so use the provided value.
695 # We support the DAG API if we're on Linux or BSD, or if we're
696 # building a DAG-only libpcap.
701 # If the user explicitly requested DAG, tell them it's not
704 # If they expressed no preference, don't include it.
706 if test $want_dag = yes; then
707 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
708 elif test $want_dag = yes; then
715 if test "$want_dag" != no; then
717 AC_MSG_CHECKING([whether we have DAG API headers])
719 # If necessary, set default paths for DAG API headers and libraries.
720 if test -z "$dag_root"; then
724 if test -z "$dag_include_dir"; then
725 dag_include_dir="$dag_root/include"
728 if test -z "$dag_lib_dir"; then
729 dag_lib_dir="$dag_root/lib"
732 if test -z "$dag_tools_dir"; then
733 dag_tools_dir="$dag_root/tools"
736 if test -r $dag_include_dir/dagapi.h; then
737 ac_cv_lbl_dag_api=yes
739 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
742 if test $ac_cv_lbl_dag_api = yes; then
744 AC_MSG_CHECKING([dagapi.o])
746 if test -r $dag_tools_dir/dagapi.o; then
748 dagapi_obj=$dag_tools_dir/dagapi.o
749 elif test -r $dag_lib_dir/dagapi.o; then
751 dagapi_obj=$dag_lib_dir/dagapi.o
752 elif test -r $dag_lib_dir/libdag.a; then
754 ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
755 if test -r ./dagapi.o; then
756 dagapi_obj=./dagapi.o
758 ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
759 if test -r ./libdag_la-dagapi.o; then
760 dagapi_obj=./libdag_la-dagapi.o
765 if test $dagapi_obj = no; then
766 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
769 AC_MSG_RESULT([yes ($dagapi_obj)])
773 if test $ac_cv_lbl_dag_api = yes; then
775 AC_MSG_CHECKING([dagopts.o])
777 if test -r $dag_tools_dir/dagopts.o; then
779 dagopts_obj=$dag_tools_dir/dagopts.o
780 elif test -r $dag_lib_dir/dagopts.o; then
782 dagopts_obj=$dag_lib_dir/dagopts.o
783 elif test -r $dag_lib_dir/libdag.a; then
785 ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
786 if test -r ./dagopts.o; then
787 dagopts_obj=./dagopts.o
789 ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
790 if test -r ./libdag_la-dagopts.o; then
791 dagopts_obj=./libdag_la-dagopts.o
796 if test $dagopts_obj = no; then
797 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
800 AC_MSG_RESULT([yes ($dagopts_obj)])
804 if test $ac_cv_lbl_dag_api = yes; then
805 # Under 2.5.x only we need to add dagreg.o.
806 if test -r $dag_include_dir/dagreg.h; then
807 AC_MSG_CHECKING([dagreg.o])
809 if test -r $dag_lib_dir/dagreg.o; then
810 # Object file is ready and waiting.
811 dagreg_obj=$dag_lib_dir/dagreg.o
812 elif test -r $dag_lib_dir/libdag.a; then
813 # Extract from libdag.a.
814 ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
815 if test -r ./dagreg.o; then
816 dagreg_obj=./dagreg.o
818 ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
819 if test -r ./libdag_la-dagreg.o; then
820 dagreg_obj=./libdag_la-dagreg.o
825 if test $dagreg_obj = no; then
826 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
829 AC_MSG_RESULT([yes ($dagreg_obj)])
834 if test $ac_cv_lbl_dag_api = yes; then
835 # Under 2.5.x only we need to add dagutil.o.
836 if test -r $dag_include_dir/dagutil.h; then
837 AC_MSG_CHECKING([dagutil.o])
839 if test -r $dag_lib_dir/dagutil.o; then
840 # Object file is ready and waiting.
841 dagutil_obj=$dag_lib_dir/dagutil.o
842 elif test -r $dag_lib_dir/libdag.a; then
843 # Extract from libdag.a.
844 ar x $dag_lib_dir/libdag.a dagutil.o 2>/dev/null
845 if test -r ./dagutil.o; then
846 dagutil_obj=./dagutil.o
848 ar x $dag_lib_dir/libdag.a libdag_la-dagutil.o 2>/dev/null
849 if test -r ./libdag_la-dagutil.o; then
850 dagutil_obj=./libdag_la-dagutil.o
855 if test $dagutil_obj = no; then
856 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
859 AC_MSG_RESULT([yes ($dagutil_obj)])
864 if test $ac_cv_lbl_dag_api = yes; then
865 V_INCLS="$V_INCLS -I$dag_include_dir"
866 ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $dagapi_obj $dagopts_obj $dagreg_obj $dagutil_obj"
867 if test $V_PCAP != dag ; then
871 # See if we can find a general version string.
872 # Don't need to save and restore LIBS to prevent -ldag being
873 # included if there's a found-action (arg 3).
874 saved_ldflags=$LDFLAGS
875 LDFLAGS="-L$dag_lib_dir"
876 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
877 AC_CHECK_LIB([dag],[dag_get_erf_types], [
878 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
879 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
880 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
881 LDFLAGS=$saved_ldflags
883 if test "$dag_streams" = 1; then
884 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
888 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
891 AC_MSG_CHECKING(whether we have the DAG API)
893 if test $ac_cv_lbl_dag_api = no; then
895 if test "$want_dag" = yes; then
896 # User wanted DAG support but we couldn't find it.
897 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
900 if test "$V_PCAP" = dag; then
901 # User requested "dag" capture type but the DAG API wasn't
903 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.)])
910 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
912 if test "$withval" = no
915 elif test "$withval" = yes
925 # Use Septel API if present, otherwise don't
927 want_septel=ifpresent
928 septel_root=./../septel
930 ac_cv_lbl_septel_api=no
934 # We support the Septel API if we're on Linux, or if we're building
935 # a Septel-only libpcap.
940 # If the user explicitly requested Septel, tell them it's not
943 # If they expressed no preference, don't include it.
945 if test $want_septel = yes; then
946 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
947 elif test $want_septel = yes; then
953 if test "$with_septel" != no; then
954 AC_MSG_CHECKING(whether we have Septel API)
956 if test -z "$septel_root"; then
957 septel_root=$srcdir/../septel
960 septel_tools_dir="$septel_root"
961 septel_include_dir="$septel_root/INC"
963 ac_cv_lbl_septel_api=no
964 if test -r "$septel_include_dir/msg.h"; then
965 V_INCLS="$V_INCLS -I$septel_include_dir"
966 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"
967 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"
969 if test "$V_PCAP" != septel ; then
972 ac_cv_lbl_septel_api=yes
975 AC_MSG_RESULT($ac_cv_lbl_septel_api)
976 if test $ac_cv_lbl_septel_api = no; then
977 if test "$want_septel" = yes; then
978 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
981 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
985 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
986 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
990 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
991 if test "$V_LEX" = lex ; then
992 # Some versions of lex can't handle the definitions section of scanner.l .
993 # Try lexing it and complain if it can't deal.
994 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
995 if lex -t scanner.l > /dev/null 2>&1; then
996 tcpdump_cv_capable_lex=yes
998 tcpdump_cv_capable_lex=insufficient
1000 if test $tcpdump_cv_capable_lex = insufficient ; then
1001 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1002 libpcap. flex is a lex replacement that has many advantages, including
1003 being able to compile libpcap. For more information, see
1004 http://www.gnu.org/software/flex/flex.html .])
1009 # Assume, by default, no support for shared libraries and V7/BSD convention
1010 # for man pages (file formats in section 5, miscellaneous info in section 7).
1011 # Individual cases can override this.
1019 dnl Workaround to enable certain features
1020 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1023 # AIX makes it fun to build shared and static libraries,
1024 # because they're *both* ".a" archive libraries. We
1025 # build the static library for the benefit of the traditional
1026 # scheme of building libpcap and tcpdump in subdirectories of
1027 # the same directory, with tcpdump statically linked with the
1028 # libpcap in question, but we also build a shared library as
1029 # "libpcap.shareda" and install *it*, rather than the static
1030 # library, as "libpcap.a".
1038 # If we're using DLPI, applications will need to
1039 # use /lib/pse.exp if present, as we use the
1042 pseexe="/lib/pse.exp"
1043 AC_MSG_CHECKING(for $pseexe)
1044 if test -f $pseexe ; then
1052 # If we're using BPF, we need "-lodm" and "-lcfg", as
1053 # we use them to load the BPF module.
1062 V_CCOPT="$V_CCOPT -fno-common"
1066 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1069 # Use System V conventions for man pages.
1078 # Use System V conventions for man pages.
1087 # Use System V conventions for man pages.
1094 dnl HPUX 10.20 and above is similar to HPUX 9, but
1095 dnl not the same....
1097 dnl XXX - DYEXT should be set to "sl" if this is building
1098 dnl for 32-bit PA-RISC, but should be left as "so" for
1099 dnl 64-bit PA-RISC or, I suspect, IA-64.
1100 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1101 if test "`uname -m`" = "ia64"; then
1108 # "-b" builds a shared library; "+h" sets the soname.
1114 # Use System V conventions for man pages.
1122 # Use System V conventions for man pages.
1128 linux*|freebsd*|netbsd*|openbsd*|dragonfly*)
1132 # Compiler assumed to be GCC; run-time linker may require a -R
1135 if test "$libdir" != "/usr/lib"; then
1136 V_RFLAGS=-Wl,-R$libdir
1144 # Use System V conventions for man pages.
1151 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1152 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1156 ac_cv_cc_sinix_defined=yes,
1157 ac_cv_cc_sinix_defined=no))
1158 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1159 if test $ac_cv_cc_sinix_defined = no ; then
1160 AC_DEFINE(sinix,1,[on sinix])
1165 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1169 # Use System V conventions for man pages.
1178 AC_LBL_DEVEL(V_CCOPT)
1180 AC_LBL_SOCKADDR_SA_LEN
1182 AC_LBL_SOCKADDR_STORAGE
1184 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1186 AC_LBL_UNALIGNED_ACCESS
1189 # Makefile.in includes rules to generate version.h, so we assume
1190 # that it will be generated if autoconf is used.
1192 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1195 ln -s ${srcdir}/bpf/net net
1199 AC_SUBST(V_FINDALLDEVS)
1203 AC_SUBST(V_SHLIB_CMD)
1204 AC_SUBST(V_SHLIB_OPT)
1205 AC_SUBST(V_SONAME_OPT)
1206 AC_SUBST(V_RPATH_OPT)
1209 AC_SUBST(ADDLARCHIVEOBJS)
1212 AC_SUBST(MAN_FILE_FORMATS)
1213 AC_SUBST(MAN_MISC_INFO)
1215 dnl check for USB sniffing support
1216 AC_MSG_CHECKING(for USB sniffing support)
1219 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1220 USB_SRC=pcap-usb-linux.c
1222 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1223 if test $? -ne 0 ; then
1224 ac_usb_dev_name="usbmon"
1226 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1227 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1228 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1229 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1231 # OK, does it define bRequestType? Older versions of the kernel
1232 # define fields with names like "requesttype, "request", and
1233 # "value", rather than "bRequestType", "bRequest", and
1236 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1237 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1240 #ifdef HAVE_SYS_BITYPES_H
1241 #include <sys/bitypes.h>
1243 # include <linux/usbdevice_fs.h>],
1244 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1245 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1246 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1247 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1248 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1249 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1250 [if struct usbdevfs_ctrltransfer has bRequestType])
1258 AC_SUBST(PCAP_SUPPORT_USB)
1261 AC_ARG_ENABLE([bluetooth],
1262 [AC_HELP_STRING([--enable-bluetooth],[enable bluetooth support @<:@default=yes, if support available@:>@])],
1263 ,enable_bluetooth=yes)
1265 if test "x$enable_bluetooth" != "xno" ; then
1266 dnl check for bluetooth sniffing support
1269 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1271 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1272 BT_SRC=pcap-bt-linux.c
1273 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1275 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1279 AC_MSG_NOTICE(no Bluetooth sniffing support)
1282 AC_SUBST(PCAP_SUPPORT_BT)
1288 AC_CONFIG_HEADER(config.h)
1290 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1291 pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap
1292 pcap_datalink.3pcap pcap_dump_open.3pcap
1293 pcap_list_datalinks.3pcap pcap_open_dead.3pcap
1294 pcap_open_offline.3pcap)
1296 if test -f .devel ; then