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