]> The Tcpdump Group git mirrors - libpcap/blob - configure.in
ac155e6c5f286e68e0250cfd8f0de464bd1c3ad6
[libpcap] / configure.in
1 dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.84 2000-07-14 02:12:36 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.84 $)
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
145 case "$target_os" in
146
147 aix*)
148 dnl Workaround to enable certain features
149 AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
150 ;;
151
152 hpux9*)
153 AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
154 ;;
155
156 hpux10.0*)
157 ;;
158
159 hpux10.1*)
160 ;;
161
162 hpux*)
163 dnl HPUX 10.20 and above is similar to HPUX 9...
164 AC_DEFINE(HAVE_HPUX10_20,1,[on HP-UX 10.20])
165 ;;
166
167 sinix*)
168 AC_MSG_CHECKING(if SINIX compiler defines sinix)
169 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
170 AC_TRY_COMPILE(
171 [],
172 [int i = sinix;],
173 ac_cv_cc_sinix_defined=yes,
174 ac_cv_cc_sinix_defined=no))
175 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
176 if test $ac_cv_cc_sinix_defined = no ; then
177 AC_DEFINE(sinix,1,[on sinix])
178 fi
179 ;;
180
181 solaris*)
182 AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
183 ;;
184
185 linux*)
186 V_INCLS="$V_INCLS -Ilinux-include"
187 ;;
188 esac
189
190 AC_PROG_RANLIB
191
192 AC_LBL_DEVEL(V_CCOPT)
193
194 AC_LBL_SOCKADDR_SA_LEN
195
196 AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
197
198 AC_LBL_UNALIGNED_ACCESS
199
200 rm -f net
201 ln -s ${srcdir}/bpf/net net
202
203 AC_SUBST(V_CCOPT)
204 AC_SUBST(V_INCLS)
205 AC_SUBST(V_LEX)
206 AC_SUBST(V_PCAP)
207 AC_SUBST(V_RANLIB)
208 AC_SUBST(V_YACC)
209
210 AC_PROG_INSTALL
211
212 AC_CONFIG_HEADER(config.h)
213
214 AC_OUTPUT(Makefile)
215
216 if test -f .devel ; then
217 make depend
218 fi
219 exit 0