configure.in revision 172677
1130812Smarceldnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.13 2007/09/12 19:17:24 guy Exp $ (LBL) 2130812Smarceldnl 3130812Smarceldnl Copyright (c) 1994, 1995, 1996, 1997 4130812Smarceldnl The Regents of the University of California. All rights reserved. 5130812Smarceldnl 6130812Smarceldnl Process this file with autoconf to produce a configure script. 7130812Smarceldnl 8130812Smarcel 9130812SmarcelAC_REVISION($Revision: 1.120.2.13 $) 10130812SmarcelAC_PREREQ(2.50) 11130812SmarcelAC_INIT(pcap.c) 12130812Smarcel 13130812SmarcelAC_CANONICAL_SYSTEM 14130812Smarcel 15130812SmarcelAC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS) 16130812SmarcelAC_LBL_C_INLINE 17130812SmarcelAC_C___ATTRIBUTE__ 18130812Smarcel 19130812SmarcelAC_LBL_CHECK_TYPE(u_int8_t, u_char) 20130812SmarcelAC_LBL_CHECK_TYPE(u_int16_t, u_short) 21130812SmarcelAC_LBL_CHECK_TYPE(u_int32_t, u_int) 22130812Smarcel 23130812Smarceldnl 24130812Smarceldnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program 25130812Smarceldnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to 26130812Smarceldnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise 27130812Smarceldnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris. 28130812Smarceldnl 29130812SmarcelAC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h) 30130812SmarcelAC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> 31130812Smarcel#include <sys/socket.h> 32130812Smarcel#include <net/if.h>]) 33130812SmarcelAC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> 34130812Smarcel#include <sys/socket.h>]) 35130812Smarcelif test "$ac_cv_header_netinet_if_ether_h" != yes; then 36130812Smarcel # 37130812Smarcel # The simple test didn't work. 38130812Smarcel # Do we need to include <net/if.h> first? 39130812Smarcel # Unset ac_cv_header_netinet_if_ether_h so we don't 40130812Smarcel # treat the previous failure as a cached value and 41130812Smarcel # suppress the next test. 42130812Smarcel # 43130812Smarcel AC_MSG_NOTICE([Rechecking with some additional includes]) 44130812Smarcel unset ac_cv_header_netinet_if_ether_h 45130812Smarcel AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> 46130812Smarcel#include <sys/socket.h> 47130812Smarcel#include <netinet/in.h> 48130812Smarcelstruct mbuf; 49130812Smarcelstruct rtentry; 50130812Smarcel#include <net/if.h>]) 51130812Smarcelfi 52130812Smarcel 53130812SmarcelAC_LBL_FIXINCLUDES 54130812Smarcel 55130812SmarcelAC_CHECK_FUNCS(strerror strlcpy) 56130812Smarcel 57130812Smarcelneedsnprintf=no 58130812SmarcelAC_CHECK_FUNCS(vsnprintf snprintf,, 59130812Smarcel [needsnprintf=yes]) 60130812Smarcelif test $needsnprintf = yes; then 61130812Smarcel AC_LIBOBJ(snprintf) 62130812Smarcelfi 63130812Smarcel 64130812Smarcel# 65130812Smarcel# Do this before checking for ether_hostton(), as it's a 66130812Smarcel# "gethostbyname() -ish function". 67130812Smarcel# 68130812SmarcelAC_LBL_LIBRARY_NET 69130812Smarcel 70130812Smarcel# 71130812Smarcel# You are in a twisty little maze of UN*Xes, all different. 72130812Smarcel# Some might not have ether_hostton(). 73130812Smarcel# Some might have it, but not declare it in any header file. 74130812Smarcel# Some might have it, but declare it in <netinet/if_ether.h>. 75130812Smarcel# Some might have it, but declare it in <netinet/ether.h> 76130812Smarcel# (And some might have it but document it as something declared in 77130812Smarcel# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.) 78130812Smarcel# 79130812Smarcel# Before you is a C compiler. 80130812Smarcel# 81130812SmarcelAC_CHECK_FUNCS(ether_hostton) 82130812Smarcelif test "$ac_cv_func_ether_hostton" = yes; then 83130812Smarcel # 84130812Smarcel # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>? 85130812Smarcel # 86130812Smarcel if test "$ac_cv_header_netinet_if_ether_h" = yes; then 87130812Smarcel # 88130812Smarcel # Yes. Does it declare ether_hostton()? 89130812Smarcel # 90130812Smarcel AC_CHECK_DECL(ether_hostton, 91130812Smarcel [ 92130812Smarcel AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,, 93130812Smarcel [Define to 1 if netinet/if_ether.h declares `ether_hostton']) 94130812Smarcel ],, 95130812Smarcel [ 96130812Smarcel#include <sys/types.h> 97130812Smarcel#include <sys/socket.h> 98130812Smarcel#include <netinet/in.h> 99130812Smarcel#include <arpa/inet.h> 100130812Smarcelstruct mbuf; 101130812Smarcelstruct rtentry; 102130812Smarcel#include <net/if.h> 103130812Smarcel#include <netinet/if_ether.h> 104130812Smarcel ]) 105130812Smarcel fi 106130812Smarcel # 107130812Smarcel # Did that succeed? 108130812Smarcel # 109130812Smarcel if test "$ac_cv_have_decl_ether_hostton" != yes; then 110130812Smarcel # 111130812Smarcel # No, how about <netinet/ether.h>, as on Linux? 112130812Smarcel # 113130812Smarcel AC_CHECK_HEADERS(netinet/ether.h) 114130812Smarcel if test "$ac_cv_header_netinet_ether_h" = yes; then 115130812Smarcel # 116130812Smarcel # We have it - does it declare ether_hostton()? 117130812Smarcel # Unset ac_cv_have_decl_ether_hostton so we don't 118130812Smarcel # treat the previous failure as a cached value and 119130812Smarcel # suppress the next test. 120130812Smarcel # 121130812Smarcel unset ac_cv_have_decl_ether_hostton 122130812Smarcel AC_CHECK_DECL(ether_hostton, 123130812Smarcel [ 124130812Smarcel AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,, 125130812Smarcel [Define to 1 if netinet/ether.h declares `ether_hostton']) 126130812Smarcel ],, 127130812Smarcel [ 128130812Smarcel#include <netinet/ether.h> 129130812Smarcel ]) 130130812Smarcel fi 131130812Smarcel fi 132130812Smarcel # 133130812Smarcel # Is ether_hostton() declared? 134130812Smarcel # 135130812Smarcel if test "$ac_cv_have_decl_ether_hostton" != yes; then 136130812Smarcel # 137130812Smarcel # No, we'll have to declare it ourselves. 138130812Smarcel # Do we have "struct ether_addr"? 139130812Smarcel # 140130812Smarcel AC_CHECK_TYPES(struct ether_addr,,, 141130812Smarcel [ 142130812Smarcel#include <sys/types.h> 143130812Smarcel#include <sys/socket.h> 144130812Smarcel#include <netinet/in.h> 145130812Smarcel#include <arpa/inet.h> 146130812Smarcelstruct mbuf; 147130812Smarcelstruct rtentry; 148130812Smarcel#include <net/if.h> 149130812Smarcel#include <netinet/if_ether.h> 150130812Smarcel ]) 151130812Smarcel AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0, 152130812Smarcel [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you 153130812Smarceldon't.]) 154130812Smarcel else 155130812Smarcel AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1, 156130812Smarcel [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you 157130812Smarceldon't.]) 158130812Smarcel fi 159130812Smarcelfi 160130812Smarcel 161130812Smarceldnl to pacify those who hate protochain insn 162130812SmarcelAC_MSG_CHECKING(if --disable-protochain option is specified) 163130812SmarcelAC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn]) 164130812Smarcelcase "x$enable_protochain" in 165130812Smarcelxyes) enable_protochain=enabled ;; 166130812Smarcelxno) enable_protochain=disabled ;; 167130812Smarcelx) enable_protochain=enabled ;; 168130812Smarcelesac 169130812Smarcel 170130812Smarcelif test "$enable_protochain" = "disabled"; then 171130812Smarcel AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain]) 172130812Smarcelfi 173130812SmarcelAC_MSG_RESULT(${enable_protochain}) 174130812Smarcel 175130812Smarceldnl 176130812Smarceldnl Not all versions of test support -c (character special) but it's a 177130812Smarceldnl better way of testing since the device might be protected. So we 178130812Smarceldnl check in our normal order using -r and then check the for the /dev 179130812Smarceldnl guys again using -c. 180130812Smarceldnl 181130812Smarceldnl XXX This could be done for cross-compiling, but for now it's not. 182130812Smarceldnl 183130812Smarcelif test -z "$with_pcap" && test "$cross_compiling" = yes; then 184130812Smarcel AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...) 185130812Smarcelfi 186130812SmarcelAC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE]) 187130812SmarcelAC_MSG_CHECKING(packet capture type) 188130812Smarcelif test ! -z "$with_pcap" ; then 189130812Smarcel V_PCAP="$withval" 190130812Smarcelelif test -r /dev/bpf ; then 191130812Smarcel # 192130812Smarcel # Cloning BPF device. 193130812Smarcel # 194130812Smarcel V_PCAP=bpf 195130812Smarcel AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device]) 196130812Smarcelelif test -r /dev/bpf0 ; then 197130812Smarcel V_PCAP=bpf 198130812Smarcelelif test -r /usr/include/net/pfilt.h ; then 199130812Smarcel V_PCAP=pf 200130812Smarcelelif test -r /dev/enet ; then 201130812Smarcel V_PCAP=enet 202130812Smarcelelif test -r /dev/nit ; then 203130812Smarcel V_PCAP=snit 204130812Smarcelelif test -r /usr/include/sys/net/nit.h ; then 205130812Smarcel V_PCAP=nit 206130812Smarcelelif test -r /usr/include/linux/socket.h ; then 207130812Smarcel V_PCAP=linux 208130812Smarcelelif test -r /usr/include/net/raw.h ; then 209130812Smarcel V_PCAP=snoop 210130812Smarcelelif test -r /usr/include/odmi.h ; then 211130812Smarcel # 212130812Smarcel # On AIX, the BPF devices might not yet be present - they're 213130812Smarcel # created the first time libpcap runs after booting. 214130812Smarcel # We check for odmi.h instead. 215130812Smarcel # 216130812Smarcel V_PCAP=bpf 217130812Smarcelelif test -r /usr/include/sys/dlpi.h ; then 218130812Smarcel V_PCAP=dlpi 219130812Smarcelelif test -c /dev/bpf0 ; then # check again in case not readable 220130812Smarcel V_PCAP=bpf 221130812Smarcelelif test -c /dev/enet ; then # check again in case not readable 222130812Smarcel V_PCAP=enet 223130812Smarcelelif test -c /dev/nit ; then # check again in case not readable 224130812Smarcel V_PCAP=snit 225130812Smarcelelse 226130812Smarcel V_PCAP=null 227130812Smarcelfi 228130812SmarcelAC_MSG_RESULT($V_PCAP) 229130812Smarcel 230130812Smarceldnl 231130812Smarceldnl Now figure out how we get a list of interfaces and addresses, 232130812Smarceldnl if we support capturing. Don't bother if we don't support 233130812Smarceldnl capturing. 234130812Smarceldnl 235130812Smarcelif test "$V_PCAP" = null 236130812Smarcelthen 237130812Smarcel # 238130812Smarcel # We can't capture, so we can't open any capture 239130812Smarcel # devices, so we won't return any interfaces. 240130812Smarcel # 241130812Smarcel V_FINDALLDEVS=null 242130812Smarcelelse 243130812Smarcel AC_CHECK_FUNC(getifaddrs,[ 244130812Smarcel # 245130812Smarcel # We have "getifaddrs()"; make sure we have <ifaddrs.h> 246130812Smarcel # as well, just in case some platform is really weird. 247130812Smarcel # 248130812Smarcel AC_CHECK_HEADER(ifaddrs.h,[ 249130812Smarcel # 250130812Smarcel # We have the header, so we use "getifaddrs()" to 251130812Smarcel # get the list of interfaces. 252130812Smarcel # 253130812Smarcel V_FINDALLDEVS=getad 254130812Smarcel ],[ 255130812Smarcel # 256130812Smarcel # We don't have the header - give up. 257130812Smarcel # XXX - we could also fall back on some other 258130812Smarcel # mechanism, but, for now, this'll catch this 259130812Smarcel # problem so that we can at least try to figure 260130812Smarcel # out something to do on systems with "getifaddrs()" 261130812Smarcel # but without "ifaddrs.h", if there is something 262130812Smarcel # we can do on those systems. 263130812Smarcel # 264130812Smarcel AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.]) 265130812Smarcel ]) 266130812Smarcel ],[ 267130812Smarcel # 268130812Smarcel # Well, we don't have "getifaddrs()", so we have to use 269130812Smarcel # some other mechanism; determine what that mechanism is. 270130812Smarcel # 271130812Smarcel # The first thing we use is the type of capture mechanism, 272130812Smarcel # which is somewhat of a proxy for the OS we're using. 273130812Smarcel # 274130812Smarcel case "$V_PCAP" in 275130812Smarcel 276130812Smarcel dlpi) 277130812Smarcel # 278130812Smarcel # This might be Solaris 8 or later, with 279130812Smarcel # SIOCGLIFCONF, or it might be some other OS 280130812Smarcel # or some older version of Solaris, with 281130812Smarcel # just SIOCGIFCONF. 282130812Smarcel # 283130812Smarcel AC_MSG_CHECKING(whether we have SIOCGLIFCONF) 284130812Smarcel AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf, 285130812Smarcel AC_TRY_COMPILE( 286130812Smarcel [#include <sys/param.h> 287130812Smarcel #include <sys/file.h> 288130812Smarcel #include <sys/ioctl.h> 289130812Smarcel #include <sys/socket.h> 290130812Smarcel #include <sys/sockio.h>], 291130812Smarcel [ioctl(0, SIOCGLIFCONF, (char *)0);], 292130812Smarcel ac_cv_lbl_have_siocglifconf=yes, 293130812Smarcel ac_cv_lbl_have_siocglifconf=no)) 294130812Smarcel AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf) 295130812Smarcel if test $ac_cv_lbl_have_siocglifconf = yes ; then 296130812Smarcel V_FINDALLDEVS=glifc 297130812Smarcel else 298130812Smarcel V_FINDALLDEVS=gifc 299130812Smarcel fi 300130812Smarcel ;; 301130812Smarcel 302130812Smarcel *) 303130812Smarcel # 304130812Smarcel # Assume we just have SIOCGIFCONF. 305130812Smarcel # (XXX - on at least later Linux kernels, there's 306130812Smarcel # another mechanism, and we should be using that 307130812Smarcel # instead.) 308130812Smarcel # 309130812Smarcel V_FINDALLDEVS=gifc 310130812Smarcel ;; 311130812Smarcel esac]) 312130812Smarcelfi 313130812Smarcel 314130812SmarcelAC_MSG_CHECKING(if --enable-ipv6 option is specified) 315130812SmarcelAC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version]) 316130812Smarcelif test "$enable_ipv6" = "yes"; then 317130812Smarcel AC_DEFINE(INET6,1,[IPv6]) 318130812Smarcelfi 319130812SmarcelAC_MSG_RESULT(${enable_ipv6-no}) 320130812Smarcel 321130812SmarcelAC_MSG_CHECKING(whether to build optimizer debugging code) 322130812SmarcelAC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code]) 323130812Smarcelif test "$enable_optimizer_dbg" = "yes"; then 324130812Smarcel AC_DEFINE(BDEBUG,1,[Enable optimizer debugging]) 325130812Smarcelfi 326130812SmarcelAC_MSG_RESULT(${enable_optimizer_dbg-no}) 327130812Smarcel 328130812SmarcelAC_MSG_CHECKING(whether to build parser debugging code) 329130812SmarcelAC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code]) 330130812Smarcelif test "$enable_yydebug" = "yes"; then 331130812Smarcel AC_DEFINE(YYDEBUG,1,[Enable parser debugging]) 332130812Smarcelfi 333130812SmarcelAC_MSG_RESULT(${enable_yydebug-no}) 334130812Smarcel 335130812Smarcelcase "$V_PCAP" in 336130812Smarcel 337130812Smarceldlpi) 338130812Smarcel AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) 339130812Smarcel AC_MSG_CHECKING(for /dev/dlpi device) 340130812Smarcel if test -c /dev/dlpi ; then 341130812Smarcel AC_MSG_RESULT(yes) 342130812Smarcel AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi]) 343130812Smarcel else 344130812Smarcel AC_MSG_RESULT(no) 345130812Smarcel dir="/dev/dlpi" 346130812Smarcel AC_MSG_CHECKING(for $dir directory) 347130812Smarcel if test -d $dir ; then 348130812Smarcel AC_MSG_RESULT(yes) 349130812Smarcel AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory]) 350130812Smarcel else 351130812Smarcel AC_MSG_RESULT(no) 352130812Smarcel fi 353130812Smarcel fi 354130812Smarcel ;; 355130812Smarcel 356130812Smarcellinux) 357130812Smarcel AC_MSG_CHECKING(Linux kernel version) 358130812Smarcel if test "$cross_compiling" = yes; then 359130812Smarcel AC_CACHE_VAL(ac_cv_linux_vers, 360130812Smarcel ac_cv_linux_vers=unknown) 361130812Smarcel else 362130812Smarcel AC_CACHE_VAL(ac_cv_linux_vers, 363130812Smarcel ac_cv_linux_vers=`uname -r 2>&1 | \ 364130812Smarcel sed -n -e '$s/.* //' -e '$s/\..*//p'`) 365130812Smarcel fi 366130812Smarcel AC_MSG_RESULT($ac_cv_linux_vers) 367130812Smarcel if test $ac_cv_linux_vers = unknown ; then 368130812Smarcel AC_MSG_ERROR(cannot determine linux version when cross-compiling) 369130812Smarcel fi 370130812Smarcel if test $ac_cv_linux_vers -lt 2 ; then 371130812Smarcel AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) 372130812Smarcel fi 373130812Smarcel AC_LBL_TPACKET_STATS 374130812Smarcel ;; 375130812Smarcel 376130812Smarceldag) 377130812Smarcel V_DEFS="$V_DEFS -DDAG_ONLY" 378130812Smarcel ;; 379130812Smarcel 380130812Smarcelseptel) 381130812Smarcel V_DEFS="$V_DEFS -DSEPTEL_ONLY" 382130812Smarcel ;; 383130812Smarcel 384130812Smarcelnull) 385130812Smarcel AC_MSG_WARN(cannot determine packet capture interface) 386130812Smarcel AC_MSG_WARN((see the INSTALL doc for more info)) 387130812Smarcel ;; 388130812Smarcel 389130812Smarcelesac 390130812Smarcel 391130812SmarcelAC_MSG_CHECKING(whether we have /proc/net/dev) 392130812Smarcelif test -r /proc/net/dev ; then 393130812Smarcel ac_cv_lbl_proc_net_dev=yes 394130812Smarcelelse 395130812Smarcel ac_cv_lbl_proc_net_dev=no 396130812Smarcelfi 397130812Smarcelif test $ac_cv_lbl_proc_net_dev = yes; then 398130812Smarcel AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev]) 399130812Smarcelfi 400130812SmarcelAC_MSG_RESULT($ac_cv_lbl_proc_net_dev) 401130812Smarcel 402130812Smarcel# Check for Endace DAG card support. 403130812SmarcelAC_ARG_WITH([dag], [ --with-dag[[=DIR]] include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)], 404130812Smarcel[ 405130812Smarcel if test "$withval" = no 406130812Smarcel then 407130812Smarcel # User doesn't want DAG support. 408130812Smarcel want_dag=no 409130812Smarcel elif test "$withval" = yes 410130812Smarcel then 411130812Smarcel # User wants DAG support but hasn't specified a directory. 412130812Smarcel want_dag=yes 413130812Smarcel else 414130812Smarcel # User wants DAG support and has specified a directory, so use the provided value. 415130812Smarcel want_dag=yes 416130812Smarcel dag_root=$withval 417130812Smarcel fi 418130812Smarcel],[ 419130812Smarcel # 420130812Smarcel # Use DAG API if present, otherwise don't 421130812Smarcel # 422130812Smarcel want_dag=ifpresent 423130812Smarcel]) 424130812Smarcel 425130812SmarcelAC_ARG_WITH([dag-includes], [ --with-dag-includes=DIR Endace DAG include directory], 426130812Smarcel[ 427130812Smarcel # User wants DAG support and has specified a header directory, so use the provided value. 428130812Smarcel want_dag=yes 429130812Smarcel dag_include_dir=$withval 430130812Smarcel],[]) 431130812Smarcel 432130812SmarcelAC_ARG_WITH([dag-libraries], [ --with-dag-libraries=DIR Endace DAG library directory], 433130812Smarcel[ 434130812Smarcel # User wants DAG support and has specified a library directory, so use the provided value. 435130812Smarcel want_dag=yes 436130812Smarcel dag_lib_dir=$withval 437130812Smarcel],[]) 438130812Smarcel 439130812Smarcelcase "$V_PCAP" in 440130812Smarcellinux|bpf|dag) 441130812Smarcel # 442130812Smarcel # We support the DAG API if we're on Linux or BSD, or if we're 443130812Smarcel # building a DAG-only libpcap. 444130812Smarcel # 445130812Smarcel ;; 446130812Smarcel*) 447130812Smarcel # 448130812Smarcel # If the user explicitly requested DAG, tell them it's not 449130812Smarcel # supported. 450130812Smarcel # 451130812Smarcel # If they expressed no preference, don't include it. 452130812Smarcel # 453130812Smarcel if test $want_dag = yes; then 454130812Smarcel AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types]) 455130812Smarcel elif test $want_dag = yes; then 456130812Smarcel want_dag=no 457130812Smarcel fi 458130812Smarcel ;; 459130812Smarcelesac 460130812Smarcel 461130812Smarcelac_cv_lbl_dag_api=no 462130812Smarcelif test "$want_dag" != no; then 463130812Smarcel 464130812Smarcel AC_MSG_CHECKING([whether we have DAG API headers]) 465130812Smarcel 466130812Smarcel # If necessary, set default paths for DAG API headers and libraries. 467130812Smarcel if test -z "$dag_root"; then 468130812Smarcel dag_root=/usr/local 469130812Smarcel fi 470130812Smarcel 471130812Smarcel if test -z "$dag_include_dir"; then 472130812Smarcel dag_include_dir="$dag_root/include" 473130812Smarcel fi 474130812Smarcel 475130812Smarcel if test -z "$dag_lib_dir"; then 476130812Smarcel dag_lib_dir="$dag_root/lib" 477130812Smarcel fi 478130812Smarcel 479130812Smarcel if test -z "$dag_tools_dir"; then 480130812Smarcel dag_tools_dir="$dag_root/tools" 481130812Smarcel fi 482130812Smarcel 483130812Smarcel if test -r $dag_include_dir/dagapi.h; then 484130812Smarcel ac_cv_lbl_dag_api=yes 485130812Smarcel fi 486130812Smarcel AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)]) 487130812Smarcelfi 488130812Smarcel 489130812Smarcelif test $ac_cv_lbl_dag_api = yes; then 490130812Smarcel 491130812Smarcel AC_MSG_CHECKING([dagapi.o]) 492130812Smarcel dagapi_obj=no 493130812Smarcel if test -r $dag_tools_dir/dagapi.o; then 494130812Smarcel # 2.4.x. 495130812Smarcel dagapi_obj=$dag_tools_dir/dagapi.o 496130812Smarcel elif test -r $dag_lib_dir/dagapi.o; then 497130812Smarcel # 2.5.x. 498130812Smarcel dagapi_obj=$dag_lib_dir/dagapi.o 499130812Smarcel elif test -r $dag_lib_dir/libdag.a; then 500130812Smarcel # 2.5.x. 501130812Smarcel ar x $dag_lib_dir/libdag.a dagapi.o 502130812Smarcel if test -r ./dagapi.o; then 503130812Smarcel dagapi_obj=./dagapi.o 504130812Smarcel else 505130812Smarcel ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o 506130812Smarcel if test -r ./libdag_la-dagapi.o; then 507130812Smarcel dagapi_obj=./libdag_la-dagapi.o 508130812Smarcel fi 509130812Smarcel fi 510130812Smarcel fi 511130812Smarcel 512130812Smarcel if test $dagapi_obj = no; then 513130812Smarcel AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) 514130812Smarcel ac_cv_lbl_dag_api=no 515130812Smarcel else 516130812Smarcel AC_MSG_RESULT([yes ($dagapi_obj)]) 517130812Smarcel fi 518130812Smarcelfi 519130812Smarcel 520130812Smarcelif test $ac_cv_lbl_dag_api = yes; then 521130812Smarcel 522130812Smarcel AC_MSG_CHECKING([dagopts.o]) 523130812Smarcel dagopts_obj=no 524130812Smarcel if test -r $dag_tools_dir/dagopts.o; then 525130812Smarcel # 2.4.x. 526130812Smarcel dagopts_obj=$dag_tools_dir/dagopts.o 527130812Smarcel elif test -r $dag_lib_dir/dagopts.o; then 528130812Smarcel # 2.5.x. 529130812Smarcel dagopts_obj=$dag_lib_dir/dagopts.o 530130812Smarcel elif test -r $dag_lib_dir/libdag.a; then 531130812Smarcel # 2.5.x. 532130812Smarcel ar x $dag_lib_dir/libdag.a dagopts.o 533130812Smarcel if test -r ./dagopts.o; then 534130812Smarcel dagopts_obj=./dagopts.o 535130812Smarcel else 536130812Smarcel ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o 537130812Smarcel if test -r ./libdag_la-dagopts.o; then 538130812Smarcel dagopts_obj=./libdag_la-dagopts.o 539130812Smarcel fi 540130812Smarcel fi 541130812Smarcel fi 542130812Smarcel 543130812Smarcel if test $dagopts_obj = no; then 544130812Smarcel AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) 545130812Smarcel ac_cv_lbl_dag_api=no 546130812Smarcel else 547130812Smarcel AC_MSG_RESULT([yes ($dagopts_obj)]) 548130812Smarcel fi 549130812Smarcelfi 550130812Smarcel 551130812Smarcelif test $ac_cv_lbl_dag_api = yes; then 552130812Smarcel # Under 2.5.x only we need to add dagreg.o. 553130812Smarcel if test -r $dag_include_dir/dagreg.h; then 554130812Smarcel AC_MSG_CHECKING([dagreg.o]) 555130812Smarcel dagreg_obj=no 556130812Smarcel if test -r $dag_lib_dir/dagreg.o; then 557130812Smarcel # Object file is ready and waiting. 558130812Smarcel dagreg_obj=$dag_lib_dir/dagreg.o 559130812Smarcel elif test -r $dag_lib_dir/libdag.a; then 560130812Smarcel # Extract from libdag.a. 561130812Smarcel ar x $dag_lib_dir/libdag.a dagreg.o 562130812Smarcel if test -r ./dagreg.o; then 563130812Smarcel dagreg_obj=./dagreg.o 564130812Smarcel else 565130812Smarcel ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o 566130812Smarcel if test -r ./libdag_la-dagreg.o; then 567130812Smarcel dagreg_obj=./libdag_la-dagreg.o 568130812Smarcel fi 569130812Smarcel fi 570130812Smarcel fi 571130812Smarcel 572130812Smarcel if test $dagreg_obj = no; then 573130812Smarcel AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) 574130812Smarcel ac_cv_lbl_dag_api=no 575130812Smarcel else 576130812Smarcel AC_MSG_RESULT([yes ($dagreg_obj)]) 577130812Smarcel fi 578130812Smarcel fi 579130812Smarcelfi 580130812Smarcel 581130812Smarcelif test $ac_cv_lbl_dag_api = yes; then 582130812Smarcel V_INCLS="$V_INCLS -I$dag_include_dir" 583130812Smarcel V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj" 584130812Smarcel if test $V_PCAP != dag ; then 585130812Smarcel SSRC="pcap-dag.c" 586130812Smarcel fi 587130812Smarcel 588130812Smarcel # See if we can find a general version string. 589130812Smarcel # Don't need to save and restore LIBS to prevent -ldag being 590130812Smarcel # included if there's a found-action (arg 3). 591130812Smarcel saved_ldflags=$LDFLAGS 592130812Smarcel LDFLAGS="-L$dag_lib_dir" 593130812Smarcel AC_CHECK_LIB([dag], [dag_attach_stream], [dag_version="2.5.x"], [dag_version="2.4.x"]) 594130812Smarcel AC_CHECK_LIB([dag],[dag_get_erf_types], [ 595130812Smarcel AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])] 596130812Smarcel ) 597130812Smarcel LDFLAGS=$saved_ldflags 598130812Smarcel 599130812Smarcel if test "$dag_version" = 2.5.x; then 600130812Smarcel AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API]) 601130812Smarcel DAGLIBS="-ldag" 602130812Smarcel fi 603130812Smarcel 604130812Smarcel # See if we can find a specific version string. 605130812Smarcel AC_MSG_CHECKING([the DAG API version]) 606130812Smarcel if test -r "$dag_root/VERSION"; then 607130812Smarcel dag_version="`cat $dag_root/VERSION`" 608130812Smarcel fi 609130812Smarcel AC_MSG_RESULT([$dag_version]) 610130812Smarcel AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) 611130812Smarcelfi 612130812Smarcel 613130812Smarcelif test $ac_cv_lbl_dag_api = no; then 614130812Smarcel if test "$want_dag" = yes; then 615130812Smarcel # User wanted DAG support but we couldn't find it. 616130812Smarcel AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag]) 617130812Smarcel fi 618130812Smarcel 619130812Smarcel if test "$V_PCAP" = dag; then 620130812Smarcel # User requested "dag" capture type but the DAG API wasn't 621130812Smarcel # found. 622130812Smarcel AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)]) 623130812Smarcel fi 624130812Smarcelfi 625130812Smarcel 626130812SmarcelAC_ARG_WITH(septel, [ --with-septel[[=DIR]] include Septel support (located in directory DIR, if supplied). [default=yes, on Linux, if present]], 627130812Smarcel[ 628130812Smarcel if test "$withval" = no 629130812Smarcel then 630130812Smarcel want_septel=no 631130812Smarcel elif test "$withval" = yes 632130812Smarcel then 633130812Smarcel want_septel=yes 634130812Smarcel septel_root= 635130812Smarcel else 636130812Smarcel want_septel=yes 637130812Smarcel septel_root=$withval 638130812Smarcel fi 639130812Smarcel],[ 640130812Smarcel # 641130812Smarcel # Use Septel API if present, otherwise don't 642130812Smarcel # 643130812Smarcel want_septel=ifpresent 644130812Smarcel septel_root=./../septel 645130812Smarcel]) 646130812Smarcelac_cv_lbl_septel_api=no 647130812Smarcelcase "$V_PCAP" in 648130812Smarcellinux|septel) 649130812Smarcel # 650130812Smarcel # We support the Septel API if we're on Linux, or if we're building 651130812Smarcel # a Septel-only libpcap. 652130812Smarcel # 653130812Smarcel ;; 654130812Smarcel*) 655130812Smarcel # 656130812Smarcel # If the user explicitly requested Septel, tell them it's not 657130812Smarcel # supported. 658130812Smarcel # 659130812Smarcel # If they expressed no preference, don't include it. 660130812Smarcel # 661130812Smarcel if test $want_septel = yes; then 662130812Smarcel AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types) 663130812Smarcel elif test $want_septel = yes; then 664130812Smarcel want_septel=no 665130812Smarcel fi 666130812Smarcel ;; 667130812Smarcelesac 668130812Smarcel 669130812Smarcelif test "$with_septel" != no; then 670130812Smarcel AC_MSG_CHECKING(whether we have Septel API) 671130812Smarcel 672130812Smarcel if test -z "$septel_root"; then 673130812Smarcel septel_root=$srcdir/../septel 674130812Smarcel 675130812Smarcel fi 676130812Smarcel 677130812Smarcel septel_tools_dir="$septel_root" 678130812Smarcel septel_include_dir="$septel_root/INC" 679130812Smarcel DEF="-DHAVE_SEPTEL_API" 680130812Smarcel 681130812Smarcel ac_cv_lbl_septel_api=no 682130812Smarcel if test -r "$septel_include_dir/msg.h"; then 683130812Smarcel V_INCLS="$V_INCLS -I$septel_include_dir" 684130812Smarcel V_DEFS="$V_DEFS $DEF" 685130812Smarcel V_LIBS="$V_LIBS $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 " 686130812Smarcel 687130812Smarcel if test "$V_PCAP" != septel ; then 688130812Smarcel SSRC="pcap-septel.c" 689130812Smarcel 690130812Smarcel fi 691130812Smarcel ac_cv_lbl_septel_api=yes 692130812Smarcel fi 693130812Smarcel 694130812Smarcel AC_MSG_RESULT($ac_cv_lbl_septel_api) 695130812Smarcel if test $ac_cv_lbl_septel_api = no; then 696130812Smarcel if test "$want_septel" = yes; then 697130812Smarcel AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel) 698130812Smarcel fi 699130812Smarcel else 700130812Smarcel AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API]) 701130812Smarcel fi 702130812Smarcelfi 703130812Smarcel 704130812Smarcelif test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then 705130812Smarcel AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR) 706130812Smarcelfi 707130812Smarcel 708130812Smarcel 709130812SmarcelAC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_) 710130812Smarcelif test "$V_LEX" = lex ; then 711130812Smarcel# Some versions of lex can't handle the definitions section of scanner.l . 712130812Smarcel# Try lexing it and complain if it can't deal. 713130812Smarcel AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex, 714130812Smarcel if lex -t scanner.l > /dev/null 2>&1; then 715130812Smarcel tcpdump_cv_capable_lex=yes 716130812Smarcel else 717130812Smarcel tcpdump_cv_capable_lex=insufficient 718130812Smarcel fi) 719130812Smarcel if test $tcpdump_cv_capable_lex = insufficient ; then 720130812Smarcel AC_MSG_ERROR([Your operating system's lex is insufficient to compile 721130812Smarcel libpcap. flex is a lex replacement that has many advantages, including 722130812Smarcel being able to compile libpcap. For more information, see 723130812Smarcel http://www.gnu.org/software/flex/flex.html .]) 724130812Smarcel fi 725130812Smarcelfi 726130812Smarcel 727130812SmarcelDYEXT="so" 728130812Smarcelcase "$host_os" in 729130812Smarcel 730130812Smarcelaix*) 731130812Smarcel dnl Workaround to enable certain features 732130812Smarcel AC_DEFINE(_SUN,1,[define on AIX to get certain functions]) 733130812Smarcel ;; 734130812Smarcel 735130812Smarcelhpux9*) 736130812Smarcel AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x]) 737130812Smarcel ;; 738130812Smarcel 739130812Smarcelhpux10.0*) 740130812Smarcel ;; 741130812Smarcel 742130812Smarcelhpux10.1*) 743130812Smarcel ;; 744130812Smarcel 745130812Smarcelhpux*) 746130812Smarcel dnl HPUX 10.20 and above is similar to HPUX 9, but 747130812Smarcel dnl not the same.... 748130812Smarcel dnl 749130812Smarcel dnl XXX - DYEXT should be set to "sl" if this is building 750130812Smarcel dnl for 32-bit PA-RISC, but should be left as "so" for 751130812Smarcel dnl 64-bit PA-RISC or, I suspect, IA-64. 752130812Smarcel AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later]) 753130812Smarcel ;; 754130812Smarcel 755130812Smarcelsinix*) 756130812Smarcel AC_MSG_CHECKING(if SINIX compiler defines sinix) 757130812Smarcel AC_CACHE_VAL(ac_cv_cc_sinix_defined, 758130812Smarcel AC_TRY_COMPILE( 759130812Smarcel [], 760130812Smarcel [int i = sinix;], 761130812Smarcel ac_cv_cc_sinix_defined=yes, 762130812Smarcel ac_cv_cc_sinix_defined=no)) 763130812Smarcel AC_MSG_RESULT($ac_cv_cc_sinix_defined) 764130812Smarcel if test $ac_cv_cc_sinix_defined = no ; then 765130812Smarcel AC_DEFINE(sinix,1,[on sinix]) 766130812Smarcel fi 767130812Smarcel ;; 768130812Smarcel 769130812Smarcelsolaris*) 770130812Smarcel AC_DEFINE(HAVE_SOLARIS,1,[On solaris]) 771130812Smarcel ;; 772130812Smarcel 773130812Smarceldarwin*) 774130812Smarcel DYEXT="dylib" 775130812Smarcel V_CCOPT="$V_CCOPT -fno-common" 776130812Smarcel ;; 777130812Smarcel 778130812Smarcellinux*) 779130812Smarcel V_CCOPT="$V_CCOPT -fPIC" 780130812Smarcel ;; 781130812Smarcel 782130812Smarcelesac 783130812Smarcel 784130812SmarcelAC_PROG_RANLIB 785130812Smarcel 786130812SmarcelAC_LBL_DEVEL(V_CCOPT) 787130812Smarcel 788130812SmarcelAC_LBL_SOCKADDR_SA_LEN 789130812Smarcel 790130812SmarcelAC_LBL_SOCKADDR_STORAGE 791130812Smarcel 792130812SmarcelAC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1 793130812Smarcel 794130812SmarcelAC_LBL_UNALIGNED_ACCESS 795130812Smarcel 796130812Smarcel# 797130812Smarcel# Makefile.in includes rules to generate version.h, so we assume 798130812Smarcel# that it will be generated if autoconf is used. 799130812Smarcel# 800130812SmarcelAC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure]) 801130812Smarcel 802130812Smarcelrm -f net 803130812Smarcelln -s ${srcdir}/bpf/net net 804130812Smarcel 805130812SmarcelAC_SUBST(V_CCOPT) 806130812SmarcelAC_SUBST(V_DEFS) 807130812SmarcelAC_SUBST(V_INCLS) 808130812SmarcelAC_SUBST(V_LIBS) 809130812SmarcelAC_SUBST(V_LEX) 810130812SmarcelAC_SUBST(V_PCAP) 811130812SmarcelAC_SUBST(V_FINDALLDEVS) 812130812SmarcelAC_SUBST(V_RANLIB) 813130812SmarcelAC_SUBST(V_YACC) 814130812SmarcelAC_SUBST(SSRC) 815130812SmarcelAC_SUBST(DYEXT) 816130812SmarcelAC_SUBST(DAGLIBS) 817130812Smarcel 818130812SmarcelAC_PROG_INSTALL 819130812Smarcel 820130812SmarcelAC_CONFIG_HEADER(config.h) 821130812Smarcel 822130812SmarcelAC_OUTPUT(Makefile) 823130812Smarcel 824130812Smarcelif test -f .devel ; then 825130812Smarcel make depend 826130812Smarcelfi 827130812Smarcelexit 0 828130812Smarcel