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.0.4])
61 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
63 CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
64 LIBS="$LIBS $mLib_LIBS"
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])
93 [initconfig], [FILE], [configuration for init script [[/etc/tripe.conf]]],
97 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
99 dnl--------------------------------------------------------------------------
102 AC_ARG_WITH([tracing],
105 [compile out tracing support (not recommended)]),
106 [test "$withval" = no &&
107 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
110 dnl--------------------------------------------------------------------------
113 dnl Provide the user with a choice.
114 AC_ARG_WITH([tunnel],
116 [--with-tunnel=KIND],
117 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
118 [tun=$withval], [tun=auto])
120 dnl If he doesn't choose, pick something sensible.
121 if test "$tun" = auto; then
122 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
127 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
139 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
147 linux) AC_DEFINE([TUN_LINUX], [1],
148 [Install the Linux TUN/TAP driver.]) ;;
149 bsd) AC_DEFINE([TUN_BSD], [1],
150 [Install the BSD tunnel driver.]) ;;
151 unet) AC_DEFINE([TUN_UNET], [1],
152 [Install the obsolete Linux Usernet driver.]) ;;
154 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
156 tunnels="$tunnels&tun_$i, "
158 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
159 [List of tunnel drivers to install.])
161 dnl--------------------------------------------------------------------------
164 dnl Find out whether Python exists at all.
165 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
166 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
168 dnl Find out whether we can use Catacomb and GTK.
169 if test $python = yes; then
170 AC_PYTHON_MODULE([pygtk])
171 AC_PYTHON_MODULE([catacomb])
173 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
174 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
176 dnl--------------------------------------------------------------------------
179 dnl This is all distressingly ugly and complicated. Why they can't just
180 dnl provide a pkg-config dropping containing all the useful information about
181 dnl the installation I don't know.
184 : ${wireshark_plugindir=unknown}
186 dnl Get the user to help.
187 AC_ARG_WITH([wireshark],
189 [--with-wireshark[=DIR]],
190 [build and install Wireshark plugin]),
192 no) haveshark=no needshark=no ;;
193 yes) haveshark=yes needshark=yes ;;
194 *) haveshark=yes needshark=yes
195 wireshark_plugindir=$withval ;;
197 [haveshark=yes needshark=no])
199 dnl Try to find the Wireshark installation directory the hard way.
200 case "$haveshark,$wireshark_plugindir" in
202 AC_CACHE_CHECK([where to put Wireshark plugins],
203 [mdw_cv_wireshark_plugin_dir], [
204 mdw_cv_wireshark_plugin_dir="failed"
206 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
207 if test -x "$i/bin/tshark"; then
212 if test "$wsprefix" != none; then
213 wsbin=$wsprefix/bin/tshark
214 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
215 dir=$wsprefix/lib/wireshark/plugins
216 test -d "$dir/$wsver" && dir="$dir/$wsver"
217 if test -d "$dir"; then
218 mdw_cv_wireshark_plugin_dir=$dir
222 case $mdw_cv_wireshark_plugin_dir in
223 failed) haveshark=no ;;
224 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
228 dnl If we're still interested, find Glib.
230 yes) AM_PATH_GLIB([1.2.0], [], haveshark=false, [gmodule]) ;;
233 dnl Find the include directory. This would be much easier if they just
234 dnl provided a pkg-config file.
239 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
240 AC_CACHE_CHECK([how to find the Wireshark headers],
241 [mdw_cv_wireshark_includes], [
242 mdw_cv_wireshark_includes=failed
245 "-I${wsprefix}/include/wireshark" \
246 "-I${wsprefix}/include" \
247 "-I${prefix}/include/wireshark" \
248 "-I${prefix}/include" \
249 "-I/usr/include/wireshark" \
250 "-I/usr/local/include/wireshark" \
251 "-I/usr/local/include"; do
252 CFLAGS="$GLIB_CFLAGS $i"
254 #include <netinet/in.h>
256 #include <wireshark/config.h>
257 #include <wireshark/epan/packet.h>],
258 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
262 no) mdw_cv_wireshark_includes=$i ;;
266 case "$mdw_cv_wireshark_includes" in
267 failed) haveshark=no ;;
271 case "$haveshark,$needshark" in
273 AC_MSG_ERROR([failed to configure Wireshark plugin])
276 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
277 AC_SUBST(WIRESHARK_CFLAGS)
278 AC_SUBST(wireshark_plugindir)
282 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
284 dnl--------------------------------------------------------------------------
287 AC_CONFIG_HEADER([config/config.h])
288 AC_CONFIG_TESTDIR([t])
302 [t/Makefile t/atlocal])
305 dnl ----- That's all, folks -------------------------------------------------