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])
43 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
45 mdw_ORIG_CFLAGS=$CFLAGS
46 mdw_ORIG_CPPFLAGS=$CPPFLAGS
50 dnl--------------------------------------------------------------------------
51 dnl C programming environment.
53 AC_CHECK_HEADERS([stdarg.h])
55 AC_SEARCH_LIBS([socket], [socket])
59 AC_ARG_WITH([linux-includes],
61 [--with-linux-includes=DIR],
62 [Linux kernel includes]),
63 [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:])
67 PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
68 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.4])
70 AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
72 dnl--------------------------------------------------------------------------
73 dnl Directories to install things into.
75 dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
76 AC_DEFUN([TRIPE_DEFINE_PATH], [
77 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
78 [$1=$withval], [$1=$4])
81 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
87 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
88 ['${localstatedir}/tripe'],
89 [CONFIGDIR], [Look for keys and other configuration here.])
92 [socketdir], [DIR], [admin socket [[.]]], [.],
93 [SOCKETDIR], [Create or look for administration socket here.])
96 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
100 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
101 ['${sysconfdir}/tripe.conf'])
104 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
106 dnl--------------------------------------------------------------------------
107 dnl Privilege-separation helper.
110 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
111 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
112 [Pathname of privilege-separation helper.])
115 dnl--------------------------------------------------------------------------
118 AC_ARG_WITH([tracing],
121 [compile out tracing support (not recommended)]),
122 [test "$withval" = no &&
123 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
126 dnl--------------------------------------------------------------------------
129 dnl Provide the user with a choice.
130 AC_ARG_WITH([tunnel],
132 [--with-tunnel=KIND],
133 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
134 [tun=$withval], [tun=auto])
136 dnl If he doesn't choose, pick something sensible.
137 if test "$tun" = auto; then
138 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
143 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
155 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
163 linux) AC_DEFINE([TUN_LINUX], [1],
164 [Install the Linux TUN/TAP driver.]) ;;
165 bsd) AC_DEFINE([TUN_BSD], [1],
166 [Install the BSD tunnel driver.]) ;;
167 unet) AC_DEFINE([TUN_UNET], [1],
168 [Install the obsolete Linux Usernet driver.]) ;;
170 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
172 tunnels="$tunnels&tun_$i, "
174 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
175 [List of tunnel drivers to install.])
177 dnl--------------------------------------------------------------------------
180 dnl Find out whether Python exists at all.
181 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
182 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
184 dnl Find out whether we can use the various external modules.
185 if test $python = yes; then
186 AC_PYTHON_MODULE([pygtk])
187 AC_PYTHON_MODULE([cdb])
188 AC_PYTHON_MODULE([mLib])
189 AC_PYTHON_MODULE([catacomb])
191 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
192 AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
193 AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
194 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
196 dnl--------------------------------------------------------------------------
199 dnl This is all distressingly ugly and complicated. Why they can't just
200 dnl provide a pkg-config dropping containing all the useful information about
201 dnl the installation I don't know.
204 : ${wireshark_plugindir=unknown}
206 dnl Get the user to help.
207 AC_ARG_WITH([wireshark],
209 [--with-wireshark[=DIR]],
210 [build and install Wireshark plugin]),
212 no) haveshark=no needshark=no ;;
213 yes) haveshark=yes needshark=yes ;;
214 *) haveshark=yes needshark=yes
215 wireshark_plugindir=$withval ;;
217 [haveshark=yes needshark=no])
219 dnl Try to find the Wireshark installation directory the hard way. This is
220 dnl remarkably annoying. This is, unfortunately, very likely to guess wrong,
221 dnl but there doesn't seem to be a better 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=$(
228 $libexecdir $libdir $exec_prefix/lib $prefix/lib \
229 /usr/local/lib /usr/lib
232 wireshark/plugins/* wireshark/*/plugins \
233 */wireshark/plugins/* */wireshark/*/plugins
235 for k in $i/$j/*.so; do
236 if test -f "$k"; then
237 echo $(AS_DIRNAME(["$k"]))
246 case $mdw_cv_wireshark_plugin_dir in
247 failed) haveshark=no ;;
248 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
252 dnl If we're still interested, find Glib.
254 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
257 dnl Find the include directory. This would be much easier if they just
258 dnl provided a pkg-config file.
263 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
264 AC_CACHE_CHECK([how to find the Wireshark headers],
265 [mdw_cv_wireshark_includes], [
266 mdw_cv_wireshark_includes=failed
269 "-I${wsprefix}/include/wireshark" \
270 "-I${wsprefix}/include" \
271 "-I${prefix}/include/wireshark" \
272 "-I${prefix}/include" \
273 "-I/usr/include/wireshark" \
274 "-I/usr/local/include/wireshark" \
275 "-I/usr/local/include"; do
276 CFLAGS="$GLIB_CFLAGS $i"
278 #include <netinet/in.h>
280 #include <wireshark/config.h>
281 #include <wireshark/epan/packet.h>],
282 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
286 no) mdw_cv_wireshark_includes=$i ;;
290 case "$mdw_cv_wireshark_includes" in
291 failed) haveshark=no ;;
295 case "$haveshark,$needshark" in
297 AC_MSG_ERROR([failed to configure Wireshark plugin])
300 WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
301 AC_SUBST(WIRESHARK_CFLAGS)
302 AC_SUBST(wireshark_plugindir)
306 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
308 dnl--------------------------------------------------------------------------
311 CFLAGS=$mdw_ORIG_CFLAGS
312 CPPFLAGS=$mdw_ORIG_CPPFLAGS
314 AC_CONFIG_HEADER([config/config.h])
315 AC_CONFIG_TESTDIR([t])
335 [t/Makefile t/atlocal])
338 dnl----- That's all, folks --------------------------------------------------