chiark / gitweb /
Debianization.
[tripe] / configure.in
... / ...
CommitLineData
1dnl -*-autoconf-*-
2dnl
3dnl $Id: configure.in,v 1.14 2003/11/29 23:49:32 mdw Exp $
4dnl
5dnl Configuration script for TrIPE
6dnl
7dnl (c) 2001 Straylight/Edgeware
8dnl
9
10dnl ----- Licensing notice --------------------------------------------------
11dnl
12dnl This file is part of Trivial IP Encryption (TrIPE).
13dnl
14dnl TrIPE is free software; you can redistribute it and/or modify
15dnl it under the terms of the GNU General Public License as published by
16dnl the Free Software Foundation; either version 2 of the License, or
17dnl (at your option) any later version.
18dnl
19dnl TrIPE is distributed in the hope that it will be useful,
20dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22dnl GNU General Public License for more details.
23dnl
24dnl You should have received a copy of the GNU General Public License
25dnl along with TrIPE; if not, write to the Free Software Foundation,
26dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27
28dnl ----- Revision history --------------------------------------------------
29dnl
30dnl $Log: configure.in,v $
31dnl Revision 1.14 2003/11/29 23:49:32 mdw
32dnl Debianization.
33dnl
34dnl Revision 1.13 2003/10/15 09:30:18 mdw
35dnl Add support for Ethereal protocol analysis.
36dnl
37dnl Revision 1.12 2003/07/13 11:54:40 mdw
38dnl Version bump.
39dnl
40dnl Revision 1.11 2003/05/17 11:04:38 mdw
41dnl Ship new configuration and startup kit.
42dnl
43dnl Revision 1.9 2003/04/06 10:33:31 mdw
44dnl And again. (Sigh.)
45dnl
46dnl Revision 1.8 2003/04/06 10:31:13 mdw
47dnl Fix stupid bug.
48dnl
49dnl Revision 1.7 2003/04/06 10:25:17 mdw
50dnl Support Linux TUN/TAP device. Fix some bugs.
51dnl
52dnl Revision 1.6 2001/06/19 22:13:57 mdw
53dnl Version bump.
54dnl
55dnl Revision 1.5 2001/03/03 12:30:39 mdw
56dnl Make this a pre-release.
57dnl
58dnl Revision 1.4 2001/02/22 09:07:28 mdw
59dnl Build documents now.
60dnl
61dnl Revision 1.3 2001/02/16 21:24:12 mdw
62dnl Don't link the client against Catacomb.
63dnl
64dnl Revision 1.2 2001/02/04 01:17:54 mdw
65dnl Create a configuration header file to tidy up command lines.
66dnl
67dnl Revision 1.1 2001/02/03 20:26:37 mdw
68dnl Initial checkin.
69dnl
70
71AC_INIT(tripe.c)
72AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
73AM_CONFIG_HEADER(config.h)
74AC_CANONICAL_HOST
75
76AC_PROG_MAKE_SET
77AC_PROG_CC
78AM_PROG_LIBTOOL
79mdw_GCC_FLAGS([-Wall])
80mdw_OPT_TRACE
81
82AC_ARG_WITH([linux-includes],
83[ --with-linux-includes=DIR
84 search for Linux kernel includes in DIR],
85[CFLAGS="$CFLAGS -I$withval"],
86[:])
87
88AC_ARG_WITH([configdir],
89[ --with-configdir=DIR look for keys and other configuration in DIR
90 [default=/var/lib/tripe]],
91[configdir=$withval],
92[configdir=/var/lib/tripe])
93
94AC_ARG_WITH([socketdir],
95[ --with-socketdir=DIR put admin socket in DIR [default=.]],
96[socketdir=$withval],
97[socketdir=.])
98
99AC_ARG_WITH([pidfile],
100[ --with-pidfile=FILE make tripectl write its pid to FILE
101 [default=./tripectl.pid]],
102[pidfile=$withval],
103[pidfile=tripectl.pid])
104
105AC_ARG_WITH([initconfig],
106[ --with-initconfig=FILE read definitions from FILE in init script
107 [default=/etc/tripe.conf]],
108[initconfig=$withval],
109[initconfig=/etc/tripe.conf])
110
111AC_ARG_WITH([logfile],
112[ --with-logfile=DIR make tripectl write its log to FILE
113 [default=./tripe.log]],
114[logfile=$withval],
115[logfile=tripe.log])
116
117DIRS=""
118ETHEREAL_CFLAGS=""
119ETHEREAL_PLUGIN_DIR="unknown"
120AC_ARG_WITH([ethereal],
121[ --with-ethereal build and install Ethereal plugin],
122[case "$withval" in
123 no) ethereal=false requireethereal=false;;
124 yes) ethereal=true; requireethereal=true;;
125 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
126esac],
127[ethereal=true requireethereal=false])
128
129case $host_os in
130 linux*)
131 case `uname -r` in
132changequote(,)dnl
133 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
134changequote([,])dnl
135 tun=linux
136 AC_DEFINE([TUN_TYPE], [TUN_LINUX])
137 ;;
138 *)
139 tun=unet
140 AC_DEFINE([TUN_TYPE], [TUN_UNET])
141 ;;
142 esac
143 ;;
144 *bsd*)
145 tun=bsd
146 AC_DEFINE([TUN_TYPE], [TUN_BSD])
147 ;;
148 *)
149 AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
150 ;;
151esac
152AC_SUBST(tun)
153
154mdw_MLIB(2.0.0)
155mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
156
157if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
158 AC_CACHE_CHECK([where to put Ethereal plugins],
159 [mdw_cv_ethereal_plugin_dir], [
160 changequote(,)
161 mdw_cv_ethereal_plugin_dir="failed"
162 ethprefix=none
163 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
164 if test -x "$i/bin/ethereal"; then
165 ethprefix=$i
166 break
167 fi
168 done
169 if test "$ethprefix" != none; then
170 ethbin=$ethprefix/bin/ethereal
171 ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/'`
172 dir=$ethprefix/lib/ethereal/plugins/$ethver
173 if test -d "$dir"; then
174 mdw_cv_ethereal_plugin_dir=$dir
175 fi
176 fi
177 changequote([, ])
178 ])
179 case $mdw_cv_ethereal_plugin_dir in
180 failed) ethereal=false;;
181 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
182 esac
183fi
184
185if test "$ethereal" = true; then
186 AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
187fi
188if test "$ethereal" = true; then
189 bad=true
190 mdw_CFLAGS=$CFLAGS
191 ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
192 AC_CACHE_CHECK([how to find the Ethereal headers],
193 [mdw_cv_ethereal_includes], [
194 mdw_cv_ethereal_includes=failed
195 for i in \
196 "" \
197 "-I${ethprefix}/include/ethereal" \
198 "-I${ethprefix}/include" \
199 "-I${prefix}/include/ethereal" \
200 "-I${prefix}/include" \
201 "-I/usr/include/ethereal" \
202 "-I/usr/local/include/ethereal" \
203 "-I/usr/local/include"; do
204 CFLAGS="$GLIB_CFLAGS $i"
205 AC_TRY_COMPILE([
206#include <netinet/in.h>
207#include <glib.h>
208#include <epan/packet.h>
209], [
210 dissector_handle_t dh;
211 dh = creat_dissector_handle(0, 0);
212 ], [bad=false; break])
213 done
214 if test $bad = false; then
215 mdw_cv_ethereal_includes=$i
216 fi
217 CFLAGS=$mdw_CFLAGS
218 ])
219 case $mdw_cv_ethereal_plugin_dir in
220 failed) ethereal=false;;
221 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
222 esac
223fi
224
225if test "$ethereal" = true; then
226 AC_CACHE_CHECK([whether the Ethereal headers are broken],
227 [mdw_cv_ethereal_buggered], [
228 CFLAGS="$GLIB_CFLAGS $i"
229 AC_TRY_COMPILE([
230#include <netinet/in.h>
231#include <glib.h>
232#include <epan/packet.h>
233#include <plugins/plugin_api.h>
234], [
235 G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)
236 {
237 plugin_address_table_init(pat);
238 }
239 ], [mdw_cv_ethereal_buggered=no], [mdw_cv_ethereal_buggered=yes])
240 CFLAGS=$mdw_CFLAGS
241 ])
242 if test $mdw_cv_ethereal_buggered = yes; then
243 AC_DEFINE(ETHEREAL_BUGGERED)
244 fi
245
246 ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
247 AC_SUBST(ETHEREAL_CFLAGS)
248 AC_SUBST(ETHEREAL_PLUGIN_DIR)
249 DIRS="$DIRS ethereal"
250fi
251
252if test "$ethereal" = false -a "$requireethereal" = true; then
253 AC_MSG_ERROR([failed to configure Ethereal plugin])
254fi
255
256mdw_DEFINE_PATHS([
257 mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
258 mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
259 AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
260 AC_SUBST(initconfig)
261])
262AC_SUBST(DIRS)
263AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
264
265dnl ----- That's all, folks -------------------------------------------------