xref: /freebsd/contrib/tcpdump/configure.in (revision d74e86d9e30043893d6b308468008b65640ddcae)
1dnl @(#) $Header: configure.in,v 1.71 97/07/27 22:17:59 leres 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(tcpdump.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(fcntl.h malloc.h memory.h rpc/rpcent.h)
22AC_HEADER_TIME
23
24case "$target_os" in
25
26linux*)
27	AC_MSG_CHECKING(Linux kernel version)
28	AC_CACHE_VAL(ac_cv_linux_vers,
29	    ac_cv_linux_vers=`uname -r 2>&1 | \
30		sed -n -e '$s/.* //' -e '$s/\..*//p'`)
31	AC_MSG_RESULT($ac_cv_linux_vers)
32	if test $ac_cv_linux_vers -lt 2 ; then
33		AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
34	fi
35	AC_DEFINE(HAVE_NET_SLIP_H)
36	;;
37
38*)
39	AC_CHECK_HEADERS(net/slip.h)
40	;;
41esac
42
43AC_REPLACE_FUNCS(vfprintf strcasecmp)
44AC_CHECK_FUNCS(ether_ntoa setlinebuf)
45
46dnl The following generates a warning from autoconf...
47AC_C_BIGENDIAN
48
49AC_CHECK_LIB(dnet, main)
50AC_CHECK_LIB(rpc, main)
51
52AC_LBL_TYPE_SIGNAL
53
54AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
55
56V_GROUP=0
57if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
58	V_GROUP=wheel
59fi
60case "$target_os" in
61
62aix*)
63	dnl Workaround to enable certain features
64	AC_DEFINE(_SUN)
65	;;
66
67irix*)
68	V_GROUP=sys
69	;;
70
71linux*)
72	V_INCLS="$V_INCLS -Ilinux-include"
73	;;
74
75osf*)
76	V_GROUP=system
77	dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
78	AC_DEFINE(__STDC__,2)
79	;;
80
81solaris*)
82	V_GROUP=sys
83	;;
84esac
85
86if test -f /dev/bpf0 ; then
87	V_GROUP=bpf
88fi
89
90AC_LBL_CHECK_TYPE(int32_t, int)
91AC_LBL_CHECK_TYPE(u_int32_t, u_int)
92
93AC_LBL_DEVEL(V_CCOPT)
94
95AC_LBL_SOCKADDR_SA_LEN
96
97AC_MSG_CHECKING(if ether_header uses ether_addr structs)
98AC_CACHE_VAL(ac_cv_ether_header_has_ea,
99    LBL_SAVE_CFLAGS="$CFLAGS"
100    CFLAGS="$CFLAGS $V_INCLS"
101    AC_TRY_COMPILE([
102#	include <sys/types.h>
103#	if __STDC__
104	/* osf3 has REALLY good prototyes */
105	struct mbuf;
106	struct rtentry;
107#	endif
108#	include <sys/socket.h>
109#	include <net/if.h>
110#	include <netinet/in.h>
111#	include <netinet/if_ether.h>],
112	[u_int i =
113	    sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
114	ac_cv_ether_header_has_ea=yes,
115	ac_cv_ether_header_has_ea=no)
116    CFLAGS="$LBL_SAVE_CFLAGS")
117AC_MSG_RESULT($ac_cv_ether_header_has_ea)
118if test $ac_cv_ether_header_has_ea = yes ; then
119	AC_DEFINE(ETHER_HEADER_HAS_EA)
120fi
121
122AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
123AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
124    LBL_SAVE_CFLAGS="$CFLAGS"
125    CFLAGS="$CFLAGS $V_INCLS"
126    AC_TRY_COMPILE([
127#	include <sys/types.h>
128#	if __STDC__
129	/* osf3 has REALLY good prototyes */
130	struct mbuf;
131	struct rtentry;
132#	endif
133#	include <sys/socket.h>
134#	include <net/if.h>
135#	include <netinet/in.h>
136#	include <netinet/if_ether.h>],
137	[u_int i =
138	    sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
139	ac_cv_ether_arp_has_ea=yes,
140	ac_cv_ether_arp_has_ea=no)
141    CFLAGS="$LBL_SAVE_CFLAGS")
142AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
143if test $ac_cv_ether_arp_has_ea = yes ; then
144	AC_DEFINE(ETHER_ARP_HAS_EA)
145fi
146
147AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
148AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
149    LBL_SAVE_CFLAGS="$CFLAGS"
150    CFLAGS="$CFLAGS $V_INCLS"
151    AC_TRY_COMPILE([
152#	include <sys/types.h>
153#	include <sys/socket.h>
154#	if __STDC__
155	/* osf3 has REALLY good prototyes */
156	struct mbuf;
157	struct rtentry;
158#	endif
159#	include <net/if.h>
160#	include <netinet/in.h>
161#	include <netinet/if_ether.h>],
162	[u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
163	ac_cv_struct_ether_arp_x=yes,
164	ac_cv_struct_ether_arp_x=no)
165    CFLAGS="$LBL_SAVE_CFLAGS")
166AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
167if test $ac_cv_struct_ether_arp_x = yes ; then
168	AC_DEFINE(ETHER_ARP_HAS_X)
169fi
170
171AC_LBL_UNALIGNED_ACCESS
172
173if test "${srcdir}" = "." ; then
174	srcdirprefix=""
175else
176	srcdirprefix="./"
177fi
178
179if test -r ${srcdirprefix}lbl/gnuc.h ; then
180	rm -f gnuc.h
181	ln -s ${srcdirprefix}lbl/gnuc.h gnuc.h
182fi
183
184AC_SUBST(V_CCOPT)
185AC_SUBST(V_GROUP)
186AC_SUBST(V_INCLS)
187AC_SUBST(V_PCAPDEP)
188
189AC_PROG_INSTALL
190
191AC_OUTPUT(Makefile)
192
193if test -f .devel ; then
194	make depend
195fi
196exit 0
197