Home | History | Annotate | Download | only in libpcap
      1 dnl
      2 dnl Copyright (c) 1994, 1995, 1996, 1997
      3 dnl	The Regents of the University of California.  All rights reserved.
      4 dnl
      5 dnl Process this file with autoconf to produce a configure script.
      6 dnl
      7 
      8 #
      9 # See
     10 #
     11 #	http://ftp.gnu.org/gnu/config/README
     12 #
     13 # for the URLs to use to fetch new versions of config.guess and
     14 # config.sub.
     15 #
     16 
     17 AC_PREREQ(2.61)
     18 AC_INIT(pcap.c)
     19 
     20 AC_CANONICAL_SYSTEM
     21 
     22 AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
     23 AC_PROG_CC
     24 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
     25 AC_LBL_SHLIBS_INIT
     26 AC_LBL_C_INLINE
     27 AC_C___ATTRIBUTE__
     28 if test "$ac_cv___attribute__" = "yes"; then
     29 	AC_C___ATTRIBUTE___UNUSED
     30 	AC_C___ATTRIBUTE___FORMAT
     31 fi
     32 
     33 AC_CHECK_HEADERS(sys/bitypes.h)
     34 
     35 AC_CHECK_TYPE([int8_t], ,
     36 	[AC_DEFINE([int8_t], [signed char],
     37 	[Define to `signed char' if int8_t not defined.])],
     38 	[AC_INCLUDES_DEFAULT
     39 #ifdef HAVE_SYS_BITYPES_H
     40 #include <sys/bitypes.h>
     41 #endif])
     42 AC_CHECK_TYPE([u_int8_t], ,
     43 	[AC_DEFINE([u_int8_t], [unsigned char],
     44 	[Define to `unsigned char' if u_int8_t not defined.])],
     45 	[AC_INCLUDES_DEFAULT
     46 #ifdef HAVE_SYS_BITYPES_H
     47 #include <sys/bitypes.h>
     48 #endif])
     49 AC_CHECK_TYPE([int16_t], ,
     50 	[AC_DEFINE([int16_t], [short],
     51 	[Define to `short' if int16_t not defined.])]
     52 	[AC_INCLUDES_DEFAULT
     53 #ifdef HAVE_SYS_BITYPES_H
     54 #include <sys/bitypes.h>
     55 #endif])
     56 AC_CHECK_TYPE([u_int16_t], ,
     57 	[AC_DEFINE([u_int16_t], [unsigned short],
     58 	[Define to `unsigned short' if u_int16_t not defined.])],
     59 	[AC_INCLUDES_DEFAULT
     60 #ifdef HAVE_SYS_BITYPES_H
     61 #include <sys/bitypes.h>
     62 #endif])
     63 AC_CHECK_TYPE([int32_t], ,
     64 	[AC_DEFINE([int32_t], [int],
     65 	[Define to `int' if int32_t not defined.])],
     66 	[AC_INCLUDES_DEFAULT
     67 #ifdef HAVE_SYS_BITYPES_H
     68 #include <sys/bitypes.h>
     69 #endif])
     70 AC_CHECK_TYPE([u_int32_t], ,
     71 	[AC_DEFINE([u_int32_t], [unsigned int],
     72 	[Define to `unsigned int' if u_int32_t not defined.])],
     73 	[AC_INCLUDES_DEFAULT
     74 #ifdef HAVE_SYS_BITYPES_H
     75 #include <sys/bitypes.h>
     76 #endif])
     77 AC_CHECK_TYPE([int64_t], ,
     78 	[AC_DEFINE([int64_t], [long long],
     79 	[Define to `long long' if int64_t not defined.])],
     80 	[AC_INCLUDES_DEFAULT
     81 #ifdef HAVE_SYS_BITYPES_H
     82 #include <sys/bitypes.h>
     83 #endif])
     84 AC_CHECK_TYPE([u_int64_t], ,
     85 	[AC_DEFINE([u_int64_t], [unsigned long long],
     86 	[Define to `unsigned long long' if u_int64_t not defined.])],
     87 	[AC_INCLUDES_DEFAULT
     88 #ifdef HAVE_SYS_BITYPES_H
     89 #include <sys/bitypes.h>
     90 #endif])
     91 
     92 #
     93 # Try to arrange for large file support.
     94 #
     95 AC_SYS_LARGEFILE
     96 AC_FUNC_FSEEKO
     97 
     98 dnl
     99 dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to
    100 dnl include <sys/ioccom.h>, and we were to drop support for older
    101 dnl releases without that fix, so that pcap-bpf.c doesn't need to
    102 dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES"
    103 dnl in "aclocal.m4" uses it, so we would still have to test for it
    104 dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
    105 dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris.
    106 dnl
    107 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
    108 AC_CHECK_HEADERS(linux/types.h)
    109 AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h)
    110 AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
    111 #include <sys/socket.h>
    112 #include <net/if.h>])
    113 if test "$ac_cv_header_net_pfvar_h" = yes; then
    114 	#
    115 	# Check for various PF actions.
    116 	#
    117 	AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR)
    118 	AC_TRY_COMPILE(
    119 	    [#include <sys/types.h>
    120 	    #include <sys/socket.h>
    121 	    #include <net/if.h>
    122 	    #include <net/pfvar.h>],
    123 	    [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;],
    124 	    [
    125 		AC_MSG_RESULT(yes)
    126 		AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1,
    127 		    [define if net/pfvar.h defines PF_NAT through PF_NORDR])
    128 	    ],
    129 	    AC_MSG_RESULT(no))
    130 fi
    131 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
    132 #include <sys/socket.h>])
    133 if test "$ac_cv_header_netinet_if_ether_h" != yes; then
    134 	#
    135 	# The simple test didn't work.
    136 	# Do we need to include <net/if.h> first?
    137 	# Unset ac_cv_header_netinet_if_ether_h so we don't
    138 	# treat the previous failure as a cached value and
    139 	# suppress the next test.
    140 	#
    141 	AC_MSG_NOTICE([Rechecking with some additional includes])
    142 	unset ac_cv_header_netinet_if_ether_h
    143 	AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
    144 #include <sys/socket.h>
    145 #include <netinet/in.h>
    146 struct mbuf;
    147 struct rtentry;
    148 #include <net/if.h>])
    149 fi
    150 
    151 case "$host_os" in
    152 linux*)
    153 	AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,,
    154 	[
    155 #include <sys/socket.h>
    156 #include <linux/if.h>
    157 	])
    158 	;;
    159 esac
    160 
    161 AC_LBL_FIXINCLUDES
    162 
    163 AC_CHECK_FUNCS(strerror strlcpy)
    164 
    165 needsnprintf=no
    166 AC_CHECK_FUNCS(vsnprintf snprintf,,
    167 	[needsnprintf=yes])
    168 if test $needsnprintf = yes; then
    169 	AC_LIBOBJ([snprintf])
    170 fi
    171 
    172 #
    173 # Do this before checking for ether_hostton(), as it's a
    174 # "gethostbyname() -ish function".
    175 #
    176 AC_LBL_LIBRARY_NET
    177 
    178 #
    179 # You are in a twisty little maze of UN*Xes, all different.
    180 # Some might not have ether_hostton().
    181 # Some might have it, but not declare it in any header file.
    182 # Some might have it, but declare it in <netinet/if_ether.h>.
    183 # Some might have it, but declare it in <netinet/ether.h>
    184 # (And some might have it but document it as something declared in
    185 # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
    186 #
    187 # Before you is a C compiler.
    188 #
    189 AC_CHECK_FUNCS(ether_hostton)
    190 if test "$ac_cv_func_ether_hostton" = yes; then
    191 	#
    192 	# OK, we have ether_hostton().  Do we have <netinet/if_ether.h>?
    193 	#
    194 	if test "$ac_cv_header_netinet_if_ether_h" = yes; then
    195 		#
    196 		# Yes.  Does it declare ether_hostton()?
    197 		#
    198 		AC_CHECK_DECL(ether_hostton,
    199 		    [
    200 			AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
    201 			    [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
    202 		    ],,
    203 		    [
    204 #include <sys/types.h>
    205 #include <sys/socket.h>
    206 #include <netinet/in.h>
    207 #include <arpa/inet.h>
    208 struct mbuf;
    209 struct rtentry;
    210 #include <net/if.h>
    211 #include <netinet/if_ether.h>
    212 		    ])
    213 	fi
    214 	#
    215 	# Did that succeed?
    216 	#
    217 	if test "$ac_cv_have_decl_ether_hostton" != yes; then
    218 		#
    219 		# No, how about <netinet/ether.h>, as on Linux?
    220 		#
    221 		AC_CHECK_HEADERS(netinet/ether.h)
    222 		if test "$ac_cv_header_netinet_ether_h" = yes; then
    223 			#
    224 			# We have it - does it declare ether_hostton()?
    225 			# Unset ac_cv_have_decl_ether_hostton so we don't
    226 			# treat the previous failure as a cached value and
    227 			# suppress the next test.
    228 			#
    229 			unset ac_cv_have_decl_ether_hostton
    230 			AC_CHECK_DECL(ether_hostton,
    231 			    [
    232 				AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
    233 				    [Define to 1 if netinet/ether.h declares `ether_hostton'])
    234 			    ],,
    235 			    [
    236 #include <netinet/ether.h>
    237 			    ])
    238 		fi
    239 	fi
    240 	#
    241 	# Is ether_hostton() declared?
    242 	#
    243 	if test "$ac_cv_have_decl_ether_hostton" != yes; then
    244 		#
    245 		# No, we'll have to declare it ourselves.
    246 		# Do we have "struct ether_addr"?
    247 		#
    248 		AC_CHECK_TYPES(struct ether_addr,,,
    249 		    [
    250 #include <sys/types.h>
    251 #include <sys/socket.h>
    252 #include <netinet/in.h>
    253 #include <arpa/inet.h>
    254 struct mbuf;
    255 struct rtentry;
    256 #include <net/if.h>
    257 #include <netinet/if_ether.h>
    258 		    ])
    259 		AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
    260 		    [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
    261 don't.])
    262 	else
    263 		AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
    264 		    [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
    265 don't.])
    266 	fi
    267 fi
    268 
    269 dnl to pacify those who hate protochain insn
    270 AC_MSG_CHECKING(if --disable-protochain option is specified)
    271 AC_ARG_ENABLE(protochain,
    272 AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn]))
    273 case "x$enable_protochain" in
    274 xyes)	enable_protochain=enabled	;;
    275 xno)	enable_protochain=disabled	;;
    276 x)	enable_protochain=enabled	;;
    277 esac
    278 
    279 if test "$enable_protochain" = "disabled"; then
    280 	AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
    281 fi
    282 AC_MSG_RESULT(${enable_protochain})
    283 
    284 #
    285 # SITA support is mutually exclusive with native capture support;
    286 # "--with-sita" selects SITA support.
    287 #
    288 AC_ARG_WITH(sita,
    289 AC_HELP_STRING([--with-sita],[include SITA support]),
    290 [
    291 	if test ! "x$withval" = "xno" ; then
    292 		AC_DEFINE(SITA,1,[include ACN support])
    293 		AC_MSG_NOTICE(Enabling SITA ACN support)
    294 		V_PCAP=sita
    295 		V_FINDALLDEVS=sita
    296 	fi
    297 ],
    298 [
    299 dnl
    300 dnl Not all versions of test support -c (character special) but it's a
    301 dnl better way of testing since the device might be protected. So we
    302 dnl check in our normal order using -r and then check the for the /dev
    303 dnl guys again using -c.
    304 dnl
    305 dnl XXX This could be done for cross-compiling, but for now it's not.
    306 dnl
    307 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
    308 	AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
    309 fi
    310 AC_ARG_WITH(pcap,
    311 AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE]))
    312 AC_MSG_CHECKING(packet capture type)
    313 if test ! -z "$with_pcap" ; then
    314 	V_PCAP="$withval"
    315 elif test -r /dev/bpf -o -h /dev/bpf ; then
    316 	#
    317 	# Cloning BPF device.
    318 	#
    319 	V_PCAP=bpf
    320 	AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
    321 elif test -r /dev/bpf0 ; then
    322 	V_PCAP=bpf
    323 elif test -r /usr/include/net/pfilt.h ; then
    324 	V_PCAP=pf
    325 elif test -r /dev/enet ; then
    326 	V_PCAP=enet
    327 elif test -r /dev/nit ; then
    328 	V_PCAP=snit
    329 elif test -r /usr/include/sys/net/nit.h ; then
    330 	V_PCAP=nit
    331 elif test -r /usr/include/linux/socket.h ; then
    332 	V_PCAP=linux
    333 elif test -r /usr/include/net/raw.h ; then
    334 	V_PCAP=snoop
    335 elif test -r /usr/include/odmi.h ; then
    336 	#
    337 	# On AIX, the BPF devices might not yet be present - they're
    338 	# created the first time libpcap runs after booting.
    339 	# We check for odmi.h instead.
    340 	#
    341 	V_PCAP=bpf
    342 elif test -c /dev/bpf0 ; then		# check again in case not readable
    343 	V_PCAP=bpf
    344 elif test -r /usr/include/sys/dlpi.h ; then
    345 	V_PCAP=dlpi
    346 elif test -c /dev/enet ; then		# check again in case not readable
    347 	V_PCAP=enet
    348 elif test -c /dev/nit ; then		# check again in case not readable
    349 	V_PCAP=snit
    350 else
    351 	V_PCAP=null
    352 fi
    353 AC_MSG_RESULT($V_PCAP)
    354 
    355 #
    356 # Do capture-mechanism-dependent tests.
    357 #
    358 case "$V_PCAP" in
    359 dlpi)
    360 	#
    361 	# Needed for common functions used by pcap-[dlpi,libdlpi].c
    362 	#
    363  	SSRC="dlpisubs.c"
    364 
    365 	#
    366 	# Checks for some header files.
    367 	#
    368 	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
    369 
    370 	#
    371 	# Checks to see if Solaris has the public libdlpi(3LIB) library.
    372 	# Note: The existence of /usr/include/libdlpi.h does not mean it is the
    373 	# public libdlpi(3LIB) version. Before libdlpi was made public, a
    374 	# private version also existed, which did not have the same APIs.
    375 	# Due to a gcc bug, the default search path for 32-bit libraries does
    376 	# not include /lib, we add it explicitly here.
    377 	# [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485].
    378 	# Also, due to the bug above applications that link to libpcap with
    379 	# libdlpi will have to add "-L/lib" option to "configure".
    380 	#
    381 	saved_ldflags=$LDFLAGS
    382 	LDFLAGS="$LIBS -L/lib"
    383 	AC_CHECK_LIB(dlpi, dlpi_walk,
    384 		[
    385 			LIBS="-ldlpi $LIBS"
    386 			V_PCAP=libdlpi
    387 			AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists])
    388 		],
    389 		V_PCAP=dlpi)
    390 	LDFLAGS=$saved_ldflags
    391 
    392 	#
    393 	# Checks whether <sys/dlpi.h> is usable, to catch weird SCO
    394 	# versions of DLPI.
    395 	#
    396 	AC_MSG_CHECKING(whether <sys/dlpi.h> is usable)
    397 	AC_CACHE_VAL(ac_cv_sys_dlpi_usable,
    398 		AC_TRY_COMPILE(
    399 		    [
    400 			#include <sys/types.h>
    401 			#include <sys/time.h>
    402 			#include <sys/dlpi.h>
    403 		    ],
    404 		    [int i = DL_PROMISC_PHYS;],
    405 		    ac_cv_sys_dlpi_usable=yes,
    406 		    ac_cv_sys_dlpi_usable=no))
    407 	AC_MSG_RESULT($ac_cv_sys_dlpi_usable)
    408 	if test $ac_cv_sys_dlpi_usable = no ; then
    409 		AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI)
    410 	fi
    411 
    412 	#
    413 	# Check whether we have a /dev/dlpi device or have multiple devices.
    414 	#
    415 	AC_MSG_CHECKING(for /dev/dlpi device)
    416 	if test -c /dev/dlpi ; then
    417 		AC_MSG_RESULT(yes)
    418 		AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
    419 	else
    420 		AC_MSG_RESULT(no)
    421 		dir="/dev/dlpi"
    422 		AC_MSG_CHECKING(for $dir directory)
    423 		if test -d $dir ; then
    424 			AC_MSG_RESULT(yes)
    425 			AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
    426 		else
    427 			AC_MSG_RESULT(no)
    428 		fi
    429 	fi
    430 
    431 	#
    432 	# This check is for Solaris with DLPI support for passive modes.
    433 	# See dlpi(7P) for more details.
    434 	#
    435 	AC_LBL_DL_PASSIVE_REQ_T
    436 	;;
    437 
    438 linux)
    439 	#
    440 	# Do we have the wireless extensions?
    441 	#
    442 	AC_CHECK_HEADERS(linux/wireless.h, [], [],
    443 	[
    444 #include <sys/socket.h>
    445 #include <linux/if.h>
    446 #include <linux/types.h>
    447 	])
    448 
    449 	#
    450 	# Do we have libnl?
    451 	#
    452 	AC_ARG_WITH(libnl,
    453 	AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]),
    454 		with_libnl=$withval,,)
    455 
    456 	if test x$with_libnl != xno ; then
    457 		have_any_nl="no"
    458 
    459                 incdir=-I/usr/include/libnl3
    460                 libnldir=
    461                 if test x$withval != x ; then
    462                   libnldir=-L${withval}/lib/.libs
    463                   incdir=-I${withval}/include
    464                 fi
    465 
    466 		#
    467 		# Try libnl 3.x first.
    468 		#
    469 		AC_CHECK_LIB(nl-3, nl_socket_alloc,
    470 		[
    471 			#
    472 			# Yes, we have libnl 3.x.
    473 			#
    474 			LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS"
    475 			AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
    476 			AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x])
    477 			AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
    478 			AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
    479 			V_INCLS="$V_INCLS ${incdir}"
    480 			have_any_nl="yes"
    481 		],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 )
    482 
    483 		if test x$have_any_nl = xno ; then
    484 			#
    485 			# Try libnl 2.x
    486 			#
    487 			AC_CHECK_LIB(nl, nl_socket_alloc,
    488 			[
    489 				#
    490 				# Yes, we have libnl 2.x.
    491 				#
    492 				LIBS="${libnldir} -lnl-genl -lnl $LIBS"
    493 				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
    494 				AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x])
    495 				AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE])
    496 				AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api])
    497 				have_any_nl="yes"
    498 			])
    499 		fi
    500 
    501 		if test x$have_any_nl = xno ; then
    502 			#
    503 			# No, we don't; do we have libnl 1.x?
    504 			#
    505 			AC_CHECK_LIB(nl, nl_handle_alloc,
    506 			[
    507 				#
    508 				# Yes.
    509 				#
    510 				LIBS="${libnldir} -lnl $LIBS"
    511 				AC_DEFINE(HAVE_LIBNL,1,[if libnl exists])
    512 				have_any_nl="yes"
    513 			])
    514 		fi
    515 
    516 		if test x$have_any_nl = xno ; then
    517 			#
    518 			# No, we don't have libnl at all.
    519 			#
    520 			if test x$with_libnl = xyes ; then
    521 				AC_MSG_ERROR([libnl support requested but libnl not found])
    522 			fi
    523 		fi
    524 	fi
    525 
    526 	AC_CHECK_HEADERS(linux/ethtool.h,,,
    527 	    [
    528 AC_INCLUDES_DEFAULT
    529 #include <linux/types.h>
    530 	    ])
    531 	AC_LBL_TPACKET_STATS
    532 	AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
    533 	;;
    534 
    535 bpf)
    536 	#
    537 	# Check whether we have the *BSD-style ioctls.
    538 	#
    539 	AC_CHECK_HEADERS(net/if_media.h)
    540 
    541 	AC_MSG_CHECKING(whether the system supports zerocopy BPF)
    542 	AC_TRY_COMPILE(
    543 	    [#include <sys/socket.h>
    544 	    #include <sys/ioctl.h>
    545 	    #include <net/if.h>
    546 	    #include <net/bpf.h>],
    547 	    [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);],
    548 	    [
    549 		AC_MSG_RESULT(yes)
    550 		AC_DEFINE(HAVE_ZEROCOPY_BPF, 1,
    551 		[define if the system supports zerocopy BPF])
    552 	    ],
    553 	    AC_MSG_RESULT(no))
    554 
    555 	    #
    556 	    # Check whether we have struct BPF_TIMEVAL.
    557 	    #
    558 	    AC_CHECK_TYPES(struct BPF_TIMEVAL,,,
    559 		[
    560 #include <sys/types.h>
    561 #include <sys/ioctl.h>
    562 #ifdef HAVE_SYS_IOCCOM_H
    563 #include <sys/ioccom.h>
    564 #endif
    565 #include <net/bpf.h>
    566 		    ])
    567 	;;
    568 
    569 dag)
    570 	V_DEFS="$V_DEFS -DDAG_ONLY"
    571 	;;
    572 
    573 septel)
    574 	V_DEFS="$V_DEFS -DSEPTEL_ONLY"
    575 	;;
    576 
    577 snf)
    578 	V_DEFS="$V_DEFS -DSNF_ONLY"
    579 	;;
    580 
    581 null)
    582 	AC_MSG_WARN(cannot determine packet capture interface)
    583 	AC_MSG_WARN((see the INSTALL doc for more info))
    584 	;;
    585 esac
    586 
    587 dnl
    588 dnl Now figure out how we get a list of interfaces and addresses,
    589 dnl if we support capturing.  Don't bother if we don't support
    590 dnl capturing.
    591 dnl
    592 if test "$V_PCAP" = null
    593 then
    594 	#
    595 	# We can't capture, so we can't open any capture
    596 	# devices, so we won't return any interfaces.
    597 	#
    598 	V_FINDALLDEVS=null
    599 else
    600 	AC_CHECK_FUNC(getifaddrs,[
    601 		#
    602 		# We have "getifaddrs()"; make sure we have <ifaddrs.h>
    603 		# as well, just in case some platform is really weird.
    604 		#
    605 		AC_CHECK_HEADER(ifaddrs.h,[
    606 		    #
    607 		    # We have the header, so we use "getifaddrs()" to
    608 		    # get the list of interfaces.
    609 		    #
    610 		    V_FINDALLDEVS=getad
    611 		],[
    612 		    #
    613 		    # We don't have the header - give up.
    614 		    # XXX - we could also fall back on some other
    615 		    # mechanism, but, for now, this'll catch this
    616 		    # problem so that we can at least try to figure
    617 		    # out something to do on systems with "getifaddrs()"
    618 		    # but without "ifaddrs.h", if there is something
    619 		    # we can do on those systems.
    620 		    #
    621 		    AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
    622 		])
    623 	],[
    624 		#
    625 		# Well, we don't have "getifaddrs()", so we have to use
    626 		# some other mechanism; determine what that mechanism is.
    627 		#
    628 		# The first thing we use is the type of capture mechanism,
    629 		# which is somewhat of a proxy for the OS we're using.
    630 		#
    631 		case "$V_PCAP" in
    632 
    633 		dlpi|libdlpi)
    634 			#
    635 			# This might be Solaris 8 or later, with
    636 			# SIOCGLIFCONF, or it might be some other OS
    637 			# or some older version of Solaris, with
    638 			# just SIOCGIFCONF.
    639 			#
    640 			AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
    641 			AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
    642 			    AC_TRY_COMPILE(
    643 				[#include <sys/param.h>
    644 				#include <sys/file.h>
    645 				#include <sys/ioctl.h>
    646 				#include <sys/socket.h>
    647 				#include <sys/sockio.h>],
    648 				[ioctl(0, SIOCGLIFCONF, (char *)0);],
    649 				ac_cv_lbl_have_siocglifconf=yes,
    650 				ac_cv_lbl_have_siocglifconf=no))
    651 			AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
    652 			if test $ac_cv_lbl_have_siocglifconf = yes ; then
    653 				V_FINDALLDEVS=glifc
    654 			else
    655 				V_FINDALLDEVS=gifc
    656 			fi
    657 			;;
    658 
    659 		*)
    660 			#
    661 			# Assume we just have SIOCGIFCONF.
    662 			# (XXX - on at least later Linux kernels, there's
    663 			# another mechanism, and we should be using that
    664 			# instead.)
    665 			#
    666 			V_FINDALLDEVS=gifc
    667 			;;
    668 		esac])
    669 fi
    670 ])
    671 
    672 AC_MSG_CHECKING(for socklen_t)
    673 AC_TRY_COMPILE([
    674 	#include <sys/types.h>
    675 	#include <sys/socket.h>
    676 	],
    677 	[ socklen_t x; ],
    678 	have_socklen_t=yes,
    679 	have_socklen_t=no)
    680 if test "x$have_socklen_t" = "xyes"; then
    681 	AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined])
    682 fi
    683 AC_MSG_RESULT($have_socklen_t)
    684 
    685 AC_ARG_ENABLE(ipv6,
    686 AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]),
    687     [],
    688     [enable_ipv6=ifavailable])
    689 if test "$enable_ipv6" != "no"; then
    690 	AC_CHECK_FUNC(getaddrinfo,
    691 	    [
    692 		AC_DEFINE(INET6,1,[IPv6])
    693 	    ],
    694 	    [
    695 		if test "$enable_ipv6" != "ifavailable"; then
    696 			AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available])
    697 		fi
    698 	    ])
    699 fi
    700 
    701 AC_MSG_CHECKING(whether to build optimizer debugging code)
    702 AC_ARG_ENABLE(optimizer-dbg,
    703 AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code]))
    704 if test "$enable_optimizer_dbg" = "yes"; then
    705 	AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
    706 fi
    707 AC_MSG_RESULT(${enable_optimizer_dbg-no})
    708 
    709 AC_MSG_CHECKING(whether to build parser debugging code)
    710 AC_ARG_ENABLE(yydebug,
    711 AC_HELP_STRING([--enable-yydebug],[build parser debugging code]))
    712 if test "$enable_yydebug" = "yes"; then
    713 	AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
    714 fi
    715 AC_MSG_RESULT(${enable_yydebug-no})
    716 
    717 # Check for Endace DAG card support.
    718 AC_ARG_WITH([dag],
    719 AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
    720 [
    721 	if test "$withval" = no
    722 	then
    723 		# User doesn't want DAG support.
    724 		want_dag=no
    725 	elif test "$withval" = yes
    726 	then
    727 		# User wants DAG support but hasn't specified a directory.
    728 		want_dag=yes
    729 	else
    730 		# User wants DAG support and has specified a directory, so use the provided value.
    731 		want_dag=yes
    732 		dag_root=$withval
    733 	fi
    734 ],[
    735 	#
    736 	# Use DAG API if present, otherwise don't
    737 	#
    738 	want_dag=ifpresent
    739 ])
    740 
    741 AC_ARG_WITH([dag-includes],
    742 AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]),
    743 [
    744 	# User wants DAG support and has specified a header directory, so use the provided value.
    745 	want_dag=yes
    746 	dag_include_dir=$withval
    747 ],[])
    748 
    749 AC_ARG_WITH([dag-libraries],
    750 AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]),
    751 [
    752 	# User wants DAG support and has specified a library directory, so use the provided value.
    753 	want_dag=yes
    754 	dag_lib_dir=$withval
    755 ],[])
    756 
    757 case "$V_PCAP" in
    758 linux|bpf|dag)
    759 	#
    760 	# We support the DAG API if we're on Linux or BSD, or if we're
    761 	# building a DAG-only libpcap.
    762 	#
    763 	;;
    764 *)
    765 	#
    766 	# If the user explicitly requested DAG, tell them it's not
    767 	# supported.
    768 	#
    769 	# If they expressed no preference, don't include it.
    770 	#
    771 	if test $want_dag = yes; then
    772 		AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
    773 	elif test $want_dag = yes; then
    774 		want_dag=no
    775 	fi
    776 	;;
    777 esac
    778 
    779 ac_cv_lbl_dag_api=no
    780 if test "$want_dag" != no; then
    781 
    782 	AC_MSG_CHECKING([whether we have DAG API headers])
    783 
    784 	# If necessary, set default paths for DAG API headers and libraries.
    785 	if test -z "$dag_root"; then
    786 	    dag_root=/usr/local
    787 	fi
    788 
    789 	if test -z "$dag_include_dir"; then
    790 		dag_include_dir="$dag_root/include"
    791 	fi
    792 
    793 	if test -z "$dag_lib_dir"; then
    794 	    dag_lib_dir="$dag_root/lib"
    795 	fi
    796 
    797 	if test -z "$dag_tools_dir"; then
    798 	    dag_tools_dir="$dag_root/tools"
    799 	fi
    800 
    801 	if test -r $dag_include_dir/dagapi.h; then
    802 		ac_cv_lbl_dag_api=yes
    803 	fi
    804 	AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
    805 fi
    806 
    807 if test $ac_cv_lbl_dag_api = yes; then
    808 	V_INCLS="$V_INCLS -I$dag_include_dir"
    809 
    810 	if test $V_PCAP != dag ; then
    811 		 SSRC="pcap-dag.c"
    812 	fi
    813 
    814 	# See if we can find a general version string.
    815 	# Don't need to save and restore LIBS to prevent -ldag being
    816 	# included if there's a found-action (arg 3).
    817 	saved_ldflags=$LDFLAGS
    818 	LDFLAGS="-L$dag_lib_dir"
    819 	AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"])
    820 	AC_CHECK_LIB([dag],[dag_get_erf_types], [
    821 		AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])])
    822 	AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [
    823 		AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])])
    824 
    825 	LDFLAGS=$saved_ldflags
    826 
    827 	if test "$dag_streams" = 1; then
    828 		AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
    829 		LIBS="$LIBS -ldag"
    830 		LDFLAGS="$LDFLAGS -L$dag_lib_dir"
    831 
    832 		AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"])
    833 		if test "$ac_dag_have_vdag" = 1; then
    834 			AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()])
    835 			LIBS="$LIBS -lpthread"
    836 		fi
    837 	fi
    838 
    839 	AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
    840 fi
    841 
    842 AC_MSG_CHECKING(whether we have the DAG API)
    843 
    844 if test $ac_cv_lbl_dag_api = no; then
    845 	AC_MSG_RESULT(no)
    846 	if test "$want_dag" = yes; then
    847         	# User wanted DAG support but we couldn't find it.
    848 		AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
    849 	fi
    850 
    851 	if test "$V_PCAP" = dag; then
    852 		# User requested "dag" capture type but the DAG API wasn't
    853 		# found.
    854 		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.)])
    855 	fi
    856 else
    857 	AC_MSG_RESULT(yes)
    858 fi
    859 
    860 AC_ARG_WITH(septel,
    861 AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied).  @<:@default=yes, on Linux, if present@:>@]),
    862 [
    863 	if test "$withval" = no
    864 	then
    865 		want_septel=no
    866 	elif test "$withval" = yes
    867 	then
    868 		want_septel=yes
    869 		septel_root=
    870 	else
    871 		want_septel=yes
    872 		septel_root=$withval
    873 	fi
    874 ],[
    875 	#
    876 	# Use Septel API if present, otherwise don't
    877 	#
    878 	want_septel=ifpresent
    879 	septel_root=./../septel
    880 ])
    881 ac_cv_lbl_septel_api=no
    882 case "$V_PCAP" in
    883 linux|septel)
    884 	#
    885 	# We support the Septel API if we're on Linux, or if we're building
    886 	# a Septel-only libpcap.
    887 	#
    888 	;;
    889 *)
    890 	#
    891 	# If the user explicitly requested Septel, tell them it's not
    892 	# supported.
    893 	#
    894 	# If they expressed no preference, don't include it.
    895 	#
    896 	if test $want_septel = yes; then
    897 		AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
    898 	elif test $want_septel = yes; then
    899 		want_septel=no
    900 	fi
    901 	;;
    902 esac
    903 
    904 if test "$with_septel" != no; then
    905 	AC_MSG_CHECKING(whether we have Septel API)
    906 
    907 	if test -z "$septel_root"; then
    908 		septel_root=$srcdir/../septel
    909 	fi
    910 
    911 	septel_tools_dir="$septel_root"
    912 	septel_include_dir="$septel_root/INC"
    913 
    914 	ac_cv_lbl_septel_api=no
    915 	if test -r "$septel_include_dir/msg.h"; then
    916 		V_INCLS="$V_INCLS -I$septel_include_dir"
    917 		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"
    918 		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"
    919 
    920 		if test "$V_PCAP" != septel ; then
    921 			 SSRC="pcap-septel.c"
    922 		fi
    923 		ac_cv_lbl_septel_api=yes
    924 	fi
    925 
    926 	AC_MSG_RESULT($ac_cv_lbl_septel_api)
    927 	if test $ac_cv_lbl_septel_api = no; then
    928 		if test "$want_septel" = yes; then
    929 			AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
    930 		fi
    931 	else
    932 		AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
    933 	fi
    934 fi
    935 
    936 if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
    937 	AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
    938 fi
    939 
    940 # Check for Myricom SNF support.
    941 AC_ARG_WITH([snf],
    942 AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]),
    943 [
    944 	if test "$withval" = no
    945 	then
    946 		# User explicitly doesn't want SNF
    947 		want_snf=no
    948 	elif test "$withval" = yes
    949 	then
    950 		# User wants SNF support but hasn't specific a directory.
    951 		want_snf=yes
    952 	else
    953 		# User wants SNF support with a specified directory.
    954 		want_snf=yes
    955 		snf_root=$withval
    956 	fi
    957 ],[
    958 	#
    959 	# Use Sniffer API if present, otherwise don't
    960 	#
    961 	want_snf=ifpresent
    962 ])
    963 
    964 AC_ARG_WITH([snf-includes],
    965 AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]),
    966 [
    967 	# User wants SNF with specific header directory
    968 	want_snf=yes
    969 	snf_include_dir=$withval
    970 ],[])
    971 
    972 AC_ARG_WITH([snf-libraries],
    973 AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]),
    974 [
    975 	# User wants SNF with specific lib directory
    976 	want_snf=yes
    977 	snf_lib_dir=$withval
    978 ],[])
    979 
    980 case "$V_PCAP" in
    981 bpf|linux|snf)
    982 	#
    983 	# We support the Sniffer API if we're on BSD, Linux, or if we're
    984 	# building a Sniffer-only libpcap.
    985 	#
    986 	;;
    987 *)
    988 	#
    989 	# If the user explicitly requested Sniffer, tell them it's not
    990 	# supported.
    991 	#
    992 	# If they expressed no preference, don't include it.
    993 	#
    994 	if test $want_snf = yes; then
    995 		AC_MSG_ERROR(Myricom SNF support only available with 'bpf' 'linux' and 'snf' packet capture types)
    996 	elif test $want_snf = yes; then
    997 		want_snf=no
    998 	fi
    999 	;;
   1000 esac
   1001 
   1002 ac_cv_lbl_snf_api=no
   1003 if test "$with_snf" != no; then
   1004 
   1005 	AC_MSG_CHECKING(whether we have Myricom Sniffer API)
   1006 
   1007 	if test -z "$snf_root"; then
   1008 		snf_root=/opt/snf
   1009 	fi
   1010 
   1011 	if test -z "$snf_include_dir"; then
   1012 		snf_include_dir="$snf_root/include"
   1013 	fi
   1014 
   1015 	if test -z "$snf_lib_dir"; then
   1016 		snf_lib_dir="$snf_root/lib"
   1017 	fi
   1018 
   1019 	if test -f "$snf_include_dir/snf.h"; then
   1020 		ac_cv_lbl_snf_api=yes
   1021 	fi
   1022 	AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)])
   1023 
   1024 	if test $ac_cv_lbl_snf_api = no; then
   1025 		if test "$want_snf" = yes; then
   1026 			AC_MSG_ERROR(SNF API headers not found under $snf_include_dir; use --without-snf)
   1027 		fi
   1028 	else
   1029 		saved_ldflags=$LDFLAGS
   1030 		LDFLAGS="$LDFLAGS -L$snf_lib_dir"
   1031 		AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"], [ac_cv_lbl_snf_api="no"])
   1032 		LDFLAGS="$saved_ldflags"
   1033 
   1034 		if test $ac_cv_lbl_snf_api = no; then
   1035 			if test "$want_snf" = yes; then
   1036 				AC_MSG_ERROR(SNF API cannot correctly be linked check config.log; use --without-snf)
   1037 			fi
   1038 		else
   1039 			V_INCLS="$V_INCLS -I$snf_include_dir"
   1040 			LIBS="$LIBS -lsnf"
   1041 			LDFLAGS="$LDFLAGS -L$snf_lib_dir"
   1042 			if test "$V_PCAP" != snf ; then
   1043 				SSRC="pcap-snf.c"
   1044 			fi
   1045 			AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API])
   1046 		fi
   1047 	fi
   1048 fi
   1049 
   1050 if test "$V_PCAP" = snf -a "$ac_cv_lbl_snf_api" = no; then
   1051 	AC_MSG_ERROR(Specifying the capture type as 'snf' requires the Myricom Sniffer API to be present; use --with-snf=DIR)
   1052 fi
   1053 
   1054 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
   1055 if test "$V_LEX" = lex ; then
   1056 # Some versions of lex can't handle the definitions section of scanner.l .
   1057 # Try lexing it and complain if it can't deal.
   1058 	AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
   1059 		if lex -t scanner.l > /dev/null 2>&1; then
   1060 			tcpdump_cv_capable_lex=yes
   1061 		else
   1062 			tcpdump_cv_capable_lex=insufficient
   1063 		fi)
   1064 	if test $tcpdump_cv_capable_lex = insufficient ; then
   1065 		AC_MSG_ERROR([Your operating system's lex is insufficient to compile
   1066  libpcap.  flex is a lex replacement that has many advantages, including
   1067  being able to compile libpcap.  For more information, see
   1068  http://www.gnu.org/software/flex/flex.html .])
   1069 	fi
   1070 fi
   1071 
   1072 #
   1073 # Assume, by default, no support for shared libraries and V7/BSD convention
   1074 # for man pages (file formats in section 5, miscellaneous info in section 7).
   1075 # Individual cases can override this.
   1076 #
   1077 DYEXT="none"
   1078 MAN_FILE_FORMATS=5
   1079 MAN_MISC_INFO=7
   1080 case "$host_os" in
   1081 
   1082 aix*)
   1083 	dnl Workaround to enable certain features
   1084 	AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
   1085 
   1086 	#
   1087 	# AIX makes it fun to build shared and static libraries,
   1088 	# because they're *both* ".a" archive libraries.  We
   1089 	# build the static library for the benefit of the traditional
   1090 	# scheme of building libpcap and tcpdump in subdirectories of
   1091 	# the same directory, with tcpdump statically linked with the
   1092 	# libpcap in question, but we also build a shared library as
   1093 	# "libpcap.shareda" and install *it*, rather than the static
   1094 	# library, as "libpcap.a".
   1095 	#
   1096 	DYEXT="shareda"
   1097 
   1098 	case "$V_PCAP" in
   1099 
   1100 	dlpi)
   1101 		#
   1102 		# If we're using DLPI, applications will need to
   1103 		# use /lib/pse.exp if present, as we use the
   1104 		# STREAMS routines.
   1105 		#
   1106 		pseexe="/lib/pse.exp"
   1107 		AC_MSG_CHECKING(for $pseexe)
   1108 		if test -f $pseexe ; then
   1109 			AC_MSG_RESULT(yes)
   1110 			LIBS="-I:$pseexe"
   1111 		fi
   1112 		;;
   1113 
   1114 	bpf)
   1115 		#
   1116 		# If we're using BPF, we need "-lodm" and "-lcfg", as
   1117 		# we use them to load the BPF module.
   1118 		#
   1119 		LIBS="-lodm -lcfg"
   1120 		;;
   1121 	esac
   1122 	;;
   1123 
   1124 darwin*)
   1125 	DYEXT="dylib"
   1126 	V_CCOPT="$V_CCOPT -fno-common"
   1127 	AC_ARG_ENABLE(universal,
   1128 	AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
   1129 	if test "$enable_universal" != "no"; then
   1130 		case "$host_os" in
   1131 
   1132 		darwin[0-7].*)
   1133 			#
   1134 			# Pre-Tiger.  Build only for 32-bit PowerPC; no
   1135 			# need for any special compiler or linker flags.
   1136 			#
   1137 			;;
   1138 
   1139 		darwin8.[0123]*)
   1140 			#
   1141 			# Tiger, prior to Intel support.  Build for 32-bit
   1142 			# PowerPC and 64-bit PowerPC, with 32-bit PowerPC
   1143 			# first.  (I'm guessing that's what Apple does.)
   1144 			#
   1145 			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64"
   1146 			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64"
   1147 			;;
   1148 
   1149 		darwin8.[456]*)
   1150 			#
   1151 			# Tiger, subsequent to Intel support but prior to
   1152 			# x86-64 support.  Build for 32-bit PowerPC, 64-bit
   1153 			# PowerPC, and x86, with 32-bit PowerPC first.
   1154 			# (I'm guessing that's what Apple does.)
   1155 			#
   1156 			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386"
   1157 			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386"
   1158 			;;
   1159 
   1160 		darwin8.*)
   1161 			#
   1162 			# All other Tiger, so subsequent to x86-64
   1163 			# support. Build for 32-bit PowerPC, 64-bit
   1164 			# PowerPC, x86, and x86-64, and with 32-bit PowerPC
   1165 			# first.  (I'm guessing that's what Apple does.)
   1166 			#
   1167 			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
   1168 			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
   1169 			;;
   1170 
   1171 		darwin9.*)
   1172 			#
   1173 			# Leopard.  Build for 32-bit PowerPC, 64-bit
   1174 			# PowerPC, x86, and x86-64, with 32-bit PowerPC
   1175 			# first.  (That's what Apple does.)
   1176 			#
   1177 			V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64"
   1178 			LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64"
   1179 			;;
   1180 
   1181 		darwin10.*)
   1182 			#
   1183 			# Snow Leopard.  Build for x86-64, x86, and
   1184 			# 32-bit PowerPC, with x86-64 first.  (That's
   1185 			# what Apple does, even though Snow Leopard
   1186 			# doesn't run on PPC, so PPC libpcap runs under
   1187 			# Rosetta, and Rosetta doesn't support BPF
   1188 			# ioctls, so PPC programs can't do live
   1189 			# captures.)
   1190 			#
   1191 			V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc"
   1192 			LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc"
   1193 			;;
   1194 
   1195 		darwin*)
   1196 			#
   1197 			# Post-Snow Leopard.  Build for x86-64 and
   1198 			# x86, with x86-64 first.  (That's probably what
   1199 			# Apple does, given that Rosetta is gone.)
   1200 			# XXX - update if and when Apple drops support
   1201 			# for 32-bit x86 code.
   1202 			#
   1203 			V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
   1204 			LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
   1205 			;;
   1206 		esac
   1207 	fi
   1208 	;;
   1209 
   1210 hpux9*)
   1211 	AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
   1212 
   1213 	#
   1214 	# Use System V conventions for man pages.
   1215 	#
   1216 	MAN_FILE_FORMATS=4
   1217 	MAN_MISC_INFO=5
   1218 	;;
   1219 
   1220 hpux10.0*)
   1221 
   1222 	#
   1223 	# Use System V conventions for man pages.
   1224 	#
   1225 	MAN_FILE_FORMATS=4
   1226 	MAN_MISC_INFO=5
   1227 	;;
   1228 
   1229 hpux10.1*)
   1230 
   1231 	#
   1232 	# Use System V conventions for man pages.
   1233 	#
   1234 	MAN_FILE_FORMATS=4
   1235 	MAN_MISC_INFO=5
   1236 	;;
   1237 
   1238 hpux*)
   1239 	dnl HPUX 10.20 and above is similar to HPUX 9, but
   1240 	dnl not the same....
   1241 	dnl
   1242 	dnl XXX - DYEXT should be set to "sl" if this is building
   1243 	dnl for 32-bit PA-RISC, but should be left as "so" for
   1244 	dnl 64-bit PA-RISC or, I suspect, IA-64.
   1245 	AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
   1246 	if test "`uname -m`" = "ia64"; then
   1247 		DYEXT="so"
   1248 	else
   1249 		DYEXT="sl"
   1250 	fi
   1251 
   1252 	#
   1253 	# "-b" builds a shared library; "+h" sets the soname.
   1254 	#
   1255 	SHLIB_OPT="-b"
   1256 	SONAME_OPT="+h"
   1257 
   1258 	#
   1259 	# Use System V conventions for man pages.
   1260 	#
   1261 	MAN_FILE_FORMATS=4
   1262 	MAN_MISC_INFO=5
   1263 	;;
   1264 
   1265 irix*)
   1266 	#
   1267 	# Use System V conventions for man pages.
   1268 	#
   1269 	MAN_FILE_FORMATS=4
   1270 	MAN_MISC_INFO=5
   1271 	;;
   1272 
   1273 linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*)
   1274 	DYEXT="so"
   1275 
   1276 	#
   1277 	# Compiler assumed to be GCC; run-time linker may require a -R
   1278 	# flag.
   1279 	#
   1280 	if test "$libdir" != "/usr/lib"; then
   1281 		V_RFLAGS=-Wl,-R$libdir
   1282 	fi
   1283 	;;
   1284 
   1285 osf*)
   1286 	DYEXT="so"
   1287 
   1288 	#
   1289 	# Use System V conventions for man pages.
   1290 	#
   1291 	MAN_FILE_FORMATS=4
   1292 	MAN_MISC_INFO=5
   1293 	;;
   1294 
   1295 sinix*)
   1296 	AC_MSG_CHECKING(if SINIX compiler defines sinix)
   1297 	AC_CACHE_VAL(ac_cv_cc_sinix_defined,
   1298 		AC_TRY_COMPILE(
   1299 		    [],
   1300 		    [int i = sinix;],
   1301 		    ac_cv_cc_sinix_defined=yes,
   1302 		    ac_cv_cc_sinix_defined=no))
   1303 	    AC_MSG_RESULT($ac_cv_cc_sinix_defined)
   1304 	    if test $ac_cv_cc_sinix_defined = no ; then
   1305 		    AC_DEFINE(sinix,1,[on sinix])
   1306 	    fi
   1307 	;;
   1308 
   1309 solaris*)
   1310 	AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
   1311 
   1312 	DYEXT="so"
   1313 	#
   1314 	# Use System V conventions for man pages.
   1315 	#
   1316 	MAN_FILE_FORMATS=4
   1317 	MAN_MISC_INFO=5
   1318 	;;
   1319 esac
   1320 
   1321 AC_ARG_ENABLE(shared,
   1322 AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@]))
   1323 test "x$enable_shared" = "xno" && DYEXT="none"
   1324 
   1325 AC_PROG_RANLIB
   1326 AC_CHECK_TOOL([AR], [ar])
   1327 
   1328 AC_PROG_LN_S
   1329 AC_SUBST(LN_S)
   1330 
   1331 AC_LBL_DEVEL(V_CCOPT)
   1332 
   1333 AC_LBL_SOCKADDR_SA_LEN
   1334 
   1335 AC_LBL_SOCKADDR_STORAGE
   1336 
   1337 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
   1338 
   1339 AC_LBL_UNALIGNED_ACCESS
   1340 
   1341 #
   1342 # Makefile.in includes rules to generate version.h, so we assume
   1343 # that it will be generated if autoconf is used.
   1344 #
   1345 AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
   1346 
   1347 rm -f net
   1348 ln -s ${srcdir}/bpf/net net
   1349 
   1350 AC_SUBST(V_CCOPT)
   1351 AC_SUBST(V_DEFS)
   1352 AC_SUBST(V_FINDALLDEVS)
   1353 AC_SUBST(V_INCLS)
   1354 AC_SUBST(V_LEX)
   1355 AC_SUBST(V_PCAP)
   1356 AC_SUBST(V_SHLIB_CMD)
   1357 AC_SUBST(V_SHLIB_OPT)
   1358 AC_SUBST(V_SONAME_OPT)
   1359 AC_SUBST(V_RPATH_OPT)
   1360 AC_SUBST(V_YACC)
   1361 AC_SUBST(ADDLOBJS)
   1362 AC_SUBST(ADDLARCHIVEOBJS)
   1363 AC_SUBST(SSRC)
   1364 AC_SUBST(DYEXT)
   1365 AC_SUBST(MAN_FILE_FORMATS)
   1366 AC_SUBST(MAN_MISC_INFO)
   1367 
   1368 AC_ARG_ENABLE([usb],
   1369 [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])],
   1370     [],
   1371     [enable_usb=yes])
   1372 
   1373 if test "x$enable_usb" != "xno" ; then
   1374    dnl check for USB sniffing support
   1375    AC_MSG_CHECKING(for USB sniffing support)
   1376    case "$host_os" in
   1377    linux*)
   1378 	AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing])
   1379 	USB_SRC=pcap-usb-linux.c
   1380 	AC_MSG_RESULT(yes)
   1381 	ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null`
   1382 	if test $? -ne 0 ; then
   1383 	  ac_usb_dev_name="usbmon"
   1384 	fi
   1385 	AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing])
   1386 	AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name)
   1387 	#
   1388 	# Do we have a version of <linux/compiler.h> available?
   1389 	# If so, we might need it for <linux/usbdevice_fs.h>.
   1390 	#
   1391 	AC_CHECK_HEADERS(linux/compiler.h)
   1392 	if test "$ac_cv_header_linux_compiler_h" = yes; then
   1393 	  #
   1394 	  # Yes - include it when testing for <linux/usbdevice_fs.h>.
   1395 	  #
   1396 	  AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>])
   1397 	else
   1398 	  AC_CHECK_HEADERS(linux/usbdevice_fs.h)
   1399 	fi
   1400 	if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then
   1401 	  #
   1402 	  # OK, does it define bRequestType?  Older versions of the kernel
   1403 	  # define fields with names like "requesttype, "request", and
   1404 	  # "value", rather than "bRequestType", "bRequest", and
   1405 	  # "wValue".
   1406 	  #
   1407 	  AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member)
   1408 	  AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType,
   1409 	    AC_TRY_COMPILE([
   1410 AC_INCLUDES_DEFAULT
   1411 #ifdef HAVE_SYS_BITYPES_H
   1412 #include <sys/bitypes.h>
   1413 #endif
   1414 #ifdef HAVE_LINUX_COMPILER_H
   1415 #include <linux/compiler.h>
   1416 #endif
   1417 #include <linux/usbdevice_fs.h>],
   1418 	      [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)],
   1419 	      ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes,
   1420 	      ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no))
   1421 	    AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType)
   1422 	    if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then
   1423 	      AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1,
   1424 	        [if struct usbdevfs_ctrltransfer has bRequestType])
   1425 	    fi
   1426 	fi
   1427 	;;
   1428     *)
   1429 	AC_MSG_RESULT(no)
   1430 	;;
   1431 esac
   1432 fi
   1433 AC_SUBST(PCAP_SUPPORT_USB)
   1434 AC_SUBST(USB_SRC)
   1435 
   1436 dnl check for netfilter sniffing support
   1437 AC_MSG_CHECKING(whether the platform could support netfilter sniffing)
   1438 case "$host_os" in
   1439 linux*)
   1440 	AC_MSG_RESULT(yes)
   1441 	#
   1442 	# Life's too short to deal with trying to get this to compile
   1443 	# if you don't get the right types defined with
   1444 	# __KERNEL_STRICT_NAMES getting defined by some other include.
   1445 	#
   1446 	# Check whether the includes Just Work.  If not, don't turn on
   1447 	# netfilter support.
   1448 	#
   1449 	AC_MSG_CHECKING(whether we can compile the netfilter support)
   1450 	AC_CACHE_VAL(ac_cv_netfilter_can_compile,
   1451 	  AC_TRY_COMPILE([
   1452 AC_INCLUDES_DEFAULT
   1453 #include <sys/socket.h>
   1454 #include <netinet/in.h>
   1455 #include <linux/types.h>
   1456 
   1457 #include <linux/netlink.h>
   1458 #include <linux/netfilter.h>
   1459 #include <linux/netfilter/nfnetlink.h>
   1460 #include <linux/netfilter/nfnetlink_log.h>
   1461 #include <linux/netfilter/nfnetlink_queue.h>],
   1462 	    [],
   1463 	    ac_cv_netfilter_can_compile=yes,
   1464 	    ac_cv_netfilter_can_compile=no))
   1465 	AC_MSG_RESULT($ac_cv_netfilter_can_compile)
   1466 	if test $ac_cv_netfilter_can_compile = yes ; then
   1467 	  AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1,
   1468 	    [target host supports netfilter sniffing])
   1469 	  NETFILTER_SRC=pcap-netfilter-linux.c
   1470 	fi
   1471 	;;
   1472 *)
   1473 	AC_MSG_RESULT(no)
   1474 	;;
   1475 esac
   1476 AC_SUBST(PCAP_SUPPORT_NETFILTER)
   1477 AC_SUBST(NETFILTER_SRC)
   1478 
   1479 AC_ARG_ENABLE([bluetooth],
   1480 [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])],
   1481     [],
   1482     [enable_bluetooth=ifsupportavailable])
   1483 
   1484 if test "x$enable_bluetooth" != "xno" ; then
   1485 	dnl check for Bluetooth sniffing support
   1486 	case "$host_os" in
   1487 	linux*)
   1488 		AC_CHECK_HEADER(bluetooth/bluetooth.h,
   1489 		[
   1490 		  AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing])
   1491 		  BT_SRC=pcap-bt-linux.c
   1492 		  AC_MSG_NOTICE(Bluetooth sniffing is supported)
   1493 
   1494 		  #
   1495 		  # OK, does struct sockaddr_hci have an hci_channel
   1496 		  # member?
   1497 		  #
   1498 		  AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member)
   1499 		  AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel,
   1500 		    AC_TRY_COMPILE(
   1501 [
   1502 #include <bluetooth/bluetooth.h>
   1503 #include <bluetooth/hci.h>
   1504 ],
   1505 		      [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)],
   1506 		      ac_cv_lbl_sockaddr_hci_has_hci_channel=yes,
   1507 		      ac_cv_lbl_sockaddr_hci_has_hci_channel=no))
   1508 		    AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel)
   1509 		    if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then
   1510 		      AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,,
   1511 			[if struct sockaddr_hci has hci_channel member])
   1512 
   1513 		      #
   1514 		      # OK, is HCI_CHANNEL_MONITOR defined?
   1515 		      #
   1516 		      AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined)
   1517 		      AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined,
   1518 		      AC_TRY_COMPILE(
   1519 [
   1520 #include <bluetooth/bluetooth.h>
   1521 #include <bluetooth/hci.h>
   1522 ],
   1523 			[u_int i = HCI_CHANNEL_MONITOR],
   1524 			ac_cv_lbl_hci_channel_monitor_is_defined=yes,
   1525 			ac_cv_lbl_hci_channel_monitor_is_defined=no))
   1526 		      AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined)
   1527 		      if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then
   1528 			AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,,
   1529 			  [target host supports Bluetooth Monitor])
   1530 			BT_MONITOR_SRC=pcap-bt-monitor-linux.c
   1531 		      fi
   1532 		    fi
   1533 		    ac_lbl_bluetooth_available=yes
   1534 		],
   1535 		ac_lbl_bluetooth_available=no
   1536 		)
   1537 		if test "x$ac_lbl_bluetooth_available" == "xno" ; then
   1538 		    if test "x$enable_bluetooth" = "xyes" ; then
   1539 			AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
   1540 		    else
   1541 			AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it)
   1542 		    fi
   1543 		fi
   1544 		;;
   1545 	*)
   1546 		if test "x$enable_bluetooth" = "xyes" ; then
   1547 		    AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os)
   1548 		else
   1549 		    AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os)
   1550 		fi
   1551 		;;
   1552 	esac
   1553 	AC_SUBST(PCAP_SUPPORT_BT)
   1554 	AC_SUBST(BT_SRC)
   1555 	AC_SUBST(BT_MONITOR_SRC)
   1556 fi
   1557 
   1558 AC_ARG_ENABLE([canusb],
   1559 [AC_HELP_STRING([--enable-canusb],[enable canusb support @<:@default=yes, if support available@:>@])],
   1560     [],
   1561     [enable_canusb=ifsupportavailable])
   1562 
   1563 if test "x$enable_canusb" != "xno" ; then
   1564 	dnl check for canusb support
   1565 	case "$host_os" in
   1566 	linux*|uclinux*)
   1567 		AC_CHECK_HEADER(libusb-1.0/libusb.h,
   1568 		[
   1569 		    AC_CHECK_LIB(usb-1.0, libusb_init,
   1570 		    [
   1571 			AC_DEFINE(PCAP_SUPPORT_CANUSB, 1, [target host supports canusb])
   1572 			CANUSB_SRC=pcap-canusb-linux.c
   1573 			LIBS="-lusb-1.0 -lpthread $LIBS"
   1574 			ac_lbl_has_libusb=yes
   1575 		    ],
   1576 		    ac_lbl_has_libusb=no,
   1577 		    -lpthread
   1578 		    )
   1579 		],
   1580 		ac_lbl_has_libusb=no
   1581 		)
   1582 		if test "x$ac_lbl_has_libusb" = "xyes" ; then
   1583 		    AC_MSG_NOTICE(canusb sniffing is supported)
   1584 		else
   1585 		    if test "x$enable_canusb" = "xyes" ; then
   1586 			AC_MSG_ERROR(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
   1587 		    else
   1588 			AC_MSG_NOTICE(canusb sniffing is not supported; install libusb1.0 lib devel to enable it)
   1589 		    fi
   1590 		fi
   1591 		;;
   1592 	*)
   1593 		if test "x$enable_canusb" = "xyes" ; then
   1594 		    AC_MSG_ERROR(no canusb support implemented for $host_os)
   1595 		else
   1596 		    AC_MSG_NOTICE(no canusb support implemented for $host_os)
   1597 		fi
   1598 		;;
   1599 	esac
   1600 	AC_SUBST(PCAP_SUPPORT_CANUSB)
   1601 	AC_SUBST(CANUSB_SRC)
   1602 fi
   1603 
   1604 AC_ARG_ENABLE([can],
   1605 [AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])],
   1606     [],
   1607     [enable_can=ifsupportavailable])
   1608 
   1609 if test "x$enable_can" != "xno" ; then
   1610 	dnl check for CAN sniffing support
   1611 	case "$host_os" in
   1612 	linux*)
   1613 		AC_CHECK_HEADER(linux/can.h,
   1614 			[
   1615 			    AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing])
   1616 			    CAN_SRC=pcap-can-linux.c
   1617 			    AC_MSG_NOTICE(CAN sniffing is supported)
   1618 			],
   1619 			[
   1620 			    if test "x$enable_can" = "xyes" ; then
   1621 				AC_MSG_ERROR(CAN sniffing is not supported)
   1622 			    else
   1623 				AC_MSG_NOTICE(CAN sniffing is not supported)
   1624 			    fi
   1625 			],
   1626 			[#include <sys/socket.h>]
   1627 		   )
   1628 		;;
   1629 	*)
   1630 		if test "x$enable_can" = "xyes" ; then
   1631 		    AC_MSG_ERROR(no CAN sniffing support implemented for $host_os)
   1632 		else
   1633 		    AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os)
   1634 		fi
   1635 		;;
   1636 	esac
   1637 	AC_SUBST(PCAP_SUPPORT_CAN)
   1638 	AC_SUBST(CAN_SRC)
   1639 fi
   1640 
   1641 AC_ARG_ENABLE([dbus],
   1642 [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])],
   1643     [],
   1644     [enable_dbus=ifavailable])
   1645 
   1646 if test "x$enable_dbus" != "xno"; then
   1647 	if test "x$enable_dbus" = "xyes"; then
   1648 		case "$host_os" in
   1649 
   1650 		darwin*)
   1651 			#
   1652 			# We don't support D-Bus sniffing on OS X; see
   1653 			#
   1654 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
   1655 			#
   1656 			# The user requested it, so fail.
   1657 			#
   1658 			AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X])
   1659 		esac
   1660 	else
   1661 		case "$host_os" in
   1662 
   1663 		darwin*)
   1664 			#
   1665 			# We don't support D-Bus sniffing on OS X; see
   1666 			#
   1667 			# https://bugs.freedesktop.org/show_bug.cgi?id=74029
   1668 			#
   1669 			# The user dind't explicitly request it, so just
   1670 			# silently refuse to enable it.
   1671 			#
   1672 			enable_dbus="no"
   1673 			;;
   1674 		esac
   1675 	fi
   1676 fi
   1677 
   1678 if test "x$enable_dbus" != "xno"; then
   1679 	AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no])
   1680 	if test "x$PKGCONFIG" != "xno"; then
   1681 		AC_MSG_CHECKING([for D-Bus])
   1682 		if "$PKGCONFIG" dbus-1; then
   1683 			AC_MSG_RESULT([yes])
   1684 			DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1`
   1685 			DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1`
   1686 			save_CFLAGS="$CFLAGS"
   1687 			save_LIBS="$LIBS"
   1688 			CFLAGS="$CFLAGS $DBUS_CFLAGS"
   1689 			LIBS="$LIBS $DBUS_LIBS"
   1690 			AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write)
   1691 			AC_TRY_LINK(
   1692 			    [#include <string.h>
   1693 
   1694 			     #include <time.h>
   1695 			     #include <sys/time.h>
   1696 
   1697 			     #include <dbus/dbus.h>],
   1698 			    [return dbus_connection_read_write(NULL, 0);],
   1699 			    [
   1700 				AC_MSG_RESULT([yes])
   1701 				AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing])
   1702 				DBUS_SRC=pcap-dbus.c
   1703 				V_INCLS="$V_INCLS $DBUS_CFLAGS"
   1704 			    ],
   1705 			    [
   1706 				AC_MSG_RESULT([no])
   1707 				if test "x$enable_dbus" = "xyes"; then
   1708 				    AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()])
   1709 				fi
   1710 				LIBS="$save_LIBS"
   1711 			     ])
   1712 			CFLAGS="$save_CFLAGS"
   1713 		else
   1714 			AC_MSG_RESULT([no])
   1715 			if test "x$enable_dbus" = "xyes"; then
   1716 				AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed])
   1717 			fi
   1718 		fi
   1719 	fi
   1720 	AC_SUBST(PCAP_SUPPORT_DBUS)
   1721 	AC_SUBST(DBUS_SRC)
   1722 fi
   1723 
   1724 dnl check for hardware timestamp support
   1725 case "$host_os" in
   1726 linux*)
   1727 	AC_CHECK_HEADERS([linux/net_tstamp.h])
   1728 	;;
   1729 *)
   1730 	AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os)
   1731 	;;
   1732 esac
   1733 
   1734 dnl The packet ring capture facility of Linux, described in
   1735 dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before
   1736 dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for
   1737 dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run
   1738 dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a
   1739 dnl kernel struct). This problem was solved in Linux 2.6.27. Use
   1740 dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit
   1741 dnl target host, and either the build host or the target host run Linux 2.6.26
   1742 dnl or earlier.
   1743 AC_ARG_ENABLE([packet-ring],
   1744 [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])],
   1745 ,enable_packet_ring=yes)
   1746 
   1747 if test "x$enable_packet_ring" != "xno" ; then
   1748 	AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available])
   1749 	AC_SUBST(PCAP_SUPPORT_PACKET_RING)
   1750 fi
   1751 
   1752 AC_PROG_INSTALL
   1753 
   1754 AC_CONFIG_HEADER(config.h)
   1755 
   1756 AC_OUTPUT_COMMANDS([if test -f .devel; then
   1757 	echo timestamp > stamp-h
   1758 	cat Makefile-devel-adds >> Makefile
   1759 	make depend
   1760 fi])
   1761 AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc
   1762 	pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap
   1763 	pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap
   1764 	pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap
   1765 	pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap
   1766 	pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap
   1767 	pcap_set_tstamp_type.3pcap)
   1768 exit 0
   1769