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