chiark / gitweb /
Debianization.
[tripe] / configure.in
CommitLineData
165db1a8 1dnl -*-autoconf-*-
410c8acf 2dnl
ef4a1ab7 3dnl $Id: configure.in,v 1.14 2003/11/29 23:49:32 mdw Exp $
410c8acf 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 $
ef4a1ab7 31dnl Revision 1.14 2003/11/29 23:49:32 mdw
32dnl Debianization.
33dnl
165db1a8 34dnl Revision 1.13 2003/10/15 09:30:18 mdw
35dnl Add support for Ethereal protocol analysis.
36dnl
acde3175 37dnl Revision 1.12 2003/07/13 11:54:40 mdw
38dnl Version bump.
39dnl
0fa31a96 40dnl Revision 1.11 2003/05/17 11:04:38 mdw
41dnl Ship new configuration and startup kit.
42dnl
7dd8b2bb 43dnl Revision 1.9 2003/04/06 10:33:31 mdw
44dnl And again. (Sigh.)
45dnl
3e1bf5a8 46dnl Revision 1.8 2003/04/06 10:31:13 mdw
47dnl Fix stupid bug.
48dnl
37075862 49dnl Revision 1.7 2003/04/06 10:25:17 mdw
50dnl Support Linux TUN/TAP device. Fix some bugs.
51dnl
21c78c92 52dnl Revision 1.6 2001/06/19 22:13:57 mdw
53dnl Version bump.
54dnl
1f531e36 55dnl Revision 1.5 2001/03/03 12:30:39 mdw
56dnl Make this a pre-release.
57dnl
9bb1a373 58dnl Revision 1.4 2001/02/22 09:07:28 mdw
59dnl Build documents now.
60dnl
aa7f0bd9 61dnl Revision 1.3 2001/02/16 21:24:12 mdw
62dnl Don't link the client against Catacomb.
63dnl
73189848 64dnl Revision 1.2 2001/02/04 01:17:54 mdw
65dnl Create a configuration header file to tidy up command lines.
66dnl
410c8acf 67dnl Revision 1.1 2001/02/03 20:26:37 mdw
68dnl Initial checkin.
69dnl
70
71AC_INIT(tripe.c)
ef4a1ab7 72AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
73189848 73AM_CONFIG_HEADER(config.h)
410c8acf 74AC_CANONICAL_HOST
75
165db1a8 76AC_PROG_MAKE_SET
410c8acf 77AC_PROG_CC
165db1a8 78AM_PROG_LIBTOOL
37075862 79mdw_GCC_FLAGS([-Wall])
73189848 80mdw_OPT_TRACE
410c8acf 81
37075862 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
ef4a1ab7 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
165db1a8 117DIRS=""
ef4a1ab7 118ETHEREAL_CFLAGS=""
119ETHEREAL_PLUGIN_DIR="unknown"
165db1a8 120AC_ARG_WITH([ethereal],
ef4a1ab7 121[ --with-ethereal build and install Ethereal plugin],
165db1a8 122[case "$withval" in
ef4a1ab7 123 no) ethereal=false requireethereal=false;;
124 yes) ethereal=true; requireethereal=true;;
125 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
165db1a8 126esac],
ef4a1ab7 127[ethereal=true requireethereal=false])
165db1a8 128
410c8acf 129case $host_os in
130 linux*)
37075862 131 case `uname -r` in
7dd8b2bb 132changequote(,)dnl
3e1bf5a8 133 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
7dd8b2bb 134changequote([,])dnl
37075862 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
410c8acf 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
cc1668bb 154mdw_MLIB(2.0.0)
165db1a8 155mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
156
ef4a1ab7 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
165db1a8 189 bad=true
190 mdw_CFLAGS=$CFLAGS
ef4a1ab7 191 ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
165db1a8 192 AC_CACHE_CHECK([how to find the Ethereal headers],
193 [mdw_cv_ethereal_includes], [
ef4a1ab7 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
165db1a8 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
ef4a1ab7 214 if test $bad = false; then
215 mdw_cv_ethereal_includes=$i
165db1a8 216 fi
165db1a8 217 CFLAGS=$mdw_CFLAGS
218 ])
ef4a1ab7 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
165db1a8 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"
165db1a8 247 AC_SUBST(ETHEREAL_CFLAGS)
248 AC_SUBST(ETHEREAL_PLUGIN_DIR)
249 DIRS="$DIRS ethereal"
250fi
410c8acf 251
ef4a1ab7 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])
165db1a8 262AC_SUBST(DIRS)
263AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
410c8acf 264
265dnl ----- That's all, folks -------------------------------------------------