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