summaryrefslogtreecommitdiffabout
path: root/configure.ac
Unidiff
Diffstat (limited to 'configure.ac') (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac208
1 files changed, 208 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..a055c11
--- a/dev/null
+++ b/configure.ac
@@ -0,0 +1,208 @@
1# This file is part of IPACCT
2# Copyright (c) Sergey Poznyakoff
3#
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
6# the Free Software Foundation; either version 2 of the License, or
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
15# along with this program; if not, write to the Free Software
16# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17#
18AC_PREREQ(2.53)
19AC_INIT(ipacct, 0.2, bug-ipacct@cvs.farlep.net)
20AC_CONFIG_SRCDIR(src/ipacct.h)
21AC_CANONICAL_SYSTEM
22AM_INIT_AUTOMAKE(no-exeext)
23AM_CONFIG_HEADER(config.h)
24
25dnl Checks for programs.
26AC_PROG_CC
27AC_PROG_YACC
28AM_PROG_LEX
29AC_PROG_INSTALL
30AC_PROG_LN_S
31AC_PROG_RANLIB
32
33dnl Checks for header files.
34AC_HEADER_STDC
35AC_HEADER_DIRENT
36AC_HEADER_SYS_WAIT
37AC_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)
38AC_SUBST(INCLUDES)
39AC_CHECK_HEADERS(netinet/if_ether.h netinet/ip_var.h,
40 [],
41 [INCLUDES=-I'$(top_srcdir)/libpcap/linux-include'; break])
42
43dnl Checks for typedefs, structures, and compiler characteristics.
44AC_C_CONST
45AC_C_INLINE
46AC_TYPE_OFF_T
47AC_TYPE_PID_T
48AC_TYPE_SIZE_T
49AC_STRUCT_ST_RDEV
50AC_HEADER_TIME
51AC_STRUCT_TM
52
53dnl Check for libraries
54AC_CHECK_LIB(socket, main)
55AC_CHECK_LIB(nsl, main)
56
57dnl Checks for library functions.
58AC_PROG_GCC_TRADITIONAL
59AC_HEADER_MAJOR
60AC_FUNC_SETPGRP
61AC_TYPE_SIGNAL
62AC_FUNC_STRFTIME
63AC_FUNC_VFORK
64AC_FUNC_VPRINTF
65AC_FUNC_WAIT3
66AC_CHECK_FUNCS(ftime gethostname gettimeofday getusershell getwd select socket strdup strerror strtol ether_hostton strerror)
67
68rad_REPLACE_GNU_GETOPT
69
70dnl libpcap stuff
71dnl All the stuff below has been shamelessly stolen from libpcap-0.4
72dnl configure.in
73dnl
74dnl Not all versions of test support -c (character special) but it's a
75dnl better way of testing since the device might be protected. So we
76dnl check in our normal order using -r and then check the for the /dev
77dnl guys again using -c.
78dnl
79AC_SUBST(V_PCAP)
80AC_ARG_WITH(pcap, [ --with-pcap=TYPE use packet capture TYPE])
81AC_MSG_CHECKING(packet capture type)
82if test ! -z "$with_pcap" ; then
83 V_PCAP="$withval"
84elif test -r /dev/bpf0 ; then
85 V_PCAP=bpf
86elif test -r /usr/include/net/pfilt.h ; then
87 V_PCAP=pf
88elif test -r /dev/enet ; then
89 V_PCAP=enet
90elif test -r /dev/nit ; then
91 V_PCAP=snit
92elif test -r /usr/include/sys/net/nit.h ; then
93 V_PCAP=nit
94elif test -r /usr/include/net/raw.h ; then
95 V_PCAP=snoop
96elif test -r /usr/include/sys/dlpi.h ; then
97 V_PCAP=dlpi
98elif test -r /usr/include/linux/socket.h ; then
99 V_PCAP=linux
100 elif test -c /dev/bpf0 ; then # check again in case not readable
101 V_PCAP=bpf
102 elif test -c /dev/enet ; then # check again in case not readable
103 V_PCAP=enet
104 elif test -c /dev/nit ; then # check again in case not readable
105 V_PCAP=snit
106else
107 V_PCAP=null
108fi
109AC_MSG_RESULT($V_PCAP)
110
111case "$V_PCAP" in
112
113dlpi)
114 AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
115 AC_MSG_CHECKING(for /dev/dlpi device)
116 if test -c /dev/dlpi ; then
117 AC_MSG_RESULT(yes)
118 AC_DEFINE(HAVE_DEV_DLPI,1,[Define this if you have /dev/dlpi])
119 else
120 AC_MSG_RESULT(no)
121 dir="/dev/dlpi"
122 AC_MSG_CHECKING(for $dir directory)
123 if test -d $dir ; then
124 AC_MSG_RESULT(yes)
125 AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir",
126 [Path to pcap device])
127 else
128 AC_MSG_RESULT(no)
129 fi
130 fi
131 ;;
132
133linux)
134 AC_CHECK_HEADERS(net/if_arp.h)
135 AC_MSG_CHECKING(Linux kernel version)
136 AC_CACHE_VAL(ac_cv_linux_vers,
137 ac_cv_linux_vers=`uname -r 2>&1 | \
138 sed -n -e '$s/.* //' -e '$s/\..*//p'`)
139 AC_MSG_RESULT($ac_cv_linux_vers)
140 if test $ac_cv_linux_vers -lt 2 ; then
141 AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
142 fi
143 ;;
144
145null)
146 AC_MSG_WARN(cannot determine packet capture interface)
147 AC_MSG_WARN((see the INSTALL doc for more info))
148 ;;
149
150esac
151
152case "$target_os" in
153
154aix*)
155 AC_DEFINE(_SUN,1,[workarounds to enable certain features])
156 ;;
157
158hpux9*)
159 AC_DEFINE(HAVE_HPUX9,1,[Define this if we are on a HP-UX 9 system])
160 ;;
161
162hpux10.0*)
163 ;;
164
165hpux10.1*)
166 ;;
167
168hpux*)
169 dnl HPUX 10.20 and above is similar to HPUX 9...
170 AC_DEFINE(HAVE_HPUX10_20,1,[Define this if we are on a HP-UX 10.20 system])
171 ;;
172
173sinix*)
174 AC_MSG_CHECKING(if SINIX compiler defines sinix)
175 AC_CACHE_VAL(ac_cv_cc_sinix_defined,
176 AC_TRY_COMPILE(
177 [],
178 [int i = sinix;],
179 ac_cv_cc_sinix_defined=yes,
180 ac_cv_cc_sinix_defined=no))
181 AC_MSG_RESULT($ac_cv_cc_sinix_defined)
182 if test $ac_cv_cc_sinix_defined = no ; then
183 AC_DEFINE(sinix,1,[Define this if we are on a sinix system])
184 fi
185 ;;
186
187solaris*)
188 AC_DEFINE(HAVE_SOLARIS,1,[Define this if we are on a Solaris])
189 ;;
190
191linux*)
192 V_INCLS="$V_INCLS -Ilinux-include"
193 ;;
194esac
195
196AC_MSG_CHECKING(for log facility)
197log_facility="LOG_DAEMON"
198AC_ARG_WITH(log-facility,
199 [ --with-log-facility=facility enable logging to the given facility],
200 AC_TRY_COMPILE([#include <syslog.h>], int lf = $withval,
201 log_facility=$withval))
202AC_DEFINE_UNQUOTED(LOGFACILITY, $log_facility,
203 [The syslog facility to be used for diagnostics])
204AC_MSG_RESULT($log_facility)
205
206
207AC_OUTPUT(libpcap/Makefile lib/Makefile src/Makefile m4/Makefile Makefile)
208

Return to:

Send suggestions and report system problems to the System administrator.