1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.98 2003-02-11 06:21:00 guy Exp $ (LBL)
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
6 dnl Process this file with autoconf to produce a configure script.
9 AC_REVISION($Revision: 1.98 $)
14 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
18 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
19 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
20 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
23 dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
24 dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
25 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
26 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
28 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h netinet/if_ether.h)
32 AC_CHECK_FUNCS(ether_hostton strerror strlcpy)
34 dnl to pacify those who hate protochain insn
35 AC_MSG_CHECKING(if --disable-protochain option is specified)
36 AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn])
37 case "x$enable_protochain" in
38 xyes) enable_protochain=enabled ;;
39 xno) enable_protochain=disabled ;;
40 x) enable_protochain=enabled ;;
43 if test "$enable_protochain" = "disabled"; then
44 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
46 AC_MSG_RESULT(${enable_protochain})
49 dnl Not all versions of test support -c (character special) but it's a
50 dnl better way of testing since the device might be protected. So we
51 dnl check in our normal order using -r and then check the for the /dev
52 dnl guys again using -c.
54 dnl XXX This could be done for cross-compiling, but for now it's not.
56 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
57 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
59 AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
60 AC_MSG_CHECKING(packet capture type)
61 if test ! -z "$with_pcap" ; then
63 elif test -r /dev/bpf0 ; then
65 elif test -r /usr/include/net/pfilt.h ; then
67 elif test -r /dev/enet ; then
69 elif test -r /dev/nit ; then
71 elif test -r /usr/include/sys/net/nit.h ; then
73 elif test -r /usr/include/linux/socket.h ; then
75 elif test -r /usr/include/net/raw.h ; then
77 elif test -r /usr/include/odmi.h ; then
79 # On AIX, the BPF devices might not yet be present - they're
80 # created the first time libpcap runs after booting.
81 # We check for odmi.h instead.
84 elif test -r /usr/include/sys/dlpi.h ; then
86 elif test -c /dev/bpf0 ; then # check again in case not readable
88 elif test -c /dev/enet ; then # check again in case not readable
90 elif test -c /dev/nit ; then # check again in case not readable
95 AC_MSG_RESULT($V_PCAP)
98 dnl Now figure out how we get a list of interfaces and addresses.
100 AC_CHECK_FUNC(getifaddrs,[
102 # We have "getifaddrs()", so we use that to get the list
107 # Well, we don't have "getifaddrs()", so we have to use some
108 # other mechanism; determine what that mechanism is.
110 # The first thing we use is the type of capture mechanism,
111 # which is somewhat of a proxy for the OS we're using.
117 # This might be Solaris 8 or later, with SIOCGLIFCONF,
118 # or it might be some other OS, with just SIOCGIFCONF.
120 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
121 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
123 [#include <sys/param.h>
124 #include <sys/file.h>
125 #include <sys/ioctl.h>
126 #include <sys/socket.h>
127 #include <sys/sockio.h>],
128 [ioctl(0, SIOCGLIFCONF, (char *)0);],
129 ac_cv_lbl_have_siocglifconf=yes,
130 ac_cv_lbl_have_siocglifconf=no))
131 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
132 if test $ac_cv_lbl_have_siocglifconf = yes ; then
141 # We can't capture, so we can't open any capture
142 # devices, so we won't return any interfaces.
149 # Assume we just have SIOCGIFCONF.
150 # (XXX - on at least later Linux kernels, there's
151 # another mechanism, and we should be using that
158 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
159 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
160 if test "$enable_ipv6" = "yes"; then
161 AC_DEFINE(INET6,1,[IPv6])
163 AC_MSG_RESULT(${enable_ipv6-no})
165 AC_MSG_CHECKING(whether to build optimizer debugging code)
166 AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])
167 if test "$enable_optimizer_dbg" = "yes"; then
168 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
170 AC_MSG_RESULT(${enable_optimizer_dbg-no})
172 AC_MSG_CHECKING(whether to build parser debugging code)
173 AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])
174 if test "$enable_yydebug" = "yes"; then
175 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
177 AC_MSG_RESULT(${enable_yydebug-no})
182 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
183 AC_MSG_CHECKING(for /dev/dlpi device)
184 if test -c /dev/dlpi ; then
186 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
190 AC_MSG_CHECKING(for $dir directory)
191 if test -d $dir ; then
193 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
201 AC_MSG_CHECKING(Linux kernel version)
202 if test "$cross_compiling" = yes; then
203 AC_CACHE_VAL(ac_cv_linux_vers,
204 ac_cv_linux_vers=unknown)
206 AC_CACHE_VAL(ac_cv_linux_vers,
207 ac_cv_linux_vers=`uname -r 2>&1 | \
208 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
210 AC_MSG_RESULT($ac_cv_linux_vers)
211 if test $ac_cv_linux_vers = unknown ; then
212 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
214 if test $ac_cv_linux_vers -lt 2 ; then
215 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
221 AC_MSG_WARN(cannot determine packet capture interface)
222 AC_MSG_WARN((see the INSTALL doc for more info))
227 AC_MSG_CHECKING(whether we have /proc/net/dev)
228 if test -r /proc/net/dev ; then
229 ac_cv_lbl_proc_net_dev=yes
231 ac_cv_lbl_proc_net_dev=no
233 if test $ac_cv_lbl_proc_net_dev = yes; then
234 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
236 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
238 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
239 if test "$V_LEX" = lex ; then
240 # Some versions of lex can't handle the definitions section of scanner.l .
241 # Try lexing it and complain if it can't deal.
242 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
243 if lex -t scanner.l > /dev/null 2>&1; then
244 tcpdump_cv_capable_lex=yes
246 tcpdump_cv_capable_lex=insufficient
248 if test $tcpdump_cv_capable_lex = insufficient ; then
249 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
250 libpcap. flex is a lex replacement that has many advantages, including
251 being able to compile libpcap. For more information, see
252 http://www.gnu.org/software/flex/flex.html .])
259 dnl Workaround to enable certain features
260 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
264 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
274 dnl HPUX 10.20 and above is similar to HPUX 9...
275 AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20])
279 AC_MSG_CHECKING(if SINIX compiler defines sinix)
280 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
284 ac_cv_cc_sinix_defined=yes,
285 ac_cv_cc_sinix_defined=no))
286 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
287 if test $ac_cv_cc_sinix_defined = no ; then
288 AC_DEFINE(sinix,1,[on sinix])
293 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
299 AC_LBL_DEVEL(V_CCOPT)
301 AC_LBL_SOCKADDR_SA_LEN
303 AC_LBL_SOCKADDR_STORAGE
305 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
307 AC_LBL_UNALIGNED_ACCESS
310 ln -s ${srcdir}/bpf/net net
316 AC_SUBST(V_FINDALLDEVS)
322 AC_CONFIG_HEADER(config.h)
326 if test -f .devel ; then