1dnl @(#) $Header: /cvs/fragrouter/libpcap-0.4/configure.in,v 1.1.1.1 1999/05/03 04:06:43 dugsong Exp $ (LBL) 2dnl 3dnl Copyright (c) 1994, 1995, 1996, 1997 4dnl The Regents of the University of California. All rights reserved. 5dnl 6dnl Process this file with autoconf to produce a configure script. 7dnl 8 9AC_INIT(pcap.c) 10 11AC_CANONICAL_SYSTEM 12 13umask 002 14 15if test -z "$PWD" ; then 16 PWD=`pwd` 17fi 18 19AC_LBL_C_INIT(V_CCOPT, V_INCLS) 20 21AC_CHECK_HEADERS(malloc.h sys/ioccom.h sys/sockio.h) 22 23AC_LBL_FIXINCLUDES 24 25AC_CHECK_FUNCS(ether_hostton strerror) 26 27dnl 28dnl Not all versions of test support -c (character special) but it's a 29dnl better way of testing since the device might be protected. So we 30dnl check in our normal order using -r and then check the for the /dev 31dnl guys again using -c. 32dnl 33AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE]) 34AC_MSG_CHECKING(packet capture type) 35if test ! -z "$with_pcap" ; then 36 V_PCAP="$withval" 37elif test -r /dev/bpf0 ; then 38 V_PCAP=bpf 39elif test -r /usr/include/net/pfilt.h ; then 40 V_PCAP=pf 41elif test -r /dev/enet ; then 42 V_PCAP=enet 43elif test -r /dev/nit ; then 44 V_PCAP=snit 45elif test -r /usr/include/sys/net/nit.h ; then 46 V_PCAP=nit 47elif test -r /usr/include/net/raw.h ; then 48 V_PCAP=snoop 49elif test -r /usr/include/sys/dlpi.h ; then 50 V_PCAP=dlpi 51elif test -r /usr/include/linux/socket.h ; then 52 V_PCAP=linux 53elif test -c /dev/bpf0 ; then # check again in case not readable 54 V_PCAP=bpf 55elif test -c /dev/enet ; then # check again in case not readable 56 V_PCAP=enet 57elif test -c /dev/nit ; then # check again in case not readable 58 V_PCAP=snit 59else 60 V_PCAP=null 61fi 62AC_MSG_RESULT($V_PCAP) 63 64case "$V_PCAP" in 65 66dlpi) 67 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) 68 AC_MSG_CHECKING(for /dev/dlpi device) 69 if test -c /dev/dlpi ; then 70 AC_MSG_RESULT(yes) 71 AC_DEFINE(HAVE_DEV_DLPI) 72 else 73 AC_MSG_RESULT(no) 74 dir="/dev/dlpi" 75 AC_MSG_CHECKING(for $dir directory) 76 if test -d $dir ; then 77 AC_MSG_RESULT(yes) 78 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir") 79 else 80 AC_MSG_RESULT(no) 81 fi 82 fi 83 ;; 84 85linux) 86 AC_CHECK_HEADERS(net/if_arp.h) 87 AC_MSG_CHECKING(Linux kernel version) 88 AC_CACHE_VAL(ac_cv_linux_vers, 89 ac_cv_linux_vers=`uname -r 2>&1 | \ 90 sed -n -e '$s/.* //' -e '$s/\..*//p'`) 91 AC_MSG_RESULT($ac_cv_linux_vers) 92 if test $ac_cv_linux_vers -lt 2 ; then 93 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info) 94 fi 95 ;; 96 97null) 98 AC_MSG_WARN(cannot determine packet capture interface) 99 AC_MSG_WARN((see the INSTALL doc for more info)) 100 ;; 101 102esac 103 104AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_) 105 106case "$target_os" in 107 108aix*) 109 dnl Workaround to enable certain features 110 AC_DEFINE(_SUN) 111 ;; 112 113hpux9*) 114 AC_DEFINE(HAVE_HPUX9) 115 ;; 116 117hpux10.0*) 118 ;; 119 120hpux10.1*) 121 ;; 122 123hpux*) 124 dnl HPUX 10.20 and above is similar to HPUX 9... 125 AC_DEFINE(HAVE_HPUX10_20) 126 ;; 127 128sinix*) 129 AC_MSG_CHECKING(if SINIX compiler defines sinix) 130 AC_CACHE_VAL(ac_cv_cc_sinix_defined, 131 AC_TRY_COMPILE( 132 [], 133 [int i = sinix;], 134 ac_cv_cc_sinix_defined=yes, 135 ac_cv_cc_sinix_defined=no)) 136 AC_MSG_RESULT($ac_cv_cc_sinix_defined) 137 if test $ac_cv_cc_sinix_defined = no ; then 138 AC_DEFINE(sinix) 139 fi 140 ;; 141 142solaris*) 143 AC_DEFINE(HAVE_SOLARIS) 144 ;; 145 146linux*) 147 V_INCLS="$V_INCLS -Ilinux-include" 148 ;; 149esac 150 151AC_CHECK_PROGS(V_RANLIB, ranlib, @true) 152 153AC_LBL_DEVEL(V_CCOPT) 154 155AC_LBL_SOCKADDR_SA_LEN 156 157AC_LBL_UNALIGNED_ACCESS 158 159if test "${srcdir}" = "." ; then 160 srcdirprefix="" 161else 162 srcdirprefix="./" 163fi 164 165if test -r ${srcdirprefix}lbl/gnuc.h ; then 166 rm -f gnuc.h 167 ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h 168fi 169 170rm -f bpf_filter.c 171ln -s ${srcdirprefix}bpf/net/bpf_filter.c bpf_filter.c 172rm -f net 173ln -s ${srcdirprefix}bpf/net net 174 175AC_SUBST(V_CCOPT) 176AC_SUBST(V_INCLS) 177AC_SUBST(V_LEX) 178AC_SUBST(V_PCAP) 179AC_SUBST(V_RANLIB) 180AC_SUBST(V_YACC) 181 182AC_PROG_INSTALL 183 184AC_OUTPUT(Makefile) 185 186if test -f .devel ; then 187 make depend 188fi 189exit 0 190