chiark / gitweb /
cleanup: Rename a few badly-chosen variables.
[tripe] / configure.in
... / ...
CommitLineData
1dnl -*-autoconf-*-
2dnl
3dnl $Id$
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
28AC_INIT(server/tripe.c)
29AM_INIT_AUTOMAKE(tripe, 1.0.0pre7)
30AM_CONFIG_HEADER(common/config.h)
31AC_CANONICAL_HOST
32
33AC_PROG_MAKE_SET
34AC_PROG_CC
35AM_PROG_LIBTOOL
36DIRS="" AC_SUBST([DIRS])
37
38python=no
39mdw_PROG_PYTHON([2.3],
40 [python=yes
41 pyscripts='${PYTHONSCRIPTS}'
42 DIRS="$DIRS keys"
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}'
58 DIRS="$DIRS mon"
59 pygtkmans='${PYGTKMANS}'
60 fi
61fi
62AC_SUBST([pygtkscripts]) AC_SUBST([pygtkmans])
63
64AC_CHECK_HEADERS([stdarg.h])
65mdw_GCC_FLAGS([-Wall])
66mdw_OPT_TRACE
67
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
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
103WIRESHARK_CFLAGS=""
104WIRESHARK_PLUGIN_DIR="unknown"
105AC_ARG_WITH([wireshark],
106[ --with-wireshark build and install Wireshark plugin],
107[case "$withval" in
108 no) wireshark=false requirewireshark=false;;
109 yes) wireshark=true; requirewireshark=true;;
110 *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;;
111esac],
112[wireshark=true requirewireshark=false])
113
114tun=auto
115AC_ARG_WITH([tunnel],
116[ --with-tunnel=KIND kinds of tunnel device to use
117 (linux, unet, bsd, slip)],
118[tun=$withval])
119
120if test "$tun" = auto; then
121 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
122 mdw_cv_tunnel=""
123 case $host_os in
124 linux*)
125 case `uname -r` in
126changequote(,)dnl
127 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
128changequote([,])dnl
129 mdw_cv_tunnel=linux
130 ;;
131 *)
132 mdw_cv_tunnel=unet
133 ;;
134 esac
135 ;;
136 *bsd*)
137 mdw_cv_tunnel=bsd
138 ;;
139 esac
140 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
141 ])
142 tun=$mdw_cv_tunnel
143fi
144
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
159AC_SUBST(tun)
160AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
161 [List of tunnel drivers to install.])
162
163mdw_MLIB(2.0.0)
164mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
165
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], [
169 changequote(,)
170 mdw_cv_wireshark_plugin_dir="failed"
171 wsprefix=none
172 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
173 if test -x "$i/bin/tshark"; then
174 wsprefix=$i
175 break
176 fi
177 done
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
182 if test -d "$dir"; then
183 mdw_cv_wireshark_plugin_dir=$dir
184 fi
185 fi
186 changequote([, ])
187 ])
188 case $mdw_cv_wireshark_plugin_dir in
189 failed) wireshark=false;;
190 *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;;
191 esac
192fi
193
194if test "$wireshark" = true; then
195 AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule])
196fi
197if test "$wireshark" = true; then
198 bad=true
199 mdw_CFLAGS=$CFLAGS
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
204 for i in \
205 "" \
206 "-I${wsprefix}/include/wireshark" \
207 "-I${wsprefix}/include" \
208 "-I${prefix}/include/wireshark" \
209 "-I${prefix}/include" \
210 "-I/usr/include/wireshark" \
211 "-I/usr/local/include/wireshark" \
212 "-I/usr/local/include"; do
213 CFLAGS="$GLIB_CFLAGS $i"
214 AC_TRY_COMPILE([
215#include <netinet/in.h>
216#include <glib.h>
217#include <wireshark/config.h>
218#include <wireshark/epan/packet.h>
219], [
220 dissector_handle_t dh;
221 dh = create_dissector_handle(0, 0);
222 ], [bad=false; break])
223 done
224 if test $bad = false; then
225 mdw_cv_wireshark_includes=$i
226 fi
227 CFLAGS=$mdw_CFLAGS
228 ])
229 case $mdw_cv_wireshark_includes in
230 failed) wireshark=false;;
231 esac
232fi
233
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"
239fi
240
241if test "$wireshark" = false -a "$requirewireshark" = true; then
242 AC_MSG_ERROR([failed to configure Wireshark plugin])
243fi
244
245AH_TEMPLATE([CONFIGDIR],
246 [Tripe should look here for keys and other configuration.])
247AH_TEMPLATE([SOCKETDIR],
248 [Tripe should make its administration socket here.])
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])
255AC_OUTPUT( \
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)
264
265dnl ----- That's all, folks -------------------------------------------------