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