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