chiark / gitweb /
Mention that I wrote mallory's help message in the manpage.
[tripe] / configure.in
CommitLineData
165db1a8 1dnl -*-autoconf-*-
410c8acf 2dnl
c55f55af 3dnl $Id: configure.in,v 1.16 2004/04/19 07:44:16 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
410c8acf 28AC_INIT(tripe.c)
ef4a1ab7 29AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
73189848 30AM_CONFIG_HEADER(config.h)
410c8acf 31AC_CANONICAL_HOST
32
165db1a8 33AC_PROG_MAKE_SET
410c8acf 34AC_PROG_CC
165db1a8 35AM_PROG_LIBTOOL
37075862 36mdw_GCC_FLAGS([-Wall])
73189848 37mdw_OPT_TRACE
410c8acf 38
37075862 39AC_ARG_WITH([linux-includes],
40[ --with-linux-includes=DIR
41 search for Linux kernel includes in DIR],
42[CFLAGS="$CFLAGS -I$withval"],
43[:])
44
ef4a1ab7 45AC_ARG_WITH([configdir],
46[ --with-configdir=DIR look for keys and other configuration in DIR
47 [default=/var/lib/tripe]],
48[configdir=$withval],
49[configdir=/var/lib/tripe])
50
51AC_ARG_WITH([socketdir],
52[ --with-socketdir=DIR put admin socket in DIR [default=.]],
53[socketdir=$withval],
54[socketdir=.])
55
56AC_ARG_WITH([pidfile],
57[ --with-pidfile=FILE make tripectl write its pid to FILE
58 [default=./tripectl.pid]],
59[pidfile=$withval],
60[pidfile=tripectl.pid])
61
62AC_ARG_WITH([initconfig],
63[ --with-initconfig=FILE read definitions from FILE in init script
64 [default=/etc/tripe.conf]],
65[initconfig=$withval],
66[initconfig=/etc/tripe.conf])
67
68AC_ARG_WITH([logfile],
69[ --with-logfile=DIR make tripectl write its log to FILE
70 [default=./tripe.log]],
71[logfile=$withval],
72[logfile=tripe.log])
73
165db1a8 74DIRS=""
ef4a1ab7 75ETHEREAL_CFLAGS=""
76ETHEREAL_PLUGIN_DIR="unknown"
165db1a8 77AC_ARG_WITH([ethereal],
ef4a1ab7 78[ --with-ethereal build and install Ethereal plugin],
165db1a8 79[case "$withval" in
ef4a1ab7 80 no) ethereal=false requireethereal=false;;
81 yes) ethereal=true; requireethereal=true;;
82 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
165db1a8 83esac],
ef4a1ab7 84[ethereal=true requireethereal=false])
165db1a8 85
410c8acf 86case $host_os in
87 linux*)
37075862 88 case `uname -r` in
7dd8b2bb 89changequote(,)dnl
3e1bf5a8 90 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
7dd8b2bb 91changequote([,])dnl
37075862 92 tun=linux
93 AC_DEFINE([TUN_TYPE], [TUN_LINUX])
94 ;;
95 *)
96 tun=unet
97 AC_DEFINE([TUN_TYPE], [TUN_UNET])
98 ;;
99 esac
410c8acf 100 ;;
101 *bsd*)
102 tun=bsd
103 AC_DEFINE([TUN_TYPE], [TUN_BSD])
104 ;;
105 *)
106 AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
107 ;;
108esac
109AC_SUBST(tun)
110
cc1668bb 111mdw_MLIB(2.0.0)
c55f55af 112mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
165db1a8 113
ef4a1ab7 114if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
115 AC_CACHE_CHECK([where to put Ethereal plugins],
116 [mdw_cv_ethereal_plugin_dir], [
117 changequote(,)
118 mdw_cv_ethereal_plugin_dir="failed"
119 ethprefix=none
120 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
121 if test -x "$i/bin/ethereal"; then
122 ethprefix=$i
123 break
124 fi
125 done
126 if test "$ethprefix" != none; then
127 ethbin=$ethprefix/bin/ethereal
128 ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/'`
129 dir=$ethprefix/lib/ethereal/plugins/$ethver
130 if test -d "$dir"; then
131 mdw_cv_ethereal_plugin_dir=$dir
132 fi
133 fi
134 changequote([, ])
135 ])
136 case $mdw_cv_ethereal_plugin_dir in
137 failed) ethereal=false;;
138 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
139 esac
140fi
141
142if test "$ethereal" = true; then
143 AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
144fi
145if test "$ethereal" = true; then
165db1a8 146 bad=true
147 mdw_CFLAGS=$CFLAGS
ef4a1ab7 148 ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
165db1a8 149 AC_CACHE_CHECK([how to find the Ethereal headers],
150 [mdw_cv_ethereal_includes], [
ef4a1ab7 151 mdw_cv_ethereal_includes=failed
152 for i in \
153 "" \
154 "-I${ethprefix}/include/ethereal" \
155 "-I${ethprefix}/include" \
156 "-I${prefix}/include/ethereal" \
157 "-I${prefix}/include" \
158 "-I/usr/include/ethereal" \
159 "-I/usr/local/include/ethereal" \
160 "-I/usr/local/include"; do
165db1a8 161 CFLAGS="$GLIB_CFLAGS $i"
162 AC_TRY_COMPILE([
163#include <netinet/in.h>
164#include <glib.h>
165#include <epan/packet.h>
166], [
167 dissector_handle_t dh;
168 dh = creat_dissector_handle(0, 0);
169 ], [bad=false; break])
170 done
ef4a1ab7 171 if test $bad = false; then
172 mdw_cv_ethereal_includes=$i
165db1a8 173 fi
165db1a8 174 CFLAGS=$mdw_CFLAGS
175 ])
ef4a1ab7 176 case $mdw_cv_ethereal_plugin_dir in
177 failed) ethereal=false;;
178 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
179 esac
180fi
181
182if test "$ethereal" = true; then
165db1a8 183 AC_CACHE_CHECK([whether the Ethereal headers are broken],
184 [mdw_cv_ethereal_buggered], [
185 CFLAGS="$GLIB_CFLAGS $i"
186 AC_TRY_COMPILE([
187#include <netinet/in.h>
188#include <glib.h>
189#include <epan/packet.h>
190#include <plugins/plugin_api.h>
191], [
192 G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)
193 {
194 plugin_address_table_init(pat);
195 }
196 ], [mdw_cv_ethereal_buggered=no], [mdw_cv_ethereal_buggered=yes])
197 CFLAGS=$mdw_CFLAGS
198 ])
199 if test $mdw_cv_ethereal_buggered = yes; then
200 AC_DEFINE(ETHEREAL_BUGGERED)
201 fi
202
203 ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
165db1a8 204 AC_SUBST(ETHEREAL_CFLAGS)
205 AC_SUBST(ETHEREAL_PLUGIN_DIR)
206 DIRS="$DIRS ethereal"
207fi
410c8acf 208
ef4a1ab7 209if test "$ethereal" = false -a "$requireethereal" = true; then
210 AC_MSG_ERROR([failed to configure Ethereal plugin])
211fi
212
213mdw_DEFINE_PATHS([
214 mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
215 mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
216 AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
217 AC_SUBST(initconfig)
218])
165db1a8 219AC_SUBST(DIRS)
220AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
410c8acf 221
222dnl ----- That's all, folks -------------------------------------------------