14644f044SBill Fennerdnl Copyright (c) 1994, 1995, 1996, 1997 24edb46e9SPaul Trainadnl The Regents of the University of California. All rights reserved. 34edb46e9SPaul Trainadnl 44edb46e9SPaul Trainadnl Process this file with autoconf to produce a configure script. 54edb46e9SPaul Trainadnl 64edb46e9SPaul Traina 727df3f5dSRui Paulo# 827df3f5dSRui Paulo# See 927df3f5dSRui Paulo# 1027df3f5dSRui Paulo# http://ftp.gnu.org/gnu/config/README 1127df3f5dSRui Paulo# 1227df3f5dSRui Paulo# for the URLs to use to fetch new versions of config.guess and 1327df3f5dSRui Paulo# config.sub. 1427df3f5dSRui Paulo# 1527df3f5dSRui Paulo 163c602fabSXin LIAC_PREREQ(2.61) 174edb46e9SPaul TrainaAC_INIT(tcpdump.c) 184edb46e9SPaul Traina 19a90e161bSBill FennerAC_CANONICAL_HOST 204edb46e9SPaul Traina 213c602fabSXin LIAC_LBL_C_INIT_BEFORE_CC(V_INCLS) 2227df3f5dSRui PauloAC_PROG_CC 234edb46e9SPaul TrainaAC_LBL_C_INIT(V_CCOPT, V_INCLS) 249afd0c29SBill FennerAC_LBL_C_INLINE 25685295f4SBill FennerAC_C___ATTRIBUTE__ 2627df3f5dSRui Pauloif test "$ac_cv___attribute__" = "yes"; then 273c602fabSXin LI AC_C___ATTRIBUTE___UNUSED 283c602fabSXin LI AC_C___ATTRIBUTE___NORETURN_FUNCTION_POINTER 293c602fabSXin LI AC_C___ATTRIBUTE___FORMAT 303c602fabSXin LI if test "$ac_cv___attribute___format" = "yes"; then 3127df3f5dSRui Paulo AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER 3227df3f5dSRui Paulo fi 333c602fabSXin LIfi 343c602fabSXin LI 35cac3dcd5SXin LIAC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h) 36b5bfcb5dSMax LaierAC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> 37b5bfcb5dSMax Laier#include <sys/socket.h> 38b5bfcb5dSMax Laier#include <net/if.h>]) 39a5779b6eSRui Pauloif test "$ac_cv_header_net_pfvar_h" = yes; then 403340d773SGleb Smirnoff AC_CHECK_HEADERS(net/if_pflog.h, , , [#include <sys/types.h> 413340d773SGleb Smirnoff #include <sys/socket.h> 423340d773SGleb Smirnoff #include <net/if.h> 433340d773SGleb Smirnoff #include <net/pfvar.h>]) 443340d773SGleb Smirnoff if test "$ac_cv_header_net_if_pflog_h" = yes; then 45b5bfcb5dSMax Laier LOCALSRC="print-pflog.c $LOCALSRC" 46b5bfcb5dSMax Laier fi 473340d773SGleb Smirnofffi 485b0fe478SBruce M SimpsonAC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> 495b0fe478SBruce M Simpson#include <sys/socket.h>]) 501de50e9fSSam Lefflerif test "$ac_cv_header_netinet_if_ether_h" != yes; then 511de50e9fSSam Leffler # 521de50e9fSSam Leffler # The simple test didn't work. 531de50e9fSSam Leffler # Do we need to include <net/if.h> first? 541de50e9fSSam Leffler # Unset ac_cv_header_netinet_if_ether_h so we don't 551de50e9fSSam Leffler # treat the previous failure as a cached value and 561de50e9fSSam Leffler # suppress the next test. 571de50e9fSSam Leffler # 581de50e9fSSam Leffler AC_MSG_NOTICE([Rechecking with some additional includes]) 591de50e9fSSam Leffler unset ac_cv_header_netinet_if_ether_h 601de50e9fSSam Leffler AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> 611de50e9fSSam Leffler#include <sys/socket.h> 621de50e9fSSam Leffler#include <netinet/in.h> 631de50e9fSSam Lefflerstruct mbuf; 641de50e9fSSam Lefflerstruct rtentry; 651de50e9fSSam Leffler#include <net/if.h>]) 661de50e9fSSam Lefflerfi 671de50e9fSSam Leffler 684edb46e9SPaul TrainaAC_HEADER_TIME 694edb46e9SPaul Traina 70a90e161bSBill Fennercase "$host_os" in 714644f044SBill Fenner 72cac3dcd5SXin LIdarwin*) 73cac3dcd5SXin LI AC_ARG_ENABLE(universal, 74cac3dcd5SXin LI AC_HELP_STRING([--disable-universal],[don't build universal on OS X])) 75cac3dcd5SXin LI if test "$enable_universal" != "no"; then 76cac3dcd5SXin LI case "$host_os" in 77cac3dcd5SXin LI 78cac3dcd5SXin LI darwin9.*) 79cac3dcd5SXin LI # 80cac3dcd5SXin LI # Leopard. Build for x86 and 32-bit PowerPC, with 81cac3dcd5SXin LI # x86 first. (That's what Apple does.) 82cac3dcd5SXin LI # 83cac3dcd5SXin LI V_CCOPT="$V_CCOPT -arch i386 -arch ppc" 84cac3dcd5SXin LI LDFLAGS="$LDFLAGS -arch i386 -arch ppc" 85cac3dcd5SXin LI ;; 86cac3dcd5SXin LI 87cac3dcd5SXin LI darwin10.*) 88cac3dcd5SXin LI # 89cac3dcd5SXin LI # Snow Leopard. Build for x86-64 and x86, with 90cac3dcd5SXin LI # x86-64 first. (That's what Apple does.) 91cac3dcd5SXin LI # 92cac3dcd5SXin LI V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" 93cac3dcd5SXin LI LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" 94cac3dcd5SXin LI ;; 95cac3dcd5SXin LI esac 96cac3dcd5SXin LI fi 97cac3dcd5SXin LI ;; 984644f044SBill Fenneresac 994644f044SBill Fenner 100b0453382SBill Fenner 10127df3f5dSRui PauloAC_ARG_WITH(smi, 10227df3f5dSRui Paulo[ --with-smi link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes] 10327df3f5dSRui Paulo --without-smi don't link with libsmi],, 10427df3f5dSRui Paulo with_smi=yes) 10527df3f5dSRui Paulo 10627df3f5dSRui Pauloif test "x$with_smi" != "xno" ; then 1073c602fabSXin LI AC_CHECK_HEADER(smi.h, 1083c602fabSXin LI [ 1093c602fabSXin LI # 1103c602fabSXin LI # OK, we found smi.h. Do we have libsmi with smiInit? 1113c602fabSXin LI # 1123c602fabSXin LI AC_CHECK_LIB(smi, smiInit, 1133c602fabSXin LI [ 1143c602fabSXin LI # 1153c602fabSXin LI # OK, we have libsmi with smiInit. Can we use it? 1163c602fabSXin LI # 117b0453382SBill Fenner AC_MSG_CHECKING([whether to enable libsmi]) 1183c602fabSXin LI savedlibs="$LIBS" 1193c602fabSXin LI LIBS="-lsmi $LIBS" 1203c602fabSXin LI AC_TRY_RUN( 1213c602fabSXin LI [ 1223c602fabSXin LI/* libsmi available check */ 123b0453382SBill Fenner#include <smi.h> 124b0453382SBill Fennermain() 125b0453382SBill Fenner{ 126685295f4SBill Fenner int current, revision, age, n; 127685295f4SBill Fenner const int required = 2; 128b0453382SBill Fenner if (smiInit("")) 129b0453382SBill Fenner exit(1); 130685295f4SBill Fenner if (strcmp(SMI_LIBRARY_VERSION, smi_library_version)) 131685295f4SBill Fenner exit(2); 132685295f4SBill Fenner n = sscanf(smi_library_version, "%d:%d:%d", ¤t, &revision, &age); 133685295f4SBill Fenner if (n != 3) 134685295f4SBill Fenner exit(3); 135685295f4SBill Fenner if (required < current - age || required > current) 136685295f4SBill Fenner exit(4); 137b0453382SBill Fenner exit(0); 138b0453382SBill Fenner} 139b0453382SBill Fenner ], 1403c602fabSXin LI [ 1413c602fabSXin LI AC_MSG_RESULT(yes) 1423c602fabSXin LI AC_DEFINE(USE_LIBSMI, 1, 1433c602fabSXin LI [Define if you enable support for libsmi]) 1443c602fabSXin LI ], 1453c602fabSXin LI [ 1463c602fabSXin LI dnl autoconf documentation says that 1473c602fabSXin LI dnl $? contains the exit value. 1483c602fabSXin LI dnl reality is that it does not. 1493c602fabSXin LI dnl We leave this in just in case 1503c602fabSXin LI dnl autoconf ever comes back to 1513c602fabSXin LI dnl match the documentation. 1523c602fabSXin LI case $? in 153a90e161bSBill Fenner 1) AC_MSG_RESULT(no - smiInit failed) ;; 154a90e161bSBill Fenner 2) AC_MSG_RESULT(no - header/library version mismatch) ;; 155a90e161bSBill Fenner 3) AC_MSG_RESULT(no - can't determine library version) ;; 156a90e161bSBill Fenner 4) AC_MSG_RESULT(no - too old) ;; 157a90e161bSBill Fenner *) AC_MSG_RESULT(no) ;; 158a90e161bSBill Fenner esac 1593c602fabSXin LI LIBS="$savedlibs" 1603c602fabSXin LI ], 1613c602fabSXin LI [ 1623c602fabSXin LI AC_MSG_RESULT(not when cross-compiling) 1633c602fabSXin LI LIBS="$savedlibs" 1643c602fabSXin LI ] 165b0453382SBill Fenner ) 1663c602fabSXin LI ]) 1673c602fabSXin LI ]) 16827df3f5dSRui Paulofi 169b0453382SBill Fenner 170a90e161bSBill FennerAC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer]) 171a90e161bSBill FennerAC_ARG_ENABLE(smb, 172a90e161bSBill Fenner[ --enable-smb enable possibly-buggy SMB printer [default=yes] 173a90e161bSBill Fenner --disable-smb disable possibly-buggy SMB printer],, 174a90e161bSBill Fenner enableval=yes) 175a90e161bSBill Fennercase "$enableval" in 176a90e161bSBill Fenneryes) AC_MSG_RESULT(yes) 177a90e161bSBill Fenner AC_WARN([The SMB printer may have exploitable buffer overflows!!!]) 1783340d773SGleb Smirnoff AC_DEFINE(ENABLE_SMB, 1, 1793c602fabSXin LI [define if you want to build the possibly-buggy SMB printer]) 180a90e161bSBill Fenner LOCALSRC="print-smb.c smbutil.c $LOCALSRC" 181a90e161bSBill Fenner ;; 182a90e161bSBill Fenner*) AC_MSG_RESULT(no) 183a90e161bSBill Fenner ;; 184a90e161bSBill Fenneresac 185b0453382SBill Fenner 1861de50e9fSSam LefflerAC_ARG_WITH(user, [ --with-user=USERNAME drop privileges by default to USERNAME]) 1871de50e9fSSam LefflerAC_MSG_CHECKING([whether to drop root privileges by default]) 1881de50e9fSSam Lefflerif test ! -z "$with_user" ; then 1893c602fabSXin LI AC_DEFINE_UNQUOTED(WITH_USER, "$withval", 1903c602fabSXin LI [define if should drop privileges by default]) 1911de50e9fSSam Leffler AC_MSG_RESULT(to \"$withval\") 1921de50e9fSSam Lefflerelse 1931de50e9fSSam Leffler AC_MSG_RESULT(no) 1941de50e9fSSam Lefflerfi 1951de50e9fSSam Leffler 1961de50e9fSSam LefflerAC_ARG_WITH(chroot, [ --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY]) 1971de50e9fSSam LefflerAC_MSG_CHECKING([whether to chroot]) 19827df3f5dSRui Pauloif test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then 1993c602fabSXin LI AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval", 2003c602fabSXin LI [define if should chroot when dropping privileges]) 2011de50e9fSSam Leffler AC_MSG_RESULT(to \"$withval\") 2021de50e9fSSam Lefflerelse 2031de50e9fSSam Leffler AC_MSG_RESULT(no) 2041de50e9fSSam Lefflerfi 2051de50e9fSSam Leffler 2068bdc5a62SPatrick KelseyAC_ARG_WITH(sandbox-capsicum, 2078bdc5a62SPatrick Kelsey AS_HELP_STRING([--with-sandbox-capsicum], 2088bdc5a62SPatrick Kelsey [use Capsicum security functions @<:@default=yes, if available@:>@])) 2093c602fabSXin LI# 2103c602fabSXin LI# Check whether various functions are available. If any are, set 2113c602fabSXin LI# ac_lbl_capsicum_function_seen to yes; if any are not, set 2123c602fabSXin LI# ac_lbl_capsicum_function_not_seen to yes. 2133c602fabSXin LI# 2148bdc5a62SPatrick Kelsey# We don't check cap_rights_init(), as it's a macro, wrapping another 2158bdc5a62SPatrick Kelsey# function, in at least some versions of FreeBSD, and AC_CHECK_FUNCS() 2168bdc5a62SPatrick Kelsey# doesn't handle that. 2178bdc5a62SPatrick Kelsey# 2188bdc5a62SPatrick Kelsey# All of the ones we check for must be available in order to enable 2198bdc5a62SPatrick Kelsey# capsicum sandboxing. 2208bdc5a62SPatrick Kelsey# 2218bdc5a62SPatrick Kelsey# XXX - do we need to check for all of them, or are there some that, if 2228bdc5a62SPatrick Kelsey# present, imply others are present? 2233c602fabSXin LI# 2243c602fabSXin LIif test ! -z "$with_sandbox-capsicum" && test "$with_sandbox-capsicum" != "no" ; then 2258bdc5a62SPatrick Kelsey AC_CHECK_FUNCS(cap_enter cap_rights_limit cap_ioctls_limit openat, 2263c602fabSXin LI ac_lbl_capsicum_function_seen=yes, 2273c602fabSXin LI ac_lbl_capsicum_function_not_seen=yes) 2283c602fabSXin LIfi 2293c602fabSXin LIAC_MSG_CHECKING([whether to sandbox using capsicum]) 2303c602fabSXin LIif test "x$ac_lbl_capsicum_function_seen" = "xyes" -a "x$ac_lbl_capsicum_function_not_seen" != "xyes"; then 2313057e051SGleb Smirnoff AC_DEFINE(HAVE_CAPSICUM, 1, [capsicum support available]) 2323c602fabSXin LI AC_MSG_RESULT(yes) 2333c602fabSXin LIelse 2343c602fabSXin LI AC_MSG_RESULT(no) 2353c602fabSXin LIfi 2363c602fabSXin LI 2373c602fabSXin LI# 2383340d773SGleb Smirnoff# We must check this before checking whether to check the OS's IPv6, 2393340d773SGleb Smirnoff# support because, on some platforms (such as SunOS 5.x), the test 2403340d773SGleb Smirnoff# program requires the extra networking libraries. 2413c602fabSXin LI# 2423c602fabSXin LIAC_LBL_LIBRARY_NET 2433c602fabSXin LI 2443340d773SGleb Smirnoff# 2453340d773SGleb Smirnoff# Check whether AF_INET6 and struct in6_addr are defined. 2463340d773SGleb Smirnoff# If they aren't both defined, we don't have sufficient OS 2473340d773SGleb Smirnoff# support for IPv6, so we don't look for IPv6 support libraries, 2483340d773SGleb Smirnoff# and we define AF_INET6 and struct in6_addr ourselves. 2493340d773SGleb Smirnoff# 2503340d773SGleb SmirnoffAC_MSG_CHECKING([whether the operating system supports IPv6]) 2513c602fabSXin LIAC_COMPILE_IFELSE( 2523c602fabSXin LI [ 2533c602fabSXin LI AC_LANG_SOURCE( 2543340d773SGleb Smirnoff [[ 2553340d773SGleb Smirnoff/* AF_INET6 available check */ 256b0453382SBill Fenner#include <sys/types.h> 257b0453382SBill Fenner#include <sys/socket.h> 2583c602fabSXin LI#include <netinet/in.h> 2593c602fabSXin LI#ifdef AF_INET6 2603c602fabSXin LIvoid 2613c602fabSXin LIfoo(struct in6_addr *addr) 262b0453382SBill Fenner{ 2633c602fabSXin LI memset(addr, 0, sizeof (struct in6_addr)); 264b0453382SBill Fenner} 2653c602fabSXin LI#else 2663c602fabSXin LI#error "AF_INET6 not defined" 2673c602fabSXin LI#endif 2683c602fabSXin LI ]]) 269b0453382SBill Fenner ], 2703340d773SGleb Smirnoff [ 2713340d773SGleb Smirnoff AC_MSG_RESULT(yes) 2723340d773SGleb Smirnoff AC_DEFINE(HAVE_OS_IPV6_SUPPORT, 1, 2733340d773SGleb Smirnoff [define if the OS provides AF_INET6 and struct in6_addr]) 2743340d773SGleb Smirnoff ipv6=yes 2753340d773SGleb Smirnoff ], 2763340d773SGleb Smirnoff [ 2773340d773SGleb Smirnoff AC_MSG_RESULT(no) 2783340d773SGleb Smirnoff ipv6=no 2793340d773SGleb Smirnoff ] 2803340d773SGleb Smirnoff) 281b0453382SBill Fenner 282b0453382SBill Fenneripv6type=unknown 283b0453382SBill Fenneripv6lib=none 284b0453382SBill Fenneripv6trylibc=no 285b0453382SBill Fenner 286b0453382SBill Fennerif test "$ipv6" = "yes"; then 287b0453382SBill Fenner AC_MSG_CHECKING([ipv6 stack type]) 288b0453382SBill Fenner for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do 289b0453382SBill Fenner case $i in 290b0453382SBill Fenner inria) 291b0453382SBill Fenner dnl http://www.kame.net/ 2925b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 2935b0fe478SBruce M Simpson[#include <netinet/in.h> 294b0453382SBill Fenner#ifdef IPV6_INRIA_VERSION 295b0453382SBill Fenneryes 296b0453382SBill Fenner#endif], 2973340d773SGleb Smirnoff [ipv6type=$i]) 298b0453382SBill Fenner ;; 299b0453382SBill Fenner kame) 300b0453382SBill Fenner dnl http://www.kame.net/ 3015b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 3025b0fe478SBruce M Simpson[#include <netinet/in.h> 303b0453382SBill Fenner#ifdef __KAME__ 304b0453382SBill Fenneryes 305b0453382SBill Fenner#endif], 306b0453382SBill Fenner [ipv6type=$i; 307b0453382SBill Fenner ipv6lib=inet6; 308b0453382SBill Fenner ipv6libdir=/usr/local/v6/lib; 3093340d773SGleb Smirnoff ipv6trylibc=yes]) 310b0453382SBill Fenner ;; 311b0453382SBill Fenner linux-glibc) 312b0453382SBill Fenner dnl http://www.v6.linux.or.jp/ 3135b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 3145b0fe478SBruce M Simpson[#include <features.h> 315b0453382SBill Fenner#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 316b0453382SBill Fenneryes 317b0453382SBill Fenner#endif], 3183340d773SGleb Smirnoff [ipv6type=$i]) 319b0453382SBill Fenner ;; 320b0453382SBill Fenner linux-libinet6) 321b0453382SBill Fenner dnl http://www.v6.linux.or.jp/ 3225b0fe478SBruce M Simpson dnl 3235b0fe478SBruce M Simpson dnl This also matches Solaris 8 and Tru64 UNIX 5.1, 3245b0fe478SBruce M Simpson dnl and possibly other versions of those OSes 3255b0fe478SBruce M Simpson dnl 326b0453382SBill Fenner if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then 327b0453382SBill Fenner ipv6type=$i 328b0453382SBill Fenner ipv6lib=inet6 329b0453382SBill Fenner ipv6libdir=/usr/inet6/lib 330b0453382SBill Fenner ipv6trylibc=yes; 3313340d773SGleb Smirnoff CFLAGS="-I/usr/inet6/include $CFLAGS" 332b0453382SBill Fenner fi 333b0453382SBill Fenner ;; 334b0453382SBill Fenner toshiba) 3355b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 3365b0fe478SBruce M Simpson[#include <sys/param.h> 337b0453382SBill Fenner#ifdef _TOSHIBA_INET6 338b0453382SBill Fenneryes 339b0453382SBill Fenner#endif], 340b0453382SBill Fenner [ipv6type=$i; 341b0453382SBill Fenner ipv6lib=inet6; 3423340d773SGleb Smirnoff ipv6libdir=/usr/local/v6/lib]) 343b0453382SBill Fenner ;; 344b0453382SBill Fenner v6d) 3455b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 3465b0fe478SBruce M Simpson[#include </usr/local/v6/include/sys/v6config.h> 347b0453382SBill Fenner#ifdef __V6D__ 348b0453382SBill Fenneryes 349b0453382SBill Fenner#endif], 350b0453382SBill Fenner [ipv6type=$i; 351b0453382SBill Fenner ipv6lib=v6; 352b0453382SBill Fenner ipv6libdir=/usr/local/v6/lib; 353b0453382SBill Fenner CFLAGS="-I/usr/local/v6/include $CFLAGS"]) 354b0453382SBill Fenner ;; 355b0453382SBill Fenner zeta) 3565b0fe478SBruce M Simpson AC_EGREP_CPP(yes, 3575b0fe478SBruce M Simpson[#include <sys/param.h> 358b0453382SBill Fenner#ifdef _ZETA_MINAMI_INET6 359b0453382SBill Fenneryes 360b0453382SBill Fenner#endif], 361b0453382SBill Fenner [ipv6type=$i; 362b0453382SBill Fenner ipv6lib=inet6; 3633340d773SGleb Smirnoff ipv6libdir=/usr/local/v6/lib]) 364b0453382SBill Fenner ;; 365b0453382SBill Fenner esac 366b0453382SBill Fenner if test "$ipv6type" != "unknown"; then 367b0453382SBill Fenner break 368b0453382SBill Fenner fi 369b0453382SBill Fenner done 370b0453382SBill Fenner AC_MSG_RESULT($ipv6type) 371b0453382SBill Fennerfi 372b0453382SBill Fenner 373b0453382SBill Fennerif test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then 374b0453382SBill Fenner if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then 375b0453382SBill Fenner LIBS="-L$ipv6libdir -l$ipv6lib $LIBS" 376b0453382SBill Fenner echo "You have $ipv6lib library, using it" 377b0453382SBill Fenner else 378b0453382SBill Fenner if test "$ipv6trylibc" = "yes"; then 379b0453382SBill Fenner echo "You do not have $ipv6lib library, using libc" 380b0453382SBill Fenner else 381b0453382SBill Fenner echo 'Fatal: no $ipv6lib library found. cannot continue.' 382b0453382SBill Fenner echo "You need to fetch lib$ipv6lib.a from appropriate" 383b0453382SBill Fenner echo 'ipv6 kit and compile beforehand.' 384b0453382SBill Fenner exit 1 385b0453382SBill Fenner fi 386b0453382SBill Fenner fi 387b0453382SBill Fennerfi 388b0453382SBill Fenner 3895b0fe478SBruce M SimpsonAC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h], 3905b0fe478SBruce M Simpson[td_cv_decl_netdnet_dnetdb_h_dnet_htoa], 3915b0fe478SBruce M Simpson[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h, 3925b0fe478SBruce M Simpson td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes, 3935b0fe478SBruce M Simpson td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)]) 3945b0fe478SBruce M Simpsonif test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then 3953c602fabSXin LI AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1, 3963c602fabSXin LI [define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>]) 397b0453382SBill Fennerfi 398b0453382SBill Fenner 3993340d773SGleb SmirnoffAC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getopt_long) 400cac3dcd5SXin LIAC_CHECK_FUNCS(fork vfork strftime) 4011de50e9fSSam LefflerAC_CHECK_FUNCS(setlinebuf alarm) 402685295f4SBill Fenner 403685295f4SBill Fennerneedsnprintf=no 404685295f4SBill FennerAC_CHECK_FUNCS(vsnprintf snprintf,, 405685295f4SBill Fenner [needsnprintf=yes]) 406685295f4SBill Fennerif test $needsnprintf = yes; then 4071de50e9fSSam Leffler AC_LIBOBJ(snprintf) 408685295f4SBill Fennerfi 4094edb46e9SPaul Traina 410a90e161bSBill FennerAC_LBL_TYPE_SIGNAL 4114de76e31SBill Fenner 4123c602fabSXin LIAC_SEARCH_LIBS(dnet_htoa, dnet, 4133c602fabSXin LI AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function])) 414a90e161bSBill Fenner 415a90e161bSBill FennerAC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc 416a90e161bSBill Fenner 4171de50e9fSSam Lefflerdnl Some platforms may need -lnsl for getrpcbynumber. 4183c602fabSXin LIAC_SEARCH_LIBS(getrpcbynumber, nsl, 4193c602fabSXin LI AC_DEFINE(HAVE_GETRPCBYNUMBER, 1, [define if you have getrpcbynumber()])) 420a90e161bSBill Fenner 4214edb46e9SPaul TrainaAC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS) 4224edb46e9SPaul Traina 4235b0fe478SBruce M Simpson# 4245b0fe478SBruce M Simpson# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate 4255b0fe478SBruce M Simpson# libraries (e.g., "-lsocket -lnsl" on Solaris). 4265b0fe478SBruce M Simpson# 4271de50e9fSSam Leffler# You are in a twisty little maze of UN*Xes, all different. 4281de50e9fSSam Leffler# Some might not have ether_ntohost(). 4291de50e9fSSam Leffler# Some might have it, but not declare it in any header file. 4301de50e9fSSam Leffler# Some might have it, but declare it in <netinet/if_ether.h>. 4311de50e9fSSam Leffler# Some might have it, but declare it in <netinet/ether.h> 4321de50e9fSSam Leffler# (And some might have it but document it as something declared in 4331de50e9fSSam Leffler# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.) 4341de50e9fSSam Leffler# 4351de50e9fSSam Leffler# Before you is a C compiler. 4361de50e9fSSam Leffler# 4371de50e9fSSam LefflerAC_CHECK_FUNCS(ether_ntohost, [ 4381de50e9fSSam Leffler AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [ 4391de50e9fSSam Leffler AC_TRY_RUN([ 4401de50e9fSSam Leffler #include <netdb.h> 4411de50e9fSSam Leffler #include <sys/types.h> 4421de50e9fSSam Leffler #include <sys/param.h> 4431de50e9fSSam Leffler #include <sys/socket.h> 4441de50e9fSSam Leffler 4451de50e9fSSam Leffler int 4461de50e9fSSam Leffler main(int argc, char **argv) 4471de50e9fSSam Leffler { 4481de50e9fSSam Leffler u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff }; 4491de50e9fSSam Leffler char name[MAXHOSTNAMELEN]; 4501de50e9fSSam Leffler 4511de50e9fSSam Leffler ether_ntohost(name, (struct ether_addr *)ea); 4521de50e9fSSam Leffler exit(0); 4531de50e9fSSam Leffler } 4541de50e9fSSam Leffler ], [ac_cv_buggy_ether_ntohost=no], 4551de50e9fSSam Leffler [ac_cv_buggy_ether_ntohost=yes], 4561de50e9fSSam Leffler [ac_cv_buggy_ether_ntohost="not while cross-compiling"])]) 4571de50e9fSSam Leffler if test "$ac_cv_buggy_ether_ntohost" = "no"; then 4583c602fabSXin LI AC_DEFINE(USE_ETHER_NTOHOST, 1, 4593c602fabSXin LI [define if you have ether_ntohost() and it works]) 4601de50e9fSSam Leffler fi 4611de50e9fSSam Leffler]) 4621de50e9fSSam Lefflerif test "$ac_cv_func_ether_ntohost" = yes -a \ 4631de50e9fSSam Leffler "$ac_cv_buggy_ether_ntohost" = "no"; then 4641de50e9fSSam Leffler # 4651de50e9fSSam Leffler # OK, we have ether_ntohost(). Do we have <netinet/if_ether.h>? 4661de50e9fSSam Leffler # 4671de50e9fSSam Leffler if test "$ac_cv_header_netinet_if_ether_h" = yes; then 4681de50e9fSSam Leffler # 4691de50e9fSSam Leffler # Yes. Does it declare ether_ntohost()? 4701de50e9fSSam Leffler # 471f4d0c64aSSam Leffler AC_CHECK_DECL(ether_ntohost, 4721de50e9fSSam Leffler [ 4731de50e9fSSam Leffler AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,, 4741de50e9fSSam Leffler [Define to 1 if netinet/if_ether.h declares `ether_ntohost']) 4751de50e9fSSam Leffler ],, 4761de50e9fSSam Leffler [ 4771de50e9fSSam Leffler#include <sys/types.h> 4781de50e9fSSam Leffler#include <sys/socket.h> 4791de50e9fSSam Leffler#include <netinet/in.h> 480f4d0c64aSSam Leffler#include <arpa/inet.h> 4811de50e9fSSam Lefflerstruct mbuf; 4821de50e9fSSam Lefflerstruct rtentry; 4831de50e9fSSam Leffler#include <net/if.h> 4841de50e9fSSam Leffler#include <netinet/if_ether.h> 4851de50e9fSSam Leffler ]) 4861de50e9fSSam Leffler fi 4871de50e9fSSam Leffler # 4881de50e9fSSam Leffler # Did that succeed? 4891de50e9fSSam Leffler # 4901de50e9fSSam Leffler if test "$ac_cv_have_decl_ether_ntohost" != yes; then 4911de50e9fSSam Leffler # 4921de50e9fSSam Leffler # No, how about <netinet/ether.h>, as on Linux? 4931de50e9fSSam Leffler # 4941de50e9fSSam Leffler AC_CHECK_HEADERS(netinet/ether.h) 4951de50e9fSSam Leffler if test "$ac_cv_header_netinet_ether_h" = yes; then 4961de50e9fSSam Leffler # 4971de50e9fSSam Leffler # We have it - does it declare ether_ntohost()? 4981de50e9fSSam Leffler # Unset ac_cv_have_decl_ether_ntohost so we don't 4991de50e9fSSam Leffler # treat the previous failure as a cached value and 5001de50e9fSSam Leffler # suppress the next test. 5011de50e9fSSam Leffler # 5021de50e9fSSam Leffler unset ac_cv_have_decl_ether_ntohost 503f4d0c64aSSam Leffler AC_CHECK_DECL(ether_ntohost, 5041de50e9fSSam Leffler [ 5051de50e9fSSam Leffler AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,, 5061de50e9fSSam Leffler [Define to 1 if netinet/ether.h declares `ether_ntohost']) 5071de50e9fSSam Leffler ],, 5081de50e9fSSam Leffler [ 5091de50e9fSSam Leffler#include <netinet/ether.h> 5101de50e9fSSam Leffler ]) 5111de50e9fSSam Leffler fi 5121de50e9fSSam Leffler fi 513f4d0c64aSSam Leffler # 514f4d0c64aSSam Leffler # Is ether_ntohost() declared? 515f4d0c64aSSam Leffler # 516f4d0c64aSSam Leffler if test "$ac_cv_have_decl_ether_ntohost" != yes; then 517f4d0c64aSSam Leffler # 518f4d0c64aSSam Leffler # No, we'll have to declare it ourselves. 519f4d0c64aSSam Leffler # Do we have "struct ether_addr"? 520f4d0c64aSSam Leffler # 521f4d0c64aSSam Leffler AC_CHECK_TYPES(struct ether_addr,,, 522f4d0c64aSSam Leffler [ 523f4d0c64aSSam Leffler#include <sys/types.h> 524f4d0c64aSSam Leffler#include <sys/socket.h> 525f4d0c64aSSam Leffler#include <netinet/in.h> 526f4d0c64aSSam Leffler#include <arpa/inet.h> 527f4d0c64aSSam Lefflerstruct mbuf; 528f4d0c64aSSam Lefflerstruct rtentry; 529f4d0c64aSSam Leffler#include <net/if.h> 530f4d0c64aSSam Leffler#include <netinet/if_ether.h> 531f4d0c64aSSam Leffler ]) 532f4d0c64aSSam Leffler AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0, 533f4d0c64aSSam Leffler [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you 534f4d0c64aSSam Lefflerdon't.]) 535f4d0c64aSSam Leffler else 536f4d0c64aSSam Leffler AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1, 537f4d0c64aSSam Leffler [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you 538f4d0c64aSSam Lefflerdon't.]) 539f4d0c64aSSam Leffler fi 5401de50e9fSSam Lefflerfi 5415b0fe478SBruce M Simpson 542a5779b6eSRui Paulo# libdlpi is needed for Solaris 11 and later. 543a5779b6eSRui PauloAC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib) 544a5779b6eSRui Paulo 5458bdc5a62SPatrick Kelseydnl 5468bdc5a62SPatrick Kelseydnl Check for "pcap_list_datalinks()", "pcap_set_datalink()", 5478bdc5a62SPatrick Kelseydnl and "pcap_datalink_name_to_val()", and use substitute versions 5488bdc5a62SPatrick Kelseydnl if they're not present. 5498bdc5a62SPatrick Kelseydnl 5508bdc5a62SPatrick KelseyAC_CHECK_FUNC(pcap_list_datalinks, 5518bdc5a62SPatrick Kelsey [ 5528bdc5a62SPatrick Kelsey AC_DEFINE(HAVE_PCAP_LIST_DATALINKS, 1, 5538bdc5a62SPatrick Kelsey [define if libpcap has pcap_list_datalinks()]) 5548bdc5a62SPatrick Kelsey AC_CHECK_FUNCS(pcap_free_datalinks) 5558bdc5a62SPatrick Kelsey ], 5568bdc5a62SPatrick Kelsey [ 5578bdc5a62SPatrick Kelsey AC_LIBOBJ(datalinks) 5588bdc5a62SPatrick Kelsey ]) 5598bdc5a62SPatrick KelseyAC_CHECK_FUNCS(pcap_set_datalink) 5608bdc5a62SPatrick KelseyAC_CHECK_FUNC(pcap_datalink_name_to_val, 5618bdc5a62SPatrick Kelsey [ 5628bdc5a62SPatrick Kelsey AC_DEFINE(HAVE_PCAP_DATALINK_NAME_TO_VAL, 1, 5638bdc5a62SPatrick Kelsey [define if libpcap has pcap_datalink_name_to_val()]) 5648bdc5a62SPatrick Kelsey AC_CHECK_FUNC(pcap_datalink_val_to_description, 5658bdc5a62SPatrick Kelsey AC_DEFINE(HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION, 1, 5668bdc5a62SPatrick Kelsey [define if libpcap has pcap_datalink_val_to_description()]), 5678bdc5a62SPatrick Kelsey [ 5688bdc5a62SPatrick Kelsey AC_LIBOBJ(dlnames) 5698bdc5a62SPatrick Kelsey ]) 5708bdc5a62SPatrick Kelsey ], 5718bdc5a62SPatrick Kelsey [ 5728bdc5a62SPatrick Kelsey AC_LIBOBJ(dlnames) 5738bdc5a62SPatrick Kelsey ]) 5748bdc5a62SPatrick Kelsey 5758bdc5a62SPatrick Kelseydnl 5768bdc5a62SPatrick Kelseydnl Check for "pcap_breakloop()"; you can't substitute for it if 5778bdc5a62SPatrick Kelseydnl it's absent (it has hooks into the live capture routines), 5788bdc5a62SPatrick Kelseydnl so just define the HAVE_ value if it's there. 5798bdc5a62SPatrick Kelseydnl 5808bdc5a62SPatrick KelseyAC_CHECK_FUNCS(pcap_breakloop) 5818bdc5a62SPatrick Kelsey 5828bdc5a62SPatrick Kelseydnl 5838bdc5a62SPatrick Kelseydnl Check for "pcap_dump_ftell()" and use a substitute version 5848bdc5a62SPatrick Kelseydnl if it's not present. 5858bdc5a62SPatrick Kelseydnl 5868bdc5a62SPatrick KelseyAC_CHECK_FUNC(pcap_dump_ftell, 5878bdc5a62SPatrick Kelsey AC_DEFINE(HAVE_PCAP_DUMP_FTELL, 1, 5888bdc5a62SPatrick Kelsey [define if libpcap has pcap_dump_ftell()]), 5898bdc5a62SPatrick Kelsey [ 5908bdc5a62SPatrick Kelsey AC_LIBOBJ(pcap_dump_ftell) 5918bdc5a62SPatrick Kelsey ]) 5928bdc5a62SPatrick Kelsey 593a5779b6eSRui Paulo# 594a5779b6eSRui Paulo# Do we have the new open API? Check for pcap_create, and assume that, 595cac3dcd5SXin LI# if we do, we also have pcap_activate() and the other new routines 596cac3dcd5SXin LI# introduced in libpcap 1.0.0. 597cac3dcd5SXin LI# 598a5779b6eSRui PauloAC_CHECK_FUNCS(pcap_create) 599cac3dcd5SXin LIif test $ac_cv_func_pcap_create = "yes" ; then 600cac3dcd5SXin LI # 601cac3dcd5SXin LI # OK, do we have pcap_set_tstamp_type? If so, assume we have 602cac3dcd5SXin LI # pcap_list_tstamp_types and pcap_free_tstamp_types as well. 603cac3dcd5SXin LI # 604cac3dcd5SXin LI AC_CHECK_FUNCS(pcap_set_tstamp_type) 6053c602fabSXin LI # 6063c602fabSXin LI # And do we have pcap_set_tstamp_precision? If so, we assume 6073c602fabSXin LI # we also have pcap_open_offline_with_tstamp_precision. 6083c602fabSXin LI # 6093c602fabSXin LI AC_CHECK_FUNCS(pcap_set_tstamp_precision) 610cac3dcd5SXin LIfi 611a5779b6eSRui Paulo 6128bdc5a62SPatrick Kelsey# 6138bdc5a62SPatrick Kelsey# Check for a miscellaneous collection of functions which we use 6148bdc5a62SPatrick Kelsey# if we have them. 6158bdc5a62SPatrick Kelsey# 6168bdc5a62SPatrick KelseyAC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version pcap_setdirection pcap_set_immediate_mode) 6175b0fe478SBruce M Simpsonif test $ac_cv_func_pcap_findalldevs = "yes" ; then 6185b0fe478SBruce M Simpsondnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may 6195b0fe478SBruce M Simpsondnl be 0.8; this means that lib has pcap_findalldevs but header doesn't 6205b0fe478SBruce M Simpsondnl have pcap_if_t. 621d09a7e67SXin LI savedcppflags="$CPPFLAGS" 622a5779b6eSRui Paulo CPPFLAGS="$CPPFLAGS $V_INCLS" 6235b0fe478SBruce M Simpson AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>]) 624a5779b6eSRui Paulo CPPFLAGS="$savedcppflags" 6255b0fe478SBruce M Simpsonfi 6261de50e9fSSam Leffler 6275b0fe478SBruce M Simpsonif test $ac_cv_func_pcap_lib_version = "no" ; then 6285b0fe478SBruce M Simpson AC_MSG_CHECKING(whether pcap_version is defined by libpcap) 6295b0fe478SBruce M Simpson AC_TRY_LINK([], 6305b0fe478SBruce M Simpson [ 6315b0fe478SBruce M Simpson extern char pcap_version[]; 6325b0fe478SBruce M Simpson 6331de50e9fSSam Leffler return (int)pcap_version; 6345b0fe478SBruce M Simpson ], 6355b0fe478SBruce M Simpson ac_lbl_cv_pcap_version_defined=yes, 6365b0fe478SBruce M Simpson ac_lbl_cv_pcap_version_defined=no) 6375b0fe478SBruce M Simpson if test "$ac_lbl_cv_pcap_version_defined" = yes ; then 6385b0fe478SBruce M Simpson AC_MSG_RESULT(yes) 6393c602fabSXin LI AC_DEFINE(HAVE_PCAP_VERSION, 1, [define if libpcap has pcap_version]) 6405b0fe478SBruce M Simpson else 6415b0fe478SBruce M Simpson AC_MSG_RESULT(no) 6425b0fe478SBruce M Simpson fi 6435b0fe478SBruce M Simpsonfi 6443340d773SGleb Smirnoff 6453340d773SGleb Smirnoff# 6463340d773SGleb Smirnoff# Check for special debugging functions 6473340d773SGleb Smirnoff# 6483340d773SGleb SmirnoffAC_CHECK_FUNCS(pcap_set_parser_debug) 6493340d773SGleb Smirnoffif test "$ac_cv_func_pcap_set_parser_debug" = "no" ; then 6503340d773SGleb Smirnoff # 6513340d773SGleb Smirnoff # OK, we don't have pcap_set_parser_debug() to set the libpcap 6523340d773SGleb Smirnoff # filter expression parser debug flag; can we directly set the 6533340d773SGleb Smirnoff # flag? 6545b0fe478SBruce M Simpson AC_MSG_CHECKING(whether pcap_debug is defined by libpcap) 6555b0fe478SBruce M Simpson AC_TRY_LINK([], 6565b0fe478SBruce M Simpson [ 6575b0fe478SBruce M Simpson extern int pcap_debug; 6585b0fe478SBruce M Simpson 6595b0fe478SBruce M Simpson return pcap_debug; 6605b0fe478SBruce M Simpson ], 6615b0fe478SBruce M Simpson ac_lbl_cv_pcap_debug_defined=yes, 6625b0fe478SBruce M Simpson ac_lbl_cv_pcap_debug_defined=no) 6635b0fe478SBruce M Simpson if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then 6645b0fe478SBruce M Simpson AC_MSG_RESULT(yes) 6653c602fabSXin LI AC_DEFINE(HAVE_PCAP_DEBUG, 1, [define if libpcap has pcap_debug]) 6665b0fe478SBruce M Simpson else 6675b0fe478SBruce M Simpson AC_MSG_RESULT(no) 6685b0fe478SBruce M Simpson # 6695b0fe478SBruce M Simpson # OK, what about "yydebug"? 6705b0fe478SBruce M Simpson # 6715b0fe478SBruce M Simpson AC_MSG_CHECKING(whether yydebug is defined by libpcap) 6725b0fe478SBruce M Simpson AC_TRY_LINK([], 6735b0fe478SBruce M Simpson [ 6745b0fe478SBruce M Simpson extern int yydebug; 6755b0fe478SBruce M Simpson 6765b0fe478SBruce M Simpson return yydebug; 6775b0fe478SBruce M Simpson ], 6785b0fe478SBruce M Simpson ac_lbl_cv_yydebug_defined=yes, 6795b0fe478SBruce M Simpson ac_lbl_cv_yydebug_defined=no) 6805b0fe478SBruce M Simpson if test "$ac_lbl_cv_yydebug_defined" = yes ; then 6815b0fe478SBruce M Simpson AC_MSG_RESULT(yes) 6823c602fabSXin LI AC_DEFINE(HAVE_YYDEBUG, 1, [define if libpcap has yydebug]) 6835b0fe478SBruce M Simpson else 6845b0fe478SBruce M Simpson AC_MSG_RESULT(no) 6855b0fe478SBruce M Simpson fi 6865b0fe478SBruce M Simpson fi 6873340d773SGleb Smirnofffi 6883340d773SGleb SmirnoffAC_CHECK_FUNCS(pcap_set_optimizer_debug) 689685295f4SBill FennerAC_REPLACE_FUNCS(bpf_dump) dnl moved to libpcap in 0.6 690685295f4SBill Fenner 6914edb46e9SPaul TrainaV_GROUP=0 6924644f044SBill Fennerif test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then 6934644f044SBill Fenner V_GROUP=wheel 6944644f044SBill Fennerfi 69527df3f5dSRui Paulo# 69627df3f5dSRui Paulo# Assume V7/BSD convention for man pages (file formats in section 5, 69727df3f5dSRui Paulo# miscellaneous info in section 7). 69827df3f5dSRui Paulo# 69927df3f5dSRui PauloMAN_FILE_FORMATS=5 70027df3f5dSRui PauloMAN_MISC_INFO=7 701a90e161bSBill Fennercase "$host_os" in 7024edb46e9SPaul Traina 7034edb46e9SPaul Trainaaix*) 7044edb46e9SPaul Traina dnl Workaround to enable certain features 705cac3dcd5SXin LI AC_DEFINE(_SUN,1,[define on AIX to get certain functions]) 7064edb46e9SPaul Traina ;; 7074edb46e9SPaul Traina 70827df3f5dSRui Paulohpux*) 70927df3f5dSRui Paulo # 71027df3f5dSRui Paulo # Use System V conventions for man pages. 71127df3f5dSRui Paulo # 71227df3f5dSRui Paulo MAN_FILE_FORMATS=4 71327df3f5dSRui Paulo MAN_MISC_INFO=5 71427df3f5dSRui Paulo ;; 71527df3f5dSRui Paulo 7164edb46e9SPaul Trainairix*) 7174edb46e9SPaul Traina V_GROUP=sys 71827df3f5dSRui Paulo 71927df3f5dSRui Paulo # 72027df3f5dSRui Paulo # Use System V conventions for man pages. 72127df3f5dSRui Paulo # 72227df3f5dSRui Paulo MAN_FILE_FORMATS=4 72327df3f5dSRui Paulo MAN_MISC_INFO=5 7244edb46e9SPaul Traina ;; 7254edb46e9SPaul Traina 7264edb46e9SPaul Trainaosf*) 7274edb46e9SPaul Traina V_GROUP=system 72827df3f5dSRui Paulo 72927df3f5dSRui Paulo # 73027df3f5dSRui Paulo # Use System V conventions for man pages. 73127df3f5dSRui Paulo # 73227df3f5dSRui Paulo MAN_FILE_FORMATS=4 73327df3f5dSRui Paulo MAN_MISC_INFO=5 7344edb46e9SPaul Traina ;; 7354edb46e9SPaul Traina 7364edb46e9SPaul Trainasolaris*) 7374edb46e9SPaul Traina V_GROUP=sys 73827df3f5dSRui Paulo 73927df3f5dSRui Paulo # 74027df3f5dSRui Paulo # Use System V conventions for man pages. 74127df3f5dSRui Paulo # 74227df3f5dSRui Paulo MAN_FILE_FORMATS=4 74327df3f5dSRui Paulo MAN_MISC_INFO=5 7444edb46e9SPaul Traina ;; 7454edb46e9SPaul Trainaesac 7464edb46e9SPaul Traina 7474edb46e9SPaul Trainaif test -f /dev/bpf0 ; then 7484edb46e9SPaul Traina V_GROUP=bpf 7494edb46e9SPaul Trainafi 7504edb46e9SPaul Traina 7513c602fabSXin LI# 7523c602fabSXin LI# Make sure we have definitions for all the C99 specified-width types 7533c602fabSXin LI# (regardless of whether the environment is a C99 environment or not). 7543c602fabSXin LI# 7553c602fabSXin LIAC_TYPE_INT8_T 7563c602fabSXin LIAC_TYPE_INT16_T 7573c602fabSXin LIAC_TYPE_INT32_T 7583c602fabSXin LIAC_TYPE_INT64_T 7593c602fabSXin LIAC_TYPE_UINT8_T 7603c602fabSXin LIAC_TYPE_UINT16_T 7613c602fabSXin LIAC_TYPE_UINT32_T 7623c602fabSXin LIAC_TYPE_UINT64_T 7631de50e9fSSam Leffler 7641de50e9fSSam Leffler# 7658bdc5a62SPatrick Kelsey# Make sure we have a definition for C99's uintptr_t (regardless of 7668bdc5a62SPatrick Kelsey# whether the environment is a C99 environment or not). 7678bdc5a62SPatrick Kelsey# 7688bdc5a62SPatrick KelseyAC_TYPE_UINTPTR_T 7698bdc5a62SPatrick Kelsey 7708bdc5a62SPatrick Kelsey# 7713c602fabSXin LI# Define the old BSD specified-width types in terms of the C99 types; 7723c602fabSXin LI# we may need them with libpcap include files. 7733c602fabSXin LI# 7743c602fabSXin LIAC_CHECK_TYPE([u_int8_t], , 7753c602fabSXin LI [AC_DEFINE([u_int8_t], [uint8_t], 7763c602fabSXin LI [Define to `uint8_t' if u_int8_t not defined.])], 7773c602fabSXin LI [AC_INCLUDES_DEFAULT 7783c602fabSXin LI#include <sys/types.h> 7793c602fabSXin LI]) 7803c602fabSXin LIAC_CHECK_TYPE([u_int16_t], , 7813c602fabSXin LI [AC_DEFINE([u_int16_t], [uint16_t], 7823c602fabSXin LI [Define to `uint16_t' if u_int16_t not defined.])], 7833c602fabSXin LI [AC_INCLUDES_DEFAULT 7843c602fabSXin LI#include <sys/types.h> 7853c602fabSXin LI]) 7863c602fabSXin LIAC_CHECK_TYPE([u_int32_t], , 7873c602fabSXin LI [AC_DEFINE([u_int32_t], [uint32_t], 7883c602fabSXin LI [Define to `uint32_t' if u_int32_t not defined.])], 7893c602fabSXin LI [AC_INCLUDES_DEFAULT 7903c602fabSXin LI#include <sys/types.h> 7913c602fabSXin LI]) 7923c602fabSXin LIAC_CHECK_TYPE([u_int64_t], , 7933c602fabSXin LI [AC_DEFINE([u_int64_t], [uint64_t], 7943c602fabSXin LI [Define to `uint64_t' if u_int64_t not defined.])], 7953c602fabSXin LI [AC_INCLUDES_DEFAULT 7963c602fabSXin LI#include <sys/types.h> 7973c602fabSXin LI]) 7983c602fabSXin LI 7993c602fabSXin LI# 8003c602fabSXin LI# Check for <inttypes.h> 8011de50e9fSSam Leffler# 8021de50e9fSSam LefflerAC_CHECK_HEADERS(inttypes.h, 8031de50e9fSSam Leffler [ 8041de50e9fSSam Leffler # 8053c602fabSXin LI # OK, we have inttypes.h, but does it define all the PRI[doxu]64 macros? 8063c602fabSXin LI # Some systems have an inttypes.h that doesn't define all of them. 8071de50e9fSSam Leffler # 8081de50e9fSSam Leffler AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]]) 8091de50e9fSSam Leffler AC_COMPILE_IFELSE( 8101de50e9fSSam Leffler [ 8111de50e9fSSam Leffler AC_LANG_SOURCE( 8121de50e9fSSam Leffler [[ 8131de50e9fSSam Leffler #include <inttypes.h> 8141de50e9fSSam Leffler #include <stdio.h> 8151de50e9fSSam Leffler #include <sys/types.h> 8161de50e9fSSam Leffler 8171de50e9fSSam Leffler main() 8181de50e9fSSam Leffler { 8193c602fabSXin LI printf("%" PRId64 "\n", (uint64_t)1); 8203c602fabSXin LI printf("%" PRIo64 "\n", (uint64_t)1); 8213c602fabSXin LI printf("%" PRIx64 "\n", (uint64_t)1); 8223c602fabSXin LI printf("%" PRIu64 "\n", (uint64_t)1); 8231de50e9fSSam Leffler } 8241de50e9fSSam Leffler ]]) 8251de50e9fSSam Leffler ], 8261de50e9fSSam Leffler [ 8271de50e9fSSam Leffler AC_MSG_RESULT(yes) 8281de50e9fSSam Leffler ac_lbl_inttypes_h_defines_formats=yes 8291de50e9fSSam Leffler ], 8301de50e9fSSam Leffler [ 8311de50e9fSSam Leffler AC_MSG_RESULT(no) 8321de50e9fSSam Leffler ac_lbl_inttypes_h_defines_formats=no 8331de50e9fSSam Leffler ]) 8341de50e9fSSam Leffler ], 8351de50e9fSSam Leffler [ 8361de50e9fSSam Leffler # 8371de50e9fSSam Leffler # We don't have inttypes.h, so it obviously can't define those 8381de50e9fSSam Leffler # macros. 8391de50e9fSSam Leffler # 8401de50e9fSSam Leffler ac_lbl_inttypes_h_defines_formats=no 8411de50e9fSSam Leffler ]) 842f4d0c64aSSam Lefflerif test "$ac_lbl_inttypes_h_defines_formats" = no; then 843f4d0c64aSSam Leffler AC_LBL_CHECK_64BIT_FORMAT(l, 844f4d0c64aSSam Leffler [ 8451de50e9fSSam Leffler AC_LBL_CHECK_64BIT_FORMAT(ll, 8461de50e9fSSam Leffler [ 8471de50e9fSSam Leffler AC_LBL_CHECK_64BIT_FORMAT(L, 8481de50e9fSSam Leffler [ 8491de50e9fSSam Leffler AC_LBL_CHECK_64BIT_FORMAT(q, 8501de50e9fSSam Leffler [ 8511de50e9fSSam Leffler AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer]) 8521de50e9fSSam Leffler ]) 8531de50e9fSSam Leffler ]) 8541de50e9fSSam Leffler ]) 855f4d0c64aSSam Leffler ]) 8561de50e9fSSam Lefflerfi 8574edb46e9SPaul Traina 858cac3dcd5SXin LI# 859cac3dcd5SXin LI# Check for some headers introduced in later versions of libpcap 860cac3dcd5SXin LI# and used by some printers. 861cac3dcd5SXin LI# 862cac3dcd5SXin LI# Those headers use the {u_}intN_t types, so we must do this after 863cac3dcd5SXin LI# we check for what's needed to get them defined. 864cac3dcd5SXin LI# 865cac3dcd5SXin LIsavedcppflags="$CPPFLAGS" 866cac3dcd5SXin LICPPFLAGS="$CPPFLAGS $V_INCLS" 8673340d773SGleb SmirnoffAC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include "netdissect-stdinc.h"]) 8683340d773SGleb SmirnoffAC_CHECK_HEADERS(pcap/nflog.h,,,[#include "netdissect-stdinc.h"]) 8693340d773SGleb SmirnoffAC_CHECK_HEADERS(pcap/usb.h,,,[#include "netdissect-stdinc.h"]) 870cac3dcd5SXin LICPPFLAGS="$savedcppflags" 871cac3dcd5SXin LI 872a5779b6eSRui PauloAC_PROG_RANLIB 8733c602fabSXin LIAC_CHECK_TOOL([AR], [ar]) 874a5779b6eSRui Paulo 8754edb46e9SPaul TrainaAC_LBL_DEVEL(V_CCOPT) 8764edb46e9SPaul Traina 8774edb46e9SPaul TrainaAC_LBL_SOCKADDR_SA_LEN 8784edb46e9SPaul Traina 8794edb46e9SPaul TrainaAC_LBL_UNALIGNED_ACCESS 8804edb46e9SPaul Traina 8813340d773SGleb Smirnoff# Check for OpenSSL/libressl libcrypto 8823340d773SGleb SmirnoffAC_MSG_CHECKING(whether to use OpenSSL/libressl libcrypto) 883a5779b6eSRui Paulo# Specify location for both includes and libraries. 884d03c0883SXin LIwant_libcrypto=ifavailable 885a5779b6eSRui PauloAC_ARG_WITH(crypto, 8863340d773SGleb Smirnoff AS_HELP_STRING([--with-crypto]@<:@=DIR@:>@, 8873340d773SGleb Smirnoff [use OpenSSL/libressl libcrypto (located in directory DIR, if specified) @<:@default=yes, if available@:>@]), 888a5779b6eSRui Paulo[ 889a5779b6eSRui Paulo if test $withval = no 890a5779b6eSRui Paulo then 8913340d773SGleb Smirnoff # User doesn't want to link with libcrypto. 892a5779b6eSRui Paulo want_libcrypto=no 893a5779b6eSRui Paulo AC_MSG_RESULT(no) 894a5779b6eSRui Paulo elif test $withval = yes 895a5779b6eSRui Paulo then 8963340d773SGleb Smirnoff # User wants to link with libcrypto but hasn't specified 8973340d773SGleb Smirnoff # a directory. 898a5779b6eSRui Paulo want_libcrypto=yes 899a5779b6eSRui Paulo AC_MSG_RESULT(yes) 9003340d773SGleb Smirnoff else 9013340d773SGleb Smirnoff # User wants to link with libcrypto and has specified 9023340d773SGleb Smirnoff # a directory, so use the provided value. 9033340d773SGleb Smirnoff want_libcrypto=yes 9043340d773SGleb Smirnoff libcrypto_root=$withval 9053340d773SGleb Smirnoff AC_MSG_RESULT([yes, using the version installed in $withval]) 9063340d773SGleb Smirnoff 9073340d773SGleb Smirnoff # 9083340d773SGleb Smirnoff # Put the subdirectories of the libcrypto root directory 9093340d773SGleb Smirnoff # at the front of the header and library search path. 9103340d773SGleb Smirnoff # 9113340d773SGleb Smirnoff CFLAGS="-I$withval/include $CFLAGS" 9123340d773SGleb Smirnoff LIBS="-L$withval/lib $LIBS" 913a5779b6eSRui Paulo fi 914a5779b6eSRui Paulo],[ 915a5779b6eSRui Paulo # 9163340d773SGleb Smirnoff # Use libcrypto if it's present, otherwise don't; no directory 9173340d773SGleb Smirnoff # was specified. 918a5779b6eSRui Paulo # 919a5779b6eSRui Paulo want_libcrypto=ifavailable 920a5779b6eSRui Paulo AC_MSG_RESULT([yes, if available]) 921a5779b6eSRui Paulo]) 922a5779b6eSRui Pauloif test "$want_libcrypto" != "no"; then 9233340d773SGleb Smirnoff # 9243340d773SGleb Smirnoff # Don't check for libcrypto unless we have its headers; 9253340d773SGleb Smirnoff # Apple, bless their pointy little heads, apparently ship 9263340d773SGleb Smirnoff # libcrypto as a library, but not the header files, in 9273340d773SGleb Smirnoff # El Capitan, probably because they don't want you writing 9283340d773SGleb Smirnoff # nasty portable code that could run on other UN*Xes, they 9293340d773SGleb Smirnoff # want you writing code that uses their Shiny New Crypto 9303340d773SGleb Smirnoff # Library and that only runs on OS X. 9313340d773SGleb Smirnoff # 9323340d773SGleb Smirnoff AC_CHECK_HEADER(openssl/crypto.h, 9333340d773SGleb Smirnoff [ 9341de50e9fSSam Leffler AC_CHECK_LIB(crypto, DES_cbc_encrypt) 9353340d773SGleb Smirnoff if test "$ac_cv_lib_crypto_DES_cbc_encrypt" = "yes"; then 9365b0fe478SBruce M Simpson AC_CHECK_HEADERS(openssl/evp.h) 9373340d773SGleb Smirnoff # 938*0bff6a5aSEd Maste # OK, then: 939*0bff6a5aSEd Maste # 940*0bff6a5aSEd Maste # 1) do we have EVP_CIPHER_CTX_new? 9413340d773SGleb Smirnoff # If so, we use it to allocate an 9423340d773SGleb Smirnoff # EVP_CIPHER_CTX, as EVP_CIPHER_CTX may be 9433340d773SGleb Smirnoff # opaque; otherwise, we allocate it ourselves. 9443340d773SGleb Smirnoff # 945*0bff6a5aSEd Maste # 2) do we have EVP_CipherInit_ex()? 946*0bff6a5aSEd Maste # If so, we use it, because we need to be 947*0bff6a5aSEd Maste # able to make two "initialize the cipher" 948*0bff6a5aSEd Maste # calls, one with the cipher and key, and 949*0bff6a5aSEd Maste # one with the IV, and, as of OpenSSL 1.1, 950*0bff6a5aSEd Maste # You Can't Do That with EVP_CipherInit(), 951*0bff6a5aSEd Maste # because a call to EVP_CipherInit() will 952*0bff6a5aSEd Maste # unconditionally clear the context, and 953*0bff6a5aSEd Maste # if you don't supply a cipher, it'll 954*0bff6a5aSEd Maste # clear the cipher, rendering the context 955*0bff6a5aSEd Maste # unusable and causing a crash. 956*0bff6a5aSEd Maste # 957*0bff6a5aSEd Maste AC_CHECK_FUNCS(EVP_CIPHER_CTX_new EVP_CipherInit_ex) 9583340d773SGleb Smirnoff fi 9593340d773SGleb Smirnoff ]) 960a5779b6eSRui Paulofi 9614edb46e9SPaul Traina 9628bdc5a62SPatrick Kelsey# Check for libcap-ng 9638bdc5a62SPatrick KelseyAC_MSG_CHECKING(whether to use libcap-ng) 9648bdc5a62SPatrick Kelsey# Specify location for both includes and libraries. 9658bdc5a62SPatrick Kelseywant_libcap_ng=ifavailable 9668bdc5a62SPatrick KelseyAC_ARG_WITH(cap_ng, 9678bdc5a62SPatrick Kelsey AS_HELP_STRING([--with-cap-ng], 9688bdc5a62SPatrick Kelsey [use libcap-ng @<:@default=yes, if available@:>@]), 9698bdc5a62SPatrick Kelsey[ 9708bdc5a62SPatrick Kelsey if test $withval = no 9718bdc5a62SPatrick Kelsey then 9728bdc5a62SPatrick Kelsey want_libcap_ng=no 9738bdc5a62SPatrick Kelsey AC_MSG_RESULT(no) 9748bdc5a62SPatrick Kelsey elif test $withval = yes 9758bdc5a62SPatrick Kelsey then 9768bdc5a62SPatrick Kelsey want_libcap_ng=yes 9778bdc5a62SPatrick Kelsey AC_MSG_RESULT(yes) 9788bdc5a62SPatrick Kelsey fi 9798bdc5a62SPatrick Kelsey],[ 9808bdc5a62SPatrick Kelsey # 9818bdc5a62SPatrick Kelsey # Use libcap-ng if it's present, otherwise don't. 9828bdc5a62SPatrick Kelsey # 9838bdc5a62SPatrick Kelsey want_libcap_ng=ifavailable 9848bdc5a62SPatrick Kelsey AC_MSG_RESULT([yes, if available]) 9858bdc5a62SPatrick Kelsey]) 9868bdc5a62SPatrick Kelseyif test "$want_libcap_ng" != "no"; then 9878bdc5a62SPatrick Kelsey AC_CHECK_LIB(cap-ng, capng_change_id) 9888bdc5a62SPatrick Kelsey AC_CHECK_HEADERS(cap-ng.h) 9898bdc5a62SPatrick Kelseyfi 9908bdc5a62SPatrick Kelsey 9911de50e9fSSam Lefflerdnl 9921de50e9fSSam Lefflerdnl set additional include path if necessary 9931de50e9fSSam Lefflerif test "$missing_includes" = "yes"; then 994cac3dcd5SXin LI CPPFLAGS="$CPPFLAGS -I$srcdir/missing" 995cac3dcd5SXin LI V_INCLS="$V_INCLS -I$srcdir/missing" 9961de50e9fSSam Lefflerfi 9971de50e9fSSam Leffler 9984edb46e9SPaul TrainaAC_SUBST(V_CCOPT) 9995b0fe478SBruce M SimpsonAC_SUBST(V_DEFS) 10004edb46e9SPaul TrainaAC_SUBST(V_GROUP) 10014edb46e9SPaul TrainaAC_SUBST(V_INCLS) 10024edb46e9SPaul TrainaAC_SUBST(V_PCAPDEP) 1003b0453382SBill FennerAC_SUBST(LOCALSRC) 100427df3f5dSRui PauloAC_SUBST(MAN_FILE_FORMATS) 100527df3f5dSRui PauloAC_SUBST(MAN_MISC_INFO) 10064edb46e9SPaul Traina 10074edb46e9SPaul TrainaAC_PROG_INSTALL 10084edb46e9SPaul Traina 1009b0453382SBill FennerAC_CONFIG_HEADER(config.h) 1010b0453382SBill Fenner 1011685295f4SBill FennerAC_OUTPUT_COMMANDS([if test -f .devel; then 1012685295f4SBill Fenner echo timestamp > stamp-h 1013685295f4SBill Fenner cat Makefile-devel-adds >> Makefile 10144edb46e9SPaul Traina make depend 1015685295f4SBill Fennerfi]) 101627df3f5dSRui PauloAC_OUTPUT(Makefile tcpdump.1) 10174edb46e9SPaul Trainaexit 0 1018