3 dnl Configuration script for TrIPE
5 dnl (c) 2001 Straylight/Edgeware
8 dnl ----- Licensing notice --------------------------------------------------
10 dnl This file is part of Trivial IP Encryption (TrIPE).
12 dnl TrIPE is free software; you can redistribute it and/or modify
13 dnl it under the terms of the GNU General Public License as published by
14 dnl the Free Software Foundation; either version 2 of the License, or
15 dnl (at your option) any later version.
17 dnl TrIPE is distributed in the hope that it will be useful,
18 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 dnl GNU General Public License for more details.
22 dnl You should have received a copy of the GNU General Public License
23 dnl along with TrIPE; if not, write to the Free Software Foundation,
24 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 dnl--------------------------------------------------------------------------
30 AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk])
31 AC_CONFIG_SRCDIR([server/tripe.h])
32 AC_CONFIG_AUX_DIR([config])
33 AM_INIT_AUTOMAKE([foreign])
42 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
44 mdw_ORIG_CFLAGS=$CFLAGS
45 mdw_ORIG_CPPFLAGS=$CPPFLAGS
49 dnl--------------------------------------------------------------------------
50 dnl C programming environment.
52 AC_CHECK_HEADERS([stdarg.h])
54 AC_SEARCH_LIBS([socket], [socket])
58 AC_ARG_WITH([linux-includes],
60 [--with-linux-includes=DIR],
61 [Linux kernel includes]),
62 [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:])
66 PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
67 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
69 AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
71 dnl--------------------------------------------------------------------------
72 dnl Directories to install things into.
74 dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
75 AC_DEFUN([TRIPE_DEFINE_PATH], [
76 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
77 [$1=$withval], [$1=$4])
80 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
86 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
87 ['${localstatedir}/tripe'],
88 [CONFIGDIR], [Look for keys and other configuration here.])
91 [socketdir], [DIR], [admin socket [[.]]], [.],
92 [SOCKETDIR], [Create or look for administration socket here.])
95 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
99 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
100 ['${sysconfdir}/tripe.conf'])
103 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
105 dnl--------------------------------------------------------------------------
106 dnl Privilege-separation helper.
109 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
110 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
111 [Pathname of privilege-separation helper.])
114 dnl--------------------------------------------------------------------------
117 AC_ARG_WITH([tracing],
120 [compile out tracing support (not recommended)]),
121 [test "$withval" = no &&
122 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
125 dnl--------------------------------------------------------------------------
126 dnl Path MTU discovery.
136 AM_CONDITIONAL([PATHMTU], [test $pmtu = yes])
138 dnl--------------------------------------------------------------------------
141 dnl Provide the user with a choice.
142 AC_ARG_WITH([tunnel],
144 [--with-tunnel=KIND],
145 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
146 [tun=$withval], [tun=auto])
148 dnl If he doesn't choose, pick something sensible.
149 if test "$tun" = auto; then
150 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
155 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
167 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
175 linux) AC_DEFINE([TUN_LINUX], [1],
176 [Install the Linux TUN/TAP driver.]) ;;
177 bsd) AC_DEFINE([TUN_BSD], [1],
178 [Install the BSD tunnel driver.]) ;;
179 unet) AC_DEFINE([TUN_UNET], [1],
180 [Install the obsolete Linux Usernet driver.]) ;;
182 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
184 tunnels="$tunnels&tun_$i, "
186 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
187 [List of tunnel drivers to install.])
189 dnl--------------------------------------------------------------------------
192 dnl Find out whether Python exists at all.
193 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
194 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
196 dnl Find out whether we can use Catacomb and GTK.
197 if test $python = yes; then
198 AC_PYTHON_MODULE([pygtk])
199 AC_PYTHON_MODULE([catacomb])
201 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
202 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
204 dnl--------------------------------------------------------------------------
207 dnl This is all distressingly ugly and complicated. Why they can't just
208 dnl provide a pkg-config dropping containing all the useful information about
209 dnl the installation I don't know.
212 : ${wireshark_plugindir=unknown}
214 dnl Get the user to help.
215 AC_ARG_WITH([wireshark],
217 [--with-wireshark[=DIR]],
218 [build and install Wireshark plugin]),
220 no) haveshark=no needshark=no ;;
221 yes) haveshark=yes needshark=yes ;;
222 *) haveshark=yes needshark=yes
223 wireshark_plugindir=$withval ;;
225 [haveshark=yes needshark=no])
227 dnl Try to find the Wireshark installation directory the hard way.
228 case "$haveshark,$wireshark_plugindir" in
230 AC_CACHE_CHECK([where to put Wireshark plugins],
231 [mdw_cv_wireshark_plugin_dir], [
232 mdw_cv_wireshark_plugin_dir="failed"
234 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
235 if test -x "$i/bin/tshark"; then
240 if test "$wsprefix" != none; then
241 wsbin=$wsprefix/bin/tshark
242 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
243 dir=$wsprefix/lib/wireshark/plugins
244 test -d "$dir/$wsver" && dir="$dir/$wsver"
245 if test -d "$dir"; then
246 mdw_cv_wireshark_plugin_dir=$dir
250 case $mdw_cv_wireshark_plugin_dir in
251 failed) haveshark=no ;;
252 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
256 dnl If we're still interested, find Glib.
258 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
261 dnl Find the include directory. This would be much easier if they just
262 dnl provided a pkg-config file.
267 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
268 AC_CACHE_CHECK([how to find the Wireshark headers],
269 [mdw_cv_wireshark_includes], [
270 mdw_cv_wireshark_includes=failed
273 "-I${wsprefix}/include/wireshark" \
274 "-I${wsprefix}/include" \
275 "-I${prefix}/include/wireshark" \
276 "-I${prefix}/include" \
277 "-I/usr/include/wireshark" \
278 "-I/usr/local/include/wireshark" \
279 "-I/usr/local/include"; do
280 CFLAGS="$GLIB_CFLAGS $i"
282 #include <netinet/in.h>
284 #include <wireshark/config.h>
285 #include <wireshark/epan/packet.h>],
286 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
290 no) mdw_cv_wireshark_includes=$i ;;
294 case "$mdw_cv_wireshark_includes" in
295 failed) haveshark=no ;;
299 case "$haveshark,$needshark" in
301 AC_MSG_ERROR([failed to configure Wireshark plugin])
304 WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
305 AC_SUBST(WIRESHARK_CFLAGS)
306 AC_SUBST(wireshark_plugindir)
310 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
312 dnl--------------------------------------------------------------------------
315 CFLAGS=$mdw_ORIG_CFLAGS
316 CPPFLAGS=$mdw_ORIG_CPPFLAGS
318 AC_CONFIG_HEADER([config/config.h])
319 AC_CONFIG_TESTDIR([t])
339 [t/Makefile t/atlocal])
342 dnl ----- That's all, folks -------------------------------------------------