server/admin: New ALGS command.
[tripe] / configure.ac
CommitLineData
6b6ad670
MW
1dnl -*-autoconf-*-
2dnl
3dnl Configuration script for TrIPE
4dnl
5dnl (c) 2001 Straylight/Edgeware
6dnl
7
8dnl ----- Licensing notice --------------------------------------------------
9dnl
10dnl This file is part of Trivial IP Encryption (TrIPE).
11dnl
12dnl TrIPE is free software; you can redistribute it and/or modify
13dnl it under the terms of the GNU General Public License as published by
14dnl the Free Software Foundation; either version 2 of the License, or
15dnl (at your option) any later version.
16dnl
17dnl TrIPE is distributed in the hope that it will be useful,
18dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
19dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20dnl GNU General Public License for more details.
21dnl
22dnl You should have received a copy of the GNU General Public License
23dnl along with TrIPE; if not, write to the Free Software Foundation,
24dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
26dnl--------------------------------------------------------------------------
27dnl Initialization.
28
29mdw_AUTO_VERSION
30AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk])
31AC_CONFIG_SRCDIR([server/tripe.h])
32AC_CONFIG_AUX_DIR([config])
33AM_INIT_AUTOMAKE([foreign])
34
35AC_PROG_CC
36AM_PROG_CC_C_O
37AX_CFLAGS_WARN_ALL
38AC_CANONICAL_HOST
39AM_PROG_LIBTOOL
40
1c5f4539
MW
41AC_CHECK_PROGS([AUTOM4TE], [autom4te])
42
6b6ad670
MW
43dnl--------------------------------------------------------------------------
44dnl C programming environment.
45
46AC_CHECK_HEADERS([stdarg.h])
47
48AC_SEARCH_LIBS([socket], [socket])
49
50case "$host_os" in
51 linux)
52 AC_ARG_WITH([linux-includes],
53 AS_HELP_STRING(
54 [--with-linux-includes=DIR],
55 [Linux kernel includes]),
56 [CFLAGS="$CFLAGS -I$withval"], [:])
57 ;;
58esac
59
60PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4])
61PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
62
63CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
6b6ad670
MW
64
65dnl--------------------------------------------------------------------------
66dnl Directories to install things into.
67
68dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
69AC_DEFUN([TRIPE_DEFINE_PATH], [
70 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
71 [$1=$withval], [$1=$4])
72 AC_SUBST([$1])
73 m4_if([$5], [], [], [
74 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
75 ])
76])
77
78dnl Actual options.
79TRIPE_DEFINE_PATH(
80 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
81 ['${localstatedir}/tripe'],
82 [CONFIGDIR], [Look for keys and other configuration here.])
83
84TRIPE_DEFINE_PATH(
85 [socketdir], [DIR], [admin socket [[.]]], [.],
86 [SOCKETDIR], [Create or look for administration socket here.])
87
88TRIPE_DEFINE_PATH(
89 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
90
91TRIPE_DEFINE_PATH(
92 [initconfig], [FILE], [configuration for init script [[/etc/tripe.conf]]],
93 [/etc/tripe.conf])
94
95TRIPE_DEFINE_PATH(
96 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
97
98dnl--------------------------------------------------------------------------
99dnl Other options.
100
101AC_ARG_WITH([tracing],
102 AS_HELP_STRING(
103 [--without-tracing],
104 [compile out tracing support (not recommended)]),
105 [test "$withval" = no &&
106 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
107 [:])
108
109dnl--------------------------------------------------------------------------
110dnl Tunnel devices.
111
112dnl Provide the user with a choice.
113AC_ARG_WITH([tunnel],
114 AS_HELP_STRING(
115 [--with-tunnel=KIND],
116 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
117 [tun=$withval], [tun=auto])
118
119dnl If he doesn't choose, pick something sensible.
120if test "$tun" = auto; then
121 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
122 mdw_cv_tunnel=""
123 case $host_os in
124 linux*)
125 case `uname -r` in
126 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
127 mdw_cv_tunnel=linux
128 ;;
129 *)
130 mdw_cv_tunnel=unet
131 ;;
132 esac
133 ;;
134 *bsd*)
135 mdw_cv_tunnel=bsd
136 ;;
137 esac
138 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
139 ])
140 tun=$mdw_cv_tunnel
141fi
142
143tunnels=""
144for i in $tun; do
145 case $i in
146 linux) AC_DEFINE([TUN_LINUX], [1],
147 [Install the Linux TUN/TAP driver.]) ;;
148 bsd) AC_DEFINE([TUN_BSD], [1],
149 [Install the BSD tunnel driver.]) ;;
150 unet) AC_DEFINE([TUN_UNET], [1],
151 [Install the obsolete Linux Usernet driver.]) ;;
152 slip) ;;
153 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
154 esac
155 tunnels="$tunnels&tun_$i, "
156done
157AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
158 [List of tunnel drivers to install.])
159
160dnl--------------------------------------------------------------------------
161dnl Python.
162
163dnl Find out whether Python exists at all.
164AM_PATH_PYTHON([2.4], [python=yes], [python=no])
165AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
166
167dnl Find out whether we can use Catacomb and GTK.
168if test $python = yes; then
169 AC_PYTHON_MODULE([pygtk])
170 AC_PYTHON_MODULE([catacomb])
171fi
172AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
173AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
174
175dnl--------------------------------------------------------------------------
176dnl Wireshark.
177dnl
178dnl This is all distressingly ugly and complicated. Why they can't just
179dnl provide a pkg-config dropping containing all the useful information about
180dnl the installation I don't know.
181
182WIRESHARK_CFLAGS=""
183: ${wireshark_plugindir=unknown}
184
185dnl Get the user to help.
186AC_ARG_WITH([wireshark],
187 AS_HELP_STRING(
188 [--with-wireshark[=DIR]],
189 [build and install Wireshark plugin]),
190 [case "$withval" in
191 no) haveshark=no needshark=no ;;
192 yes) haveshark=yes needshark=yes ;;
193 *) haveshark=yes needshark=yes
63efe3ef 194 wireshark_plugindir=$withval ;;
6b6ad670
MW
195 esac],
196 [haveshark=yes needshark=no])
197
198dnl Try to find the Wireshark installation directory the hard way.
199case "$haveshark,$wireshark_plugindir" in
200 yes,unknown)
201 AC_CACHE_CHECK([where to put Wireshark plugins],
202 [mdw_cv_wireshark_plugin_dir], [
203 mdw_cv_wireshark_plugin_dir="failed"
204 wsprefix=none
205 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
206 if test -x "$i/bin/tshark"; then
207 wsprefix=$i
208 break
209 fi
210 done
211 if test "$wsprefix" != none; then
212 wsbin=$wsprefix/bin/tshark
213 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
214 dir=$wsprefix/lib/wireshark/plugins
215 test -d "$dir/$wsver" && dir="$dir/$wsver"
216 if test -d "$dir"; then
217 mdw_cv_wireshark_plugin_dir=$dir
218 fi
219 fi
220 ])
221 case $mdw_cv_wireshark_plugin_dir in
222 failed) haveshark=no ;;
223 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
224 esac
225esac
226
227dnl If we're still interested, find Glib.
228case "$haveshark" in
9db701ca 229 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
6b6ad670
MW
230esac
231
232dnl Find the include directory. This would be much easier if they just
233dnl provided a pkg-config file.
234case "$haveshark" in
235 yes)
236 bad=yes
237 mdw_CFLAGS=$CFLAGS
238 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
239 AC_CACHE_CHECK([how to find the Wireshark headers],
63efe3ef 240 [mdw_cv_wireshark_includes], [
6b6ad670
MW
241 mdw_cv_wireshark_includes=failed
242 for i in \
243 "" \
244 "-I${wsprefix}/include/wireshark" \
245 "-I${wsprefix}/include" \
246 "-I${prefix}/include/wireshark" \
247 "-I${prefix}/include" \
248 "-I/usr/include/wireshark" \
249 "-I/usr/local/include/wireshark" \
250 "-I/usr/local/include"; do
251 CFLAGS="$GLIB_CFLAGS $i"
252 AC_TRY_COMPILE([
253#include <netinet/in.h>
254#include <glib.h>
255#include <wireshark/config.h>
256#include <wireshark/epan/packet.h>],
257 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
258 [bad=no; break])
259 done
260 case "$bad" in
261 no) mdw_cv_wireshark_includes=$i ;;
262 esac
263 CFLAGS=$mdw_CFLAGS
264 ])
265 case "$mdw_cv_wireshark_includes" in
266 failed) haveshark=no ;;
267 esac
268esac
269
270case "$haveshark,$needshark" in
271 no,yes)
272 AC_MSG_ERROR([failed to configure Wireshark plugin])
273 ;;
274 yes,*)
275 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
276 AC_SUBST(WIRESHARK_CFLAGS)
277 AC_SUBST(wireshark_plugindir)
278 ;;
279esac
280
281AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
282
283dnl--------------------------------------------------------------------------
284dnl Produce output.
285
286AC_CONFIG_HEADER([config/config.h])
1c5f4539 287AC_CONFIG_TESTDIR([t])
6b6ad670
MW
288
289AC_CONFIG_FILES(
290 [Makefile]
291 [common/Makefile]
49f86fe4 292 [uslip/Makefile]
6b6ad670
MW
293 [client/Makefile]
294 [server/Makefile]
295 [proxy/Makefile]
296 [pkstream/Makefile]
297 [wireshark/Makefile]
298 [init/Makefile]
299 [keys/Makefile]
1c5f4539
MW
300 [mon/Makefile]
301 [t/Makefile t/atlocal])
6b6ad670
MW
302AC_OUTPUT
303
304dnl ----- That's all, folks -------------------------------------------------