chiark / gitweb /
Great reorganization.
[tripe] / configure.in
CommitLineData
165db1a8 1dnl -*-autoconf-*-
410c8acf 2dnl
3cdc3f3a 3dnl $Id$
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
78698994 28AC_INIT(server/tripe.c)
d36eda2a 29AM_INIT_AUTOMAKE(tripe, 1.0.0pre7)
78698994 30AM_CONFIG_HEADER(common/config.h)
410c8acf 31AC_CANONICAL_HOST
32
165db1a8 33AC_PROG_MAKE_SET
410c8acf 34AC_PROG_CC
165db1a8 35AM_PROG_LIBTOOL
78698994
MW
36DIRS="" AC_SUBST([DIRS])
37
060ca767 38python=no
39mdw_PROG_PYTHON([2.3],
40 [python=yes
78698994
MW
41 pyscripts='${PYTHONSCRIPTS}'
42 DIRS="$DIRS keys"
060ca767 43 pymans='${PYTHONMANS}'])
44AC_SUBST([pyscripts]) AC_SUBST([pymans])
45
46if test $python = yes; then
47 mdw_CHECK_PYTHON([2.3])
48 AC_CACHE_CHECK([for pygtk], [mdw_cv_pygtk], [
49 mdw_cv_pygtk=no
50 python -c >&5 2>&5 '
51import pygtk
52pygtk.require("2.0")
53import gtk
54' && mdw_cv_pygtk=yes
55 ])
56 if test $mdw_cv_pygtk = yes; then
57 pygtkscripts='${PYGTKSCRIPTS}'
78698994 58 DIRS="$DIRS mon"
060ca767 59 pygtkmans='${PYGTKMANS}'
60 fi
61fi
62AC_SUBST([pygtkscripts]) AC_SUBST([pygtkmans])
63
3cdc3f3a 64AC_CHECK_HEADERS([stdarg.h])
37075862 65mdw_GCC_FLAGS([-Wall])
73189848 66mdw_OPT_TRACE
410c8acf 67
37075862 68AC_ARG_WITH([linux-includes],
69[ --with-linux-includes=DIR
70 search for Linux kernel includes in DIR],
71[CFLAGS="$CFLAGS -I$withval"],
72[:])
73
ef4a1ab7 74AC_ARG_WITH([configdir],
75[ --with-configdir=DIR look for keys and other configuration in DIR
76 [default=/var/lib/tripe]],
77[configdir=$withval],
78[configdir=/var/lib/tripe])
79
80AC_ARG_WITH([socketdir],
81[ --with-socketdir=DIR put admin socket in DIR [default=.]],
82[socketdir=$withval],
83[socketdir=.])
84
85AC_ARG_WITH([pidfile],
86[ --with-pidfile=FILE make tripectl write its pid to FILE
87 [default=./tripectl.pid]],
88[pidfile=$withval],
89[pidfile=tripectl.pid])
90
91AC_ARG_WITH([initconfig],
92[ --with-initconfig=FILE read definitions from FILE in init script
93 [default=/etc/tripe.conf]],
94[initconfig=$withval],
95[initconfig=/etc/tripe.conf])
96
97AC_ARG_WITH([logfile],
98[ --with-logfile=DIR make tripectl write its log to FILE
99 [default=./tripe.log]],
100[logfile=$withval],
101[logfile=tripe.log])
102
28461f0e
MW
103WIRESHARK_CFLAGS=""
104WIRESHARK_PLUGIN_DIR="unknown"
105AC_ARG_WITH([wireshark],
0a5d7a35 106[ --with-wireshark build and install Wireshark plugin],
165db1a8 107[case "$withval" in
28461f0e
MW
108 no) wireshark=false requirewireshark=false;;
109 yes) wireshark=true; requirewireshark=true;;
110 *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;;
165db1a8 111esac],
28461f0e 112[wireshark=true requirewireshark=false])
165db1a8 113
42da2a58 114tun=auto
b9066fbb 115AC_ARG_WITH([tunnel],
42da2a58 116[ --with-tunnel=KIND kinds of tunnel device to use
b9066fbb 117 (linux, unet, bsd, slip)],
118[tun=$withval])
119
42da2a58 120if test "$tun" = auto; then
121 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
122 mdw_cv_tunnel=""
b9066fbb 123 case $host_os in
124 linux*)
125 case `uname -r` in
7dd8b2bb 126changequote(,)dnl
b9066fbb 127 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
7dd8b2bb 128changequote([,])dnl
b9066fbb 129 mdw_cv_tunnel=linux
130 ;;
131 *)
132 mdw_cv_tunnel=unet
133 ;;
134 esac
135 ;;
136 *bsd*)
137 mdw_cv_tunnel=bsd
37075862 138 ;;
37075862 139 esac
42da2a58 140 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
b9066fbb 141 ])
142 tun=$mdw_cv_tunnel
143fi
144
42da2a58 145tunnels=""
146for i in $tun; do
147 case $i in
148 linux) AC_DEFINE([TUN_LINUX], [1],
149 [Install the Linux TUN/TAP driver.]) ;;
150 bsd) AC_DEFINE([TUN_BSD], [1],
151 [Install the BSD tunnel driver.]) ;;
152 unet) AC_DEFINE([TUN_UNET], [1],
153 [Install the obsolete Linux Usernet driver.]) ;;
154 slip) ;;
155 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
156 esac
157 tunnels="$tunnels&tun_$i, "
158done
410c8acf 159AC_SUBST(tun)
42da2a58 160AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
161 [List of tunnel drivers to install.])
410c8acf 162
cc1668bb 163mdw_MLIB(2.0.0)
c55f55af 164mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
165db1a8 165
28461f0e
MW
166if test "$wireshark" = true -a "$WIRESHARK_PLUGIN_DIR" = unknown; then
167 AC_CACHE_CHECK([where to put Wireshark plugins],
168 [mdw_cv_wireshark_plugin_dir], [
ef4a1ab7 169 changequote(,)
28461f0e
MW
170 mdw_cv_wireshark_plugin_dir="failed"
171 wsprefix=none
ef4a1ab7 172 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
28461f0e
MW
173 if test -x "$i/bin/tshark"; then
174 wsprefix=$i
ef4a1ab7 175 break
176 fi
177 done
28461f0e
MW
178 if test "$wsprefix" != none; then
179 wsbin=$wsprefix/bin/tshark
180 wsver=`$wsbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q'`
181 dir=$wsprefix/lib/wireshark/plugins/$wsver
ef4a1ab7 182 if test -d "$dir"; then
28461f0e 183 mdw_cv_wireshark_plugin_dir=$dir
ef4a1ab7 184 fi
185 fi
186 changequote([, ])
187 ])
28461f0e
MW
188 case $mdw_cv_wireshark_plugin_dir in
189 failed) wireshark=false;;
190 *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;;
ef4a1ab7 191 esac
192fi
193
28461f0e
MW
194if test "$wireshark" = true; then
195 AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule])
ef4a1ab7 196fi
28461f0e 197if test "$wireshark" = true; then
165db1a8 198 bad=true
199 mdw_CFLAGS=$CFLAGS
28461f0e
MW
200 wsprefix=`echo $WIRESHARK_PLUGIN_DIR | sed 's:/lib/.*$::'`
201 AC_CACHE_CHECK([how to find the Wireshark headers],
202 [mdw_cv_wireshark_includes], [
203 mdw_cv_wireshark_includes=failed
ef4a1ab7 204 for i in \
205 "" \
28461f0e
MW
206 "-I${wsprefix}/include/wireshark" \
207 "-I${wsprefix}/include" \
208 "-I${prefix}/include/wireshark" \
ef4a1ab7 209 "-I${prefix}/include" \
28461f0e
MW
210 "-I/usr/include/wireshark" \
211 "-I/usr/local/include/wireshark" \
ef4a1ab7 212 "-I/usr/local/include"; do
165db1a8 213 CFLAGS="$GLIB_CFLAGS $i"
214 AC_TRY_COMPILE([
215#include <netinet/in.h>
216#include <glib.h>
28461f0e
MW
217#include <wireshark/config.h>
218#include <wireshark/epan/packet.h>
165db1a8 219], [
220 dissector_handle_t dh;
3cdc3f3a 221 dh = create_dissector_handle(0, 0);
165db1a8 222 ], [bad=false; break])
223 done
ef4a1ab7 224 if test $bad = false; then
28461f0e 225 mdw_cv_wireshark_includes=$i
165db1a8 226 fi
165db1a8 227 CFLAGS=$mdw_CFLAGS
228 ])
28461f0e
MW
229 case $mdw_cv_wireshark_includes in
230 failed) wireshark=false;;
ef4a1ab7 231 esac
232fi
233
28461f0e
MW
234if test "$wireshark" = true; then
235 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
236 AC_SUBST(WIRESHARK_CFLAGS)
237 AC_SUBST(WIRESHARK_PLUGIN_DIR)
238 DIRS="$DIRS wireshark"
165db1a8 239fi
410c8acf 240
28461f0e
MW
241if test "$wireshark" = false -a "$requirewireshark" = true; then
242 AC_MSG_ERROR([failed to configure Wireshark plugin])
ef4a1ab7 243fi
244
3cdc3f3a 245AH_TEMPLATE([CONFIGDIR],
246 [Tripe should look here for keys and other configuration.])
247AH_TEMPLATE([SOCKETDIR],
248 [Tripe should make its administration socket here.])
ef4a1ab7 249mdw_DEFINE_PATHS([
250 mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
251 mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
252 AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
253 AC_SUBST(initconfig)
254])
060ca767 255AC_OUTPUT( \
78698994
MW
256 Makefile \
257 common/Makefile client/Makefile server/Makefile \
258 proxy/Makefile pkstream/Makefile \
259 doc/Makefile \
260 wireshark/Makefile \
261 init/Makefile init/tripe-init \
262 keys/Makefile keys/tripe-keys \
263 mon/Makefile mon/tripemon)
410c8acf 264
265dnl ----- That's all, folks -------------------------------------------------