]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
Declare "install_bpf_program()" in "pcap-int.h", not "gencode.h"; it has
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.86 2000-10-21 04:50:43 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.86 $)
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_int32_t, u_int)
19
20 dnl
21 dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
22 dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
23 dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
24 dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
25 dnl
26 AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h ifaddrs.h)
27
28 AC_LBL_FIXINCLUDES
29
30 AC_CHECK_FUNCS(ether_hostton strerror freeifaddrs strlcpy)
31
32 dnl to pacify those who hate protochain insn
33 AC_MSG_CHECKING(if --disable-protochain option is specified)
34 AC_ARG_ENABLE(protochain, [ --disable-protochain disable \"protochain\" insn])
35 case "x$enable_protochain" in
36 xyes) enable_protochain=enabled ;;
37 xno) enable_protochain=disabled ;;
38 x) enable_protochain=enabled ;;
39 esac
40
41 if test "$enable_protochain" = "disabled"; then
42 AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
43 fi
44 AC_MSG_RESULT(${enable_protochain})
45
46 dnl
47 dnl Not all versions of test support -c (character special) but it's a
48 dnl better way of testing since the device might be protected. So we
49 dnl check in our normal order using -r and then check the for the /dev
50 dnl guys again using -c.
51 dnl
52 dnl XXX This could be done for cross-compiling, but for now it's not.
53 dnl
54 if test -z "$with_pcap" && test "$cross_compiling" = yes; then
55 AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
56 fi
57 AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
58 AC_MSG_CHECKING(packet capture type)
59 if test ! -z "$with_pcap" ; then
60 V_PCAP="$withval"
61 elif test -r /dev/bpf0 ; then
62 V_PCAP=bpf
63 elif test -r /usr/include/net/pfilt.h ; then
64 V_PCAP=pf
65 elif test -r /dev/enet ; then
66 V_PCAP=enet
67 elif test -r /dev/nit ; then
68 V_PCAP=snit
69 elif test -r /usr/include/sys/net/nit.h ; then
70 V_PCAP=nit
71 elif test -r /usr/include/net/raw.h ; then
72 V_PCAP=snoop
73 elif test -r /usr/include/sys/dlpi.h ; then
74 V_PCAP=dlpi
75 elif test -r /usr/include/linux/socket.h ; then
76 V_PCAP=linux
77 elif test -c /dev/bpf0 ; then # check again in case not readable
78 V_PCAP=bpf
79 elif test -c /dev/enet ; then # check again in case not readable
80 V_PCAP=enet
81 elif test -c /dev/nit ; then # check again in case not readable
82 V_PCAP=snit
83 else
84 V_PCAP=null
85 fi
86 AC_MSG_RESULT($V_PCAP)
87
88 AC_MSG_CHECKING(if --enable-ipv6 option is specified)
89 AC_ARG_ENABLE(ipv6, [ --enable-ipv6 build IPv6-capable version])
90 if test "$enable_ipv6" = "yes"; then
91 AC_DEFINE(INET6,1,[IPv6])
92 fi
93 AC_MSG_RESULT(${enable_ipv6-no})
94
95 case "$V_PCAP" in
96
97 dlpi)
98 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
99 AC_MSG_CHECKING(for /dev/dlpi device)
100 if test -c /dev/dlpi ; then
101 AC_MSG_RESULT(yes)
102 AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
103 else
104 AC_MSG_RESULT(no)
105 dir="/dev/dlpi"
106 AC_MSG_CHECKING(for $dir directory)
107 if test -d $dir ; then
108 AC_MSG_RESULT(yes)
109 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
110 else
111 AC_MSG_RESULT(no)
112 fi
113 fi
114 ;;
115
116 linux)
117 AC_CHECK_HEADERS(netpacket/packet.h)
118 AC_MSG_CHECKING(Linux kernel version)
119 if test "$cross_compiling" = yes; then
120 AC_CACHE_VAL(ac_cv_linux_vers,
121 ac_cv_linux_vers=unknown)
122 else
123 AC_CACHE_VAL(ac_cv_linux_vers,
124 ac_cv_linux_vers=`uname -r 2>&1 | \
125 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
126 fi
127 AC_MSG_RESULT($ac_cv_linux_vers)
128 if test $ac_cv_linux_vers = unknown ; then
129 AC_MSG_ERROR(cannot determine linux version when cross-compiling)
130 fi
131 if test $ac_cv_linux_vers -lt 2 ; then
132 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
133 fi
134 ;;
135
136 null)
137 AC_MSG_WARN(cannot determine packet capture interface)
138 AC_MSG_WARN((see the INSTALL doc for more info))
139 ;;
140
141 esac
142
143 AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
144 if test "$V_LEX" = lex ; then
145 # Some versions of lex can't handle the definitions section of scanner.l .
146 # Try lexing it and complain if it can't deal.
147 AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
148 if lex -t scanner.l > /dev/null 2>&1; then
149 tcpdump_cv_capable_lex=yes
150 else
151 tcpdump_cv_capable_lex=insufficient
152 fi)
153 if test $tcpdump_cv_capable_lex = insufficient ; then
154 AC_MSG_ERROR([Your operating system's lex is insufficient to compile
155 libpcap. flex is a lex replacement that has many advantages, including
156 being able to compile libpcap. For more information, see
157 http://www.gnu.org/software/flex/flex.html .])
158 fi
159 fi
160
161 case "$target_os" in
162
163 aix*)
164 dnl Workaround to enable certain features
165 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
166 ;;
167
168 hpux9*)
169 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
170 ;;
171
172 hpux10.0*)
173 ;;
174
175 hpux10.1*)
176 ;;
177
178 hpux*)
179 dnl HPUX 10.20 and above is similar to HPUX 9...
180 AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20])
181 ;;
182
183 sinix*)
184 AC_MSG_CHECKING(if SINIX compiler defines sinix)
185 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
186 AC_TRY_COMPILE(
187 [],
188 [int i = sinix;],
189 ac_cv_cc_sinix_defined=yes,
190 ac_cv_cc_sinix_defined=no))
191 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
192 if test $ac_cv_cc_sinix_defined = no ; then
193 AC_DEFINE(sinix,1,[on sinix])
194 fi
195 ;;
196
197 solaris*)
198 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
199 ;;
200 esac
201
202 AC_PROG_RANLIB
203
204 AC_LBL_DEVEL(V_CCOPT)
205
206 AC_LBL_SOCKADDR_SA_LEN
207
208 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
209
210 AC_LBL_UNALIGNED_ACCESS
211
212 rm -f net
213 ln -s ${srcdir}/bpf/net net
214
215 AC_SUBST(V_CCOPT)
216 AC_SUBST(V_INCLS)
217 AC_SUBST(V_LEX)
218 AC_SUBST(V_PCAP)
219 AC_SUBST(V_RANLIB)
220 AC_SUBST(V_YACC)
221
222 AC_PROG_INSTALL
223
224 AC_CONFIG_HEADER(config.h)
225
226 AC_OUTPUT(Makefile)
227
228 if test -f .devel ; then
229 make depend
230 fi
231 exit 0