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.64) 18 19AC_INIT(pcap, m4_esyscmd_s([cat VERSION])) 20AC_CONFIG_SRCDIR(pcap.c) 21AC_SUBST(PACKAGE_NAME) 22 23AC_CANONICAL_SYSTEM 24 25AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS) 26# 27# Try to enable as many C99 features as we can. 28# At minimum, we want C++/C99-style // comments. 29# 30AC_PROG_CC_C99 31AC_LBL_C_INIT(V_CCOPT, V_INCLS) 32AC_LBL_SHLIBS_INIT 33AC_LBL_C_INLINE 34 35# 36# Try to arrange for large file support. 37# 38AC_SYS_LARGEFILE 39AC_FUNC_FSEEKO 40 41dnl 42dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to 43dnl include <sys/ioccom.h>, and we were to drop support for older 44dnl releases without that fix, so that pcap-bpf.c doesn't need to 45dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES" 46dnl in "aclocal.m4" uses it, so we would still have to test for it 47dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise 48dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris. 49dnl 50AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h) 51AC_CHECK_HEADERS(netpacket/packet.h) 52AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> 53#include <sys/socket.h> 54#include <net/if.h>]) 55if test "$ac_cv_header_net_pfvar_h" = yes; then 56 # 57 # Check for various PF actions. 58 # 59 AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR) 60 AC_TRY_COMPILE( 61 [#include <sys/types.h> 62 #include <sys/socket.h> 63 #include <net/if.h> 64 #include <net/pfvar.h>], 65 [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;], 66 [ 67 AC_MSG_RESULT(yes) 68 AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1, 69 [define if net/pfvar.h defines PF_NAT through PF_NORDR]) 70 ], 71 AC_MSG_RESULT(no)) 72fi 73 74case "$host_os" in 75linux*|uclinux*) 76 AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,, 77 [ 78#include <sys/socket.h> 79#include <linux/if.h> 80 ]) 81 ;; 82esac 83 84AC_LBL_FIXINCLUDES 85 86AC_CHECK_FUNCS(strerror strerror_r strerror_s strlcpy strlcat) 87 88needsnprintf=no 89AC_CHECK_FUNCS(vsnprintf snprintf,, 90 [needsnprintf=yes]) 91if test $needsnprintf = yes; then 92 AC_LIBOBJ([snprintf]) 93fi 94 95needstrtok_r=no 96AC_CHECK_FUNCS(strtok_r,, 97 [needstrtok_r=yes]) 98if test $needstrtok_r = yes; then 99 AC_LIBOBJ([strtok_r]) 100fi 101 102# 103# Do we have ffs(), and is it declared in <strings.h>? 104# 105AC_CHECK_FUNCS(ffs) 106if test "$ac_cv_func_ffs" = yes; then 107 # 108 # We have ffs(); is it declared in <strings.h>? 109 # 110 # This test fails if we don't have <strings.h> or if we do 111 # but it doesn't declare ffs(). 112 # 113 AC_CHECK_DECL(ffs, 114 [ 115 AC_DEFINE(STRINGS_H_DECLARES_FFS,, 116 [Define to 1 if strings.h declares `ffs']) 117 ],, 118 [ 119#include <strings.h> 120 ]) 121fi 122 123# 124# Do this before checking for ether_hostton(), as it's a 125# "getaddrinfo()-ish function". 126# 127AC_LBL_LIBRARY_NET 128 129# 130# Check for reentrant versions of getnetbyname_r(), as provided by 131# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!). 132# If we don't find one, we just use getnetbyname(), which uses 133# thread-specific data on many platforms, but doesn't use it on 134# NetBSD or OpenBSD, and may not use it on older versions of other 135# platforms. 136# 137# Only do the check if we have a declaration of getnetbyname_r(); 138# without it, we can't check which API it has. (We assume that 139# if there's a declaration, it has a prototype, so that the API 140# can be checked.) 141# 142AC_CHECK_DECL(getnetbyname_r, 143 [ 144 AC_MSG_CHECKING([for the Linux getnetbyname_r()]) 145 AC_TRY_LINK( 146 [#include <netdb.h>], 147 [ 148 struct netent netent_buf; 149 char buf[1024]; 150 struct netent *resultp; 151 int h_errnoval; 152 153 return getnetbyname_r((const char *)0, &netent_buf, buf, sizeof buf, &resultp, &h_errnoval); 154 ], 155 [ 156 AC_MSG_RESULT(yes) 157 AC_DEFINE(HAVE_LINUX_GETNETBYNAME_R, 1, 158 [define if we have the Linux getnetbyname_r()]) 159 ], 160 [ 161 AC_MSG_RESULT(no) 162 163 AC_MSG_CHECKING([for Solaris/IRIX getnetbyname_r()]) 164 AC_TRY_LINK( 165 [#include <netdb.h>], 166 [ 167 struct netent netent_buf; 168 char buf[1024]; 169 170 return getnetbyname_r((const char *)0, &netent_buf, buf, (int)sizeof buf) != NULL; 171 ], 172 [ 173 AC_MSG_RESULT(yes) 174 AC_DEFINE(HAVE_SOLARIS_IRIX_GETNETBYNAME_R, 1, 175 [define if we have the Solaris/IRIX getnetbyname_r()]) 176 ], 177 [ 178 AC_MSG_RESULT(no) 179 180 AC_MSG_CHECKING([for AIX getnetbyname_r()]) 181 AC_TRY_LINK( 182 [#include <netdb.h>], 183 [ 184 struct netent netent_buf; 185 struct netent_data net_data; 186 187 return getnetbyname_r((const char *)0, &netent_buf, &net_data); 188 ], 189 [ 190 AC_MSG_RESULT(yes) 191 AC_DEFINE(HAVE_AIX_GETNETBYNAME_R, 1, 192 [define if we have the AIX getnetbyname_r()]) 193 ], 194 [ 195 AC_MSG_RESULT(no) 196 ]) 197 ]) 198 ]) 199 ],,[#include <netdb.h>]) 200 201# 202# Check for reentrant versions of getprotobyname_r(), as provided by 203# Linux (glibc), Solaris/IRIX, and AIX (with three different APIs!). 204# If we don't find one, we just use getprotobyname(), which uses 205# thread-specific data on many platforms, but doesn't use it on 206# NetBSD or OpenBSD, and may not use it on older versions of other 207# platforms. 208# 209# Only do the check if we have a declaration of getprotobyname_r(); 210# without it, we can't check which API it has. (We assume that 211# if there's a declaration, it has a prototype, so that the API 212# can be checked.) 213# 214AC_CHECK_DECL(getprotobyname_r, 215 [ 216 AC_MSG_CHECKING([for the Linux getprotobyname_r()]) 217 AC_TRY_LINK( 218 [#include <netdb.h>], 219 [ 220 struct protoent protoent_buf; 221 char buf[1024]; 222 struct protoent *resultp; 223 224 return getprotobyname_r((const char *)0, &protoent_buf, buf, sizeof buf, &resultp); 225 ], 226 [ 227 AC_MSG_RESULT(yes) 228 AC_DEFINE(HAVE_LINUX_GETPROTOBYNAME_R, 1, 229 [define if we have the Linux getprotobyname_r()]) 230 ], 231 [ 232 AC_MSG_RESULT(no) 233 234 AC_MSG_CHECKING([for Solaris/IRIX getprotobyname_r()]) 235 AC_TRY_LINK( 236 [#include <netdb.h>], 237 [ 238 struct protoent protoent_buf; 239 char buf[1024]; 240 241 return getprotobyname_r((const char *)0, &protoent_buf, buf, (int)sizeof buf) != NULL; 242 ], 243 [ 244 AC_MSG_RESULT(yes) 245 AC_DEFINE(HAVE_SOLARIS_IRIX_GETPROTOBYNAME_R, 1, 246 [define if we have the Solaris/IRIX getprotobyname_r()]) 247 ], 248 [ 249 AC_MSG_RESULT(no) 250 251 AC_MSG_CHECKING([for AIX getprotobyname_r()]) 252 AC_TRY_LINK( 253 [#include <netdb.h>], 254 [ 255 struct protoent protoent_buf; 256 struct protoent_data proto_data; 257 258 return getprotobyname_r((const char *)0, &protoent_buf, &proto_data); 259 ], 260 [ 261 AC_MSG_RESULT(yes) 262 AC_DEFINE(HAVE_AIX_GETPROTOBYNAME_R, 1, 263 [define if we have the AIX getprotobyname_r()]) 264 ], 265 [ 266 AC_MSG_RESULT(no) 267 ]) 268 ]) 269 ]) 270 ],,[#include <netdb.h>]) 271 272# 273# You are in a twisty little maze of UN*Xes, all different. 274# Some might not have ether_hostton(). 275# Some might have it and declare it in <net/ethernet.h>. 276# Some might have it and declare it in <netinet/ether.h> 277# Some might have it and declare it in <sys/ethernet.h>. 278# Some might have it and declare it in <arpa/inet.h>. 279# Some might have it and declare it in <netinet/if_ether.h>. 280# Some might have it and not declare it in any header file. 281# 282# Before you is a C compiler. 283# 284AC_CHECK_FUNCS(ether_hostton) 285if test "$ac_cv_func_ether_hostton" = yes; then 286 # 287 # OK, we have ether_hostton(). Is it declared in <net/ethernet.h>? 288 # 289 # This test fails if we don't have <net/ethernet.h> or if we do 290 # but it doesn't declare ether_hostton(). 291 # 292 AC_CHECK_DECL(ether_hostton, 293 [ 294 AC_DEFINE(NET_ETHERNET_H_DECLARES_ETHER_HOSTTON,, 295 [Define to 1 if net/ethernet.h declares `ether_hostton']) 296 ],, 297 [ 298#include <net/ethernet.h> 299 ]) 300 # 301 # Did that succeed? 302 # 303 if test "$ac_cv_have_decl_ether_hostton" != yes; then 304 # 305 # No, how about <netinet/ether.h>, as on Linux? 306 # 307 # This test fails if we don't have <netinet/ether.h> 308 # or if we do but it doesn't declare ether_hostton(). 309 # 310 # Unset ac_cv_have_decl_ether_hostton so we don't 311 # treat the previous failure as a cached value and 312 # suppress the next test. 313 # 314 unset ac_cv_have_decl_ether_hostton 315 AC_CHECK_DECL(ether_hostton, 316 [ 317 AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,, 318 [Define to 1 if netinet/ether.h declares `ether_hostton']) 319 ],, 320 [ 321#include <netinet/ether.h> 322 ]) 323 fi 324 # 325 # Did that succeed? 326 # 327 if test "$ac_cv_have_decl_ether_hostton" != yes; then 328 # 329 # No, how about <sys/ethernet.h>, as on Solaris 10 330 # and later? 331 # 332 # This test fails if we don't have <sys/ethernet.h> 333 # or if we do but it doesn't declare ether_hostton(). 334 # 335 # Unset ac_cv_have_decl_ether_hostton so we don't 336 # treat the previous failure as a cached value and 337 # suppress the next test. 338 # 339 unset ac_cv_have_decl_ether_hostton 340 AC_CHECK_DECL(ether_hostton, 341 [ 342 AC_DEFINE(SYS_ETHERNET_H_DECLARES_ETHER_HOSTTON,, 343 [Define to 1 if sys/ethernet.h declares `ether_hostton']) 344 ],, 345 [ 346#include <sys/ethernet.h> 347 ]) 348 fi 349 # 350 # Did that succeed? 351 # 352 if test "$ac_cv_have_decl_ether_hostton" != yes; then 353 # 354 # No, how about <arpa/inet.h>, as in AIX? 355 # 356 # This test fails if we don't have <arpa/inet.h> 357 # (if we have ether_hostton(), we should have 358 # networking, and if we have networking, we should 359 # have <arapa/inet.h>) or if we do but it doesn't 360 # declare ether_hostton(). 361 # 362 # Unset ac_cv_have_decl_ether_hostton so we don't 363 # treat the previous failure as a cached value and 364 # suppress the next test. 365 # 366 unset ac_cv_have_decl_ether_hostton 367 AC_CHECK_DECL(ether_hostton, 368 [ 369 AC_DEFINE(ARPA_INET_H_DECLARES_ETHER_HOSTTON,, 370 [Define to 1 if arpa/inet.h declares `ether_hostton']) 371 ],, 372 [ 373#include <arpa/inet.h> 374 ]) 375 fi 376 # 377 # Did that succeed? 378 # 379 if test "$ac_cv_have_decl_ether_hostton" != yes; then 380 # 381 # No, how about <netinet/if_ether.h>? 382 # On some platforms, it requires <net/if.h> and 383 # <netinet/in.h>, and we always include it with 384 # both of them, so test it with both of them. 385 # 386 # This test fails if we don't have <netinet/if_ether.h> 387 # and the headers we include before it, or if we do but 388 # <netinet/if_ether.h> doesn't declare ether_hostton(). 389 # 390 # Unset ac_cv_have_decl_ether_hostton so we don't 391 # treat the previous failure as a cached value and 392 # suppress the next test. 393 # 394 unset ac_cv_have_decl_ether_hostton 395 AC_CHECK_DECL(ether_hostton, 396 [ 397 AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,, 398 [Define to 1 if netinet/if_ether.h declares `ether_hostton']) 399 ],, 400 [ 401#include <sys/types.h> 402#include <sys/socket.h> 403#include <net/if.h> 404#include <netinet/in.h> 405#include <netinet/if_ether.h> 406 ]) 407 fi 408 # 409 # After all that, is ether_hostton() declared? 410 # 411 if test "$ac_cv_have_decl_ether_hostton" = yes; then 412 # 413 # Yes. 414 # 415 AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1, 416 [Define to 1 if you have the declaration of `ether_hostton']) 417 else 418 # 419 # No, we'll have to declare it ourselves. 420 # Do we have "struct ether_addr" if we include 421 # <netinet/if_ether.h>? 422 # 423 AC_CHECK_TYPES(struct ether_addr,,, 424 [ 425 #include <sys/types.h> 426 #include <sys/socket.h> 427 #include <net/if.h> 428 #include <netinet/in.h> 429 #include <netinet/if_ether.h> 430 ]) 431 fi 432fi 433 434# 435# For various things that might use pthreads. 436# 437AC_CHECK_HEADER(pthread.h, 438 [ 439 # 440 # OK, we have pthread.h. Do we have pthread_create in the 441 # system libraries? 442 # 443 AC_CHECK_FUNC(pthread_create, 444 [ 445 # 446 # Yes. 447 # 448 ac_lbl_have_pthreads="found" 449 ], 450 [ 451 # 452 # No - do we have it in -lpthreads? 453 # 454 AC_CHECK_LIB(pthreads, pthread_create, 455 [ 456 # 457 # Yes - add -lpthreads. 458 # 459 ac_lbl_have_pthreads="found" 460 PTHREAD_LIBS="$PTHREAD_LIBS -lpthreads" 461 ], 462 [ 463 # 464 # No - do we have it in -lpthread? 465 # 466 AC_CHECK_LIB(pthread, pthread_create, 467 [ 468 # 469 # Yes - add -lpthread. 470 # 471 ac_lbl_have_pthreads="found" 472 PTHREAD_LIBS="$PTHREAD_LIBS -lpthread" 473 ], 474 [ 475 # 476 # No. 477 # 478 ac_lbl_have_pthreads="not found" 479 ]) 480 ]) 481 ]) 482 ], 483 [ 484 # 485 # We didn't find pthread.h. 486 # 487 ac_lbl_have_pthreads="not found" 488 ] 489) 490 491dnl to pacify those who hate protochain insn 492AC_MSG_CHECKING(if --disable-protochain option is specified) 493AC_ARG_ENABLE(protochain, 494AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn])) 495case "x$enable_protochain" in 496xyes) enable_protochain=enabled ;; 497xno) enable_protochain=disabled ;; 498x) enable_protochain=enabled ;; 499esac 500 501if test "$enable_protochain" = "disabled"; then 502 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain]) 503fi 504AC_MSG_RESULT(${enable_protochain}) 505 506# 507# valgrindtest directly uses the native capture mechanism, but 508# only tests with BPF and PF_PACKET sockets; only enable it if 509# we have BPF or PF_PACKET sockets. 510# 511VALGRINDTEST_SRC= 512 513# 514# SITA support is mutually exclusive with native capture support; 515# "--with-sita" selects SITA support. 516# 517AC_ARG_WITH(sita, 518AC_HELP_STRING([--with-sita],[include SITA support]), 519[ 520 if test ! "x$withval" = "xno" ; then 521 AC_DEFINE(SITA,1,[include ACN support]) 522 AC_MSG_NOTICE(Enabling SITA ACN support) 523 V_PCAP=sita 524 fi 525], 526[ 527AC_ARG_WITH(pcap, 528AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE])) 529if test ! -z "$with_pcap" ; then 530 V_PCAP="$withval" 531else 532 # 533 # Check for a bunch of headers for various packet 534 # capture mechanisms. 535 # 536 AC_CHECK_HEADERS(net/bpf.h) 537 if test "$ac_cv_header_net_bpf_h" = yes; then 538 # 539 # Does it define BIOCSETIF? 540 # I.e., is it a header for an LBL/BSD-style capture 541 # mechanism, or is it just a header for a BPF filter 542 # engine? Some versions of Arch Linux, for example, 543 # have a net/bpf.h that doesn't define BIOCSETIF; 544 # as it's a Linux, it should use packet sockets, 545 # instead. 546 # 547 # We need: 548 # 549 # sys/types.h, because FreeBSD 10's net/bpf.h 550 # requires that various BSD-style integer types 551 # be defined; 552 # 553 # sys/ioctl.h and, if we have it, sys/ioccom.h, 554 # because net/bpf.h defines ioctls; 555 # 556 # net/if.h, because it defines some structures 557 # used in ioctls defined by net/bpf.h; 558 # 559 # sys/socket.h, because OpenBSD 5.9's net/bpf.h 560 # defines some structure fields as being 561 # struct sockaddrs; 562 # 563 # and net/bpf.h doesn't necessarily include all 564 # of those headers itself. 565 # 566 AC_MSG_CHECKING(if net/bpf.h defines BIOCSETIF) 567 AC_CACHE_VAL(ac_cv_lbl_bpf_h_defines_biocsetif, 568 AC_TRY_COMPILE( 569[ 570#include <sys/types.h> 571#include <sys/ioctl.h> 572#include <sys/socket.h> 573#ifdef HAVE_SYS_IOCCOM_H 574#include <sys/ioccom.h> 575#endif 576#include <net/bpf.h> 577#include <net/if.h> 578], 579 [u_int i = BIOCSETIF;], 580 ac_cv_lbl_bpf_h_defines_biocsetif=yes, 581 ac_cv_lbl_bpf_h_defines_biocsetif=no)) 582 AC_MSG_RESULT($ac_cv_lbl_bpf_h_defines_biocsetif) 583 fi 584 AC_CHECK_HEADERS(net/pfilt.h net/enet.h) 585 AC_CHECK_HEADERS(net/nit.h sys/net/nit.h) 586 AC_CHECK_HEADERS(linux/socket.h net/raw.h sys/dlpi.h) 587 588 if test "$ac_cv_lbl_bpf_h_defines_biocsetif" = yes; then 589 # 590 # BPF. 591 # Check this before DLPI, so that we pick BPF on 592 # Solaris 11 and later. 593 # 594 V_PCAP=bpf 595 596 # 597 # We have BPF, so build valgrindtest with "make test" 598 # on macOS and FreeBSD (add your OS once there's a 599 # valgrind for it). 600 # 601 case "$host_os" in 602 603 freebsd*|darwin*|linux*) 604 VALGRINDTEST_SRC=valgrindtest.c 605 ;; 606 esac 607 elif test "$ac_cv_header_linux_socket_h" = yes; then 608 # 609 # No prizes for guessing this one. 610 # 611 V_PCAP=linux 612 613 # 614 # XXX - this won't work with older kernels that have 615 # SOCK_PACKET sockets but not PF_PACKET sockets. 616 # 617 VALGRINDTEST_SRC=valgrindtest.c 618 elif test "$ac_cv_header_net_pfilt_h" = yes; then 619 # 620 # DEC OSF/1, Digital UNIX, Tru64 UNIX 621 # 622 V_PCAP=pf 623 elif test "$ac_cv_header_net_enet_h" = yes; then 624 # 625 # Stanford Enetfilter. 626 # 627 V_PCAP=enet 628 elif test "$ac_cv_header_net_nit_h" = yes; then 629 # 630 # SunOS 4.x STREAMS NIT. 631 # 632 V_PCAP=snit 633 elif test "$ac_cv_header_sys_net_nit_h" = yes; then 634 # 635 # Pre-SunOS 4.x non-STREAMS NIT. 636 # 637 V_PCAP=nit 638 elif test "$ac_cv_header_net_raw_h" = yes; then 639 # 640 # IRIX snoop. 641 # 642 V_PCAP=snoop 643 elif test "$ac_cv_header_sys_dlpi_h" = yes; then 644 # 645 # DLPI on pre-Solaris 11 SunOS 5, HP-UX, possibly others. 646 # 647 V_PCAP=dlpi 648 else 649 # 650 # Nothing we support. 651 # 652 V_PCAP=null 653 AC_MSG_WARN(cannot determine packet capture interface) 654 AC_MSG_WARN((see the INSTALL doc for more info)) 655 fi 656fi 657AC_MSG_CHECKING(packet capture type) 658AC_MSG_RESULT($V_PCAP) 659AC_SUBST(VALGRINDTEST_SRC) 660 661# 662# Do capture-mechanism-dependent tests. 663# 664case "$V_PCAP" in 665dlpi) 666 # 667 # Needed for common functions used by pcap-[dlpi,libdlpi].c 668 # 669 SSRC="dlpisubs.c" 670 671 # 672 # Checks for some header files. 673 # 674 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) 675 676 # 677 # Checks to see if Solaris has the public libdlpi(3LIB) library. 678 # Note: The existence of /usr/include/libdlpi.h does not mean it is the 679 # public libdlpi(3LIB) version. Before libdlpi was made public, a 680 # private version also existed, which did not have the same APIs. 681 # Due to a gcc bug, the default search path for 32-bit libraries does 682 # not include /lib, we add it explicitly here. 683 # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485]. 684 # Also, due to the bug above applications that link to libpcap with 685 # libdlpi will have to add "-L/lib" option to "configure". 686 # 687 saved_ldflags=$LDFLAGS 688 LDFLAGS="$LIBS -L/lib" 689 AC_CHECK_LIB(dlpi, dlpi_walk, 690 [ 691 LIBS="-ldlpi $LIBS" 692 V_PCAP=libdlpi 693 AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]) 694 ], 695 V_PCAP=dlpi) 696 LDFLAGS=$saved_ldflags 697 698 # 699 # Checks whether <sys/dlpi.h> is usable, to catch weird SCO 700 # versions of DLPI. 701 # 702 AC_MSG_CHECKING(whether <sys/dlpi.h> is usable) 703 AC_CACHE_VAL(ac_cv_sys_dlpi_usable, 704 AC_TRY_COMPILE( 705 [ 706 #include <sys/types.h> 707 #include <sys/time.h> 708 #include <sys/dlpi.h> 709 ], 710 [int i = DL_PROMISC_PHYS;], 711 ac_cv_sys_dlpi_usable=yes, 712 ac_cv_sys_dlpi_usable=no)) 713 AC_MSG_RESULT($ac_cv_sys_dlpi_usable) 714 if test $ac_cv_sys_dlpi_usable = no ; then 715 AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI) 716 fi 717 718 # 719 # Check to see if Solaris has the dl_passive_req_t struct defined 720 # in <sys/dlpi.h>. 721 # This check is for DLPI support for passive modes. 722 # See dlpi(7P) for more details. 723 # 724 AC_CHECK_TYPES(dl_passive_req_t,,, 725 [ 726 #include <sys/types.h> 727 #include <sys/dlpi.h> 728 ]) 729 ;; 730 731linux) 732 # 733 # Do we have the wireless extensions? 734 # 735 AC_CHECK_HEADERS(linux/wireless.h, [], [], 736 [ 737#include <sys/socket.h> 738#include <linux/if.h> 739#include <linux/types.h> 740 ]) 741 742 # 743 # Do we have libnl? 744 # 745 AC_ARG_WITH(libnl, 746 AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]), 747 with_libnl=$withval,with_libnl=if_available) 748 749 if test x$with_libnl != xno ; then 750 have_any_nl="no" 751 752 incdir=-I/usr/include/libnl3 753 libnldir= 754 case "$with_libnl" in 755 756 yes|if_available) 757 ;; 758 759 *) 760 if test -d $withval; then 761 libnldir=-L${withval}/lib/.libs 762 incdir=-I${withval}/include 763 fi 764 ;; 765 esac 766 767 # 768 # Try libnl 3.x first. 769 # 770 AC_CHECK_LIB(nl-3, nl_socket_alloc, 771 [ 772 # 773 # Yes, we have libnl 3.x. 774 # 775 LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS" 776 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) 777 AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) 778 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) 779 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) 780 V_INCLS="$V_INCLS ${incdir}" 781 have_any_nl="yes" 782 ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 ) 783 784 if test x$have_any_nl = xno ; then 785 # 786 # Try libnl 2.x 787 # 788 AC_CHECK_LIB(nl, nl_socket_alloc, 789 [ 790 # 791 # Yes, we have libnl 2.x. 792 # 793 LIBS="${libnldir} -lnl-genl -lnl $LIBS" 794 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) 795 AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x]) 796 AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) 797 AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) 798 have_any_nl="yes" 799 ]) 800 fi 801 802 if test x$have_any_nl = xno ; then 803 # 804 # No, we don't; do we have libnl 1.x? 805 # 806 AC_CHECK_LIB(nl, nl_handle_alloc, 807 [ 808 # 809 # Yes. 810 # 811 LIBS="${libnldir} -lnl $LIBS" 812 AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) 813 have_any_nl="yes" 814 ]) 815 fi 816 817 if test x$have_any_nl = xno ; then 818 # 819 # No, we don't have libnl at all. 820 # 821 if test x$with_libnl = xyes ; then 822 AC_MSG_ERROR([libnl support requested but libnl not found]) 823 fi 824 fi 825 fi 826 827 AC_CHECK_HEADERS(linux/ethtool.h,,, 828 [ 829AC_INCLUDES_DEFAULT 830#include <linux/types.h> 831 ]) 832 833 # 834 # Check to see if struct tpacket_stats is defined in 835 # <linux/if_packet.h>. If so, then pcap-linux.c can use this 836 # to report proper statistics. 837 # 838 # -Scott Barron 839 # 840 AC_CHECK_TYPES(struct tpacket_stats,,, 841 [ 842 #include <linux/if_packet.h> 843 ]) 844 845 # 846 # Check to see if the tpacket_auxdata struct has a tp_vlan_tci member. 847 # 848 # NOTE: any failure means we conclude that it doesn't have that 849 # member, so if we don't have tpacket_auxdata, we conclude it 850 # doesn't have that member (which is OK, as either we won't be 851 # using code that would use that member, or we wouldn't compile 852 # in any case). 853 AC_CHECK_MEMBERS([struct tpacket_auxdata.tp_vlan_tci],,, 854 [ 855 #include <sys/types.h> 856 #include <linux/if_packet.h> 857 ]) 858 ;; 859 860bpf) 861 # 862 # Check whether we have the *BSD-style ioctls. 863 # 864 AC_CHECK_HEADERS(net/if_media.h) 865 866 # 867 # Check whether we have struct BPF_TIMEVAL. 868 # 869 AC_CHECK_TYPES(struct BPF_TIMEVAL,,, 870 [ 871 #include <sys/types.h> 872 #include <sys/ioctl.h> 873 #ifdef HAVE_SYS_IOCCOM_H 874 #include <sys/ioccom.h> 875 #endif 876 #include <net/bpf.h> 877 ]) 878 ;; 879 880dag) 881 # 882 # --with-pcap=dag is the only way to get here, and it means 883 # "DAG support but nothing else" 884 # 885 V_DEFS="$V_DEFS -DDAG_ONLY" 886 xxx_only=yes 887 ;; 888 889septel) 890 # 891 # --with-pcap=septel is the only way to get here, and it means 892 # "Septel support but nothing else" 893 # 894 V_DEFS="$V_DEFS -DSEPTEL_ONLY" 895 xxx_only=yes 896 ;; 897 898snf) 899 # 900 # --with-pcap=snf is the only way to get here, and it means 901 # "SNF support but nothing else" 902 # 903 V_DEFS="$V_DEFS -DSNF_ONLY" 904 xxx_only=yes 905 ;; 906 907null) 908 ;; 909 910*) 911 AC_MSG_ERROR($V_PCAP is not a valid pcap type) 912 ;; 913esac 914 915dnl 916dnl Now figure out how we get a list of interfaces and addresses, 917dnl if we support capturing. Don't bother if we don't support 918dnl capturing. 919dnl 920if test "$V_PCAP" != null 921then 922 AC_CHECK_FUNC(getifaddrs,[ 923 # 924 # We have "getifaddrs()"; make sure we have <ifaddrs.h> 925 # as well, just in case some platform is really weird. 926 # 927 AC_CHECK_HEADER(ifaddrs.h,[ 928 # 929 # We have the header, so we use "getifaddrs()" to 930 # get the list of interfaces. 931 # 932 V_FINDALLDEVS=fad-getad.c 933 ],[ 934 # 935 # We don't have the header - give up. 936 # XXX - we could also fall back on some other 937 # mechanism, but, for now, this'll catch this 938 # problem so that we can at least try to figure 939 # out something to do on systems with "getifaddrs()" 940 # but without "ifaddrs.h", if there is something 941 # we can do on those systems. 942 # 943 AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.]) 944 ]) 945 ],[ 946 # 947 # Well, we don't have "getifaddrs()", at least not with the 948 # libraries with which we've decided we need to link 949 # libpcap with, so we have to use some other mechanism. 950 # 951 # Note that this may happen on Solaris, which has 952 # getifaddrs(), but in -lsocket, not in -lxnet, so we 953 # won't find it if we link with -lxnet, which we want 954 # to do for other reasons. 955 # 956 # For now, we use either the SIOCGIFCONF ioctl or the 957 # SIOCGLIFCONF ioctl, preferring the latter if we have 958 # it; the latter is a Solarisism that first appeared 959 # in Solaris 8. (Solaris's getifaddrs() appears to 960 # be built atop SIOCGLIFCONF; using it directly 961 # avoids a not-all-that-useful middleman.) 962 # 963 AC_MSG_CHECKING(whether we have SIOCGLIFCONF) 964 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf, 965 AC_TRY_COMPILE( 966 [#include <sys/param.h> 967 #include <sys/file.h> 968 #include <sys/ioctl.h> 969 #include <sys/socket.h> 970 #include <sys/sockio.h>], 971 [ioctl(0, SIOCGLIFCONF, (char *)0);], 972 ac_cv_lbl_have_siocglifconf=yes, 973 ac_cv_lbl_have_siocglifconf=no)) 974 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf) 975 if test $ac_cv_lbl_have_siocglifconf = yes ; then 976 V_FINDALLDEVS=fad-glifc.c 977 else 978 V_FINDALLDEVS=fad-gifc.c 979 fi 980 ]) 981fi 982]) 983 984dnl check for hardware timestamp support 985case "$host_os" in 986linux*) 987 AC_CHECK_HEADERS([linux/net_tstamp.h]) 988 ;; 989*) 990 AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os) 991 ;; 992esac 993 994AC_ARG_ENABLE([packet-ring], 995[AC_HELP_STRING([--enable-packet-ring],[enable packet ring support on Linux @<:@default=yes@:>@])], 996,enable_packet_ring=yes) 997 998if test "x$enable_packet_ring" != "xno" ; then 999 AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use packet ring capture support on Linux if available]) 1000 AC_SUBST(PCAP_SUPPORT_PACKET_RING) 1001fi 1002 1003# 1004# Check for socklen_t. 1005# 1006AC_CHECK_TYPES(socklen_t,,, 1007 [ 1008 #include <sys/types.h> 1009 #include <sys/socket.h> 1010 ]) 1011 1012AC_ARG_ENABLE(ipv6, 1013AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes@:>@]), 1014 [], 1015 [enable_ipv6=yes]) 1016if test "$enable_ipv6" != "no"; then 1017 # 1018 # We've already made sure we have getaddrinfo above in 1019 # AC_LBL_LIBRARY_NET. 1020 # 1021 AC_DEFINE(INET6,1,[IPv6]) 1022fi 1023 1024# Check for Endace DAG card support. 1025AC_ARG_WITH([dag], 1026AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), 1027[ 1028 if test "$withval" = no 1029 then 1030 # User doesn't want DAG support. 1031 want_dag=no 1032 elif test "$withval" = yes 1033 then 1034 # User wants DAG support but hasn't specified a directory. 1035 want_dag=yes 1036 else 1037 # User wants DAG support and has specified a directory, so use the provided value. 1038 want_dag=yes 1039 dag_root=$withval 1040 fi 1041],[ 1042 if test "$V_PCAP" = dag; then 1043 # User requested DAG-only libpcap, so we'd better have 1044 # the DAG API. 1045 want_dag=yes 1046 elif test "xxx_only" = yes; then 1047 # User requested something-else-only pcap, so they don't 1048 # want DAG support. 1049 want_dag=no 1050 else 1051 # 1052 # Use DAG API if present, otherwise don't 1053 # 1054 want_dag=ifpresent 1055 fi 1056]) 1057 1058AC_ARG_WITH([dag-includes], 1059AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]), 1060[ 1061 # User wants DAG support and has specified a header directory, so use the provided value. 1062 want_dag=yes 1063 dag_include_dir=$withval 1064],[]) 1065 1066AC_ARG_WITH([dag-libraries], 1067AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]), 1068[ 1069 # User wants DAG support and has specified a library directory, so use the provided value. 1070 want_dag=yes 1071 dag_lib_dir=$withval 1072],[]) 1073 1074if test "$want_dag" != no; then 1075 1076 # If necessary, set default paths for DAG API headers and libraries. 1077 if test -z "$dag_root"; then 1078 dag_root=/usr/local 1079 fi 1080 1081 if test -z "$dag_include_dir"; then 1082 dag_include_dir="$dag_root/include" 1083 fi 1084 1085 if test -z "$dag_lib_dir"; then 1086 dag_lib_dir="$dag_root/lib" 1087 fi 1088 1089 V_INCLS="$V_INCLS -I$dag_include_dir" 1090 1091 AC_CHECK_HEADERS([dagapi.h]) 1092 1093 if test "$ac_cv_header_dagapi_h" = yes; then 1094 1095 if test $V_PCAP != dag ; then 1096 SSRC="$SSRC pcap-dag.c" 1097 fi 1098 1099 # Check for various DAG API functions. 1100 # Don't need to save and restore LIBS to prevent -ldag being 1101 # included if there's a found-action (arg 3). 1102 saved_ldflags=$LDFLAGS 1103 LDFLAGS="-L$dag_lib_dir" 1104 AC_CHECK_LIB([dag], [dag_attach_stream], 1105 [], 1106 [AC_MSG_ERROR(DAG library lacks streams support)]) 1107 AC_CHECK_LIB([dag], [dag_attach_stream64], [dag_large_streams="1"], [dag_large_streams="0"]) 1108 AC_CHECK_LIB([dag],[dag_get_erf_types], [ 1109 AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]) 1110 AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [ 1111 AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])]) 1112 1113 LDFLAGS=$saved_ldflags 1114 1115 # 1116 # We assume that if we have libdag we have libdagconf, 1117 # as they're installed at the same time from the same 1118 # package. 1119 # 1120 LIBS="$LIBS -ldag -ldagconf" 1121 LDFLAGS="$LDFLAGS -L$dag_lib_dir" 1122 1123 if test "$dag_large_streams" = 1; then 1124 AC_DEFINE(HAVE_DAG_LARGE_STREAMS_API, 1, [define if you have large streams capable DAG API]) 1125 AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"]) 1126 if test "$ac_dag_have_vdag" = 1; then 1127 AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()]) 1128 if test "$ac_lbl_have_pthreads" != "found"; then 1129 AC_MSG_ERROR([DAG requires pthreads, but we didn't find them]) 1130 fi 1131 LIBS="$LIBS $PTHREAD_LIBS" 1132 fi 1133 fi 1134 1135 AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) 1136 else 1137 1138 if test "$V_PCAP" = dag; then 1139 # User requested "dag" capture type but we couldn't 1140 # find the DAG API support. 1141 AC_MSG_ERROR([DAG support requested with --with-pcap=dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support]) 1142 fi 1143 1144 if test "$want_dag" = yes; then 1145 # User wanted DAG support but we couldn't find it. 1146 AC_MSG_ERROR([DAG support requested with --with-dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support]) 1147 fi 1148 fi 1149fi 1150 1151AC_ARG_WITH(septel, 1152AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), 1153[ 1154 if test "$withval" = no 1155 then 1156 want_septel=no 1157 elif test "$withval" = yes 1158 then 1159 want_septel=yes 1160 septel_root= 1161 else 1162 want_septel=yes 1163 septel_root=$withval 1164 fi 1165],[ 1166 if test "$V_PCAP" = septel; then 1167 # User requested Septel-only libpcap, so we'd better have 1168 # the Septel API. 1169 want_septel=yes 1170 elif test "xxx_only" = yes; then 1171 # User requested something-else-only pcap, so they don't 1172 # want Septel support. 1173 want_septel=no 1174 else 1175 # 1176 # Use Septel API if present, otherwise don't 1177 # 1178 want_septel=ifpresent 1179 fi 1180]) 1181 1182ac_cv_lbl_septel_api=no 1183if test "$with_septel" != no; then 1184 1185 AC_MSG_CHECKING([whether we have Septel API headers]) 1186 1187 # If necessary, set default paths for Septel API headers and libraries. 1188 if test -z "$septel_root"; then 1189 septel_root=$srcdir/../septel 1190 fi 1191 1192 septel_tools_dir="$septel_root" 1193 septel_include_dir="$septel_root/INC" 1194 1195 if test -r "$septel_include_dir/msg.h"; then 1196 ac_cv_lbl_septel_api=yes 1197 fi 1198 1199 if test "$ac_cv_lbl_septel_api" = yes; then 1200 AC_MSG_RESULT([yes ($septel_include_dir)]) 1201 1202 V_INCLS="$V_INCLS -I$septel_include_dir" 1203 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" 1204 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" 1205 1206 if test "$V_PCAP" != septel ; then 1207 SSRC="$SSRC pcap-septel.c" 1208 fi 1209 1210 AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API]) 1211 else 1212 AC_MSG_RESULT(no) 1213 1214 if test "$V_PCAP" = septel; then 1215 # User requested "septel" capture type but 1216 # we couldn't find the Septel API support. 1217 AC_MSG_ERROR([Septel support requested with --with-pcap=septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support]) 1218 fi 1219 1220 if test "$want_septel" = yes; then 1221 # User wanted Septel support but we couldn't find it. 1222 AC_MSG_ERROR([Septel support requested with --with-septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support]) 1223 fi 1224 fi 1225fi 1226 1227# Check for Myricom SNF support. 1228AC_ARG_WITH([snf], 1229AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), 1230[ 1231 if test "$withval" = no 1232 then 1233 # User explicitly doesn't want SNF 1234 want_snf=no 1235 elif test "$withval" = yes 1236 then 1237 # User wants SNF support but hasn't specified a directory. 1238 want_snf=yes 1239 else 1240 # User wants SNF support with a specified directory. 1241 want_snf=yes 1242 snf_root=$withval 1243 fi 1244],[ 1245 if test "$V_PCAP" = snf; then 1246 # User requested Sniffer-only libpcap, so we'd better have 1247 # the Sniffer API. 1248 want_snf=yes 1249 elif test "xxx_only" = yes; then 1250 # User requested something-else-only pcap, so they don't 1251 # want SNF support. 1252 want_snf=no 1253 else 1254 # 1255 # Use Sniffer API if present, otherwise don't 1256 # 1257 want_snf=ifpresent 1258 fi 1259]) 1260 1261AC_ARG_WITH([snf-includes], 1262AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]), 1263[ 1264 # User wants SNF with specific header directory 1265 want_snf=yes 1266 snf_include_dir=$withval 1267],[]) 1268 1269AC_ARG_WITH([snf-libraries], 1270AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]), 1271[ 1272 # User wants SNF with specific lib directory 1273 want_snf=yes 1274 snf_lib_dir=$withval 1275],[]) 1276 1277ac_cv_lbl_snf_api=no 1278if test "$with_snf" != no; then 1279 1280 AC_MSG_CHECKING(whether we have Myricom Sniffer API) 1281 1282 # If necessary, set default paths for Sniffer headers and libraries. 1283 if test -z "$snf_root"; then 1284 snf_root=/opt/snf 1285 fi 1286 1287 if test -z "$snf_include_dir"; then 1288 snf_include_dir="$snf_root/include" 1289 fi 1290 1291 if test -z "$snf_lib_dir"; then 1292 snf_lib_dir="$snf_root/lib" 1293 fi 1294 1295 if test -f "$snf_include_dir/snf.h"; then 1296 # We found a header; make sure we can link with the library 1297 saved_ldflags=$LDFLAGS 1298 LDFLAGS="$LDFLAGS -L$snf_lib_dir" 1299 AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"]) 1300 LDFLAGS="$saved_ldflags" 1301 if test "$ac_cv_lbl_snf_api" = no; then 1302 AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log) 1303 fi 1304 fi 1305 1306 if test "$ac_cv_lbl_snf_api" = yes; then 1307 AC_MSG_RESULT([yes ($snf_root)]) 1308 1309 V_INCLS="$V_INCLS -I$snf_include_dir" 1310 LIBS="$LIBS -lsnf" 1311 LDFLAGS="$LDFLAGS -L$snf_lib_dir" 1312 1313 if test "$V_PCAP" != snf ; then 1314 SSRC="$SSRC pcap-snf.c" 1315 fi 1316 1317 AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API]) 1318 else 1319 AC_MSG_RESULT(no) 1320 1321 if test "$want_snf" = yes; then 1322 # User requested "snf" capture type but 1323 # we couldn't find the Sniffer API support. 1324 AC_MSG_ERROR([Myricom Sniffer support requested with --with-pcap=snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support]) 1325 fi 1326 1327 if test "$want_snf" = yes; then 1328 AC_MSG_ERROR([Myricom Sniffer support requested with --with-snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support]) 1329 fi 1330 fi 1331fi 1332 1333# Check for Riverbed TurboCap support. 1334AC_ARG_WITH([turbocap], 1335AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), 1336[ 1337 if test "$withval" = no 1338 then 1339 # User explicitly doesn't want TurboCap 1340 want_turbocap=no 1341 elif test "$withval" = yes 1342 then 1343 # User wants TurboCap support but hasn't specified a directory. 1344 want_turbocap=yes 1345 else 1346 # User wants TurboCap support with a specified directory. 1347 want_turbocap=yes 1348 turbocap_root=$withval 1349 fi 1350],[ 1351 if test "xxx_only" = yes; then 1352 # User requested something-else-only pcap, so they don't 1353 # want TurboCap support. 1354 want_turbocap=no 1355 else 1356 # 1357 # Use TurboCap API if present, otherwise don't 1358 # 1359 want_turbocap=ifpresent 1360 fi 1361]) 1362 1363ac_cv_lbl_turbocap_api=no 1364if test "$want_turbocap" != no; then 1365 1366 AC_MSG_CHECKING(whether TurboCap is supported) 1367 1368 save_CFLAGS="$CFLAGS" 1369 save_LIBS="$LIBS" 1370 if test ! -z "$turbocap_root"; then 1371 TURBOCAP_CFLAGS="-I$turbocap_root/include" 1372 TURBOCAP_LIBS="-L$turbocap_root/lib" 1373 CFLAGS="$CFLAGS $TURBOCAP_CFLAGS" 1374 fi 1375 1376 AC_TRY_COMPILE( 1377 [ 1378 #include <TcApi.h> 1379 ], 1380 [ 1381 TC_INSTANCE a; TC_PORT b; TC_BOARD c; 1382 TC_INSTANCE i; 1383 (void)TcInstanceCreateByName("foo", &i); 1384 ], 1385 ac_cv_lbl_turbocap_api=yes) 1386 1387 CFLAGS="$save_CFLAGS" 1388 if test $ac_cv_lbl_turbocap_api = yes; then 1389 AC_MSG_RESULT(yes) 1390 1391 SSRC="$SSRC pcap-tc.c" 1392 V_INCLS="$V_INCLS $TURBOCAP_CFLAGS" 1393 LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++" 1394 1395 AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API]) 1396 else 1397 AC_MSG_RESULT(no) 1398 1399 if test "$want_turbocap" = yes; then 1400 # User wanted Turbo support but we couldn't find it. 1401 AC_MSG_ERROR([TurboCap support requested with --with-turbocap, but the TurboCap headers weren't found: make sure the TurboCap support is installed or don't request TurboCap support]) 1402 fi 1403 fi 1404fi 1405 1406dnl 1407dnl Allow the user to enable remote capture. 1408dnl It's off by default, as that increases the attack surface of 1409dnl libpcap, exposing it to malicious servers. 1410dnl 1411AC_MSG_CHECKING([whether to enable remote packet capture]) 1412AC_ARG_ENABLE(remote, 1413[ --enable-remote enable remote packet capture @<:@default=no@:>@ 1414 --disable-remote disable remote packet capture],, 1415 enableval=no) 1416case "$enableval" in 1417yes) AC_MSG_RESULT(yes) 1418 AC_WARN([Remote packet capture may expose libpcap-based applications]) 1419 AC_WARN([to attacks by malicious remote capture servers!]) 1420 # 1421 # rpcapd requires pthreads on UN*X. 1422 # 1423 if test "$ac_lbl_have_pthreads" != "found"; then 1424 AC_MSG_ERROR([rpcapd requires pthreads, but we didn't find them]) 1425 fi 1426 # 1427 # It also requires crypt(). 1428 # Do we have it in the system libraries? 1429 # 1430 AC_CHECK_FUNC(crypt,, 1431 [ 1432 # 1433 # No. Do we have it in -lcrypt? 1434 # 1435 AC_CHECK_LIB(crypt, crypt, 1436 [ 1437 # 1438 # Yes; add -lcrypt to the libraries for rpcapd. 1439 # 1440 RPCAPD_LIBS="$RPCAPD_LIBS -lcrypt" 1441 ], 1442 [ 1443 AC_MSG_ERROR([rpcapd requires crypt(), but we didn't find it]) 1444 ]) 1445 ]) 1446 1447 # 1448 # OK, we have crypt(). Do we have getspnam()? 1449 # 1450 AC_CHECK_FUNCS(getspnam) 1451 1452 # 1453 # Check for various members of struct msghdr. 1454 # 1455 AC_CHECK_MEMBERS([struct msghdr.msg_control],,, 1456 [ 1457 #include "ftmacros.h" 1458 #include <sys/socket.h> 1459 ]) 1460 AC_CHECK_MEMBERS([struct msghdr.msg_flags],,, 1461 [ 1462 #include "ftmacros.h" 1463 #include <sys/socket.h> 1464 ]) 1465 1466 AC_DEFINE(ENABLE_REMOTE,, 1467 [Define to 1 if remote packet capture is to be supported]) 1468 SSRC="$SSRC pcap-new.c pcap-rpcap.c rpcap-protocol.c sockutils.c" 1469 BUILD_RPCAPD=build-rpcapd 1470 INSTALL_RPCAPD=install-rpcapd 1471 ;; 1472*) AC_MSG_RESULT(no) 1473 ;; 1474esac 1475 1476AC_MSG_CHECKING(whether to build optimizer debugging code) 1477AC_ARG_ENABLE(optimizer-dbg, 1478AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code])) 1479if test "$enable_optimizer_dbg" = "yes"; then 1480 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging]) 1481fi 1482AC_MSG_RESULT(${enable_optimizer_dbg-no}) 1483 1484AC_MSG_CHECKING(whether to build parser debugging code) 1485AC_ARG_ENABLE(yydebug, 1486AC_HELP_STRING([--enable-yydebug],[build parser debugging code])) 1487if test "$enable_yydebug" = "yes"; then 1488 AC_DEFINE(YYDEBUG,1,[Enable parser debugging]) 1489fi 1490AC_MSG_RESULT(${enable_yydebug-no}) 1491 1492# 1493# Look for {f}lex. 1494# 1495AC_PROG_LEX 1496if test "$LEX" = ":"; then 1497 AC_MSG_ERROR([Neither flex nor lex was found.]) 1498fi 1499 1500# 1501# Make sure {f}lex supports the -P, --header-file, and --nounput flags 1502# and supports processing our scanner.l. 1503# 1504AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex, 1505 if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then 1506 tcpdump_cv_capable_lex=yes 1507 else 1508 tcpdump_cv_capable_lex=insufficient 1509 fi) 1510if test $tcpdump_cv_capable_lex = insufficient ; then 1511 AC_MSG_ERROR([$LEX is insufficient to compile libpcap. 1512 libpcap requires Flex 2.5.31 or later, or a compatible version of lex.]) 1513fi 1514 1515# 1516# Look for yacc/bison/byacc. 1517# 1518AC_PROG_YACC 1519 1520# 1521# Make sure it supports the -p flag and supports processing our 1522# grammar.y. 1523# 1524AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc, 1525 if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then 1526 tcpdump_cv_capable_yacc=yes 1527 else 1528 tcpdump_cv_capable_yacc=insufficient 1529 fi) 1530if test $tcpdump_cv_capable_yacc = insufficient ; then 1531 AC_MSG_ERROR([$YACC is insufficient to compile libpcap. 1532 libpcap requires Bison, a newer version of Berkeley YACC with support 1533 for reentrant parsers, or another YACC compatible with them.]) 1534fi 1535 1536# 1537# Do various checks for various OSes and versions of those OSes. 1538# 1539# Assume, by default, no support for shared libraries and V7/BSD 1540# convention for man pages (file formats in section 5, miscellaneous 1541# info in section 7, administrative commands and daemons in section 8). 1542# Individual cases can override this. 1543# 1544DYEXT="none" 1545MAN_FILE_FORMATS=5 1546MAN_MISC_INFO=7 1547MAN_ADMIN_COMMANDS=8 1548case "$host_os" in 1549 1550aix*) 1551 dnl Workaround to enable certain features 1552 AC_DEFINE(_SUN,1,[define on AIX to get certain functions]) 1553 1554 # 1555 # AIX makes it fun to build shared and static libraries, 1556 # because they're *both* ".a" archive libraries. We 1557 # build the static library for the benefit of the traditional 1558 # scheme of building libpcap and tcpdump in subdirectories of 1559 # the same directory, with tcpdump statically linked with the 1560 # libpcap in question, but we also build a shared library as 1561 # "libpcap.shareda" and install *it*, rather than the static 1562 # library, as "libpcap.a". 1563 # 1564 DYEXT="shareda" 1565 1566 case "$V_PCAP" in 1567 1568 dlpi) 1569 # 1570 # If we're using DLPI, applications will need to 1571 # use /lib/pse.exp if present, as we use the 1572 # STREAMS routines. 1573 # 1574 pseexe="/lib/pse.exp" 1575 AC_MSG_CHECKING(for $pseexe) 1576 if test -f $pseexe ; then 1577 AC_MSG_RESULT(yes) 1578 LIBS="-I:$pseexe" 1579 fi 1580 ;; 1581 1582 bpf) 1583 # 1584 # If we're using BPF, we need "-lodm" and "-lcfg", as 1585 # we use them to load the BPF module. 1586 # 1587 LIBS="-lodm -lcfg" 1588 ;; 1589 esac 1590 ;; 1591 1592darwin*) 1593 DYEXT="dylib" 1594 V_CCOPT="$V_CCOPT -fno-common" 1595 AC_ARG_ENABLE(universal, 1596 AC_HELP_STRING([--disable-universal],[don't build universal on macOS])) 1597 if test "$enable_universal" != "no"; then 1598 case "$host_os" in 1599 1600 darwin[0-7].*) 1601 # 1602 # Pre-Tiger. Build only for 32-bit PowerPC; no 1603 # need for any special compiler or linker flags. 1604 # 1605 ;; 1606 1607 darwin8.[0123]*) 1608 # 1609 # Tiger, prior to Intel support. Build for 32-bit 1610 # PowerPC and 64-bit PowerPC, with 32-bit PowerPC 1611 # first. (I'm guessing that's what Apple does.) 1612 # 1613 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64" 1614 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64" 1615 ;; 1616 1617 darwin8.[456]*) 1618 # 1619 # Tiger, subsequent to Intel support but prior to 1620 # x86-64 support. Build for 32-bit PowerPC, 64-bit 1621 # PowerPC, and x86, with 32-bit PowerPC first. 1622 # (I'm guessing that's what Apple does.) 1623 # 1624 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386" 1625 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386" 1626 ;; 1627 1628 darwin8.*) 1629 # 1630 # All other Tiger, so subsequent to x86-64 1631 # support. Build for 32-bit PowerPC, 64-bit 1632 # PowerPC, x86, and x86-64, and with 32-bit PowerPC 1633 # first. (I'm guessing that's what Apple does.) 1634 # 1635 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" 1636 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" 1637 ;; 1638 1639 darwin9.*) 1640 # 1641 # Leopard. Build for 32-bit PowerPC, 64-bit 1642 # PowerPC, x86, and x86-64, with 32-bit PowerPC 1643 # first. (That's what Apple does.) 1644 # 1645 V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" 1646 LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" 1647 ;; 1648 1649 darwin10.*) 1650 # 1651 # Snow Leopard. Build for x86-64, x86, and 1652 # 32-bit PowerPC, with x86-64 first. (That's 1653 # what Apple does, even though Snow Leopard 1654 # doesn't run on PPC, so PPC libpcap runs under 1655 # Rosetta, and Rosetta doesn't support BPF 1656 # ioctls, so PPC programs can't do live 1657 # captures.) 1658 # 1659 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc" 1660 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc" 1661 ;; 1662 1663 darwin*) 1664 # 1665 # Post-Snow Leopard. Build for x86-64 and 1666 # x86, with x86-64 first. (That's probably what 1667 # Apple does, given that Rosetta is gone.) 1668 # XXX - update if and when Apple drops support 1669 # for 32-bit x86 code. 1670 # 1671 V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" 1672 LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" 1673 ;; 1674 esac 1675 fi 1676 ;; 1677 1678hpux9*) 1679 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x]) 1680 1681 # 1682 # Use System V conventions for man pages. 1683 # 1684 MAN_ADMIN_COMMANDS=1m 1685 MAN_FILE_FORMATS=4 1686 MAN_MISC_INFO=5 1687 ;; 1688 1689hpux10.0*) 1690 1691 # 1692 # Use System V conventions for man pages. 1693 # 1694 MAN_ADMIN_COMMANDS=1m 1695 MAN_FILE_FORMATS=4 1696 MAN_MISC_INFO=5 1697 ;; 1698 1699hpux10.1*) 1700 1701 # 1702 # Use System V conventions for man pages. 1703 # 1704 MAN_ADMIN_COMMANDS=1m 1705 MAN_FILE_FORMATS=4 1706 MAN_MISC_INFO=5 1707 ;; 1708 1709hpux*) 1710 dnl HPUX 10.20 and above is similar to HPUX 9, but 1711 dnl not the same.... 1712 dnl 1713 dnl XXX - DYEXT should be set to "sl" if this is building 1714 dnl for 32-bit PA-RISC, but should be left as "so" for 1715 dnl 64-bit PA-RISC or, I suspect, IA-64. 1716 AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later]) 1717 if test "`uname -m`" = "ia64"; then 1718 DYEXT="so" 1719 else 1720 DYEXT="sl" 1721 fi 1722 1723 # 1724 # "-b" builds a shared library; "+h" sets the soname. 1725 # 1726 SHLIB_OPT="-b" 1727 SONAME_OPT="+h" 1728 1729 # 1730 # Use System V conventions for man pages. 1731 # 1732 MAN_FILE_FORMATS=4 1733 MAN_MISC_INFO=5 1734 ;; 1735 1736irix*) 1737 # 1738 # Use IRIX conventions for man pages; they're the same as the 1739 # System V conventions, except that they use section 8 for 1740 # administrative commands and daemons. 1741 # 1742 MAN_FILE_FORMATS=4 1743 MAN_MISC_INFO=5 1744 ;; 1745 1746linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*) 1747 DYEXT="so" 1748 1749 # 1750 # Compiler assumed to be GCC; run-time linker may require a -R 1751 # flag. 1752 # 1753 if test "$libdir" != "/usr/lib"; then 1754 V_RFLAGS=-Wl,-R$libdir 1755 fi 1756 ;; 1757 1758osf*) 1759 DYEXT="so" 1760 1761 # 1762 # DEC OSF/1, a/k/a Digial UNIX, a/k/a Tru64 UNIX. 1763 # Use Tru64 UNIX conventions for man pages; they're the same as 1764 # the System V conventions except that they use section 8 for 1765 # administrative commands and daemons. 1766 # 1767 MAN_FILE_FORMATS=4 1768 MAN_MISC_INFO=5 1769 ;; 1770 1771sinix*) 1772 AC_MSG_CHECKING(if SINIX compiler defines sinix) 1773 AC_CACHE_VAL(ac_cv_cc_sinix_defined, 1774 AC_TRY_COMPILE( 1775 [], 1776 [int i = sinix;], 1777 ac_cv_cc_sinix_defined=yes, 1778 ac_cv_cc_sinix_defined=no)) 1779 AC_MSG_RESULT($ac_cv_cc_sinix_defined) 1780 if test $ac_cv_cc_sinix_defined = no ; then 1781 AC_DEFINE(sinix,1,[on sinix]) 1782 fi 1783 ;; 1784 1785solaris*) 1786 AC_DEFINE(HAVE_SOLARIS,1,[On solaris]) 1787 1788 DYEXT="so" 1789 1790 # 1791 # Make sure errno is thread-safe, in case we're called in 1792 # a multithreaded program. We don't guarantee that two 1793 # threads can use the *same* pcap_t safely, but the 1794 # current version does guarantee that you can use different 1795 # pcap_t's in different threads, and even that pcap_compile() 1796 # is thread-safe (it wasn't thread-safe in some older versions). 1797 # 1798 V_CCOPT="$V_CCOPT -D_TS_ERRNO" 1799 1800 case "`uname -r`" in 1801 1802 5.12) 1803 ;; 1804 1805 *) 1806 # 1807 # Use System V conventions for man pages. 1808 # 1809 MAN_ADMIN_COMMANDS=1m 1810 MAN_FILE_FORMATS=4 1811 MAN_MISC_INFO=5 1812 esac 1813 ;; 1814esac 1815 1816AC_ARG_ENABLE(shared, 1817AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@])) 1818test "x$enable_shared" = "xno" && DYEXT="none" 1819 1820AC_PROG_RANLIB 1821AC_CHECK_TOOL([AR], [ar]) 1822 1823AC_PROG_LN_S 1824AC_SUBST(LN_S) 1825 1826AC_LBL_DEVEL(V_CCOPT) 1827 1828# 1829# Check to see if the sockaddr struct has the 4.4 BSD sa_len member. 1830# 1831AC_CHECK_MEMBERS([struct sockaddr.sa_len],,, 1832 [ 1833 #include <sys/types.h> 1834 #include <sys/socket.h> 1835 ]) 1836 1837# 1838# Check to see if there's a sockaddr_storage structure. 1839# 1840AC_CHECK_TYPES(struct sockaddr_storage,,, 1841 [ 1842 #include <sys/types.h> 1843 #include <sys/socket.h> 1844 ]) 1845 1846# 1847# Check to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00 1848# dl_module_id_1 member. 1849# 1850# NOTE: any failure means we conclude that it doesn't have that member, 1851# so if we don't have DLPI, don't have a <sys/dlpi_ext.h> header, or 1852# have one that doesn't declare a dl_hp_ppa_info_t type, we conclude 1853# it doesn't have that member (which is OK, as either we won't be 1854# using code that would use that member, or we wouldn't compile in 1855# any case). 1856# 1857AC_CHECK_MEMBERS([dl_hp_ppa_info_t.dl_module_id_1],,, 1858 [ 1859 #include <sys/types.h> 1860 #include <sys/dlpi.h> 1861 #include <sys/dlpi_ext.h> 1862 ]) 1863 1864AC_LBL_UNALIGNED_ACCESS 1865 1866AC_SUBST(V_CCOPT) 1867AC_SUBST(V_DEFS) 1868AC_SUBST(V_FINDALLDEVS) 1869AC_SUBST(V_INCLS) 1870AC_SUBST(V_LEX) 1871AC_SUBST(V_PCAP) 1872AC_SUBST(V_SHLIB_CCOPT) 1873AC_SUBST(V_SHLIB_CMD) 1874AC_SUBST(V_SHLIB_OPT) 1875AC_SUBST(V_SONAME_OPT) 1876AC_SUBST(V_RPATH_OPT) 1877AC_SUBST(V_YACC) 1878AC_SUBST(ADDLOBJS) 1879AC_SUBST(ADDLARCHIVEOBJS) 1880AC_SUBST(SSRC) 1881AC_SUBST(DYEXT) 1882AC_SUBST(MAN_FILE_FORMATS) 1883AC_SUBST(MAN_MISC_INFO) 1884AC_SUBST(MAN_ADMIN_COMMANDS) 1885AC_SUBST(PTHREAD_LIBS) 1886AC_SUBST(BUILD_RPCAPD) 1887AC_SUBST(INSTALL_RPCAPD) 1888AC_SUBST(RPCAPD_LIBS) 1889AC_SUBST(EXTRA_NETWORK_LIBS) 1890 1891AC_ARG_ENABLE([usb], 1892[AC_HELP_STRING([--enable-usb],[enable USB capture support @<:@default=yes, if support available@:>@])], 1893 [], 1894 [enable_usb=yes]) 1895 1896if test "xxx_only" = yes; then 1897 # User requested something-else-only pcap, so they don't 1898 # want USB support. 1899 enable_usb=no 1900fi 1901 1902if test "x$enable_usb" != "xno" ; then 1903 dnl check for USB sniffing support 1904 AC_MSG_CHECKING(for USB sniffing support) 1905 case "$host_os" in 1906 linux*) 1907 AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing]) 1908 USB_SRC=pcap-usb-linux.c 1909 AC_MSG_RESULT(yes) 1910 ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` 1911 if test $? -ne 0 ; then 1912 ac_usb_dev_name="usbmon" 1913 fi 1914 AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) 1915 AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) 1916 # 1917 # Do we have a version of <linux/compiler.h> available? 1918 # If so, we might need it for <linux/usbdevice_fs.h>. 1919 # 1920 AC_CHECK_HEADERS(linux/compiler.h) 1921 if test "$ac_cv_header_linux_compiler_h" = yes; then 1922 # 1923 # Yes - include it when testing for <linux/usbdevice_fs.h>. 1924 # 1925 AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>]) 1926 else 1927 AC_CHECK_HEADERS(linux/usbdevice_fs.h) 1928 fi 1929 if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then 1930 # 1931 # OK, does it define bRequestType? Older versions of the kernel 1932 # define fields with names like "requesttype, "request", and 1933 # "value", rather than "bRequestType", "bRequest", and 1934 # "wValue". 1935 # 1936 AC_CHECK_MEMBERS([struct usbdevfs_ctrltransfer.bRequestType],,, 1937 [ 1938 AC_INCLUDES_DEFAULT 1939 #ifdef HAVE_LINUX_COMPILER_H 1940 #include <linux/compiler.h> 1941 #endif 1942 #include <linux/usbdevice_fs.h> 1943 ]) 1944 fi 1945 ;; 1946 freebsd*) 1947 # 1948 # This just uses BPF in FreeBSD 8.4 and later; we don't need 1949 # to check for anything special for capturing. 1950 # 1951 AC_MSG_RESULT([yes, in FreeBSD 8.4 and later]) 1952 ;; 1953 1954 *) 1955 AC_MSG_RESULT(no) 1956 ;; 1957esac 1958fi 1959AC_SUBST(PCAP_SUPPORT_USB) 1960AC_SUBST(USB_SRC) 1961 1962dnl check for netfilter sniffing support 1963if test "xxx_only" != yes; then 1964 AC_MSG_CHECKING(whether the platform could support netfilter sniffing) 1965 case "$host_os" in 1966 linux*) 1967 AC_MSG_RESULT(yes) 1968 # 1969 # Life's too short to deal with trying to get this to compile 1970 # if you don't get the right types defined with 1971 # __KERNEL_STRICT_NAMES getting defined by some other include. 1972 # 1973 # Check whether the includes Just Work. If not, don't turn on 1974 # netfilter support. 1975 # 1976 AC_MSG_CHECKING(whether we can compile the netfilter support) 1977 AC_CACHE_VAL(ac_cv_netfilter_can_compile, 1978 AC_TRY_COMPILE([ 1979AC_INCLUDES_DEFAULT 1980#include <sys/socket.h> 1981#include <netinet/in.h> 1982#include <linux/types.h> 1983 1984#include <linux/netlink.h> 1985#include <linux/netfilter.h> 1986#include <linux/netfilter/nfnetlink.h> 1987#include <linux/netfilter/nfnetlink_log.h> 1988#include <linux/netfilter/nfnetlink_queue.h>], 1989 [], 1990 ac_cv_netfilter_can_compile=yes, 1991 ac_cv_netfilter_can_compile=no)) 1992 AC_MSG_RESULT($ac_cv_netfilter_can_compile) 1993 if test $ac_cv_netfilter_can_compile = yes ; then 1994 AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1, 1995 [target host supports netfilter sniffing]) 1996 NETFILTER_SRC=pcap-netfilter-linux.c 1997 fi 1998 ;; 1999 *) 2000 AC_MSG_RESULT(no) 2001 ;; 2002 esac 2003fi 2004AC_SUBST(PCAP_SUPPORT_NETFILTER) 2005AC_SUBST(NETFILTER_SRC) 2006 2007AC_ARG_ENABLE([netmap], 2008[AC_HELP_STRING([--enable-netmap],[enable netmap support @<:@default=yes, if support available@:>@])], 2009 [], 2010 [enable_netmap=yes]) 2011 2012if test "x$enable_netmap" != "xno" ; then 2013 # 2014 # Check whether net/netmap_user.h is usable if NETMAP_WITH_LIBS is 2015 # defined; it's not usable on DragonFly BSD 4.6 if NETMAP_WITH_LIBS 2016 # is defined, for example, as it includes a non-existent malloc.h 2017 # header. 2018 # 2019 AC_MSG_CHECKING(whether we can compile the netmap support) 2020 AC_CACHE_VAL(ac_cv_net_netmap_user_can_compile, 2021 AC_TRY_COMPILE([ 2022AC_INCLUDES_DEFAULT 2023#define NETMAP_WITH_LIBS 2024#include <net/netmap_user.h>], 2025 [], 2026 ac_cv_net_netmap_user_can_compile=yes, 2027 ac_cv_net_netmap_user_can_compile=no)) 2028 AC_MSG_RESULT($ac_cv_net_netmap_user_can_compile) 2029 if test $ac_cv_net_netmap_user_can_compile = yes ; then 2030 AC_DEFINE(PCAP_SUPPORT_NETMAP, 1, 2031 [target host supports netmap]) 2032 NETMAP_SRC=pcap-netmap.c 2033 fi 2034 AC_SUBST(PCAP_SUPPORT_NETMAP) 2035 AC_SUBST(NETMAP_SRC) 2036fi 2037 2038 2039AC_ARG_ENABLE([bluetooth], 2040[AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])], 2041 [], 2042 [enable_bluetooth=ifsupportavailable]) 2043 2044if test "xxx_only" = yes; then 2045 # User requested something-else-only pcap, so they don't 2046 # want Bluetooth support. 2047 enable_bluetooth=no 2048fi 2049 2050if test "x$enable_bluetooth" != "xno" ; then 2051 dnl check for Bluetooth sniffing support 2052 case "$host_os" in 2053 linux*) 2054 AC_CHECK_HEADER(bluetooth/bluetooth.h, 2055 [ 2056 # 2057 # We have bluetooth.h, so we support Bluetooth 2058 # sniffing. 2059 # 2060 AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing]) 2061 BT_SRC=pcap-bt-linux.c 2062 AC_MSG_NOTICE(Bluetooth sniffing is supported) 2063 ac_lbl_bluetooth_available=yes 2064 2065 # 2066 # OK, does struct sockaddr_hci have an hci_channel 2067 # member? 2068 # 2069 AC_CHECK_MEMBERS([struct sockaddr_hci.hci_channel], 2070 [ 2071 # 2072 # Yes; is HCI_CHANNEL_MONITOR defined? 2073 # 2074 AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined) 2075 AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined, 2076 AC_TRY_COMPILE( 2077 [ 2078 #include <bluetooth/bluetooth.h> 2079 #include <bluetooth/hci.h> 2080 ], 2081 [ 2082 u_int i = HCI_CHANNEL_MONITOR; 2083 ], 2084 [ 2085 AC_MSG_RESULT(yes) 2086 AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,, 2087 [target host supports Bluetooth Monitor]) 2088 BT_MONITOR_SRC=pcap-bt-monitor-linux.c 2089 ], 2090 [ 2091 AC_MSG_RESULT(no) 2092 ])) 2093 ],, 2094 [ 2095 #include <bluetooth/bluetooth.h> 2096 #include <bluetooth/hci.h> 2097 ]) 2098 ], 2099 [ 2100 # 2101 # We don't have bluetooth.h, so we don't support 2102 # Bluetooth sniffing. 2103 # 2104 if test "x$enable_bluetooth" = "xyes" ; then 2105 AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) 2106 else 2107 AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) 2108 fi 2109 ]) 2110 ;; 2111 *) 2112 if test "x$enable_bluetooth" = "xyes" ; then 2113 AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os) 2114 else 2115 AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) 2116 fi 2117 ;; 2118 esac 2119 AC_SUBST(PCAP_SUPPORT_BT) 2120 AC_SUBST(BT_SRC) 2121 AC_SUBST(BT_MONITOR_SRC) 2122fi 2123 2124AC_ARG_ENABLE([dbus], 2125[AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])], 2126 [], 2127 [enable_dbus=ifavailable]) 2128 2129if test "xxx_only" = yes; then 2130 # User requested something-else-only pcap, so they don't 2131 # want D-Bus support. 2132 enable_dbus=no 2133fi 2134 2135if test "x$enable_dbus" != "xno"; then 2136 if test "x$enable_dbus" = "xyes"; then 2137 case "$host_os" in 2138 2139 darwin*) 2140 # 2141 # We don't support D-Bus sniffing on macOS; see 2142 # 2143 # https://bugs.freedesktop.org/show_bug.cgi?id=74029 2144 # 2145 # The user requested it, so fail. 2146 # 2147 AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on macOS]) 2148 esac 2149 else 2150 case "$host_os" in 2151 2152 darwin*) 2153 # 2154 # We don't support D-Bus sniffing on macOS; see 2155 # 2156 # https://bugs.freedesktop.org/show_bug.cgi?id=74029 2157 # 2158 # The user dind't explicitly request it, so just 2159 # silently refuse to enable it. 2160 # 2161 enable_dbus="no" 2162 ;; 2163 esac 2164 fi 2165fi 2166 2167if test "x$enable_dbus" != "xno"; then 2168 AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) 2169 if test "x$PKGCONFIG" != "xno"; then 2170 AC_MSG_CHECKING([for D-Bus]) 2171 if "$PKGCONFIG" dbus-1; then 2172 AC_MSG_RESULT([yes]) 2173 DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1` 2174 DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1` 2175 save_CFLAGS="$CFLAGS" 2176 save_LIBS="$LIBS" 2177 CFLAGS="$CFLAGS $DBUS_CFLAGS" 2178 LIBS="$LIBS $DBUS_LIBS" 2179 AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write) 2180 AC_TRY_LINK( 2181 [#include <string.h> 2182 2183 #include <time.h> 2184 #include <sys/time.h> 2185 2186 #include <dbus/dbus.h>], 2187 [return dbus_connection_read_write(NULL, 0);], 2188 [ 2189 AC_MSG_RESULT([yes]) 2190 AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing]) 2191 DBUS_SRC=pcap-dbus.c 2192 V_INCLS="$V_INCLS $DBUS_CFLAGS" 2193 ], 2194 [ 2195 AC_MSG_RESULT([no]) 2196 if test "x$enable_dbus" = "xyes"; then 2197 AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()]) 2198 fi 2199 LIBS="$save_LIBS" 2200 ]) 2201 CFLAGS="$save_CFLAGS" 2202 else 2203 AC_MSG_RESULT([no]) 2204 if test "x$enable_dbus" = "xyes"; then 2205 AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed]) 2206 fi 2207 fi 2208 fi 2209 AC_SUBST(PCAP_SUPPORT_DBUS) 2210 AC_SUBST(DBUS_SRC) 2211fi 2212 2213AC_ARG_ENABLE([rdma], 2214[AC_HELP_STRING([--enable-rdma],[enable RDMA capture support @<:@default=yes, if support available@:>@])], 2215 [], 2216 [enable_rdmasniff=ifavailable]) 2217 2218if test "xxx_only" = yes; then 2219 # User requested something-else-only pcap, so they don't 2220 # want RDMA support. 2221 enable_rdmasniff=no 2222fi 2223 2224if test "x$enable_rdmasniff" != "xno"; then 2225 AC_CHECK_LIB(ibverbs, ibv_get_device_list, [ 2226 AC_CHECK_HEADER(infiniband/verbs.h, [ 2227 # 2228 # ibv_create_flow may be defined as a static inline 2229 # function in infiniband/verbs.h, so we can't 2230 # use AC_CHECK_LIB. 2231 # 2232 # Too bad autoconf has no AC_SYMBOL_EXISTS() 2233 # macro that works like CMake's check_symbol_exists() 2234 # function, to check do a compile check like 2235 # this (they do a clever trick to avoid having 2236 # to know the function's signature). 2237 # 2238 AC_MSG_CHECKING(whether libibverbs defines ibv_create_flow) 2239 AC_TRY_LINK( 2240 [ 2241 #include <infiniband/verbs.h> 2242 ], 2243 [ 2244 (void) ibv_create_flow((struct ibv_qp *) NULL, 2245 (struct ibv_flow_attr *) NULL); 2246 ], 2247 [ 2248 AC_MSG_RESULT([yes]) 2249 AC_DEFINE(PCAP_SUPPORT_RDMASNIFF, , [target host supports RDMA sniffing]) 2250 RDMA_SRC=pcap-rdmasniff.c 2251 LIBS="-libverbs $LIBS" 2252 ], 2253 [ 2254 AC_MSG_RESULT([no]) 2255 ] 2256 ) 2257 ]) 2258 ]) 2259 AC_SUBST(PCAP_SUPPORT_RDMASNIFF) 2260 AC_SUBST(RDMA_SRC) 2261fi 2262 2263AC_PROG_INSTALL 2264 2265AC_CONFIG_HEADER(config.h) 2266 2267AC_OUTPUT_COMMANDS([if test -f .devel; then 2268 echo timestamp > stamp-h 2269 cat $srcdir/Makefile-devel-adds >> Makefile 2270 make depend 2271fi]) 2272AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc 2273 pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap 2274 pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap 2275 pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap 2276 pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap 2277 pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap 2278 pcap_set_tstamp_type.3pcap rpcapd/Makefile rpcapd/rpcapd.manadmin 2279 testprogs/Makefile) 2280exit 0 2281