3 dnl $Id: configure.in,v 1.14 2003/11/29 23:49:32 mdw Exp $
5 dnl Configuration script for TrIPE
7 dnl (c) 2001 Straylight/Edgeware
10 dnl ----- Licensing notice --------------------------------------------------
12 dnl This file is part of Trivial IP Encryption (TrIPE).
14 dnl TrIPE is free software; you can redistribute it and/or modify
15 dnl it under the terms of the GNU General Public License as published by
16 dnl the Free Software Foundation; either version 2 of the License, or
17 dnl (at your option) any later version.
19 dnl TrIPE is distributed in the hope that it will be useful,
20 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
21 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 dnl GNU General Public License for more details.
24 dnl You should have received a copy of the GNU General Public License
25 dnl along with TrIPE; if not, write to the Free Software Foundation,
26 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 dnl ----- Revision history --------------------------------------------------
30 dnl $Log: configure.in,v $
31 dnl Revision 1.14 2003/11/29 23:49:32 mdw
34 dnl Revision 1.13 2003/10/15 09:30:18 mdw
35 dnl Add support for Ethereal protocol analysis.
37 dnl Revision 1.12 2003/07/13 11:54:40 mdw
40 dnl Revision 1.11 2003/05/17 11:04:38 mdw
41 dnl Ship new configuration and startup kit.
43 dnl Revision 1.9 2003/04/06 10:33:31 mdw
44 dnl And again. (Sigh.)
46 dnl Revision 1.8 2003/04/06 10:31:13 mdw
49 dnl Revision 1.7 2003/04/06 10:25:17 mdw
50 dnl Support Linux TUN/TAP device. Fix some bugs.
52 dnl Revision 1.6 2001/06/19 22:13:57 mdw
55 dnl Revision 1.5 2001/03/03 12:30:39 mdw
56 dnl Make this a pre-release.
58 dnl Revision 1.4 2001/02/22 09:07:28 mdw
59 dnl Build documents now.
61 dnl Revision 1.3 2001/02/16 21:24:12 mdw
62 dnl Don't link the client against Catacomb.
64 dnl Revision 1.2 2001/02/04 01:17:54 mdw
65 dnl Create a configuration header file to tidy up command lines.
67 dnl Revision 1.1 2001/02/03 20:26:37 mdw
72 AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
73 AM_CONFIG_HEADER(config.h)
79 mdw_GCC_FLAGS([-Wall])
82 AC_ARG_WITH([linux-includes],
83 [ --with-linux-includes=DIR
84 search for Linux kernel includes in DIR],
85 [CFLAGS="$CFLAGS -I$withval"],
88 AC_ARG_WITH([configdir],
89 [ --with-configdir=DIR look for keys and other configuration in DIR
90 [default=/var/lib/tripe]],
92 [configdir=/var/lib/tripe])
94 AC_ARG_WITH([socketdir],
95 [ --with-socketdir=DIR put admin socket in DIR [default=.]],
99 AC_ARG_WITH([pidfile],
100 [ --with-pidfile=FILE make tripectl write its pid to FILE
101 [default=./tripectl.pid]],
103 [pidfile=tripectl.pid])
105 AC_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])
111 AC_ARG_WITH([logfile],
112 [ --with-logfile=DIR make tripectl write its log to FILE
113 [default=./tripe.log]],
119 ETHEREAL_PLUGIN_DIR="unknown"
120 AC_ARG_WITH([ethereal],
121 [ --with-ethereal build and install Ethereal plugin],
123 no) ethereal=false requireethereal=false;;
124 yes) ethereal=true; requireethereal=true;;
125 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
127 [ethereal=true requireethereal=false])
133 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
136 AC_DEFINE([TUN_TYPE], [TUN_LINUX])
140 AC_DEFINE([TUN_TYPE], [TUN_UNET])
146 AC_DEFINE([TUN_TYPE], [TUN_BSD])
149 AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
155 mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
157 if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
158 AC_CACHE_CHECK([where to put Ethereal plugins],
159 [mdw_cv_ethereal_plugin_dir], [
161 mdw_cv_ethereal_plugin_dir="failed"
163 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
164 if test -x "$i/bin/ethereal"; then
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
179 case $mdw_cv_ethereal_plugin_dir in
180 failed) ethereal=false;;
181 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
185 if test "$ethereal" = true; then
186 AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
188 if test "$ethereal" = true; then
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
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"
206 #include <netinet/in.h>
208 #include <epan/packet.h>
210 dissector_handle_t dh;
211 dh = creat_dissector_handle(0, 0);
212 ], [bad=false; break])
214 if test $bad = false; then
215 mdw_cv_ethereal_includes=$i
219 case $mdw_cv_ethereal_plugin_dir in
220 failed) ethereal=false;;
221 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
225 if test "$ethereal" = true; then
226 AC_CACHE_CHECK([whether the Ethereal headers are broken],
227 [mdw_cv_ethereal_buggered], [
228 CFLAGS="$GLIB_CFLAGS $i"
230 #include <netinet/in.h>
232 #include <epan/packet.h>
233 #include <plugins/plugin_api.h>
235 G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)
237 plugin_address_table_init(pat);
239 ], [mdw_cv_ethereal_buggered=no], [mdw_cv_ethereal_buggered=yes])
242 if test $mdw_cv_ethereal_buggered = yes; then
243 AC_DEFINE(ETHEREAL_BUGGERED)
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"
252 if test "$ethereal" = false -a "$requireethereal" = true; then
253 AC_MSG_ERROR([failed to configure Ethereal plugin])
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)
263 AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
265 dnl ----- That's all, folks -------------------------------------------------