]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Have "map_arphrd_to_dlt()" take a flag indicating whether it's OK to
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.94 2001-12-10 08:33:42 guy Exp $ (LBL)
2 dnl
3 dnl Copyright (c) 1994, 1995, 1996, 1997
4 dnl The Regents of the University of California. All rights reserved.
5 dnl
6 dnl Process this file with autoconf to produce a configure script.
7 dnl
8
9 AC_REVISION($Revision: 1.94 $)
10 AC_INIT(pcap.c)
11
12 AC_CANONICAL_SYSTEM
13
14 AC_LBL_C_INIT(V_CCOPT, V_INCLS)
15 AC_C_INLINE
16 AC_C___ATTRIBUTE__
17
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)
21
22 dnl
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.
27 dnl
28 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h limits.h netinet/if_ether.h)
29
30 AC_LBL_FIXINCLUDES
31
32 AC_CHECK_FUNCS(ether_hostton strerror strlcpy)
33
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 ;;
41 esac
42
43 if test "$enable_protochain" = "disabled"; then
44 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
45 fi
46 AC_MSG_RESULT(${enable_protochain})
47
48 dnl
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.
53 dnl
54 dnl XXX This could be done for cross-compiling, but for now it's not.
55 dnl
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=...)
58 fi
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
62 V_PCAP="$withval"
63 elif test -r /dev/bpf0 ; then
64 V_PCAP=bpf
65 elif test -r /usr/include/net/pfilt.h ; then
66 V_PCAP=pf
67 elif test -r /dev/enet ; then
68 V_PCAP=enet
69 elif test -r /dev/nit ; then
70 V_PCAP=snit
71 elif test -r /usr/include/sys/net/nit.h ; then
72 V_PCAP=nit
73 elif test -r /usr/include/net/raw.h ; then
74 V_PCAP=snoop
75 elif test -r /usr/include/sys/dlpi.h ; then
76 V_PCAP=dlpi
77 elif test -r /usr/include/linux/socket.h ; then
78 V_PCAP=linux
79 elif test -c /dev/bpf0 ; then # check again in case not readable
80 V_PCAP=bpf
81 elif test -c /dev/enet ; then # check again in case not readable
82 V_PCAP=enet
83 elif test -c /dev/nit ; then # check again in case not readable
84 V_PCAP=snit
85 else
86 V_PCAP=null
87 fi
88 AC_MSG_RESULT($V_PCAP)
89
90 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
91 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
92 if test "$enable_ipv6" = "yes"; then
93 AC_DEFINE(INET6,1,[IPv6])
94 fi
95 AC_MSG_RESULT(${enable_ipv6-no})
96
97 AC_MSG_CHECKING(whether to build optimizer debugging code)
98 AC_ARG_ENABLE(optimizer-dbg, [ --enable-optimizer-dbg build optimizer debugging code])
99 if test "$enable_optimizer_dbg" = "yes"; then
100 AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
101 fi
102 AC_MSG_RESULT(${enable_optimizer_dbg-no})
103
104 AC_MSG_CHECKING(whether to build parser debugging code)
105 AC_ARG_ENABLE(yydebug, [ --enable-yydebug build parser debugging code])
106 if test "$enable_yydebug" = "yes"; then
107 AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
108 fi
109 AC_MSG_RESULT(${enable_yydebug-no})
110
111 case "$V_PCAP" in
112
113 dlpi)
114 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
115 AC_MSG_CHECKING(for /dev/dlpi device)
116 if test -c /dev/dlpi ; then
117 AC_MSG_RESULT(yes)
118 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
119 else
120 AC_MSG_RESULT(no)
121 dir="/dev/dlpi"
122 AC_MSG_CHECKING(for $dir directory)
123 if test -d $dir ; then
124 AC_MSG_RESULT(yes)
125 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
126 else
127 AC_MSG_RESULT(no)
128 fi
129 fi
130 ;;
131
132 linux)
133 AC_MSG_CHECKING(Linux kernel version)
134 if test "$cross_compiling" = yes; then
135 AC_CACHE_VAL(ac_cv_linux_vers,
136 ac_cv_linux_vers=unknown)
137 else
138 AC_CACHE_VAL(ac_cv_linux_vers,
139 ac_cv_linux_vers=`uname -r 2>&1 | \
140 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
141 fi
142 AC_MSG_RESULT($ac_cv_linux_vers)
143 if test $ac_cv_linux_vers = unknown ; then
144 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
145 fi
146 if test $ac_cv_linux_vers -lt 2 ; then
147 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
148 fi
149 AC_LBL_TPACKET_STATS
150 ;;
151
152 null)
153 AC_MSG_WARN(cannot determine packet capture interface)
154 AC_MSG_WARN((see the INSTALL doc for more info))
155 ;;
156
157 esac
158
159 AC_MSG_CHECKING(whether we have /proc/net/dev)
160 if test -r /proc/net/dev ; then
161 ac_cv_lbl_proc_net_dev=yes
162 else
163 ac_cv_lbl_proc_net_dev=no
164 fi
165 if test $ac_cv_lbl_proc_net_dev = yes; then
166 AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
167 fi
168 AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
169
170 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
171 if test "$V_LEX" = lex ; then
172 # Some versions of lex can't handle the definitions section of scanner.l .
173 # Try lexing it and complain if it can't deal.
174 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
175 if lex -t scanner.l > /dev/null 2>&1; then
176 tcpdump_cv_capable_lex=yes
177 else
178 tcpdump_cv_capable_lex=insufficient
179 fi)
180 if test $tcpdump_cv_capable_lex = insufficient ; then
181 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
182 libpcap. flex is a lex replacement that has many advantages, including
183 being able to compile libpcap. For more information, see
184 http://www.gnu.org/software/flex/flex.html .])
185 fi
186 fi
187
188 case "$host_os" in
189
190 aix*)
191 dnl Workaround to enable certain features
192 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
193 ;;
194
195 hpux9*)
196 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
197 ;;
198
199 hpux10.0*)
200 ;;
201
202 hpux10.1*)
203 ;;
204
205 hpux*)
206 dnl HPUX 10.20 and above is similar to HPUX 9...
207 AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20])
208 ;;
209
210 sinix*)
211 AC_MSG_CHECKING(if SINIX compiler defines sinix)
212 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
213 AC_TRY_COMPILE(
214 [],
215 [int i = sinix;],
216 ac_cv_cc_sinix_defined=yes,
217 ac_cv_cc_sinix_defined=no))
218 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
219 if test $ac_cv_cc_sinix_defined = no ; then
220 AC_DEFINE(sinix,1,[on sinix])
221 fi
222 ;;
223
224 solaris*)
225 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
226 ;;
227 esac
228
229 AC_PROG_RANLIB
230
231 AC_LBL_DEVEL(V_CCOPT)
232
233 AC_LBL_SOCKADDR_SA_LEN
234
235 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
236
237 AC_LBL_UNALIGNED_ACCESS
238
239 rm -f net
240 ln -s ${srcdir}/bpf/net net
241
242 AC_SUBST(V_CCOPT)
243 AC_SUBST(V_INCLS)
244 AC_SUBST(V_LEX)
245 AC_SUBST(V_PCAP)
246 AC_SUBST(V_RANLIB)
247 AC_SUBST(V_YACC)
248
249 AC_PROG_INSTALL
250
251 AC_CONFIG_HEADER(config.h)
252
253 AC_OUTPUT(Makefile)
254
255 if test -f .devel ; then
256 make depend
257 fi
258 exit 0