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