configure.in revision 214518
1dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.168 2008-12-23 20:49:26 guy Exp $ (LBL) 2dnl 3dnl Copyright (c) 1994, 1995, 1996, 1997 4dnl The Regents of the University of California. All rights reserved. 5dnl 6dnl Process this file with autoconf to produce a configure script. 7dnl 8 9# 10# See 11# 12# http://ftp.gnu.org/gnu/config/README 13# 14# for the URLs to use to fetch new versions of config.guess and 15# config.sub. 16# 17 18AC_REVISION($Revision: 1.168 $) 19AC_PREREQ(2.50) 20AC_INIT(pcap.c) 21 22AC_CANONICAL_SYSTEM 23 24AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS) 25AC_PROG_CC 26AC_LBL_C_INIT(V_CCOPT, V_INCLS) 27AC_LBL_SHLIBS_INIT 28AC_LBL_C_INLINE 29AC_C___ATTRIBUTE__ 30 31AC_CHECK_HEADERS(sys/bitypes.h) 32 33AC_CHECK_TYPE([int8_t], , 34 [AC_DEFINE([int8_t], [signed char], 35 [Define to `signed char' if int8_t not defined.])], 36 [AC_INCLUDES_DEFAULT 37#ifdef HAVE_SYS_BITYPES_H 38#include <sys/bitypes.h> 39#endif]) 40AC_CHECK_TYPE([u_int8_t], , 41 [AC_DEFINE([u_int8_t], [unsigned char], 42 [Define to `unsigned char' if u_int8_t not defined.])], 43 [AC_INCLUDES_DEFAULT 44#ifdef HAVE_SYS_BITYPES_H 45#include <sys/bitypes.h> 46#endif]) 47AC_CHECK_TYPE([int16_t], , 48 [AC_DEFINE([int16_t], [short], 49 [Define to `short' if int16_t not defined.])] 50 [AC_INCLUDES_DEFAULT 51#ifdef HAVE_SYS_BITYPES_H 52#include <sys/bitypes.h> 53#endif]) 54AC_CHECK_TYPE([u_int16_t], , 55 [AC_DEFINE([u_int16_t], [unsigned short], 56 [Define to `unsigned short' if u_int16_t not defined.])], 57 [AC_INCLUDES_DEFAULT 58#ifdef HAVE_SYS_BITYPES_H 59#include <sys/bitypes.h> 60#endif]) 61AC_CHECK_TYPE([int32_t], , 62 [AC_DEFINE([int32_t], [int], 63 [Define to `int' if int32_t not defined.])], 64 [AC_INCLUDES_DEFAULT 65#ifdef HAVE_SYS_BITYPES_H 66#include <sys/bitypes.h> 67#endif]) 68AC_CHECK_TYPE([u_int32_t], , 69 [AC_DEFINE([u_int32_t], [unsigned int], 70 [Define to `unsigned int' if u_int32_t not defined.])], 71 [AC_INCLUDES_DEFAULT 72#ifdef HAVE_SYS_BITYPES_H 73#include <sys/bitypes.h> 74#endif]) 75AC_CHECK_TYPE([int64_t], , 76 [AC_DEFINE([int64_t], [long long], 77 [Define to `long long' if int64_t not defined.])], 78 [AC_INCLUDES_DEFAULT 79#ifdef HAVE_SYS_BITYPES_H 80#include <sys/bitypes.h> 81#endif]) 82AC_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.])], 85 [AC_INCLUDES_DEFAULT 86#ifdef HAVE_SYS_BITYPES_H 87#include <sys/bitypes.h> 88#endif]) 89 90# 91# Try to arrange for large file support. 92# 93AC_SYS_LARGEFILE 94AC_FUNC_FSEEKO 95 96dnl 97dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to 98dnl include <sys/ioccom.h>, and we were to drop support for older 99dnl releases without that fix, so that pcap-bpf.c doesn't need to 100dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES" 101dnl in "aclocal.m4" uses it, so we would still have to test for it 102dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise 103dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris. 104dnl 105AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h) 106AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> 107#include <sys/socket.h> 108#include <net/if.h>]) 109if test "$ac_cv_header_net_pfvar_h" = yes; then 110 # 111 # Check for various PF actions. 112 # 113 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR) 114 AC_TRY_COMPILE( 115 [#include <sys/types.h> 116 #include <sys/socket.h> 117 #include <net/if.h> 118 #include <net/pfvar.h>], 119 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;], 120 [ 121 AC_MSG_RESULT(yes) 122 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1, 123 [define if net/pfvar.h defines PF_NAT through PF_NORDR]) 124 ], 125 AC_MSG_RESULT(no)) 126fi 127AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> 128#include <sys/socket.h>]) 129if test "$ac_cv_header_netinet_if_ether_h" != yes; then 130 # 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. 136 # 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> 142struct mbuf; 143struct rtentry; 144#include <net/if.h>]) 145fi 146 147AC_LBL_FIXINCLUDES 148 149AC_CHECK_FUNCS(strerror strlcpy) 150 151needsnprintf=no 152AC_CHECK_FUNCS(vsnprintf snprintf,, 153 [needsnprintf=yes]) 154if test $needsnprintf = yes; then 155 AC_LIBOBJ(snprintf) 156fi 157 158# 159# Do this before checking for ether_hostton(), as it's a 160# "gethostbyname() -ish function". 161# 162AC_LBL_LIBRARY_NET 163 164# 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.) 172# 173# Before you is a C compiler. 174# 175AC_CHECK_FUNCS(ether_hostton) 176if test "$ac_cv_func_ether_hostton" = yes; then 177 # 178 # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>? 179 # 180 if test "$ac_cv_header_netinet_if_ether_h" = yes; then 181 # 182 # Yes. Does it declare ether_hostton()? 183 # 184 AC_CHECK_DECL(ether_hostton, 185 [ 186 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,, 187 [Define to 1 if netinet/if_ether.h declares `ether_hostton']) 188 ],, 189 [ 190#include <sys/types.h> 191#include <sys/socket.h> 192#include <netinet/in.h> 193#include <arpa/inet.h> 194struct mbuf; 195struct rtentry; 196#include <net/if.h> 197#include <netinet/if_ether.h> 198 ]) 199 fi 200 # 201 # Did that succeed? 202 # 203 if test "$ac_cv_have_decl_ether_hostton" != yes; then 204 # 205 # No, how about <netinet/ether.h>, as on Linux? 206 # 207 AC_CHECK_HEADERS(netinet/ether.h) 208 if test "$ac_cv_header_netinet_ether_h" = yes; then 209 # 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. 214 # 215 unset ac_cv_have_decl_ether_hostton 216 AC_CHECK_DECL(ether_hostton, 217 [ 218 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,, 219 [Define to 1 if netinet/ether.h declares `ether_hostton']) 220 ],, 221 [ 222#include <netinet/ether.h> 223 ]) 224 fi 225 fi 226 # 227 # Is ether_hostton() declared? 228 # 229 if test "$ac_cv_have_decl_ether_hostton" != yes; then 230 # 231 # No, we'll have to declare it ourselves. 232 # Do we have "struct ether_addr"? 233 # 234 AC_CHECK_TYPES(struct ether_addr,,, 235 [ 236#include <sys/types.h> 237#include <sys/socket.h> 238#include <netinet/in.h> 239#include <arpa/inet.h> 240struct mbuf; 241struct rtentry; 242#include <net/if.h> 243#include <netinet/if_ether.h> 244 ]) 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 247don't.]) 248 else 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 251don't.]) 252 fi 253fi 254 255dnl to pacify those who hate protochain insn 256AC_MSG_CHECKING(if --disable-protochain option is specified) 257AC_ARG_ENABLE(protochain, 258AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn])) 259case "x$enable_protochain" in 260xyes) enable_protochain=enabled ;; 261xno) enable_protochain=disabled ;; 262x) enable_protochain=enabled ;; 263esac 264 265if test "$enable_protochain" = "disabled"; then 266 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain]) 267fi 268AC_MSG_RESULT(${enable_protochain}) 269 270# 271# SITA support is mutually exclusive with native capture support; 272# "--with-sita" selects SITA support. 273# 274AC_ARG_WITH(sita, 275AC_HELP_STRING([--with-sita],[include SITA support]), 276[ 277 if test ! "x$withval" = "xno" ; then 278 AC_DEFINE(SITA,1,[include ACN support]) 279 AC_MSG_NOTICE(Enabling SITA ACN support) 280 V_PCAP=sita 281 V_FINDALLDEVS=sita 282 fi 283], 284[ 285dnl 286dnl Not all versions of test support -c (character special) but it's a 287dnl better way of testing since the device might be protected. So we 288dnl check in our normal order using -r and then check the for the /dev 289dnl guys again using -c. 290dnl 291dnl XXX This could be done for cross-compiling, but for now it's not. 292dnl 293if test -z "$with_pcap" && test "$cross_compiling" = yes; then 294 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...) 295fi 296AC_ARG_WITH(pcap, 297AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE])) 298AC_MSG_CHECKING(packet capture type) 299if test ! -z "$with_pcap" ; then 300 V_PCAP="$withval" 301elif test -r /dev/bpf -o -h /dev/bpf ; then 302 # 303 # Cloning BPF device. 304 # 305 V_PCAP=bpf 306 AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device]) 307elif test -r /dev/bpf0 ; then 308 V_PCAP=bpf 309elif test -r /usr/include/net/pfilt.h ; then 310 V_PCAP=pf 311elif test -r /dev/enet ; then 312 V_PCAP=enet 313elif test -r /dev/nit ; then 314 V_PCAP=snit 315elif test -r /usr/include/sys/net/nit.h ; then 316 V_PCAP=nit 317elif test -r /usr/include/linux/socket.h ; then 318 V_PCAP=linux 319elif test -r /usr/include/net/raw.h ; then 320 V_PCAP=snoop 321elif test -r /usr/include/odmi.h ; then 322 # 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. 326 # 327 V_PCAP=bpf 328elif test -c /dev/bpf0 ; then # check again in case not readable 329 V_PCAP=bpf 330elif test -r /usr/include/sys/dlpi.h ; then 331 V_PCAP=dlpi 332elif test -c /dev/enet ; then # check again in case not readable 333 V_PCAP=enet 334elif test -c /dev/nit ; then # check again in case not readable 335 V_PCAP=snit 336else 337 V_PCAP=null 338fi 339AC_MSG_RESULT($V_PCAP) 340 341# 342# Do capture-mechanism-dependent tests. 343# 344case "$V_PCAP" in 345dlpi) 346 # 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". 356 # 357 saved_ldflags=$LDFLAGS 358 LDFLAGS="$LIBS -L/lib" 359 AC_CHECK_LIB(dlpi, dlpi_walk, 360 LIBS="-ldlpi $LIBS" 361 V_PCAP=libdlpi 362 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]), 363 V_PCAP=dlpi) 364 LDFLAGS=$saved_ldflags 365 366 # 367 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO 368 # versions of DLPI. 369 # 370 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable) 371 AC_CACHE_VAL(ac_cv_sys_dlpi_usable, 372 AC_TRY_COMPILE( 373 [ 374 #include <sys/types.h> 375 #include <sys/time.h> 376 #include <sys/dlpi.h> 377 ], 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) 384 fi 385 386 # 387 # Check whether we have a /dev/dlpi device or have multiple devices. 388 # 389 AC_MSG_CHECKING(for /dev/dlpi device) 390 if test -c /dev/dlpi ; then 391 AC_MSG_RESULT(yes) 392 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi]) 393 else 394 AC_MSG_RESULT(no) 395 dir="/dev/dlpi" 396 AC_MSG_CHECKING(for $dir directory) 397 if test -d $dir ; then 398 AC_MSG_RESULT(yes) 399 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory]) 400 else 401 AC_MSG_RESULT(no) 402 fi 403 fi 404 405 # 406 # This check is for Solaris with DLPI support for passive modes. 407 # See dlpi(7P) for more details. 408 # 409 AC_LBL_DL_PASSIVE_REQ_T 410 ;; 411 412linux) 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) 417 else 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'`) 421 fi 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) 425 fi 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) 428 fi 429 430 # 431 # Do we have the wireless extensions? 432 # 433 AC_CHECK_HEADERS(linux/wireless.h, [], [], 434 [ 435#include <sys/socket.h> 436#include <linux/if.h> 437#include <linux/types.h> 438 ]) 439 440 # 441 # Do we have libnl? 442 # 443 AC_ARG_WITH(libnl, 444 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]), 445 with_libnl=$withval,,) 446 447 if test x$with_libnl != xno ; then 448 AC_CHECK_LIB(nl, nl_handle_alloc, 449 LIBS="-lnl $LIBS" 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]) 453 fi 454 ) 455 fi 456 457 AC_LBL_TPACKET_STATS 458 AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI 459 ;; 460 461bpf) 462 # 463 # Check whether we have the *BSD-style ioctls. 464 # 465 AC_CHECK_HEADERS(net/if_media.h) 466 467 AC_MSG_CHECKING(whether the system supports zerocopy BPF) 468 AC_TRY_COMPILE( 469 [#include <sys/socket.h> 470 #include <sys/ioctl.h> 471 #include <net/if.h> 472 #include <net/bpf.h>], 473 [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);], 474 [ 475 AC_MSG_RESULT(yes) 476 AC_DEFINE(HAVE_ZEROCOPY_BPF, 1, 477 [define if the system supports zerocopy BPF]) 478 ], 479 AC_MSG_RESULT(no)) 480 481 # 482 # Check whether we have struct BPF_TIMEVAL. 483 # 484 AC_CHECK_TYPES(struct BPF_TIMEVAL,,, 485 [ 486#include <sys/types.h> 487#include <sys/ioctl.h> 488#ifdef HAVE_SYS_IOCCOM_H 489#include <sys/ioccom.h> 490#endif 491#include <net/bpf.h> 492 ]) 493 ;; 494 495dag) 496 V_DEFS="$V_DEFS -DDAG_ONLY" 497 ;; 498 499septel) 500 V_DEFS="$V_DEFS -DSEPTEL_ONLY" 501 ;; 502 503snf) 504 V_DEFS="$V_DEFS -DSNF_ONLY" 505 ;; 506 507null) 508 AC_MSG_WARN(cannot determine packet capture interface) 509 AC_MSG_WARN((see the INSTALL doc for more info)) 510 ;; 511esac 512 513dnl 514dnl Now figure out how we get a list of interfaces and addresses, 515dnl if we support capturing. Don't bother if we don't support 516dnl capturing. 517dnl 518if test "$V_PCAP" = null 519then 520 # 521 # We can't capture, so we can't open any capture 522 # devices, so we won't return any interfaces. 523 # 524 V_FINDALLDEVS=null 525else 526 AC_CHECK_FUNC(getifaddrs,[ 527 # 528 # We have "getifaddrs()"; make sure we have <ifaddrs.h> 529 # as well, just in case some platform is really weird. 530 # 531 AC_CHECK_HEADER(ifaddrs.h,[ 532 # 533 # We have the header, so we use "getifaddrs()" to 534 # get the list of interfaces. 535 # 536 V_FINDALLDEVS=getad 537 ],[ 538 # 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. 546 # 547 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.]) 548 ]) 549 ],[ 550 # 551 # Well, we don't have "getifaddrs()", so we have to use 552 # some other mechanism; determine what that mechanism is. 553 # 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. 556 # 557 case "$V_PCAP" in 558 559 dlpi|libdlpi) 560 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) 561 # 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 565 # just SIOCGIFCONF. 566 # 567 AC_MSG_CHECKING(whether we have SIOCGLIFCONF) 568 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf, 569 AC_TRY_COMPILE( 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 580 V_FINDALLDEVS=glifc 581 else 582 V_FINDALLDEVS=gifc 583 fi 584 # 585 # Needed for common functions used by pcap-[dlpi,libdlpi].c 586 # 587 SSRC="dlpisubs.c" 588 ;; 589 590 *) 591 # 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 595 # instead.) 596 # 597 V_FINDALLDEVS=gifc 598 ;; 599 esac]) 600fi 601]) 602 603AC_MSG_CHECKING(for socklen_t) 604AC_TRY_COMPILE([ 605 #include <sys/types.h> 606 #include <sys/socket.h> 607 ], 608 [ socklen_t x; ], 609 have_socklen_t=yes, 610 have_socklen_t=no) 611if test "x$have_socklen_t" = "xyes"; then 612 AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined]) 613fi 614AC_MSG_RESULT($have_socklen_t) 615 616AC_ARG_ENABLE(ipv6, 617AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]), 618 [], 619 [enable_ipv6=ifavailable]) 620if test "$enable_ipv6" != "no"; then 621 AC_CHECK_FUNC(getaddrinfo, 622 [ 623 AC_DEFINE(INET6,1,[IPv6]) 624 ], 625 [ 626 if test "$enable_ipv6" != "ifavailable"; then 627 AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available]) 628 fi 629 ]) 630fi 631 632AC_MSG_CHECKING(whether to build optimizer debugging code) 633AC_ARG_ENABLE(optimizer-dbg, 634AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code])) 635if test "$enable_optimizer_dbg" = "yes"; then 636 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging]) 637fi 638AC_MSG_RESULT(${enable_optimizer_dbg-no}) 639 640AC_MSG_CHECKING(whether to build parser debugging code) 641AC_ARG_ENABLE(yydebug, 642AC_HELP_STRING([--enable-yydebug],[build parser debugging code])) 643if test "$enable_yydebug" = "yes"; then 644 AC_DEFINE(YYDEBUG,1,[Enable parser debugging]) 645fi 646AC_MSG_RESULT(${enable_yydebug-no}) 647 648# Check for Endace DAG card support. 649AC_ARG_WITH([dag], 650AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]), 651[ 652 if test "$withval" = no 653 then 654 # User doesn't want DAG support. 655 want_dag=no 656 elif test "$withval" = yes 657 then 658 # User wants DAG support but hasn't specified a directory. 659 want_dag=yes 660 else 661 # User wants DAG support and has specified a directory, so use the provided value. 662 want_dag=yes 663 dag_root=$withval 664 fi 665],[ 666 # 667 # Use DAG API if present, otherwise don't 668 # 669 want_dag=ifpresent 670]) 671 672AC_ARG_WITH([dag-includes], 673AC_HELP_STRING([--with-dag-includes=DIR],[Endace DAG include directory]), 674[ 675 # User wants DAG support and has specified a header directory, so use the provided value. 676 want_dag=yes 677 dag_include_dir=$withval 678],[]) 679 680AC_ARG_WITH([dag-libraries], 681AC_HELP_STRING([--with-dag-libraries=DIR],[Endace DAG library directory]), 682[ 683 # User wants DAG support and has specified a library directory, so use the provided value. 684 want_dag=yes 685 dag_lib_dir=$withval 686],[]) 687 688case "$V_PCAP" in 689linux|bpf|dag) 690 # 691 # We support the DAG API if we're on Linux or BSD, or if we're 692 # building a DAG-only libpcap. 693 # 694 ;; 695*) 696 # 697 # If the user explicitly requested DAG, tell them it's not 698 # supported. 699 # 700 # If they expressed no preference, don't include it. 701 # 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 705 want_dag=no 706 fi 707 ;; 708esac 709 710ac_cv_lbl_dag_api=no 711if test "$want_dag" != no; then 712 713 AC_MSG_CHECKING([whether we have DAG API headers]) 714 715 # If necessary, set default paths for DAG API headers and libraries. 716 if test -z "$dag_root"; then 717 dag_root=/usr/local 718 fi 719 720 if test -z "$dag_include_dir"; then 721 dag_include_dir="$dag_root/include" 722 fi 723 724 if test -z "$dag_lib_dir"; then 725 dag_lib_dir="$dag_root/lib" 726 fi 727 728 if test -z "$dag_tools_dir"; then 729 dag_tools_dir="$dag_root/tools" 730 fi 731 732 if test -r $dag_include_dir/dagapi.h; then 733 ac_cv_lbl_dag_api=yes 734 fi 735 AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)]) 736fi 737 738if test $ac_cv_lbl_dag_api = yes; then 739 740 AC_MSG_CHECKING([dagapi.o]) 741 dagapi_obj=no 742 if test -r $dag_tools_dir/dagapi.o; then 743 # 2.4.x. 744 dagapi_obj=$dag_tools_dir/dagapi.o 745 elif test -r $dag_lib_dir/dagapi.o; then 746 # 2.5.x. 747 dagapi_obj=$dag_lib_dir/dagapi.o 748 elif test -r $dag_lib_dir/libdag.a; then 749 # 2.5.x. 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 753 else 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 757 fi 758 fi 759 fi 760 761 if test $dagapi_obj = no; then 762 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) 763 ac_cv_lbl_dag_api=no 764 else 765 AC_MSG_RESULT([yes ($dagapi_obj)]) 766 fi 767fi 768 769if test $ac_cv_lbl_dag_api = yes; then 770 771 AC_MSG_CHECKING([dagopts.o]) 772 dagopts_obj=no 773 if test -r $dag_tools_dir/dagopts.o; then 774 # 2.4.x. 775 dagopts_obj=$dag_tools_dir/dagopts.o 776 elif test -r $dag_lib_dir/dagopts.o; then 777 # 2.5.x. 778 dagopts_obj=$dag_lib_dir/dagopts.o 779 elif test -r $dag_lib_dir/libdag.a; then 780 # 2.5.x. 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 784 else 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 788 fi 789 fi 790 fi 791 792 if test $dagopts_obj = no; then 793 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) 794 ac_cv_lbl_dag_api=no 795 else 796 AC_MSG_RESULT([yes ($dagopts_obj)]) 797 fi 798fi 799 800if 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]) 804 dagreg_obj=no 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 813 else 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 817 fi 818 fi 819 fi 820 821 if test $dagreg_obj = no; then 822 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) 823 ac_cv_lbl_dag_api=no 824 else 825 AC_MSG_RESULT([yes ($dagreg_obj)]) 826 fi 827 fi 828fi 829 830if 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]) 834 dagutil_obj=no 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 843 else 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 847 fi 848 fi 849 fi 850 851 if test $dagutil_obj = no; then 852 AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) 853 ac_cv_lbl_dag_api=no 854 else 855 AC_MSG_RESULT([yes ($dagutil_obj)]) 856 fi 857 fi 858fi 859 860if 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 864 SSRC="pcap-dag.c" 865 fi 866 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 878 879 if test "$dag_streams" = 1; then 880 AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API]) 881 LIBS="$LIBS -ldag" 882 fi 883 884 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) 885fi 886 887AC_MSG_CHECKING(whether we have the DAG API) 888 889if test $ac_cv_lbl_dag_api = no; then 890 AC_MSG_RESULT(no) 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]) 894 fi 895 896 if test "$V_PCAP" = dag; then 897 # User requested "dag" capture type but the DAG API wasn't 898 # found. 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.)]) 900 fi 901else 902 AC_MSG_RESULT(yes) 903fi 904 905AC_ARG_WITH(septel, 906AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, on Linux, if present@:>@]), 907[ 908 if test "$withval" = no 909 then 910 want_septel=no 911 elif test "$withval" = yes 912 then 913 want_septel=yes 914 septel_root= 915 else 916 want_septel=yes 917 septel_root=$withval 918 fi 919],[ 920 # 921 # Use Septel API if present, otherwise don't 922 # 923 want_septel=ifpresent 924 septel_root=./../septel 925]) 926ac_cv_lbl_septel_api=no 927case "$V_PCAP" in 928linux|septel) 929 # 930 # We support the Septel API if we're on Linux, or if we're building 931 # a Septel-only libpcap. 932 # 933 ;; 934*) 935 # 936 # If the user explicitly requested Septel, tell them it's not 937 # supported. 938 # 939 # If they expressed no preference, don't include it. 940 # 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 944 want_septel=no 945 fi 946 ;; 947esac 948 949if test "$with_septel" != no; then 950 AC_MSG_CHECKING(whether we have Septel API) 951 952 if test -z "$septel_root"; then 953 septel_root=$srcdir/../septel 954 fi 955 956 septel_tools_dir="$septel_root" 957 septel_include_dir="$septel_root/INC" 958 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" 964 965 if test "$V_PCAP" != septel ; then 966 SSRC="pcap-septel.c" 967 fi 968 ac_cv_lbl_septel_api=yes 969 fi 970 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) 975 fi 976 else 977 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API]) 978 fi 979fi 980 981if 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) 983fi 984 985# Check for Myricom SNF support. 986AC_ARG_WITH([snf], 987AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support @<:@"yes", "no" or DIR; default="yes" on BSD and Linux if present@:>@]), 988[ 989 if test "$withval" = no 990 then 991 # User explicitly doesn't want SNF 992 want_snf=no 993 elif test "$withval" = yes 994 then 995 # User wants SNF support but hasn't specific a directory. 996 want_snf=yes 997 else 998 # User wants SNF support with a specified directory. 999 want_snf=yes 1000 snf_root=$withval 1001 fi 1002],[ 1003 # 1004 # Use Sniffer API if present, otherwise don't 1005 # 1006 want_snf=ifpresent 1007]) 1008 1009AC_ARG_WITH([snf-includes], 1010AC_HELP_STRING([--with-snf-includes=DIR],[Myricom SNF include directory]), 1011[ 1012 # User wants SNF with specific header directory 1013 want_snf=yes 1014 snf_include_dir=$withval 1015],[]) 1016 1017AC_ARG_WITH([snf-libraries], 1018AC_HELP_STRING([--with-snf-libraries=DIR],[Myricom SNF library directory]), 1019[ 1020 # User wants SNF with specific lib directory 1021 want_snf=yes 1022 snf_lib_dir=$withval 1023],[]) 1024 1025case "$V_PCAP" in 1026bpf|linux|snf) 1027 # 1028 # We support the Sniffer API if we're on BSD, Linux, or if we're 1029 # building a Sniffer-only libpcap. 1030 # 1031 ;; 1032*) 1033 # 1034 # If the user explicitly requested Sniffer, tell them it's not 1035 # supported. 1036 # 1037 # If they expressed no preference, don't include it. 1038 # 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 1042 want_snf=no 1043 fi 1044 ;; 1045esac 1046 1047ac_cv_lbl_snf_api=no 1048if test "$with_snf" != no; then 1049 1050 AC_MSG_CHECKING(whether we have Myricom Sniffer API) 1051 1052 if test -z "$snf_root"; then 1053 snf_root=/opt/snf 1054 fi 1055 1056 if test -z "$snf_include_dir"; then 1057 snf_include_dir="$snf_root/include" 1058 fi 1059 1060 if test -z "$snf_lib_dir"; then 1061 snf_lib_dir="$snf_root/lib" 1062 fi 1063 1064 if test -f "$snf_include_dir/snf.h"; then 1065 ac_cv_lbl_snf_api=yes 1066 fi 1067 AC_MSG_RESULT([$ac_cv_lbl_snf_api ($snf_root)]) 1068 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) 1072 fi 1073 else 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" 1078 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) 1082 fi 1083 else 1084 V_INCLS="$V_INCLS -I$snf_include_dir" 1085 LIBS="$LIBS -lsnf" 1086 LDFLAGS="$LDFLAGS -L$snf_lib_dir" 1087 if test "$V_PCAP" != snf ; then 1088 SSRC="pcap-snf.c" 1089 fi 1090 AC_DEFINE(HAVE_SNF_API, 1, [define if you have Myricom SNF API]) 1091 fi 1092 fi 1093fi 1094 1095if 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) 1097fi 1098 1099AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_) 1100if 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 1106 else 1107 tcpdump_cv_capable_lex=insufficient 1108 fi) 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 .]) 1114 fi 1115fi 1116 1117# 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. 1121# 1122DYEXT="none" 1123MAN_FILE_FORMATS=5 1124MAN_MISC_INFO=7 1125case "$host_os" in 1126 1127aix*) 1128 dnl Workaround to enable certain features 1129 AC_DEFINE(_SUN,1,[define on AIX to get certain functions]) 1130 1131 # 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". 1140 # 1141 DYEXT="shareda" 1142 1143 case "$V_PCAP" in 1144 1145 dlpi) 1146 # 1147 # If we're using DLPI, applications will need to 1148 # use /lib/pse.exp if present, as we use the 1149 # STREAMS routines. 1150 # 1151 pseexe="/lib/pse.exp" 1152 AC_MSG_CHECKING(for $pseexe) 1153 if test -f $pseexe ; then 1154 AC_MSG_RESULT(yes) 1155 LIBS="-I:$pseexe" 1156 fi 1157 ;; 1158 1159 bpf) 1160 # 1161 # If we're using BPF, we need "-lodm" and "-lcfg", as 1162 # we use them to load the BPF module. 1163 # 1164 LIBS="-lodm -lcfg" 1165 ;; 1166 esac 1167 ;; 1168 1169darwin*) 1170 DYEXT="dylib" 1171 V_CCOPT="$V_CCOPT -fno-common" 1172 ;; 1173 1174hpux9*) 1175 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x]) 1176 1177 # 1178 # Use System V conventions for man pages. 1179 # 1180 MAN_FILE_FORMATS=4 1181 MAN_MISC_INFO=5 1182 ;; 1183 1184hpux10.0*) 1185 1186 # 1187 # Use System V conventions for man pages. 1188 # 1189 MAN_FILE_FORMATS=4 1190 MAN_MISC_INFO=5 1191 ;; 1192 1193hpux10.1*) 1194 1195 # 1196 # Use System V conventions for man pages. 1197 # 1198 MAN_FILE_FORMATS=4 1199 MAN_MISC_INFO=5 1200 ;; 1201 1202hpux*) 1203 dnl HPUX 10.20 and above is similar to HPUX 9, but 1204 dnl not the same.... 1205 dnl 1206 dnl XXX - DYEXT should be set to "sl" if this is building 1207 dnl for 32-bit PA-RISC, but should be left as "so" for 1208 dnl 64-bit PA-RISC or, I suspect, IA-64. 1209 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later]) 1210 if test "`uname -m`" = "ia64"; then 1211 DYEXT="so" 1212 else 1213 DYEXT="sl" 1214 fi 1215 1216 # 1217 # "-b" builds a shared library; "+h" sets the soname. 1218 # 1219 SHLIB_OPT="-b" 1220 SONAME_OPT="+h" 1221 1222 # 1223 # Use System V conventions for man pages. 1224 # 1225 MAN_FILE_FORMATS=4 1226 MAN_MISC_INFO=5 1227 ;; 1228 1229irix*) 1230 # 1231 # Use System V conventions for man pages. 1232 # 1233 MAN_FILE_FORMATS=4 1234 MAN_MISC_INFO=5 1235 ;; 1236 1237linux*|freebsd*|netbsd*|openbsd*|dragonfly*) 1238 DYEXT="so" 1239 1240 # 1241 # Compiler assumed to be GCC; run-time linker may require a -R 1242 # flag. 1243 # 1244 if test "$libdir" != "/usr/lib"; then 1245 V_RFLAGS=-Wl,-R$libdir 1246 fi 1247 ;; 1248 1249osf*) 1250 DYEXT="so" 1251 1252 # 1253 # Use System V conventions for man pages. 1254 # 1255 MAN_FILE_FORMATS=4 1256 MAN_MISC_INFO=5 1257 ;; 1258 1259sinix*) 1260 AC_MSG_CHECKING(if SINIX compiler defines sinix) 1261 AC_CACHE_VAL(ac_cv_cc_sinix_defined, 1262 AC_TRY_COMPILE( 1263 [], 1264 [int i = sinix;], 1265 ac_cv_cc_sinix_defined=yes, 1266 ac_cv_cc_sinix_defined=no)) 1267 AC_MSG_RESULT($ac_cv_cc_sinix_defined) 1268 if test $ac_cv_cc_sinix_defined = no ; then 1269 AC_DEFINE(sinix,1,[on sinix]) 1270 fi 1271 ;; 1272 1273solaris*) 1274 AC_DEFINE(HAVE_SOLARIS,1,[On solaris]) 1275 1276 DYEXT="so" 1277 # 1278 # Use System V conventions for man pages. 1279 # 1280 MAN_FILE_FORMATS=4 1281 MAN_MISC_INFO=5 1282 ;; 1283esac 1284 1285AC_PROG_RANLIB 1286 1287AC_LBL_DEVEL(V_CCOPT) 1288 1289AC_LBL_SOCKADDR_SA_LEN 1290 1291AC_LBL_SOCKADDR_STORAGE 1292 1293AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1 1294 1295AC_LBL_UNALIGNED_ACCESS 1296 1297# 1298# Makefile.in includes rules to generate version.h, so we assume 1299# that it will be generated if autoconf is used. 1300# 1301AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure]) 1302 1303rm -f net 1304ln -s ${srcdir}/bpf/net net 1305 1306AC_SUBST(V_CCOPT) 1307AC_SUBST(V_DEFS) 1308AC_SUBST(V_FINDALLDEVS) 1309AC_SUBST(V_INCLS) 1310AC_SUBST(V_LEX) 1311AC_SUBST(V_PCAP) 1312AC_SUBST(V_SHLIB_CMD) 1313AC_SUBST(V_SHLIB_OPT) 1314AC_SUBST(V_SONAME_OPT) 1315AC_SUBST(V_RPATH_OPT) 1316AC_SUBST(V_YACC) 1317AC_SUBST(ADDLOBJS) 1318AC_SUBST(ADDLARCHIVEOBJS) 1319AC_SUBST(SSRC) 1320AC_SUBST(DYEXT) 1321AC_SUBST(MAN_FILE_FORMATS) 1322AC_SUBST(MAN_MISC_INFO) 1323 1324dnl check for USB sniffing support 1325AC_MSG_CHECKING(for USB sniffing support) 1326case "$host_os" in 1327linux*) 1328 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing]) 1329 USB_SRC=pcap-usb-linux.c 1330 AC_MSG_RESULT(yes) 1331 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` 1332 if test $? -ne 0 ; then 1333 ac_usb_dev_name="usbmon" 1334 fi 1335 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) 1336 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) 1337 AC_CHECK_HEADERS(linux/usbdevice_fs.h) 1338 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then 1339 # 1340 # OK, does it define bRequestType? Older versions of the kernel 1341 # define fields with names like "requesttype, "request", and 1342 # "value", rather than "bRequestType", "bRequest", and 1343 # "wValue". 1344 # 1345 AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member) 1346 AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType, 1347 AC_TRY_COMPILE([ 1348AC_INCLUDES_DEFAULT 1349#ifdef HAVE_SYS_BITYPES_H 1350#include <sys/bitypes.h> 1351#endif 1352# include <linux/usbdevice_fs.h>], 1353 [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)], 1354 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes, 1355 ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no)) 1356 AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType) 1357 if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then 1358 AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1, 1359 [if struct usbdevfs_ctrltransfer has bRequestType]) 1360 fi 1361 fi 1362 ;; 1363*) 1364 AC_MSG_RESULT(no) 1365 ;; 1366esac 1367AC_SUBST(PCAP_SUPPORT_USB) 1368AC_SUBST(USB_SRC) 1369 1370AC_ARG_ENABLE([bluetooth], 1371[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])], 1372,enable_bluetooth=yes) 1373 1374if test "x$enable_bluetooth" != "xno" ; then 1375 dnl check for Bluetooth sniffing support 1376 case "$host_os" in 1377 linux*) 1378 AC_CHECK_HEADER(bluetooth/bluetooth.h, 1379 [ 1380 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing]) 1381 BT_SRC=pcap-bt-linux.c 1382 AC_MSG_NOTICE(Bluetooth sniffing is supported) 1383 ], 1384 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) 1385 ) 1386 ;; 1387 *) 1388 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) 1389 ;; 1390 esac 1391 AC_SUBST(PCAP_SUPPORT_BT) 1392 AC_SUBST(BT_SRC) 1393fi 1394 1395AC_ARG_ENABLE([can], 1396[AC_HELP_STRING([--enable-can],[enable CAN support @<:@default=yes, if support available@:>@])], 1397,enable_can=yes) 1398 1399if test "x$enable_can" != "xno" ; then 1400 dnl check for CAN sniffing support 1401 case "$host_os" in 1402 linux*) 1403 AC_CHECK_HEADER(linux/can.h, 1404 [ AC_DEFINE(PCAP_SUPPORT_CAN, 1, [target host supports CAN sniffing]) 1405 CAN_SRC=pcap-can-linux.c 1406 AC_MSG_NOTICE(CAN sniffing is supported)], 1407 AC_MSG_NOTICE(CAN sniffing is not supported), 1408 [#include <sys/socket.h>] 1409 ) 1410 ;; 1411 *) 1412 AC_MSG_NOTICE(no CAN sniffing support implemented for $host_os) 1413 ;; 1414 esac 1415 AC_SUBST(PCAP_SUPPORT_CAN) 1416 AC_SUBST(CAN_SRC) 1417fi 1418 1419AC_PROG_INSTALL 1420 1421AC_CONFIG_HEADER(config.h) 1422 1423AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc 1424 pcap-savefile.manfile pcap.3pcap pcap_compile.3pcap 1425 pcap_datalink.3pcap pcap_dump_open.3pcap 1426 pcap_list_datalinks.3pcap pcap_open_dead.3pcap 1427 pcap_open_offline.3pcap) 1428 1429if test -f .devel ; then 1430 make depend 1431fi 1432exit 0 1433