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