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