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 dnl--------------------------------------------------------------------------
45 dnl C programming environment.
47 AC_CHECK_HEADERS([stdarg.h])
49 AC_SEARCH_LIBS([socket], [socket])
53 AC_ARG_WITH([linux-includes],
55 [--with-linux-includes=DIR],
56 [Linux kernel includes]),
57 [CFLAGS="$CFLAGS -I$withval"], [:])
61 PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
62 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
64 CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
66 dnl--------------------------------------------------------------------------
67 dnl Directories to install things into.
69 dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
70 AC_DEFUN([TRIPE_DEFINE_PATH], [
71 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
72 [$1=$withval], [$1=$4])
75 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
81 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
82 ['${localstatedir}/tripe'],
83 [CONFIGDIR], [Look for keys and other configuration here.])
86 [socketdir], [DIR], [admin socket [[.]]], [.],
87 [SOCKETDIR], [Create or look for administration socket here.])
90 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
94 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
95 ['${sysconfdir}/tripe.conf'])
98 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
100 dnl--------------------------------------------------------------------------
101 dnl Privilege-separation helper.
104 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
105 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
106 [Pathname of privilege-separation helper.])
109 dnl--------------------------------------------------------------------------
112 AC_ARG_WITH([tracing],
115 [compile out tracing support (not recommended)]),
116 [test "$withval" = no &&
117 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
120 dnl--------------------------------------------------------------------------
121 dnl Path MTU discovery.
131 AM_CONDITIONAL([PATHMTU], [test $pmtu = yes])
133 dnl--------------------------------------------------------------------------
136 dnl Provide the user with a choice.
137 AC_ARG_WITH([tunnel],
139 [--with-tunnel=KIND],
140 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
141 [tun=$withval], [tun=auto])
143 dnl If he doesn't choose, pick something sensible.
144 if test "$tun" = auto; then
145 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
150 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
162 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
170 linux) AC_DEFINE([TUN_LINUX], [1],
171 [Install the Linux TUN/TAP driver.]) ;;
172 bsd) AC_DEFINE([TUN_BSD], [1],
173 [Install the BSD tunnel driver.]) ;;
174 unet) AC_DEFINE([TUN_UNET], [1],
175 [Install the obsolete Linux Usernet driver.]) ;;
177 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
179 tunnels="$tunnels&tun_$i, "
181 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
182 [List of tunnel drivers to install.])
184 dnl--------------------------------------------------------------------------
187 dnl Find out whether Python exists at all.
188 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
189 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
191 dnl Find out whether we can use Catacomb and GTK.
192 if test $python = yes; then
193 AC_PYTHON_MODULE([pygtk])
194 AC_PYTHON_MODULE([catacomb])
196 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
197 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
199 dnl--------------------------------------------------------------------------
202 dnl This is all distressingly ugly and complicated. Why they can't just
203 dnl provide a pkg-config dropping containing all the useful information about
204 dnl the installation I don't know.
207 : ${wireshark_plugindir=unknown}
209 dnl Get the user to help.
210 AC_ARG_WITH([wireshark],
212 [--with-wireshark[=DIR]],
213 [build and install Wireshark plugin]),
215 no) haveshark=no needshark=no ;;
216 yes) haveshark=yes needshark=yes ;;
217 *) haveshark=yes needshark=yes
218 wireshark_plugindir=$withval ;;
220 [haveshark=yes needshark=no])
222 dnl Try to find the Wireshark installation directory the hard way.
223 case "$haveshark,$wireshark_plugindir" in
225 AC_CACHE_CHECK([where to put Wireshark plugins],
226 [mdw_cv_wireshark_plugin_dir], [
227 mdw_cv_wireshark_plugin_dir="failed"
229 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
230 if test -x "$i/bin/tshark"; then
235 if test "$wsprefix" != none; then
236 wsbin=$wsprefix/bin/tshark
237 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
238 dir=$wsprefix/lib/wireshark/plugins
239 test -d "$dir/$wsver" && dir="$dir/$wsver"
240 if test -d "$dir"; then
241 mdw_cv_wireshark_plugin_dir=$dir
245 case $mdw_cv_wireshark_plugin_dir in
246 failed) haveshark=no ;;
247 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
251 dnl If we're still interested, find Glib.
253 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
256 dnl Find the include directory. This would be much easier if they just
257 dnl provided a pkg-config file.
262 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
263 AC_CACHE_CHECK([how to find the Wireshark headers],
264 [mdw_cv_wireshark_includes], [
265 mdw_cv_wireshark_includes=failed
268 "-I${wsprefix}/include/wireshark" \
269 "-I${wsprefix}/include" \
270 "-I${prefix}/include/wireshark" \
271 "-I${prefix}/include" \
272 "-I/usr/include/wireshark" \
273 "-I/usr/local/include/wireshark" \
274 "-I/usr/local/include"; do
275 CFLAGS="$GLIB_CFLAGS $i"
277 #include <netinet/in.h>
279 #include <wireshark/config.h>
280 #include <wireshark/epan/packet.h>],
281 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
285 no) mdw_cv_wireshark_includes=$i ;;
289 case "$mdw_cv_wireshark_includes" in
290 failed) haveshark=no ;;
294 case "$haveshark,$needshark" in
296 AC_MSG_ERROR([failed to configure Wireshark plugin])
299 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
300 AC_SUBST(WIRESHARK_CFLAGS)
301 AC_SUBST(wireshark_plugindir)
305 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
307 dnl--------------------------------------------------------------------------
310 AC_CONFIG_HEADER([config/config.h])
311 AC_CONFIG_TESTDIR([t])
330 [t/Makefile t/atlocal])
333 dnl ----- That's all, folks -------------------------------------------------