aboutsummaryrefslogtreecommitdiff
path: root/configure.ac
blob: 10fa9426f4a30fc780f2b6806169408e1f56a81a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# This file is part of IPACCT
# Copyright (c) Sergey Poznyakoff
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
#
AC_PREREQ(2.53)
AC_INIT(ipacct, 0.2, bug-ipacct@cvs.farlep.net) 
AC_CONFIG_SRCDIR(src/ipacct.h)
AC_CANONICAL_SYSTEM
AM_INIT_AUTOMAKE(no-exeext)
AM_CONFIG_HEADER(config.h)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_YACC
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB

dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(fcntl.h limits.h malloc.h sys/file.h sys/ioctl.h sys/time.h syslog.h unistd.h malloc.h sys/ioccom.h sys/sockio.h getopt.h)
AC_SUBST(INCLUDES)
AC_CHECK_HEADERS(netinet/if_ether.h netinet/ip_var.h,
	         [],
		 [INCLUDES=-I'$(top_srcdir)/libpcap/linux-include'; break]) 

dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_STRUCT_ST_RDEV
AC_HEADER_TIME
AC_STRUCT_TM

dnl Check for libraries
AC_CHECK_LIB(socket, main)
AC_CHECK_LIB(nsl, main)

dnl Checks for library functions.
AC_PROG_GCC_TRADITIONAL
AC_HEADER_MAJOR
AC_FUNC_SETPGRP
AC_TYPE_SIGNAL
AC_FUNC_STRFTIME
AC_FUNC_VFORK
AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_CHECK_FUNCS(ftime gethostname gettimeofday getusershell ether_hostton) 
AC_REPLACE_FUNCS(strchrnul strndup strnlen strerror)
AC_CHECK_FUNCS(setegid setregid setresgid seteuid setreuid)

rad_REPLACE_GNU_GETOPT
AC_ARG_WITH(included-argp,
        [  --with-included-argp           Use included argp library],
        [USE_INCLUDED_ARGP=$withval],
        [USE_INCLUDED_ARGP=no])

AC_CHECK_FUNCS(argp_parse, :, USE_INCLUDED_ARGP=yes)

if test $USE_INCLUDED_ARGP = yes; then
        AC_LIBOBJ([argp-ba])
        AC_LIBOBJ([argp-eexst])
        AC_LIBOBJ([argp-fmtstream])
        AC_LIBOBJ([argp-fs-xinl])
        AC_LIBOBJ([argp-help])
        AC_LIBOBJ([argp-parse])
        AC_LIBOBJ([argp-pv])
        AC_LIBOBJ([argp-pvh])
        AC_LIBOBJ([argp-xinl])
	AC_LIBOBJ([pin])
fi

