configure.in revision 17683
1dnl @(#) $Header: configure.in,v 1.56 96/07/17 15:27:07 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(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
28dnl Not all versions of test support -c (character special) but it's a
29dnl better way of testing since the device might be protected. So we
30dnl check in our normal order using -r and then check the for the /dev
31dnl guys again using -c.
32dnl
33AC_MSG_CHECKING(packet capture type)
34if test -r /dev/bpf0 ; then
35	V_PCAP=bpf
36elif test -r /usr/include/net/pfilt.h ; then
37	V_PCAP=pf
38elif test -r /dev/enet ; then
39	V_PCAP=enet
40elif test -r /dev/nit ; then
41	V_PCAP=snit
42elif test -r /usr/include/sys/net/nit.h ; then
43	V_PCAP=nit
44elif test -r /usr/include/net/raw.h ; then
45	V_PCAP=snoop
46elif test -r /usr/include/sys/dlpi.h ; then
47	V_PCAP=dlpi
48elif test -c /dev/bpf0 ; then		# check again in case not readable
49	V_PCAP=bpf
50elif test -c /dev/enet ; then		# check again in case not readable
51	V_PCAP=enet
52elif test -c /dev/nit ; then		# check again in case not readable
53	V_PCAP=snit
54else
55	V_PCAP=null
56fi
57AC_MSG_RESULT($V_PCAP)
58
59case "$V_PCAP" in
60
61null)
62	AC_MSG_WARN(cannot determine packet capture interface)
63	AC_MSG_WARN((see INSTALL for more info))
64	;;
65
66dlpi)
67	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
68	AC_MSG_CHECKING(for /dev/dlpi device)
69	if test -c /dev/dlpi ; then
70		AC_MSG_RESULT(yes)
71		AC_DEFINE(HAVE_DEV_DLPI)
72
73		case "$target_os" in
74
75		hpux9*)
76			AC_DEFINE(HAVE_HPUX9)
77			;;
78
79		esac
80	else
81		AC_MSG_RESULT(no)
82		dir="/dev/dlpi"
83		AC_MSG_CHECKING(for $dir directory)
84		if test -d $dir ; then
85			AC_MSG_RESULT(yes)
86			AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir")
87		else
88			AC_MSG_RESULT(no)
89		fi
90	fi
91	;;
92esac
93
94AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
95
96case "$target_os" in
97
98aix*)
99	dnl Workaround to enable certain features
100	AC_DEFINE(_SUN)
101	;;
102
103solaris*)
104	AC_DEFINE(HAVE_SOLARIS)
105	;;
106esac
107
108AC_CHECK_PROGS(V_RANLIB, ranlib, @true)
109
110AC_LBL_DEVEL(V_CCOPT)
111
112AC_LBL_SOCKADDR_SA_LEN
113
114AC_LBL_UNALIGNED_ACCESS
115
116if test -r lbl/gnuc.h ; then
117	rm -f gnuc.h
118	ln -s lbl/gnuc.h gnuc.h
119fi
120
121rm -f bpf_filter.c
122ln -s bpf/net/bpf_filter.c bpf_filter.c
123rm -f net
124ln -s bpf/net net
125
126AC_SUBST(V_CCOPT)
127AC_SUBST(V_INCLS)
128AC_SUBST(V_LEX)
129AC_SUBST(V_PCAP)
130AC_SUBST(V_RANLIB)
131AC_SUBST(V_YACC)
132
133AC_PROG_INSTALL
134
135AC_OUTPUT(Makefile)
136
137if test -f .devel ; then
138	make depend
139fi
140exit 0
141