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(net/pfvar.h, , , [#include <sys/types.h>
107 #include <sys/socket.h>
108 #include <net/if.h>])
109 if test "$ac_cv_header_net_pfvar_h" = yes; then
111 # Check for various PF actions.
113 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
115 [#include <sys/types.h>
116 #include <sys/socket.h>
118 #include <net/pfvar.h>],
119 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
122 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
123 [define if net/pfvar.h defines PF_NAT through PF_NORDR])
127 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
128 #include <sys/socket.h>])
129 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
131 # The simple test didn't work.
132 # Do we need to include <net/if.h> first?
133 # Unset ac_cv_header_netinet_if_ether_h so we don't
134 # treat the previous failure as a cached value and
135 # suppress the next test.
137 AC_MSG_NOTICE([Rechecking with some additional includes])
138 unset ac_cv_header_netinet_if_ether_h
139 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
140 #include <sys/socket.h>
141 #include <netinet/in.h>
144 #include <net/if.h>])
149 AC_CHECK_FUNCS(strerror strlcpy)
152 AC_CHECK_FUNCS(vsnprintf snprintf,,
154 if test $needsnprintf = yes; then
159 # Do this before checking for ether_hostton(), as it's a
160 # "gethostbyname() -ish function".
165 # You are in a twisty little maze of UN*Xes, all different.
166 # Some might not have ether_hostton().
167 # Some might have it, but not declare it in any header file.
168 # Some might have it, but declare it in <netinet/if_ether.h>.
169 # Some might have it, but declare it in <netinet/ether.h>
170 # (And some might have it but document it as something declared in
171 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
173 # Before you is a C compiler.
175 AC_CHECK_FUNCS(ether_hostton)
176 if test "$ac_cv_func_ether_hostton" = yes; then
178 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>?
180 if test "$ac_cv_header_netinet_if_ether_h" = yes; then
182 # Yes. Does it declare ether_hostton()?
184 AC_CHECK_DECL(ether_hostton,
186 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
187 [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
190 #include <sys/types.h>
191 #include <sys/socket.h>
192 #include <netinet/in.h>
193 #include <arpa/inet.h>
197 #include <netinet/if_ether.h>
203 if test "$ac_cv_have_decl_ether_hostton" != yes; then
205 # No, how about <netinet/ether.h>, as on Linux?
207 AC_CHECK_HEADERS(netinet/ether.h)
208 if test "$ac_cv_header_netinet_ether_h" = yes; then
210 # We have it - does it declare ether_hostton()?
211 # Unset ac_cv_have_decl_ether_hostton so we don't
212 # treat the previous failure as a cached value and
213 # suppress the next test.
215 unset ac_cv_have_decl_ether_hostton
216 AC_CHECK_DECL(ether_hostton,
218 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
219 [Define to 1 if netinet/ether.h declares `ether_hostton'])
222 #include <netinet/ether.h>
227 # Is ether_hostton() declared?
229 if test "$ac_cv_have_decl_ether_hostton" != yes; then
231 # No, we'll have to declare it ourselves.
232 # Do we have "struct ether_addr"?
234 AC_CHECK_TYPES(struct ether_addr,,,
236 #include <sys/types.h>
237 #include <sys/socket.h>
238 #include <netinet/in.h>
239 #include <arpa/inet.h>
243 #include <netinet/if_ether.h>
245 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
246 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
249 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
250 [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
255 dnl to pacify those who hate protochain insn
256 AC_MSG_CHECKING(if --disable-protochain option is specified)
257 AC_ARG_ENABLE(protochain,
258 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
259 case "x$enable_protochain" in
260 xyes) enable_protochain=enabled ;;
261 xno) enable_protochain=disabled ;;
262 x) enable_protochain=enabled ;;
265 if test "$enable_protochain" = "disabled"; then
266 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
268 AC_MSG_RESULT(${enable_protochain})
271 # SITA support is mutually exclusive with native capture support;
272 # "--with-sita" selects SITA support.
275 AC_HELP_STRING([--with-sita],[include SITA support]),
277 if test ! "x$withval" = "xno" ; then
278 AC_DEFINE(SITA,1,[include ACN support])
279 AC_MSG_NOTICE(Enabling SITA ACN support)
286 dnl Not all versions of test support -c (character special) but it's a
287 dnl better way of testing since the device might be protected. So we
288 dnl check in our normal order using -r and then check the for the /dev
289 dnl guys again using -c.
291 dnl XXX This could be done for cross-compiling, but for now it's not.
293 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
294 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
297 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
298 AC_MSG_CHECKING(packet capture type)
299 if test ! -z "$with_pcap" ; then
301 elif test -r /dev/bpf -o -h /dev/bpf ; then
303 # Cloning BPF device.
306 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
307 elif test -r /dev/bpf0 ; then
309 elif test -r /usr/include/net/pfilt.h ; then
311 elif test -r /dev/enet ; then
313 elif test -r /dev/nit ; then
315 elif test -r /usr/include/sys/net/nit.h ; then
317 elif test -r /usr/include/linux/socket.h ; then
319 elif test -r /usr/include/net/raw.h ; then
321 elif test -r /usr/include/odmi.h ; then
323 # On AIX, the BPF devices might not yet be present - they're
324 # created the first time libpcap runs after booting.
325 # We check for odmi.h instead.
328 elif test -c /dev/bpf0 ; then # check again in case not readable
330 elif test -r /usr/include/sys/dlpi.h ; then
332 elif test -c /dev/enet ; then # check again in case not readable
334 elif test -c /dev/nit ; then # check again in case not readable
339 AC_MSG_RESULT($V_PCAP)
342 # Do capture-mechanism-dependent tests.
347 # Checks to see if Solaris has the public libdlpi(3LIB) library.
348 # Note: The existence of /usr/include/libdlpi.h does not mean it is the
349 # public libdlpi(3LIB) version. Before libdlpi was made public, a
350 # private version also existed, which did not have the same APIs.
351 # Due to a gcc bug, the default search path for 32-bit libraries does
352 # not include /lib, we add it explicitly here.
353 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
354 # Also, due to the bug above applications that link to libpcap with
355 # libdlpi will have to add "-L/lib" option to "configure".
357 saved_ldflags=$LDFLAGS
358 LDFLAGS="$LIBS -L/lib"
359 AC_CHECK_LIB(dlpi, dlpi_walk,
362 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]),
364 LDFLAGS=$saved_ldflags
367 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO
370 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
371 AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
374 #include <sys/types.h>
375 #include <sys/time.h>
376 #include <sys/dlpi.h>
378 [int i = DL_PROMISC_PHYS;],
379 ac_cv_sys_dlpi_usable=yes,
380 ac_cv_sys_dlpi_usable=no))
381 AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
382 if test $ac_cv_sys_dlpi_usable = no ; then
383 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
387 # Check whether we have a /dev/dlpi device or have multiple devices.
389 AC_MSG_CHECKING(for /dev/dlpi device)
390 if test -c /dev/dlpi ; then
392 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
396 AC_MSG_CHECKING(for $dir directory)
397 if test -d $dir ; then
399 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
406 # This check is for Solaris with DLPI support for passive modes.
407 # See dlpi(7P) for more details.
409 AC_LBL_DL_PASSIVE_REQ_T
413 AC_MSG_CHECKING(Linux kernel version)
414 if test "$cross_compiling" = yes; then
415 AC_CACHE_VAL(ac_cv_linux_vers,
416 ac_cv_linux_vers=unknown)
418 AC_CACHE_VAL(ac_cv_linux_vers,
419 ac_cv_linux_vers=`uname -r 2>&1 | \
420 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
422 AC_MSG_RESULT($ac_cv_linux_vers)
423 if test $ac_cv_linux_vers = unknown ; then
424 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
426 if test $ac_cv_linux_vers -lt 2 ; then
427 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
431 # Do we have the wireless extensions?
433 AC_CHECK_HEADERS(linux/wireless.h, [], [],
435 #include <sys/socket.h>
436 #include <linux/if.h>
437 #include <linux/types.h>
444 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
445 with_libnl=$withval,,)
447 if test x$with_libnl != xno ; then
448 AC_CHECK_LIB(nl, nl_handle_alloc,
450 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]),
451 if test x$with_libnl = xyes ; then
452 AC_MSG_ERROR([libnl support requested but libnl not found])
458 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
463 # Check whether we have the *BSD-style ioctls.
465 AC_CHECK_HEADERS(net/if_media.h)
467 AC_MSG_CHECKING(whether the system supports zerocopy BPF)
469 [#include <sys/socket.h>
470 #include <sys/ioctl.h>
472 #include <net/bpf.h>],
473 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
476 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
477 [define if the system supports zerocopy BPF])
482 # Check whether we have struct BPF_TIMEVAL.
484 AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
486 #include <sys/types.h>
487 #include <sys/ioctl.h>
488 #ifdef HAVE_SYS_IOCCOM_H
489 #include <sys/ioccom.h>
496 V_DEFS="$V_DEFS -DDAG_ONLY"
500 V_DEFS="$V_DEFS -DSEPTEL_ONLY"
504 V_DEFS="$V_DEFS -DSNF_ONLY"
508 AC_MSG_WARN(cannot determine packet capture interface)
509 AC_MSG_WARN((see the INSTALL doc for more info))
514 dnl Now figure out how we get a list of interfaces and addresses,
515 dnl if we support capturing. Don't bother if we don't support
518 if test "$V_PCAP" = null
521 # We can't capture, so we can't open any capture
522 # devices, so we won't return any interfaces.
526 AC_CHECK_FUNC(getifaddrs,[
528 # We have "getifaddrs()"; make sure we have <ifaddrs.h>
529 # as well, just in case some platform is really weird.
531 AC_CHECK_HEADER(ifaddrs.h,[
533 # We have the header, so we use "getifaddrs()" to
534 # get the list of interfaces.
539 # We don't have the header - give up.
540 # XXX - we could also fall back on some other
541 # mechanism, but, for now, this'll catch this
542 # problem so that we can at least try to figure
543 # out something to do on systems with "getifaddrs()"
544 # but without "ifaddrs.h", if there is something
545 # we can do on those systems.
547 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
551 # Well, we don't have "getifaddrs()", so we have to use
552 # some other mechanism; determine what that mechanism is.
554 # The first thing we use is the type of capture mechanism,
555 # which is somewhat of a proxy for the OS we're using.
560 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
562 # This might be Solaris 8 or later, with
563 # SIOCGLIFCONF, or it might be some other OS
564 # or some older version of Solaris, with
567 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
568 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
570 [#include <sys/param.h>
571 #include <sys/file.h>
572 #include <sys/ioctl.h>
573 #include <sys/socket.h>
574 #include <sys/sockio.h>],
575 [ioctl(0, SIOCGLIFCONF, (char *)0);],
576 ac_cv_lbl_have_siocglifconf=yes,
577 ac_cv_lbl_have_siocglifconf=no))
578 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
579 if test $ac_cv_lbl_have_siocglifconf = yes ; then
585 # Needed for common functions used by pcap-[dlpi,libdlpi].c
592 # Assume we just have SIOCGIFCONF.
593 # (XXX - on at least later Linux kernels, there's
594 # another mechanism, and we should be using that
603 AC_MSG_CHECKING(for socklen_t)
605 #include <sys/types.h>
606 #include <sys/socket.h>
611 if test "x$have_socklen_t" = "xyes"; then
612 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
614 AC_MSG_RESULT($have_socklen_t)
617 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
619 [enable_ipv6=ifavailable])
620 if test "$enable_ipv6" != "no"; then
621 AC_CHECK_FUNC(getaddrinfo,
623 AC_DEFINE(INET6,1,[IPv6])
626 if test "$enable_ipv6" != "ifavailable"; then
627 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
632 AC_MSG_CHECKING(whether to build optimizer debugging code)
633 AC_ARG_ENABLE(optimizer-dbg,
634 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
635 if test "$enable_optimizer_dbg" = "yes"; then
636 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
638 AC_MSG_RESULT(${enable_optimizer_dbg-no})
640 AC_MSG_CHECKING(whether to build parser debugging code)
641 AC_ARG_ENABLE(yydebug,
642 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
643 if test "$enable_yydebug" = "yes"; then
644 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
646 AC_MSG_RESULT(${enable_yydebug-no})
648 # Check for Endace DAG card support.
650 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
652 if test "$withval" = no
654 # User doesn't want DAG support.
656 elif test "$withval" = yes
658 # User wants DAG support but hasn't specified a directory.
661 # User wants DAG support and has specified a directory, so use the provided value.
667 # Use DAG API if present, otherwise don't
672 AC_ARG_WITH([dag-includes],
673 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
675 # User wants DAG support and has specified a header directory, so use the provided value.
677 dag_include_dir=$withval
680 AC_ARG_WITH([dag-libraries],
681 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
683 # User wants DAG support and has specified a library directory, so use the provided value.
691 # We support the DAG API if we're on Linux or BSD, or if we're
692 # building a DAG-only libpcap.
697 # If the user explicitly requested DAG, tell them it's not
700 # If they expressed no preference, don't include it.
702 if test $want_dag = yes; then
703 AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
704 elif test $want_dag = yes; then
711 if test "$want_dag" != no; then
713 AC_MSG_CHECKING([whether we have DAG API headers])
715 # If necessary, set default paths for DAG API headers and libraries.
716 if test -z "$dag_root"; then
720 if test -z "$dag_include_dir"; then
721 dag_include_dir="$dag_root/include"
724 if test -z "$dag_lib_dir"; then
725 dag_lib_dir="$dag_root/lib"
728 if test -z "$dag_tools_dir"; then
729 dag_tools_dir="$dag_root/tools"
732 if test -r $dag_include_dir/dagapi.h; then
733 ac_cv_lbl_dag_api=yes
735 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
738 if test $ac_cv_lbl_dag_api = yes; then
740 AC_MSG_CHECKING([dagapi.o])
742 if test -r $dag_tools_dir/dagapi.o; then
744 dagapi_obj=$dag_tools_dir/dagapi.o
745 elif test -r $dag_lib_dir/dagapi.o; then
747 dagapi_obj=$dag_lib_dir/dagapi.o
748 elif test -r $dag_lib_dir/libdag.a; then
750 ar x $dag_lib_dir/libdag.a dagapi.o 2>/dev/null
751 if test -r ./dagapi.o; then
752 dagapi_obj=./dagapi.o
754 ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 2>/dev/null
755 if test -r ./libdag_la-dagapi.o; then
756 dagapi_obj=./libdag_la-dagapi.o
761 if test $dagapi_obj = no; then
762 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
765 AC_MSG_RESULT([yes ($dagapi_obj)])
769 if test $ac_cv_lbl_dag_api = yes; then
771 AC_MSG_CHECKING([dagopts.o])
773 if test -r $dag_tools_dir/dagopts.o; then
775 dagopts_obj=$dag_tools_dir/dagopts.o
776 elif test -r $dag_lib_dir/dagopts.o; then
778 dagopts_obj=$dag_lib_dir/dagopts.o
779 elif test -r $dag_lib_dir/libdag.a; then
781 ar x $dag_lib_dir/libdag.a dagopts.o 2>/dev/null
782 if test -r ./dagopts.o; then
783 dagopts_obj=./dagopts.o
785 ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 2>/dev/null
786 if test -r ./libdag_la-dagopts.o; then
787 dagopts_obj=./libdag_la-dagopts.o
792 if test $dagopts_obj = no; then
793 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)])
796 AC_MSG_RESULT([yes ($dagopts_obj)])
800 if test $ac_cv_lbl_dag_api = yes; then
801 # Under 2.5.x only we need to add dagreg.o.
802 if test -r $dag_include_dir/dagreg.h; then
803 AC_MSG_CHECKING([dagreg.o])
805 if test -r $dag_lib_dir/dagreg.o; then
806 # Object file is ready and waiting.
807 dagreg_obj=$dag_lib_dir/dagreg.o
808 elif test -r $dag_lib_dir/libdag.a; then
809 # Extract from libdag.a.
810 ar x $dag_lib_dir/libdag.a dagreg.o 2>/dev/null
811 if test -r ./dagreg.o; then
812 dagreg_obj=./dagreg.o
814 ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 2>/dev/null
815 if test -r ./libdag_la-dagreg.o; then
816 dagreg_obj=./libdag_la-dagreg.o
821 if test $dagreg_obj = no; then
822 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
825 AC_MSG_RESULT([yes ($dagreg_obj)])
830 if test $ac_cv_lbl_dag_api = yes; then
831 # Under 2.5.x only we need to add dagutil.o.
832 if test -r $dag_include_dir/dagutil.h; then
833 AC_MSG_CHECKING([dagutil.o])
835 if test -r $dag_lib_dir/dagutil.o; then
836 # Object file is ready and waiting.
837 dagutil_obj=$dag_lib_dir/dagutil.o
838 elif test -r $dag_lib_dir/libdag.a; then
839 # Extract from libdag.a.
840 ar x $dag_lib_dir/libdag.a dagutil.o 2>/dev/null
841 if test -r ./dagutil.o; then
842 dagutil_obj=./dagutil.o
844 ar x $dag_lib_dir/libdag.a libdag_la-dagutil.o 2>/dev/null
845 if test -r ./libdag_la-dagutil.o; then
846 dagutil_obj=./libdag_la-dagutil.o
851 if test $dagutil_obj = no; then
852 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)])
855 AC_MSG_RESULT([yes ($dagutil_obj)])
860 if test $ac_cv_lbl_dag_api = yes; then
861 V_INCLS="$V_INCLS -I$dag_include_dir"
862 ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $dagapi_obj $dagopts_obj $dagreg_obj $dagutil_obj"
863 if test $V_PCAP != dag ; then
867 # See if we can find a general version string.
868 # Don't need to save and restore LIBS to prevent -ldag being
869 # included if there's a found-action (arg 3).
870 saved_ldflags=$LDFLAGS
871 LDFLAGS="-L$dag_lib_dir"
872 AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
873 AC_CHECK_LIB([dag],[dag_get_erf_types], [
874 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
875 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
876 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
877 LDFLAGS=$saved_ldflags
879 if test "$dag_streams" = 1; then
880 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
884 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
887 AC_MSG_CHECKING(whether we have the DAG API)
889 if test $ac_cv_lbl_dag_api = no; then
891 if test "$want_dag" = yes; then
892 # User wanted DAG support but we couldn't find it.
893 AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
896 if test "$V_PCAP" = dag; then
897 # User requested "dag" capture type but the DAG API wasn't
899 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.)])
906 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]),
908 if test "$withval" = no
911 elif test "$withval" = yes
921 # Use Septel API if present, otherwise don't
923 want_septel=ifpresent
924 septel_root=./../septel
926 ac_cv_lbl_septel_api=no
930 # We support the Septel API if we're on Linux, or if we're building
931 # a Septel-only libpcap.
936 # If the user explicitly requested Septel, tell them it's not
939 # If they expressed no preference, don't include it.
941 if test $want_septel = yes; then
942 AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
943 elif test $want_septel = yes; then
949 if test "$with_septel" != no; then
950 AC_MSG_CHECKING(whether we have Septel API)
952 if test -z "$septel_root"; then
953 septel_root=$srcdir/../septel
956 septel_tools_dir="$septel_root"
957 septel_include_dir="$septel_root/INC"
959 ac_cv_lbl_septel_api=no
960 if test -r "$septel_include_dir/msg.h"; then
961 V_INCLS="$V_INCLS -I$septel_include_dir"
962 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"
963 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"
965 if test "$V_PCAP" != septel ; then
968 ac_cv_lbl_septel_api=yes
971 AC_MSG_RESULT($ac_cv_lbl_septel_api)
972 if test $ac_cv_lbl_septel_api = no; then
973 if test "$want_septel" = yes; then
974 AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
977 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
981 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
982 AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
985 # Check for Myricom SNF support.
987 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
989 if test "$withval" = no
991 # User explicitly doesn't want SNF
993 elif test "$withval" = yes
995 # User wants SNF support but hasn't specific a directory.
998 # User wants SNF support with a specified directory.
1004 # Use Sniffer API if present, otherwise don't
1009 AC_ARG_WITH([snf-includes],
1010 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
1012 # User wants SNF with specific header directory
1014 snf_include_dir=$withval
1017 AC_ARG_WITH([snf-libraries],
1018 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
1020 # User wants SNF with specific lib directory
1022 snf_lib_dir=$withval
1028 # We support the Sniffer API if we're on BSD, Linux, or if we're
1029 # building a Sniffer-only libpcap.
1034 # If the user explicitly requested Sniffer, tell them it's not
1037 # If they expressed no preference, don't include it.
1039 if test $want_snf = yes; then
1040 AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
1041 elif test $want_snf = yes; then
1047 ac_cv_lbl_snf_api=no
1048 if test "$with_snf" != no; then
1050 AC_MSG_CHECKING(whether we have Myricom Sniffer API)
1052 if test -z "$snf_root"; then
1056 if test -z "$snf_include_dir"; then
1057 snf_include_dir="$snf_root/include"
1060 if test -z "$snf_lib_dir"; then
1061 snf_lib_dir="$snf_root/lib"
1064 if test -f "$snf_include_dir/snf.h"; then
1065 ac_cv_lbl_snf_api=yes
1067 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
1069 if test $ac_cv_lbl_snf_api = no; then
1070 if test "$want_snf" = yes; then
1071 AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
1074 saved_ldflags=$LDFLAGS
1075 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1076 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
1077 LDFLAGS="$saved_ldflags"
1079 if test $ac_cv_lbl_snf_api = no; then
1080 if test "$want_snf" = yes; then
1081 AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
1084 V_INCLS="$V_INCLS -I$snf_include_dir"
1086 LDFLAGS="$LDFLAGS -L$snf_lib_dir"
1087 if test "$V_PCAP" != snf ; then
1090 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
1095 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
1096 AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
1099 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
1100 if test "$V_LEX" = lex ; then
1101 # Some versions of lex can't handle the definitions section of scanner.l .
1102 # Try lexing it and complain if it can't deal.
1103 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
1104 if lex -t scanner.l > /dev/null 2>&1; then
1105 tcpdump_cv_capable_lex=yes
1107 tcpdump_cv_capable_lex=insufficient
1109 if test $tcpdump_cv_capable_lex = insufficient ; then
1110 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
1111 libpcap. flex is a lex replacement that has many advantages, including
1112 being able to compile libpcap. For more information, see
1113 http://www.gnu.org/software/flex/flex.html .])
1118 # Assume, by default, no support for shared libraries and V7/BSD convention
1119 # for man pages (file formats in section 5, miscellaneous info in section 7).
1120 # Individual cases can override this.
1128 dnl Workaround to enable certain features
1129 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
1132 # AIX makes it fun to build shared and static libraries,
1133 # because they're *both* ".a" archive libraries. We
1134 # build the static library for the benefit of the traditional
1135 # scheme of building libpcap and tcpdump in subdirectories of
1136 # the same directory, with tcpdump statically linked with the
1137 # libpcap in question, but we also build a shared library as
1138 # "libpcap.shareda" and install *it*, rather than the static
1139 # library, as "libpcap.a".
1147 # If we're using DLPI, applications will need to
1148 # use /lib/pse.exp if present, as we use the
1151 pseexe="/lib/pse.exp"
1152 AC_MSG_CHECKING(for $pseexe)
1153 if test -f $pseexe ; then
1161 # If we're using BPF, we need "-lodm" and "-lcfg", as
1162 # we use them to load the BPF module.
1171 V_CCOPT="$V_CCOPT -fno-common"
1172 AC_ARG_ENABLE(universal,
1173 AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
1174 if test "$enable_universal" != "no"; then
1179 # Leopard. Build for 32-bit PowerPC, 64-bit
1180 # PowerPC, x86, and x86-64, with 32-bit PowerPC
1181 # first. (That's what Apple does.)
1183 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1184 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
1189 # Snow Leopard. Build for x86-64, x86, and
1190 # 32-bit PowerPC, with x86-64 first. (That's
1191 # what Apple does, even though Snow Leopard
1192 # doesn't run on PPC, so PPC libpcap runs under
1193 # Rosetta, and Rosetta doesn't support BPF
1194 # ioctls, so PPC programs can't do live
1197 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
1198 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
1205 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
1208 # Use System V conventions for man pages.
1217 # Use System V conventions for man pages.
1226 # Use System V conventions for man pages.
1233 dnl HPUX 10.20 and above is similar to HPUX 9, but
1234 dnl not the same....
1236 dnl XXX - DYEXT should be set to "sl" if this is building
1237 dnl for 32-bit PA-RISC, but should be left as "so" for
1238 dnl 64-bit PA-RISC or, I suspect, IA-64.
1239 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
1240 if test "`uname -m`" = "ia64"; then
1247 # "-b" builds a shared library; "+h" sets the soname.
1253 # Use System V conventions for man pages.
1261 # Use System V conventions for man pages.
1267 linux*|freebsd*|netbsd*|openbsd*|dragonfly*)
1271 # Compiler assumed to be GCC; run-time linker may require a -R
1274 if test "$libdir" != "/usr/lib"; then
1275 V_RFLAGS=-Wl,-R$libdir
1283 # Use System V conventions for man pages.
1290 AC_MSG_CHECKING(if SINIX compiler defines sinix)
1291 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
1295 ac_cv_cc_sinix_defined=yes,
1296 ac_cv_cc_sinix_defined=no))
1297 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
1298 if test $ac_cv_cc_sinix_defined = no ; then
1299 AC_DEFINE(sinix,1,[on sinix])
1304 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
1308 # Use System V conventions for man pages.
1317 AC_LBL_DEVEL(V_CCOPT)
1319 AC_LBL_SOCKADDR_SA_LEN
1321 AC_LBL_SOCKADDR_STORAGE
1323 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
1325 AC_LBL_UNALIGNED_ACCESS
1328 # Makefile.in includes rules to generate version.h, so we assume
1329 # that it will be generated if autoconf is used.
1331 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
1334 ln -s ${srcdir}/bpf/net net
1338 AC_SUBST(V_FINDALLDEVS)
1342 AC_SUBST(V_SHLIB_CMD)
1343 AC_SUBST(V_SHLIB_OPT)
1344 AC_SUBST(V_SONAME_OPT)
1345 AC_SUBST(V_RPATH_OPT)
1348 AC_SUBST(ADDLARCHIVEOBJS)
1351 AC_SUBST(MAN_FILE_FORMATS)
1352 AC_SUBST(MAN_MISC_INFO)
1354 dnl check for USB sniffing support
1355 AC_MSG_CHECKING(for USB sniffing support)
1358 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
1359 USB_SRC=pcap-usb-linux.c
1361 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
1362 if test $? -ne 0 ; then
1363 ac_usb_dev_name="usbmon"
1365 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
1366 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
1367 AC_CHECK_HEADERS(linux/usbdevice_fs.h)
1368 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
1370 # OK, does it define bRequestType? Older versions of the kernel
1371 # define fields with names like "requesttype, "request", and
1372 # "value", rather than "bRequestType", "bRequest", and
1375 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
1376 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
1379 #ifdef HAVE_SYS_BITYPES_H
1380 #include <sys/bitypes.h>
1382 # include <linux/usbdevice_fs.h>],
1383 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
1384 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
1385 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
1386 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
1387 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
1388 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
1389 [if struct usbdevfs_ctrltransfer has bRequestType])
1397 AC_SUBST(PCAP_SUPPORT_USB)
1400 AC_ARG_ENABLE([bluetooth],
1401 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
1402 ,enable_bluetooth=yes)
1404 if test "x$enable_bluetooth" != "xno" ; then
1405 dnl check for Bluetooth sniffing support
1408 AC_CHECK_HEADER(bluetooth/bluetooth.h,
1410 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
1411 BT_SRC=pcap-bt-linux.c
1412 AC_MSG_NOTICE(Bluetooth sniffing is supported)
1414 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
1418 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
1421 AC_SUBST(PCAP_SUPPORT_BT)
1425 AC_ARG_ENABLE([can],
1426 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
1429 if test "x$enable_can" != "xno" ; then
1430 dnl check for CAN sniffing support
1433 AC_CHECK_HEADER(linux/can.h,
1434 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
1435 CAN_SRC=pcap-can-linux.c
1436 AC_MSG_NOTICE(CAN sniffing is supported)],
1437 AC_MSG_NOTICE(CAN sniffing is not supported),
1438 [#include <sys/socket.h>]
1442 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
1445 AC_SUBST(PCAP_SUPPORT_CAN)
1451 AC_CONFIG_HEADER(config.h)
1453 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
1454 pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap
1455 pcap_datalink.3pcap pcap_dump_open.3pcap
1456 pcap_list_datalinks.3pcap pcap_open_dead.3pcap
1457 pcap_open_offline.3pcap)
1459 if test -f .devel ; then