📄 configure.in
字号:
dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.8 2006/04/07 07:08:50 guy Exp $ (LBL)dnldnl Copyright (c) 1994, 1995, 1996, 1997dnl The Regents of the University of California. All rights reserved.dnldnl Process this file with autoconf to produce a configure script.dnlAC_REVISION($Revision: 1.120.2.8 $)AC_PREREQ(2.50)AC_INIT(pcap.c)AC_CANONICAL_SYSTEMAC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS)AC_LBL_C_INLINEAC_C___ATTRIBUTE__AC_LBL_CHECK_TYPE(u_int8_t, u_char)AC_LBL_CHECK_TYPE(u_int16_t, u_short)AC_LBL_CHECK_TYPE(u_int32_t, u_int)dnldnl libpcap doesn't itself use <sys/ioccom.h>; however, the test programdnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have todnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwisednl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.dnlAC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h)AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>#include <sys/socket.h>])if test "$ac_cv_header_netinet_if_ether_h" != yes; then # # The simple test didn't work. # Do we need to include <net/if.h> first? # Unset ac_cv_header_netinet_if_ether_h so we don't # treat the previous failure as a cached value and # suppress the next test. # AC_MSG_NOTICE([Rechecking with some additional includes]) unset ac_cv_header_netinet_if_ether_h AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>struct mbuf;struct rtentry;#include <net/if.h>])fiAC_LBL_FIXINCLUDESAC_CHECK_FUNCS(strerror strlcpy)needsnprintf=noAC_CHECK_FUNCS(vsnprintf snprintf,, [needsnprintf=yes])if test $needsnprintf = yes; then AC_LIBOBJ(snprintf)fi## Do this before checking for ether_hostton(), as it's a# "gethostbyname() -ish function".#AC_LBL_LIBRARY_NET## You are in a twisty little maze of UN*Xes, all different.# Some might not have ether_hostton().# Some might have it, but not declare it in any header file.# Some might have it, but declare it in <netinet/if_ether.h>.# Some might have it, but declare it in <netinet/ether.h># (And some might have it but document it as something declared in# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)## Before you is a C compiler.#AC_CHECK_FUNCS(ether_hostton)if test "$ac_cv_func_ether_hostton" = yes; then # # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>? # if test "$ac_cv_header_netinet_if_ether_h" = yes; then # # Yes. Does it declare ether_hostton()? # AC_CHECK_DECL(ether_hostton, [ AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,, [Define to 1 if netinet/if_ether.h declares `ether_hostton']) ],, [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>struct mbuf;struct rtentry;#include <net/if.h>#include <netinet/if_ether.h> ]) fi # # Did that succeed? # if test "$ac_cv_have_decl_ether_hostton" != yes; then # # No, how about <netinet/ether.h>, as on Linux? # AC_CHECK_HEADERS(netinet/ether.h) if test "$ac_cv_header_netinet_ether_h" = yes; then # # We have it - does it declare ether_hostton()? # Unset ac_cv_have_decl_ether_hostton so we don't # treat the previous failure as a cached value and # suppress the next test. # unset ac_cv_have_decl_ether_hostton AC_CHECK_DECL(ether_hostton, [ AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,, [Define to 1 if netinet/ether.h declares `ether_hostton']) ],, [#include <netinet/ether.h> ]) fi fi # # Is ether_hostton() declared? # if test "$ac_cv_have_decl_ether_hostton" != yes; then # # No, we'll have to declare it ourselves. # Do we have "struct ether_addr"? # AC_CHECK_TYPES(struct ether_addr,,, [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>struct mbuf;struct rtentry;#include <net/if.h>#include <netinet/if_ether.h> ]) AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0, [Define to 1 if you have the declaration of `ether_hostton', and to 0 if youdon't.]) else AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1, [Define to 1 if you have the declaration of `ether_hostton', and to 0 if youdon't.]) fifidnl to pacify those who hate protochain insnAC_MSG_CHECKING(if --disable-protochain option is specified)AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn])case "x$enable_protochain" inxyes) enable_protochain=enabled ;;xno) enable_protochain=disabled ;;x) enable_protochain=enabled ;;esacif test "$enable_protochain" = "disabled"; then AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])fiAC_MSG_RESULT(${enable_protochain})dnldnl Not all versions of test support -c (character special) but it's adnl better way of testing since the device might be protected. So wednl check in our normal order using -r and then check the for the /devdnl guys again using -c.dnldnl XXX This could be done for cross-compiling, but for now it's not.dnlif test -z "$with_pcap" && test "$cross_compiling" = yes; then AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)fiAC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])AC_MSG_CHECKING(packet capture type)if test ! -z "$with_pcap" ; then V_PCAP="$withval"elif test -r /dev/bpf0 ; then V_PCAP=bpfelif test -r /usr/include/net/pfilt.h ; then V_PCAP=pfelif test -r /dev/enet ; then V_PCAP=enetelif test -r /dev/nit ; then V_PCAP=snitelif test -r /usr/include/sys/net/nit.h ; then V_PCAP=nitelif test -r /usr/include/linux/socket.h ; then V_PCAP=linuxelif test -r /usr/include/net/raw.h ; then V_PCAP=snoopelif test -r /usr/include/odmi.h ; then # # On AIX, the BPF devices might not yet be present - they're # created the first time libpcap runs after booting. # We check for odmi.h instead. # V_PCAP=bpfelif test -r /usr/include/sys/dlpi.h ; then V_PCAP=dlpielif test -c /dev/bpf0 ; then # check again in case not readable V_PCAP=bpfelif test -c /dev/enet ; then # check again in case not readable V_PCAP=enetelif test -c /dev/nit ; then # check again in case not readable V_PCAP=snitelse V_PCAP=nullfiAC_MSG_RESULT($V_PCAP)dnldnl Now figure out how we get a list of interfaces and addresses,dnl if we support capturing. Don't bother if we don't supportdnl capturing.dnlif test "$V_PCAP" = nullthen # # We can't capture, so we can't open any capture # devices, so we won't return any interfaces. # V_FINDALLDEVS=nullelse AC_CHECK_FUNC(getifaddrs,[ # # We have "getifaddrs()"; make sure we have <ifaddrs.h> # as well, just in case some platform is really weird. # AC_CHECK_HEADER(ifaddrs.h,[ # # We have the header, so we use "getifaddrs()" to # get the list of interfaces. # V_FINDALLDEVS=getad ],[ # # We don't have the header - give up. # XXX - we could also fall back on some other # mechanism, but, for now, this'll catch this # problem so that we can at least try to figure # out something to do on systems with "getifaddrs()" # but without "ifaddrs.h", if there is something # we can do on those systems. # AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.]) ]) ],[ # # Well, we don't have "getifaddrs()", so we have to use # some other mechanism; determine what that mechanism is. # # The first thing we use is the type of capture mechanism, # which is somewhat of a proxy for the OS we're using. # case "$V_PCAP" in dlpi) # # This might be Solaris 8 or later, with # SIOCGLIFCONF, or it might be some other OS # or some older version of Solaris, with # just SIOCGIFCONF. # AC_MSG_CHECKING(whether we have SIOCGLIFCONF) AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf, AC_TRY_COMPILE( [#include <sys/param.h> #include <sys/file.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <sys/sockio.h>], [ioctl(0, SIOCGLIFCONF, (char *)0);], ac_cv_lbl_have_siocglifconf=yes, ac_cv_lbl_have_siocglifconf=no)) AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf) if test $ac_cv_lbl_have_siocglifconf = yes ; then V_FINDALLDEVS=glifc else V_FINDALLDEVS=gifc fi ;; *) # # Assume we just have SIOCGIFCONF. # (XXX - on at least later Linux kernels, there's # another mechanism, and we should be using that # instead.) # V_FINDALLDEVS=gifc ;; esac])fidnl HAVE_REMOTEAC_MSG_CHECKING(if --disable-remote option is specified)AC_ARG_ENABLE(remote, [ --disable-remote disable remote capture capabilities])case "x$enable_remote" inxyes) enable_remote=enabled ;;xno) enable_remote=disabled ;;x) enable_remote=enabled ;;esacAC_MSG_RESULT(${enable_remote})if test "$enable_remote" = "enabled"; then dnl dnl Checking if the remote features of libpcap are supported by dnl the OS and must be compiled dnl AC_MSG_CHECKING(if remote capture is supported) if test -e ./remote-ext.h ; then # Check that the remote extensions are there case "$V_PCAP" in linux) V_REMOTE_FILES="pcap-new.c pcap-remote.c sockutils.c" V_HAVE_REMOTE="-DHAVE_REMOTE" AC_DEFINE(HAVE_REMOTE,1,[Enable remote capture support]) have_remote=yes ;; bpf) V_REMOTE_FILES="pcap-new.c pcap-remote.c sockutils.c" V_HAVE_REMOTE="-DHAVE_REMOTE" AC_DEFINE(HAVE_REMOTE,1,[Enable remote capture support]) have_remote=yes ;; *) have_remote=no ;; esac AC_MSG_RESULT(${have_remote}) fifidnl END HAVE_REMOTEAC_MSG_CHECKING(if --enable-ipv6 option is specified)AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])if test "$enable_ipv6" = "yes"; then AC_DEFINE(INET6,1,[IPv6])fiAC_MSG_RESULT(${enable_ipv6-no})AC_MSG_CHECKING(whether to build optimizer debugging code)AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])if test "$enable_optimizer_dbg" = "yes"; then AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])fiAC_MSG_RESULT(${enable_optimizer_dbg-no})AC_MSG_CHECKING(whether to build parser debugging code)AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])if test "$enable_yydebug" = "yes"; then AC_DEFINE(YYDEBUG,1,[Enable parser debugging])fiAC_MSG_RESULT(${enable_yydebug-no})case "$V_PCAP" indlpi) AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) AC_MSG_CHECKING(for /dev/dlpi device) if test -c /dev/dlpi ; then AC_MSG_RESULT(yes) AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi]) else AC_MSG_RESULT(no) dir="/dev/dlpi" AC_MSG_CHECKING(for $dir directory) if test -d $dir ; then AC_MSG_RESULT(yes) AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory]) else AC_MSG_RESULT(no) fi fi ;;linux) AC_MSG_CHECKING(Linux kernel version) if test "$cross_compiling" = yes; then AC_CACHE_VAL(ac_cv_linux_vers, ac_cv_linux_vers=unknown) else AC_CACHE_VAL(ac_cv_linux_vers, ac_cv_linux_vers=`uname -r 2>&1 | \ sed -n -e '$s/.* //' -e '$s/\..*//p'`) fi AC_MSG_RESULT($ac_cv_linux_vers) if test $ac_cv_linux_vers = unknown ; then AC_MSG_ERROR(cannot determine linux version when cross-compiling) fi if test $ac_cv_linux_vers -lt 2 ; then AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) fi AC_LBL_TPACKET_STATS ;;dag) V_DEFS="$V_DEFS -DDAG_ONLY" ;;septel) V_DEFS="$V_DEFS -DSEPTEL_ONLY" ;;null)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -