chiark / gitweb /
server/tripe-admin.5.in: Document `unknown-jobid' error code.
[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
b9537f3b 60PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
6b6ad670
MW
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
388e0319
MW
98dnl--------------------------------------------------------------------------
99dnl Privilege-separation helper.
100
101mdw_DEFINE_PATHS([
102 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
103 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
104 [Pathname of privilege-separation helper.])
105])
106
6b6ad670
MW
107dnl--------------------------------------------------------------------------
108dnl Other options.
109
110AC_ARG_WITH([tracing],
111 AS_HELP_STRING(
112 [--without-tracing],
113 [compile out tracing support (not recommended)]),
114 [test "$withval" = no &&
115 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
116 [:])
117
c64d8cd5
MW
118dnl--------------------------------------------------------------------------
119dnl Path MTU discovery.
120
121case $host_os in
122 linux*)
123 pmtu=yes
124 ;;
125 *)
126 pmtu=no
127 ;;
128esac
129AM_CONDITIONAL([PATHMTU], [test $pmtu = yes])
130
6b6ad670
MW
131dnl--------------------------------------------------------------------------
132dnl Tunnel devices.
133
134dnl Provide the user with a choice.
135AC_ARG_WITH([tunnel],
136 AS_HELP_STRING(
137 [--with-tunnel=KIND],
138 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
139 [tun=$withval], [tun=auto])
140
141dnl If he doesn't choose, pick something sensible.
142if test "$tun" = auto; then
143 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
144 mdw_cv_tunnel=""
145 case $host_os in
146 linux*)
147 case `uname -r` in
148 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
149 mdw_cv_tunnel=linux
150 ;;
151 *)
152 mdw_cv_tunnel=unet
153 ;;
154 esac
155 ;;
156 *bsd*)
157 mdw_cv_tunnel=bsd
158 ;;
159 esac
160 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
161 ])
162 tun=$mdw_cv_tunnel
163fi
164
165tunnels=""
166for i in $tun; do
167 case $i in
168 linux) AC_DEFINE([TUN_LINUX], [1],
169 [Install the Linux TUN/TAP driver.]) ;;
170 bsd) AC_DEFINE([TUN_BSD], [1],
171 [Install the BSD tunnel driver.]) ;;
172 unet) AC_DEFINE([TUN_UNET], [1],
173 [Install the obsolete Linux Usernet driver.]) ;;
174 slip) ;;
175 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
176 esac
177 tunnels="$tunnels&tun_$i, "
178done
179AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
180 [List of tunnel drivers to install.])
181
182dnl--------------------------------------------------------------------------
183dnl Python.
184
185dnl Find out whether Python exists at all.
186AM_PATH_PYTHON([2.4], [python=yes], [python=no])
187AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
188
189dnl Find out whether we can use Catacomb and GTK.
190if test $python = yes; then
191 AC_PYTHON_MODULE([pygtk])
192 AC_PYTHON_MODULE([catacomb])
193fi
194AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
195AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
196
197dnl--------------------------------------------------------------------------
198dnl Wireshark.
199dnl
200dnl This is all distressingly ugly and complicated. Why they can't just
201dnl provide a pkg-config dropping containing all the useful information about
202dnl the installation I don't know.
203
204WIRESHARK_CFLAGS=""
205: ${wireshark_plugindir=unknown}
206
207dnl Get the user to help.
208AC_ARG_WITH([wireshark],
209 AS_HELP_STRING(
210 [--with-wireshark[=DIR]],
211 [build and install Wireshark plugin]),
212 [case "$withval" in
213 no) haveshark=no needshark=no ;;
214 yes) haveshark=yes needshark=yes ;;
215 *) haveshark=yes needshark=yes
63efe3ef 216 wireshark_plugindir=$withval ;;
6b6ad670
MW
217 esac],
218 [haveshark=yes needshark=no])
219
220dnl Try to find the Wireshark installation directory the hard way.
221case "$haveshark,$wireshark_plugindir" in
222 yes,unknown)
223 AC_CACHE_CHECK([where to put Wireshark plugins],
224 [mdw_cv_wireshark_plugin_dir], [
225 mdw_cv_wireshark_plugin_dir="failed"
226 wsprefix=none
227 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
228 if test -x "$i/bin/tshark"; then
229 wsprefix=$i
230 break
231 fi
232 done
233 if test "$wsprefix" != none; then
234 wsbin=$wsprefix/bin/tshark
235 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
236 dir=$wsprefix/lib/wireshark/plugins
237 test -d "$dir/$wsver" && dir="$dir/$wsver"
238 if test -d "$dir"; then
239 mdw_cv_wireshark_plugin_dir=$dir
240 fi
241 fi
242 ])
243 case $mdw_cv_wireshark_plugin_dir in
244 failed) haveshark=no ;;
245 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
246 esac
247esac
248
249dnl If we're still interested, find Glib.
250case "$haveshark" in
9db701ca 251 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
6b6ad670
MW
252esac
253
254dnl Find the include directory. This would be much easier if they just
255dnl provided a pkg-config file.
256case "$haveshark" in
257 yes)
258 bad=yes
259 mdw_CFLAGS=$CFLAGS
260 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
261 AC_CACHE_CHECK([how to find the Wireshark headers],
63efe3ef 262 [mdw_cv_wireshark_includes], [
6b6ad670
MW
263 mdw_cv_wireshark_includes=failed
264 for i in \
265 "" \
266 "-I${wsprefix}/include/wireshark" \
267 "-I${wsprefix}/include" \
268 "-I${prefix}/include/wireshark" \
269 "-I${prefix}/include" \
270 "-I/usr/include/wireshark" \
271 "-I/usr/local/include/wireshark" \
272 "-I/usr/local/include"; do
273 CFLAGS="$GLIB_CFLAGS $i"
274 AC_TRY_COMPILE([
275#include <netinet/in.h>
276#include <glib.h>
277#include <wireshark/config.h>
278#include <wireshark/epan/packet.h>],
279 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
280 [bad=no; break])
281 done
282 case "$bad" in
283 no) mdw_cv_wireshark_includes=$i ;;
284 esac
285 CFLAGS=$mdw_CFLAGS
286 ])
287 case "$mdw_cv_wireshark_includes" in
288 failed) haveshark=no ;;
289 esac
290esac
291
292case "$haveshark,$needshark" in
293 no,yes)
294 AC_MSG_ERROR([failed to configure Wireshark plugin])
295 ;;
296 yes,*)
297 WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
298 AC_SUBST(WIRESHARK_CFLAGS)
299 AC_SUBST(wireshark_plugindir)
300 ;;
301esac
302
303AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
304
305dnl--------------------------------------------------------------------------
306dnl Produce output.
307
308AC_CONFIG_HEADER([config/config.h])
1c5f4539 309AC_CONFIG_TESTDIR([t])
6b6ad670
MW
310
311AC_CONFIG_FILES(
312 [Makefile]
313 [common/Makefile]
49f86fe4 314 [uslip/Makefile]
c64d8cd5 315 [pathmtu/Makefile]
6b6ad670 316 [client/Makefile]
388e0319 317 [priv/Makefile]
6b6ad670
MW
318 [server/Makefile]
319 [proxy/Makefile]
320 [pkstream/Makefile]
321 [wireshark/Makefile]
322 [init/Makefile]
323 [keys/Makefile]
1c5f4539
MW
324 [mon/Makefile]
325 [t/Makefile t/atlocal])
6b6ad670
MW
326AC_OUTPUT
327
328dnl ----- That's all, folks -------------------------------------------------