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])
41 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
43 dnl--------------------------------------------------------------------------
44 dnl C programming environment.
46 AC_CHECK_HEADERS([stdarg.h])
48 AC_SEARCH_LIBS([socket], [socket])
52 AC_ARG_WITH([linux-includes],
54 [--with-linux-includes=DIR],
55 [Linux kernel includes]),
56 [CFLAGS="$CFLAGS -I$withval"], [:])
60 PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
61 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
63 CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
65 dnl--------------------------------------------------------------------------
66 dnl Directories to install things into.
68 dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
69 AC_DEFUN([TRIPE_DEFINE_PATH], [
70 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
71 [$1=$withval], [$1=$4])
74 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
80 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
81 ['${localstatedir}/tripe'],
82 [CONFIGDIR], [Look for keys and other configuration here.])
85 [socketdir], [DIR], [admin socket [[.]]], [.],
86 [SOCKETDIR], [Create or look for administration socket here.])
89 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
93 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
94 ['${sysconfdir}/tripe.conf'])
97 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
99 dnl--------------------------------------------------------------------------
100 dnl Privilege-separation helper.
103 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
104 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
105 [Pathname of privilege-separation helper.])
108 dnl--------------------------------------------------------------------------
111 AC_ARG_WITH([tracing],
114 [compile out tracing support (not recommended)]),
115 [test "$withval" = no &&
116 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
119 dnl--------------------------------------------------------------------------
120 dnl Path MTU discovery.
130 AM_CONDITIONAL([PATHMTU], [test $pmtu = yes])
132 dnl--------------------------------------------------------------------------
135 dnl Provide the user with a choice.
136 AC_ARG_WITH([tunnel],
138 [--with-tunnel=KIND],
139 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
140 [tun=$withval], [tun=auto])
142 dnl If he doesn't choose, pick something sensible.
143 if test "$tun" = auto; then
144 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
149 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
161 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
169 linux) AC_DEFINE([TUN_LINUX], [1],
170 [Install the Linux TUN/TAP driver.]) ;;
171 bsd) AC_DEFINE([TUN_BSD], [1],
172 [Install the BSD tunnel driver.]) ;;
173 unet) AC_DEFINE([TUN_UNET], [1],
174 [Install the obsolete Linux Usernet driver.]) ;;
176 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
178 tunnels="$tunnels&tun_$i, "
180 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
181 [List of tunnel drivers to install.])
183 dnl--------------------------------------------------------------------------
186 dnl Find out whether Python exists at all.
187 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
188 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
190 dnl Find out whether we can use Catacomb and GTK.
191 if test $python = yes; then
192 AC_PYTHON_MODULE([pygtk])
193 AC_PYTHON_MODULE([catacomb])
195 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
196 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
198 dnl--------------------------------------------------------------------------
201 dnl This is all distressingly ugly and complicated. Why they can't just
202 dnl provide a pkg-config dropping containing all the useful information about
203 dnl the installation I don't know.
206 : ${wireshark_plugindir=unknown}
208 dnl Get the user to help.
209 AC_ARG_WITH([wireshark],
211 [--with-wireshark[=DIR]],
212 [build and install Wireshark plugin]),
214 no) haveshark=no needshark=no ;;
215 yes) haveshark=yes needshark=yes ;;
216 *) haveshark=yes needshark=yes
217 wireshark_plugindir=$withval ;;
219 [haveshark=yes needshark=no])
221 dnl Try to find the Wireshark installation directory the hard way.
222 case "$haveshark,$wireshark_plugindir" in
224 AC_CACHE_CHECK([where to put Wireshark plugins],
225 [mdw_cv_wireshark_plugin_dir], [
226 mdw_cv_wireshark_plugin_dir="failed"
228 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
229 if test -x "$i/bin/tshark"; then
234 if test "$wsprefix" != none; then
235 wsbin=$wsprefix/bin/tshark
236 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
237 dir=$wsprefix/lib/wireshark/plugins
238 test -d "$dir/$wsver" && dir="$dir/$wsver"
239 if test -d "$dir"; then
240 mdw_cv_wireshark_plugin_dir=$dir
244 case $mdw_cv_wireshark_plugin_dir in
245 failed) haveshark=no ;;
246 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
250 dnl If we're still interested, find Glib.
252 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
255 dnl Find the include directory. This would be much easier if they just
256 dnl provided a pkg-config file.
261 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
262 AC_CACHE_CHECK([how to find the Wireshark headers],
263 [mdw_cv_wireshark_includes], [
264 mdw_cv_wireshark_includes=failed
267 "-I${wsprefix}/include/wireshark" \
268 "-I${wsprefix}/include" \
269 "-I${prefix}/include/wireshark" \
270 "-I${prefix}/include" \
271 "-I/usr/include/wireshark" \
272 "-I/usr/local/include/wireshark" \
273 "-I/usr/local/include"; do
274 CFLAGS="$GLIB_CFLAGS $i"
276 #include <netinet/in.h>
278 #include <wireshark/config.h>
279 #include <wireshark/epan/packet.h>],
280 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
284 no) mdw_cv_wireshark_includes=$i ;;
288 case "$mdw_cv_wireshark_includes" in
289 failed) haveshark=no ;;
293 case "$haveshark,$needshark" in
295 AC_MSG_ERROR([failed to configure Wireshark plugin])
298 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
299 AC_SUBST(WIRESHARK_CFLAGS)
300 AC_SUBST(wireshark_plugindir)
304 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
306 dnl--------------------------------------------------------------------------
309 AC_CONFIG_HEADER([config/config.h])
310 AC_CONFIG_TESTDIR([t])
329 [t/Makefile t/atlocal])
332 dnl ----- That's all, folks -------------------------------------------------