diff options
author | Sam Leffler <sam@FreeBSD.org> | 2005-05-29 17:46:52 +0000 |
---|---|---|
committer | Sam Leffler <sam@FreeBSD.org> | 2005-05-29 17:46:52 +0000 |
commit | 04fb274578a5def82f89c3a522b3f28c8916aa1f (patch) | |
tree | b733a54335042f876f8969020dc9dc4408f485f4 /contrib/libpcap/configure.in | |
parent | feb4ecdbac00a57548c3e75b168107e9c470f354 (diff) | |
download | src-04fb274578a5def82f89c3a522b3f28c8916aa1f.tar.gz src-04fb274578a5def82f89c3a522b3f28c8916aa1f.zip |
Notes
Diffstat (limited to 'contrib/libpcap/configure.in')
-rwxr-xr-x | contrib/libpcap/configure.in | 428 |
1 files changed, 339 insertions, 89 deletions
diff --git a/contrib/libpcap/configure.in b/contrib/libpcap/configure.in index 48464992b987..d970fd55141b 100755 --- a/contrib/libpcap/configure.in +++ b/contrib/libpcap/configure.in @@ -1,4 +1,4 @@ -dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.100.2.4 2004/03/28 21:43:34 fenner Exp $ (LBL) +dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120 2005/03/27 22:26:25 guy Exp $ (LBL) dnl dnl Copyright (c) 1994, 1995, 1996, 1997 dnl The Regents of the University of California. All rights reserved. @@ -6,7 +6,7 @@ dnl dnl Process this file with autoconf to produce a configure script. dnl -AC_REVISION($Revision: 1.100.2.4 $) +AC_REVISION($Revision: 1.120 $) AC_PREREQ(2.50) AC_INIT(pcap.c) @@ -26,13 +26,30 @@ dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris. dnl -AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h) +AC_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>]) +fi AC_LBL_FIXINCLUDES -AC_CHECK_FUNCS(ether_hostton strerror strlcpy) +AC_CHECK_FUNCS(strerror strlcpy) needsnprintf=no AC_CHECK_FUNCS(vsnprintf snprintf,, @@ -41,6 +58,75 @@ 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_DECLS(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> +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_DECLS(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 +fi + dnl to pacify those who hate protochain insn AC_MSG_CHECKING(if --disable-protochain option is specified) AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn]) @@ -105,65 +191,88 @@ fi AC_MSG_RESULT($V_PCAP) dnl -dnl Now figure out how we get a list of interfaces and addresses. +dnl Now figure out how we get a list of interfaces and addresses, +dnl if we support capturing. Don't bother if we don't support +dnl capturing. dnl -AC_CHECK_FUNC(getifaddrs,[ +if test "$V_PCAP" = null +then # - # We have "getifaddrs()", so we use that to get the list + # We can't capture, so we can't open any capture + # devices, so we won't return any interfaces. # - V_FINDALLDEVS=getad -],[ - # - # 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, with just SIOCGIFCONF. + V_FINDALLDEVS=null +else + AC_CHECK_FUNC(getifaddrs,[ # - 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 - ;; - - null) + # We have "getifaddrs()"; make sure we have <ifaddrs.h> + # as well, just in case some platform is really weird. # - # We can't capture, so we can't open any capture - # devices, so we won't return any interfaces. + 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>.]) + ]) + ],[ # - V_FINDALLDEVS=null - ;; - - *) + # Well, we don't have "getifaddrs()", so we have to use + # some other mechanism; determine what that mechanism is. # - # Assume we just have SIOCGIFCONF. - # (XXX - on at least later Linux kernels, there's - # another mechanism, and we should be using that - # instead.) + # The first thing we use is the type of capture mechanism, + # which is somewhat of a proxy for the OS we're using. # - V_FINDALLDEVS=gifc - ;; - esac]) + 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]) +fi AC_MSG_CHECKING(if --enable-ipv6 option is specified) AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version]) @@ -249,16 +358,19 @@ if test $ac_cv_lbl_proc_net_dev = yes; then fi AC_MSG_RESULT($ac_cv_lbl_proc_net_dev) -AC_ARG_WITH(dag, [ --with-dag[=DIR] include DAG support (located in directory DIR, if supplied). [default=yes, on BSD and Linux, if present]], +# Check for Endace DAG card support. +AC_ARG_WITH([dag], [ --with-dag[[=DIR]] include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)], [ if test "$withval" = no then + # User doesn't want DAG support. want_dag=no elif test "$withval" = yes then + # User wants DAG support but hasn't specified a directory. want_dag=yes - dag_root= else + # User wants DAG support and has specified a directory, so use the provided value. want_dag=yes dag_root=$withval fi @@ -267,9 +379,22 @@ AC_ARG_WITH(dag, [ --with-dag[=DIR] include DAG support (located in dire # Use DAG API if present, otherwise don't # want_dag=ifpresent - dag_root=/root/dag ]) -ac_cv_lbl_dag_api=no + +AC_ARG_WITH([dag-includes], [ --with-dag-includes=DIR Endace DAG include directory], +[ + # User wants DAG support and has specified a header directory, so use the provided value. + want_dag=yes + dag_include_dir=$withval +],[]) + +AC_ARG_WITH([dag-libraries], [ --with-dag-libraries=DIR Endace DAG library directory], +[ + # User wants DAG support and has specified a library directory, so use the provided value. + want_dag=yes + dag_lib_dir=$withval +],[]) + case "$V_PCAP" in linux|bpf|dag) # @@ -285,60 +410,167 @@ linux|bpf|dag) # If they expressed no preference, don't include it. # if test $want_dag = yes; then - AC_MSG_ERROR(DAG support only available with 'linux' 'bpf' and 'dag' packet capture types) + AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types]) elif test $want_dag = yes; then want_dag=no fi ;; esac -if test "$with_dag" != no; then - AC_MSG_CHECKING(whether we have DAG API) +ac_cv_lbl_dag_api=no +if test "$want_dag" != no; then + + AC_MSG_CHECKING([whether we have DAG API headers]) + # If necessary, set default paths for DAG API headers and libraries. if test -z "$dag_root"; then - dag_root=$srcdir/../dag + dag_root=/usr/local fi - if test -r "$dag_root/tools" -a -r "$dag_root/include"; then - dag_tools_dir="$dag_root/tools" + if test -z "$dag_include_dir"; then dag_include_dir="$dag_root/include" - else - dag_tools_dir="$dag_root" - dag_include_dir="$dag_root" fi - ac_cv_lbl_dag_api=no - if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_tools_dir/dagapi.o" -a -r "$dag_tools_dir/dagopts.o"; then - V_INCLS="$V_INCLS -I $dag_include_dir" - V_LIBS="$V_LIBS $dag_tools_dir/dagapi.o $dag_tools_dir/dagopts.o" - if test "$V_PCAP" != dag ; then - SSRC="pcap-dag.c" + if test -z "$dag_lib_dir"; then + dag_lib_dir="$dag_root/lib" + fi + + if test -z "$dag_tools_dir"; then + dag_tools_dir="$dag_root/tools" fi + + if test -r $dag_include_dir/dagapi.h; then ac_cv_lbl_dag_api=yes fi - if test -r "$dag_root/lib/dagreg.c"; then # DAG 2.5.x - if test -r "$dag_tools_dir/dagreg.o"; then - V_LIBS="$V_LIBS $dag_tools_dir/dagreg.o" - else + AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)]) +fi + +if test $ac_cv_lbl_dag_api = yes; then + + AC_MSG_CHECKING([dagapi.o]) + dagapi_obj=no + if test -r $dag_tools_dir/dagapi.o; then + + # 2.4.x. + dagapi_obj=$dag_tools_dir/dagapi.o + + elif test -r $dag_lib_dir/dagapi.o; then + + # 2.5.x. + dagapi_obj=$dag_lib_dir/dagapi.o + + elif test -r $dag_lib_dir/libdag.a; then + + # 2.5.x. + ar x $dag_lib_dir/libdag.a dagapi.o + if test -r ./dagapi.o; then + dagapi_obj=./dagapi.o + fi + fi + + if test $dagapi_obj = no; then + AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) ac_cv_lbl_dag_api=no + else + AC_MSG_RESULT([yes ($dagapi_obj)]) fi +fi + +if test $ac_cv_lbl_dag_api = yes; then + + AC_MSG_CHECKING([dagopts.o]) + dagopts_obj=no + if test -r $dag_tools_dir/dagopts.o; then + + # 2.4.x. + dagopts_obj=$dag_tools_dir/dagopts.o + + elif test -r $dag_lib_dir/dagopts.o; then + + # 2.5.x. + dagopts_obj=$dag_lib_dir/dagopts.o + + elif test -r $dag_lib_dir/libdag.a; then + + # 2.5.x. + ar x $dag_lib_dir/libdag.a dagopts.o + if test -r ./dagopts.o; then + dagopts_obj=./dagopts.o fi - dag_version= - if test $ac_cv_lbl_dag_api = yes -a -r "$dag_root/VERSION"; then - dag_version=" (`cat $dag_root/VERSION`)" fi - AC_MSG_RESULT($ac_cv_lbl_dag_api$dag_version) - if test $ac_cv_lbl_dag_api = no; then - if test "$want_dag" = yes; then - AC_MSG_ERROR(DAG API not found under directory $dag_root; use --without-dag) + + if test $dagopts_obj = no; then + AC_MSG_RESULT([no (checked $dag_lib_dir $dag_tools_dir $dag_lib_dir/libdag.a)]) + ac_cv_lbl_dag_api=no + else + AC_MSG_RESULT([yes ($dagopts_obj)]) + fi +fi + +if test $ac_cv_lbl_dag_api = yes; then + + # Under 2.5.x only we need to add dagreg.o. + if test -r $dag_include_dir/dagreg.h; then + + AC_MSG_CHECKING([dagreg.o]) + dagreg_obj=no + if test -r $dag_lib_dir/dagreg.o; then + + # Object file is ready and waiting. + dagreg_obj=$dag_lib_dir/dagreg.o + + elif test -r $dag_lib_dir/libdag.a; then + + # Extract from libdag.a. + ar x $dag_lib_dir/libdag.a dagreg.o + if test -r ./dagreg.o; then + dagreg_obj=./dagreg.o fi + fi + + if test $dagreg_obj = no; then + AC_MSG_RESULT([no (checked $dag_lib_dir $dag_lib_dir/libdag.a)]) + ac_cv_lbl_dag_api=no else - AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) + AC_MSG_RESULT([yes ($dagreg_obj)]) + fi fi fi -if test "$V_PCAP" = dag -a "$ac_cv_lbl_dag_api" = no; then - AC_MSG_ERROR(Specifying the capture type as 'dag' requires the DAG API to be present; use --with-dag=DIR) +if test $ac_cv_lbl_dag_api = yes; then + + V_INCLS="$V_INCLS -I$dag_include_dir" + V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj" + if test $V_PCAP != dag ; then + SSRC="pcap-dag.c" + fi + + # See if we can find a general version string. + # Don't need to save and restore LIBS to prevent -ldag being included if there's a found-action (arg 3). + saved_ldflags=$LDFLAGS + LDFLAGS="-L$dag_lib_dir" + AC_CHECK_LIB([dag], [dag_attach_stream], [dag_version="2.5.x"], [dag_version="2.4.x"]) + LDFLAGS=$saved_ldflags + + # See if we can find a specific version string. + AC_MSG_CHECKING([the DAG API version]) + if test -r "$dag_root/VERSION"; then + dag_version="`cat $dag_root/VERSION`" + fi + AC_MSG_RESULT([$dag_version]) + AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) +fi + +if test $ac_cv_lbl_dag_api = no; then + if test "$want_dag" = yes; then + # User wanted DAG support but we couldn't find it. + AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag]) + fi + + if test "$V_PCAP" = dag; then + # User requested "dag" capture type but the DAG API wasn't found. + 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.)]) + fi fi @@ -360,6 +592,7 @@ if test "$V_LEX" = lex ; then fi fi +DYEXT="so" case "$host_os" in aix*) @@ -378,7 +611,12 @@ hpux10.1*) ;; hpux*) - dnl HPUX 10.20 and above is similar to HPUX 9... + dnl HPUX 10.20 and above is similar to HPUX 9, but + dnl not the same.... + dnl + dnl XXX - DYEXT should be set to "sl" if this is building + dnl for 32-bit PA-RISC, but should be left as "so" for + dnl 64-bit PA-RISC or, I suspect, IA-64. AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20]) ;; @@ -399,6 +637,11 @@ sinix*) solaris*) AC_DEFINE(HAVE_SOLARIS,1,[On solaris]) ;; + +darwin*) + DYEXT="dylib" + V_CCOPT="$V_CCOPT -fno-common" + ;; esac AC_PROG_RANLIB @@ -413,6 +656,12 @@ AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1 AC_LBL_UNALIGNED_ACCESS +# +# Makefile.in includes rules to generate version.h, so we assume +# that it will be generated if autoconf is used. +# +AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure]) + rm -f net ln -s ${srcdir}/bpf/net net @@ -426,6 +675,7 @@ AC_SUBST(V_FINDALLDEVS) AC_SUBST(V_RANLIB) AC_SUBST(V_YACC) AC_SUBST(SSRC) +AC_SUBST(DYEXT) AC_PROG_INSTALL |