1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.107 2004-03-28 20:31:07 fenner 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.107 $)
15 AC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS)
19 AC_LBL_CHECK_TYPE(u_int8_t, u_char)
20 AC_LBL_CHECK_TYPE(u_int16_t, u_short)
21 AC_LBL_CHECK_TYPE(u_int32_t, u_int)
24 dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
25 dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
26 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
27 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
29 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h)
30 AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
31 #include <sys/socket.h>])
35 AC_CHECK_FUNCS(ether_hostton strerror strlcpy)
38 AC_CHECK_FUNCS(vsnprintf snprintf,,
40 if test $needsnprintf = yes; then
44 dnl to pacify those who hate protochain insn
45 AC_MSG_CHECKING(if --disable-protochain option is specified)
46 AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn])
47 case "x$enable_protochain" in
48 xyes) enable_protochain=enabled ;;
49 xno) enable_protochain=disabled ;;
50 x) enable_protochain=enabled ;;
53 if test "$enable_protochain" = "disabled"; then
54 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
56 AC_MSG_RESULT(${enable_protochain})
59 dnl Not all versions of test support -c (character special) but it's a
60 dnl better way of testing since the device might be protected. So we
61 dnl check in our normal order using -r and then check the for the /dev
62 dnl guys again using -c.
64 dnl XXX This could be done for cross-compiling, but for now it's not.
66 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
67 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
69 AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
70 AC_MSG_CHECKING(packet capture type)
71 if test ! -z "$with_pcap" ; then
73 elif test -r /dev/bpf0 ; then
75 elif test -r /usr/include/net/pfilt.h ; then
77 elif test -r /dev/enet ; then
79 elif test -r /dev/nit ; then
81 elif test -r /usr/include/sys/net/nit.h ; then
83 elif test -r /usr/include/linux/socket.h ; then
85 elif test -r /usr/include/net/raw.h ; then
87 elif test -r /usr/include/odmi.h ; then
89 # On AIX, the BPF devices might not yet be present - they're
90 # created the first time libpcap runs after booting.
91 # We check for odmi.h instead.
94 elif test -r /usr/include/sys/dlpi.h ; then
96 elif test -c /dev/bpf0 ; then # check again in case not readable
98 elif test -c /dev/enet ; then # check again in case not readable
100 elif test -c /dev/nit ; then # check again in case not readable
105 AC_MSG_RESULT($V_PCAP)
108 dnl Now figure out how we get a list of interfaces and addresses.
110 AC_CHECK_FUNC(getifaddrs,[
112 # We have "getifaddrs()", so we use that to get the list
117 # Well, we don't have "getifaddrs()", so we have to use some
118 # other mechanism; determine what that mechanism is.
120 # The first thing we use is the type of capture mechanism,
121 # which is somewhat of a proxy for the OS we're using.
127 # This might be Solaris 8 or later, with SIOCGLIFCONF,
128 # or it might be some other OS, with just SIOCGIFCONF.
130 AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
131 AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
133 [#include <sys/param.h>
134 #include <sys/file.h>
135 #include <sys/ioctl.h>
136 #include <sys/socket.h>
137 #include <sys/sockio.h>],
138 [ioctl(0, SIOCGLIFCONF, (char *)0);],
139 ac_cv_lbl_have_siocglifconf=yes,
140 ac_cv_lbl_have_siocglifconf=no))
141 AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
142 if test $ac_cv_lbl_have_siocglifconf = yes ; then
151 # We can't capture, so we can't open any capture
152 # devices, so we won't return any interfaces.
159 # Assume we just have SIOCGIFCONF.
160 # (XXX - on at least later Linux kernels, there's
161 # another mechanism, and we should be using that
168 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
169 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
170 if test "$enable_ipv6" = "yes"; then
171 AC_DEFINE(INET6,1,[IPv6])
173 AC_MSG_RESULT(${enable_ipv6-no})
175 AC_MSG_CHECKING(whether to build optimizer debugging code)
176 AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])
177 if test "$enable_optimizer_dbg" = "yes"; then
178 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
180 AC_MSG_RESULT(${enable_optimizer_dbg-no})
182 AC_MSG_CHECKING(whether to build parser debugging code)
183 AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])
184 if test "$enable_yydebug" = "yes"; then
185 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
187 AC_MSG_RESULT(${enable_yydebug-no})
192 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
193 AC_MSG_CHECKING(for /dev/dlpi device)
194 if test -c /dev/dlpi ; then
196 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
200 AC_MSG_CHECKING(for $dir directory)
201 if test -d $dir ; then
203 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
211 AC_MSG_CHECKING(Linux kernel version)
212 if test "$cross_compiling" = yes; then
213 AC_CACHE_VAL(ac_cv_linux_vers,
214 ac_cv_linux_vers=unknown)
216 AC_CACHE_VAL(ac_cv_linux_vers,
217 ac_cv_linux_vers=`uname -r 2>&1 | \
218 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
220 AC_MSG_RESULT($ac_cv_linux_vers)
221 if test $ac_cv_linux_vers = unknown ; then
222 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
224 if test $ac_cv_linux_vers -lt 2 ; then
225 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
231 V_DEFS="$V_DEFS -DDAG_ONLY"
235 AC_MSG_WARN(cannot determine packet capture interface)
236 AC_MSG_WARN((see the INSTALL doc for more info))
241 AC_MSG_CHECKING(whether we have /proc/net/dev)
242 if test -r /proc/net/dev ; then
243 ac_cv_lbl_proc_net_dev=yes
245 ac_cv_lbl_proc_net_dev=no
247 if test $ac_cv_lbl_proc_net_dev = yes; then
248 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
250 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
252 AC_ARG_WITH(dag, [ --with-dag[=DIR] include DAG support (located in directory DIR, if supplied). [default=yes, on BSD and Linux, if present]],
254 if test "$withval" = no
257 elif test "$withval" = yes
267 # Use DAG API if present, otherwise don't
276 # We support the DAG API on Linux or BSD, or if we're building a
282 # If the user explicitly requested DAG, tell them it's not
285 # If they expressed no preference, don't include it.
287 if test $want_dag = yes; then
288 AC_MSG_ERROR(DAG support only available with 'linux' 'bpf' and 'dag' packet capture types)
289 elif test $want_dag = yes; then
295 if test "$with_dag" != no; then
296 AC_MSG_CHECKING(whether we have DAG API)
298 if test -z "$dag_root"; then
299 dag_root=$srcdir/../dag
302 if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
303 dag_tools_dir="$dag_root/tools"
304 dag_include_dir="$dag_root/include"
306 dag_tools_dir="$dag_root"
307 dag_include_dir="$dag_root"
311 if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_tools_dir/dagapi.o" -a -r "$dag_tools_dir/dagopts.o"; then
312 V_INCLS="$V_INCLS -I $dag_include_dir"
313 V_LIBS="$V_LIBS $dag_tools_dir/dagapi.o $dag_tools_dir/dagopts.o"
314 if test "$V_PCAP" != dag ; then
317 ac_cv_lbl_dag_api=yes
319 if test -r "$dag_root/lib/dagreg.c"; then # DAG 2.5.x
320 if test -r "$dag_tools_dir/dagreg.o"; then
321 V_LIBS="$V_LIBS $dag_tools_dir/dagreg.o"
327 if test $ac_cv_lbl_dag_api = yes -a -r "$dag_root/VERSION"; then
328 dag_version=" (`cat $dag_root/VERSION`)"
330 AC_MSG_RESULT($ac_cv_lbl_dag_api$dag_version)
331 if test $ac_cv_lbl_dag_api = no; then
332 if test "$want_dag" = yes; then
333 AC_MSG_ERROR(DAG API not found under directory $dag_root; use --without-dag)
336 AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
340 if test "$V_PCAP" = dag -a "$ac_cv_lbl_dag_api" = no; then
341 AC_MSG_ERROR(Specifying the capture type as 'dag' requires the DAG API to be present; use --with-dag=DIR)
345 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
346 if test "$V_LEX" = lex ; then
347 # Some versions of lex can't handle the definitions section of scanner.l .
348 # Try lexing it and complain if it can't deal.
349 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
350 if lex -t scanner.l > /dev/null 2>&1; then
351 tcpdump_cv_capable_lex=yes
353 tcpdump_cv_capable_lex=insufficient
355 if test $tcpdump_cv_capable_lex = insufficient ; then
356 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
357 libpcap. flex is a lex replacement that has many advantages, including
358 being able to compile libpcap. For more information, see
359 http://www.gnu.org/software/flex/flex.html .])
367 dnl Workaround to enable certain features
368 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
372 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
382 dnl HPUX 10.20 and above is similar to HPUX 9, but
385 dnl XXX - DYEXT should be set to "sl" if this is building
386 dnl for 32-bit PA-RISC, but should be left as "so" for
387 dnl 64-bit PA-RISC or, I suspect, IA-64.
388 AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20])
392 AC_MSG_CHECKING(if SINIX compiler defines sinix)
393 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
397 ac_cv_cc_sinix_defined=yes,
398 ac_cv_cc_sinix_defined=no))
399 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
400 if test $ac_cv_cc_sinix_defined = no ; then
401 AC_DEFINE(sinix,1,[on sinix])
406 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
410 V_CCOPT="$V_CCOPT -fno-common"
416 AC_LBL_DEVEL(V_CCOPT)
418 AC_LBL_SOCKADDR_SA_LEN
420 AC_LBL_SOCKADDR_STORAGE
422 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
424 AC_LBL_UNALIGNED_ACCESS
427 ln -s ${srcdir}/bpf/net net
435 AC_SUBST(V_FINDALLDEVS)
443 AC_CONFIG_HEADER(config.h)
447 if test -f .devel ; then