if test $USE_INCLUDED_ARGP != yes; then
	AC_CHECK_DECLS(program_invocation_name,,,[#include <argp.h>])
	AH_BOTTOM([
#if !HAVE_DECL_PROGRAM_INVOCATION_NAME
extern char *program_invocation_short_name;
extern char *program_invocation_name;
#endif])
fi

dnl libpcap stuff
dnl All the stuff below has been shamelessly stolen from libpcap-0.4
dnl configure.in
dnl
dnl Not all versions of test support -c (character special) but it's a
dnl better way of testing since the device might be protected. So we
dnl check in our normal order using -r and then check the for the /dev
dnl guys again using -c.
dnl
AC_SUBST(V_PCAP)
AC_ARG_WITH(pcap, [  --with-pcap=TYPE        use packet capture TYPE])
AC_MSG_CHECKING(packet capture type)
if test ! -z "$with_pcap" ; then
	V_PCAP="$withval"
elif test -r /dev/bpf0 ; then
	V_PCAP=bpf
elif test -r /usr/include/net/pfilt.h ; then
	V_PCAP=pf
elif test -r /dev/enet ; then
	V_PCAP=enet
elif test -r /dev/nit ; then
	V_PCAP=snit
elif test -r /usr/include/sys/net/nit.h ; then
	V_PCAP=nit
elif test -r /usr/include/net/raw.h ; then
	V_PCAP=snoop
elif test -r /usr/include/sys/dlpi.h ; then
	V_PCAP=dlpi
elif test -r /usr/include/linux/socket.h ; then
	V_PCAP=linux
elif test -c /dev/bpf0 ; then		# check again in case not readable
	V_PCAP=bpf
elif test -c /dev/enet ; then		# check again in case not readable
	V_PCAP=enet
elif test -c /dev/nit ; then		# check again in case not readable
	V_PCAP=snit
else
	V_PCAP=null
fi
AC_MSG_RESULT($V_PCAP)

case "$V_PCAP" in

dlpi)
	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
	AC_MSG_CHECKING(for /dev/dlpi device)
	if test -c /dev/dlpi ; then
		AC_MSG_RESULT(yes)
		AC_DEFINE(HAVE_DEV_DLPI,1,[Define this if you have /dev/dlpi])
	else
		AC_MSG_RESULT(no)
		dir="/dev/dlpi"
		AC_MSG_CHECKING(for $dir directory)
		if test -d $dir ; then
			AC_MSG_RESULT(yes)
			AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir",
                                           [Path to pcap device])
		else
			AC_MSG_RESULT(no)
		fi
	fi
	;;

linux)
	AC_CHECK_HEADERS(net/if_arp.h)
	AC_MSG_CHECKING(Linux kernel version)
	AC_CACHE_VAL(ac_cv_linux_vers,
	    ac_cv_linux_vers=`uname -r 2>&1 | \
		sed -n -e '$s/.* //' -e '$s/\..*//p'`)
	AC_MSG_RESULT($ac_cv_linux_vers)
	if test $ac_cv_linux_vers -lt 2 ; then
		AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
	fi
	;;

null)
	AC_MSG_WARN(cannot determine packet capture interface)
	AC_MSG_WARN((see the INSTALL doc for more info))
	;;

esac

case "$target_os" in

aix*)
	AC_DEFINE(_SUN,1,[workarounds to enable certain features])
	;;

hpux9*)
	AC_DEFINE(HAVE_HPUX9,1,[Define this if we are on a HP-UX 9 system])
	;;

hpux10.0*)
	;;

hpux10.1*)
	;;

hpux*)
	dnl HPUX 10.20 and above is similar to HPUX 9...
	AC_DEFINE(HAVE_HPUX10_20,1,[Define this if we are on a HP-UX 10.20 system])
	;;

sinix*)
	AC_MSG_CHECKING(if SINIX compiler defines sinix)
	AC_CACHE_VAL(ac_cv_cc_sinix_defined,
		AC_TRY_COMPILE(
		    [],
		    [int i = sinix;],
		    ac_cv_cc_sinix_defined=yes,
		    ac_cv_cc_sinix_defined=no))
	    AC_MSG_RESULT($ac_cv_cc_sinix_defined)
	    if test $ac_cv_cc_sinix_defined = no ; then
		    AC_DEFINE(sinix,1,[Define this if we are on a sinix system])
	    fi
	;;

solaris*)
	AC_DEFINE(HAVE_SOLARIS,1,[Define this if we are on a Solaris])
	;;

linux*)
	V_INCLS="$V_INCLS -Ilinux-include"
	;;
esac

AC_MSG_CHECKING(for log facility)
log_facility="LOG_DAEMON"
AC_ARG_WITH(log-facility,
 [  --with-log-facility=facility   enable logging to the given facility],
 AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval,
	log_facility=$withval))
AC_DEFINE_UNQUOTED(LOGFACILITY, $log_facility,
                   [The syslog facility to be used for diagnostics])
AC_MSG_RESULT($log_facility)


AC_OUTPUT(libpcap/Makefile lib/Makefile src/Makefile m4/Makefile Makefile)

Return to:

Send suggestions and report system problems to the System administrator.