xref: /freebsd/contrib/tcpdump/configure.in (revision e627b39baccd1ec9129690167cf5e6d860509655)
1dnl @(#) $Header: configure.in,v 1.53 96/07/17 15:27:31 leres Exp $ (LBL)
2dnl
3dnl Copyright (c) 1994, 1995, 1996
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 net/slip.h rpc/rpcent.h)
22AC_HEADER_TIME
23
24AC_REPLACE_FUNCS(vfprintf strcasecmp)
25AC_CHECK_FUNCS(ether_ntoa setlinebuf)
26
27AC_CHECK_LIB(dnet, main)
28AC_CHECK_LIB(rpc, main)
29AC_CHECK_LIB(nsl, main)
30AC_CHECK_LIB(str, main)
31
32dnl -lsocket is broken for snoop under IRIX 5.2 and earlier
33case "$target_os" in
34irix5.0*)
35	;;
36
37irix5.1*)
38	;;
39
40irix5.2*)
41	;;
42
43*)
44	AC_CHECK_LIB(socket, main)
45	;;
46esac
47
48AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
49
50V_GROUP=0
51case "$target_os" in
52
53aix*)
54	dnl Workaround to enable certain features
55	AC_DEFINE(_SUN)
56	;;
57
58irix*)
59	V_GROUP=sys
60	;;
61
62osf*)
63	V_GROUP=system
64	case "$target_os" in
65
66	osf3*)
67		dnl Workaround around ip_hl vs. ip_vhl problem in netinet/ip.h
68		AC_DEFINE(__STDC__,2)
69		;;
70	esac
71	;;
72
73solaris*)
74	V_GROUP=sys
75	;;
76esac
77
78if test -f /dev/bpf0 ; then
79	V_GROUP=bpf
80fi
81
82AC_CHECK_TYPE(int32_t, int)
83AC_CHECK_TYPE(u_int32_t, u_int)
84
85AC_LBL_TYPE_SIGNAL
86
87AC_LBL_DEVEL(V_CCOPT)
88
89AC_LBL_SOCKADDR_SA_LEN
90
91AC_MSG_CHECKING(if altzone is available)
92AC_CACHE_VAL(ac_cv_decl_altzone,
93    AC_TRY_COMPILE([
94#	include <sys/types.h>
95#	include <sys/time.h>
96#	ifdef TIME_WITH_SYS_TIME
97#	include <time.h>
98#	endif],
99	[long i = -altzone],
100	ac_cv_decl_altzone=yes,
101	ac_cv_decl_altzone=no))
102AC_MSG_RESULT($ac_cv_decl_altzone)
103if test $ac_cv_decl_altzone = yes ; then
104	AC_DEFINE(HAVE_ALTZONE)
105fi
106
107AC_MSG_CHECKING(if timezone and daylight are available)
108AC_CACHE_VAL(ac_cv_decl_timezone,
109    AC_TRY_LINK([
110#	include <sys/types.h>
111#	include <sys/time.h>
112#	ifdef TIME_WITH_SYS_TIME
113#	include <time.h>
114#	endif],
115	[long i;
116	tzset();
117	i = -timezone + daylight ? 3600 : 0],
118	ac_cv_decl_timezone=yes,
119	ac_cv_decl_timezone=no))
120AC_MSG_RESULT($ac_cv_decl_timezone)
121if test $ac_cv_decl_timezone = yes ; then
122	AC_DEFINE(HAVE_TIMEZONE)
123fi
124
125if test $ac_cv_decl_altzone = no ; then
126	AC_MSG_CHECKING(if tm struct has tm_gmtoff member)
127	AC_CACHE_VAL(ac_cv_tm_has_tm_gmtoff,
128	    AC_TRY_COMPILE([
129#		include <sys/types.h>
130#		include <sys/time.h>
131#		ifdef TIME_WITH_SYS_TIME
132#		include <time.h>
133#		endif],
134		[u_int i = sizeof(((struct tm *)0)->tm_gmtoff)],
135		ac_cv_tm_has_tm_gmtoff=yes,
136		ac_cv_tm_has_tm_gmtoff=no))
137	AC_MSG_RESULT($ac_cv_tm_has_tm_gmtoff)
138	if test $ac_cv_tm_has_tm_gmtoff = yes ; then
139		AC_DEFINE(HAVE_TM_GMTOFF)
140	fi
141fi
142
143AC_MSG_CHECKING(if ether_header uses ether_addr structs)
144AC_CACHE_VAL(ac_cv_ether_header_has_ea,
145    AC_TRY_COMPILE([
146#	include <sys/types.h>
147#	if __STDC__
148	/* osf3 has REALLY good prototyes */
149	struct mbuf;
150	struct rtentry;
151#	endif
152#	include <sys/socket.h>
153#	include <net/if.h>
154#	include <netinet/in.h>
155#	include <netinet/if_ether.h>],
156	[u_int i =
157	    sizeof(((struct ether_header *)0)->ether_dhost.ether_addr_octet)],
158	ac_cv_ether_header_has_ea=yes,
159	ac_cv_ether_header_has_ea=no))
160AC_MSG_RESULT($ac_cv_ether_header_has_ea)
161if test $ac_cv_ether_header_has_ea = yes ; then
162	AC_DEFINE(ETHER_HEADER_HAS_EA)
163fi
164
165AC_MSG_CHECKING(if ether_arp uses ether_addr structs)
166AC_CACHE_VAL(ac_cv_ether_arp_has_ea,
167    AC_TRY_COMPILE([
168#	include <sys/types.h>
169#	if __STDC__
170	/* osf3 has REALLY good prototyes */
171	struct mbuf;
172	struct rtentry;
173#	endif
174#	include <sys/socket.h>
175#	include <net/if.h>
176#	include <netinet/in.h>
177#	include <netinet/if_ether.h>],
178	[u_int i =
179	    sizeof(((struct ether_arp *)0)->arp_sha.ether_addr_octet)],
180	ac_cv_ether_arp_has_ea=yes,
181	ac_cv_ether_arp_has_ea=no))
182AC_MSG_RESULT($ac_cv_ether_arp_has_ea)
183if test $ac_cv_ether_arp_has_ea = yes ; then
184	AC_DEFINE(ETHER_ARP_HAS_EA)
185fi
186
187AC_MSG_CHECKING(if ether_arp uses erp_xsha member)
188AC_CACHE_VAL(ac_cv_struct_ether_arp_x,
189    AC_TRY_COMPILE([
190#	include <sys/types.h>
191#	include <sys/socket.h>
192#	if __STDC__
193	/* osf3 has REALLY good prototyes */
194	struct mbuf;
195	struct rtentry;
196#	endif
197#	include <net/if.h>
198#	include <netinet/in.h>
199#	include <netinet/if_ether.h>],
200	[u_int i = sizeof( ((struct ether_arp *)0)->arp_xsha)],
201	ac_cv_struct_ether_arp_x=yes,
202	ac_cv_struct_ether_arp_x=no))
203AC_MSG_RESULT($ac_cv_struct_ether_arp_x)
204if test $ac_cv_struct_ether_arp_x = yes ; then
205	AC_DEFINE(ETHER_ARP_HAS_X)
206fi
207
208AC_LBL_UNALIGNED_ACCESS
209
210if test -r lbl/gnuc.h ; then
211	rm -f gnuc.h
212	ln -s lbl/gnuc.h gnuc.h
213fi
214
215AC_SUBST(V_CCOPT)
216AC_SUBST(V_GROUP)
217AC_SUBST(V_INCLS)
218AC_SUBST(V_PCAPDEP)
219
220AC_PROG_INSTALL
221
222AC_OUTPUT(Makefile)
223
224if test -f .devel ; then
225	make depend
226fi
227exit 0
228