chiark / gitweb /
Allow the caller to configure the administration socket permissions.
[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])
2171b19e 34mdw_SILENT_RULES
6b6ad670
MW
35
36AC_PROG_CC
37AM_PROG_CC_C_O
38AX_CFLAGS_WARN_ALL
39AC_CANONICAL_HOST
40AM_PROG_LIBTOOL
41
1c5f4539
MW
42AC_CHECK_PROGS([AUTOM4TE], [autom4te])
43
b90b8384
MW
44mdw_ORIG_CFLAGS=$CFLAGS
45mdw_ORIG_CPPFLAGS=$CPPFLAGS
46AC_SUBST(AM_CFLAGS)
47AC_SUBST(AM_CPPFLAGS)
48
6b6ad670
MW
49dnl--------------------------------------------------------------------------
50dnl C programming environment.
51
52AC_CHECK_HEADERS([stdarg.h])
53
54AC_SEARCH_LIBS([socket], [socket])
55
56case "$host_os" in
57 linux)
58 AC_ARG_WITH([linux-includes],
b90b8384 59 AS_HELP_STRING(
6b6ad670
MW
60 [--with-linux-includes=DIR],
61 [Linux kernel includes]),
b90b8384 62 [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:])
6b6ad670
MW
63 ;;
64esac
65
b9537f3b 66PKG_CHECK_MODULES([mLib], [mLib >= 2.1.0])
6b6ad670
MW
67PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1])
68
b90b8384 69AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
6b6ad670
MW
70
71dnl--------------------------------------------------------------------------
72dnl Directories to install things into.
73
74dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
75AC_DEFUN([TRIPE_DEFINE_PATH], [
76 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
77 [$1=$withval], [$1=$4])
78 AC_SUBST([$1])
79 m4_if([$5], [], [], [
80 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
81 ])
82])
83
84dnl Actual options.
85TRIPE_DEFINE_PATH(
86 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
87 ['${localstatedir}/tripe'],
88 [CONFIGDIR], [Look for keys and other configuration here.])
89
90TRIPE_DEFINE_PATH(
91 [socketdir], [DIR], [admin socket [[.]]], [.],
92 [SOCKETDIR], [Create or look for administration socket here.])
93
94TRIPE_DEFINE_PATH(
95 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
96
97TRIPE_DEFINE_PATH(
288fc12b
MW
98 [initconfig], [FILE],
99 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
100 ['${sysconfdir}/tripe.conf'])
6b6ad670
MW
101
102TRIPE_DEFINE_PATH(
103 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
104
105dnl--------------------------------------------------------------------------
388e0319
MW
106dnl Privilege-separation helper.
107
108mdw_DEFINE_PATHS([
109 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
110 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
111 [Pathname of privilege-separation helper.])
112])
113
114dnl--------------------------------------------------------------------------
6b6ad670
MW
115dnl Other options.
116
117AC_ARG_WITH([tracing],
118 AS_HELP_STRING(
119 [--without-tracing],
120 [compile out tracing support (not recommended)]),
121 [test "$withval" = no &&
122 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
123 [:])
124
125dnl--------------------------------------------------------------------------
c64d8cd5
MW
126dnl Path MTU discovery.
127
128case $host_os in
129 linux*)
130 pmtu=yes
131 ;;
132 *)
133 pmtu=no
134 ;;
135esac
136AM_CONDITIONAL([PATHMTU], [test $pmtu = yes])
137
138dnl--------------------------------------------------------------------------
6b6ad670
MW
139dnl Tunnel devices.
140
141dnl Provide the user with a choice.
142AC_ARG_WITH([tunnel],
143 AS_HELP_STRING(
144 [--with-tunnel=KIND],
145 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
146 [tun=$withval], [tun=auto])
147
148dnl If he doesn't choose, pick something sensible.
149if test "$tun" = auto; then
150 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
151 mdw_cv_tunnel=""
152 case $host_os in
153 linux*)
154 case `uname -r` in
155 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
156 mdw_cv_tunnel=linux
157 ;;
158 *)
159 mdw_cv_tunnel=unet
160 ;;
161 esac
162 ;;
163 *bsd*)
164 mdw_cv_tunnel=bsd
165 ;;
166 esac
167 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
168 ])
169 tun=$mdw_cv_tunnel
170fi
171
172tunnels=""
173for i in $tun; do
174 case $i in
175 linux) AC_DEFINE([TUN_LINUX], [1],
176 [Install the Linux TUN/TAP driver.]) ;;
177 bsd) AC_DEFINE([TUN_BSD], [1],
178 [Install the BSD tunnel driver.]) ;;
179 unet) AC_DEFINE([TUN_UNET], [1],
180 [Install the obsolete Linux Usernet driver.]) ;;
181 slip) ;;
182 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
183 esac
184 tunnels="$tunnels&tun_$i, "
185done
186AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
187 [List of tunnel drivers to install.])
188
189dnl--------------------------------------------------------------------------
190dnl Python.
191
192dnl Find out whether Python exists at all.
193AM_PATH_PYTHON([2.4], [python=yes], [python=no])
194AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
195
196dnl Find out whether we can use Catacomb and GTK.
197if test $python = yes; then
198 AC_PYTHON_MODULE([pygtk])
199 AC_PYTHON_MODULE([catacomb])
200fi
201AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
202AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
203
204dnl--------------------------------------------------------------------------
205dnl Wireshark.
206dnl
207dnl This is all distressingly ugly and complicated. Why they can't just
208dnl provide a pkg-config dropping containing all the useful information about
209dnl the installation I don't know.
210
211WIRESHARK_CFLAGS=""
212: ${wireshark_plugindir=unknown}
213
214dnl Get the user to help.
215AC_ARG_WITH([wireshark],
216 AS_HELP_STRING(
217 [--with-wireshark[=DIR]],
218 [build and install Wireshark plugin]),
219 [case "$withval" in
220 no) haveshark=no needshark=no ;;
221 yes) haveshark=yes needshark=yes ;;
222 *) haveshark=yes needshark=yes
63efe3ef 223 wireshark_plugindir=$withval ;;
6b6ad670
MW
224 esac],
225 [haveshark=yes needshark=no])
226
227dnl Try to find the Wireshark installation directory the hard way.
228case "$haveshark,$wireshark_plugindir" in
229 yes,unknown)
230 AC_CACHE_CHECK([where to put Wireshark plugins],
231 [mdw_cv_wireshark_plugin_dir], [
232 mdw_cv_wireshark_plugin_dir="failed"
233 wsprefix=none
234 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
235 if test -x "$i/bin/tshark"; then
236 wsprefix=$i
237 break
238 fi
239 done
240 if test "$wsprefix" != none; then
241 wsbin=$wsprefix/bin/tshark
242 wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
243 dir=$wsprefix/lib/wireshark/plugins
244 test -d "$dir/$wsver" && dir="$dir/$wsver"
245 if test -d "$dir"; then
246 mdw_cv_wireshark_plugin_dir=$dir
247 fi
248 fi
249 ])
250 case $mdw_cv_wireshark_plugin_dir in
251 failed) haveshark=no ;;
252 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
253 esac
254esac
255
256dnl If we're still interested, find Glib.
257case "$haveshark" in
9db701ca 258 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
6b6ad670
MW
259esac
260
261dnl Find the include directory. This would be much easier if they just
262dnl provided a pkg-config file.
263case "$haveshark" in
264 yes)
265 bad=yes
266 mdw_CFLAGS=$CFLAGS
267 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
268 AC_CACHE_CHECK([how to find the Wireshark headers],
63efe3ef 269 [mdw_cv_wireshark_includes], [
6b6ad670
MW
270 mdw_cv_wireshark_includes=failed
271 for i in \
272 "" \
273 "-I${wsprefix}/include/wireshark" \
274 "-I${wsprefix}/include" \
275 "-I${prefix}/include/wireshark" \
276 "-I${prefix}/include" \
277 "-I/usr/include/wireshark" \
278 "-I/usr/local/include/wireshark" \
279 "-I/usr/local/include"; do
280 CFLAGS="$GLIB_CFLAGS $i"
281 AC_TRY_COMPILE([
282#include <netinet/in.h>
283#include <glib.h>
284#include <wireshark/config.h>
285#include <wireshark/epan/packet.h>],
286 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
287 [bad=no; break])
288 done
289 case "$bad" in
290 no) mdw_cv_wireshark_includes=$i ;;
291 esac
292 CFLAGS=$mdw_CFLAGS
293 ])
294 case "$mdw_cv_wireshark_includes" in
295 failed) haveshark=no ;;
296 esac
297esac
298
299case "$haveshark,$needshark" in
300 no,yes)
301 AC_MSG_ERROR([failed to configure Wireshark plugin])
302 ;;
303 yes,*)
b90b8384 304 WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
6b6ad670
MW
305 AC_SUBST(WIRESHARK_CFLAGS)
306 AC_SUBST(wireshark_plugindir)
307 ;;
308esac
309
310AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
311
312dnl--------------------------------------------------------------------------
313dnl Produce output.
314
b90b8384
MW
315CFLAGS=$mdw_ORIG_CFLAGS
316CPPFLAGS=$mdw_ORIG_CPPFLAGS
317
6b6ad670 318AC_CONFIG_HEADER([config/config.h])
1c5f4539 319AC_CONFIG_TESTDIR([t])
6b6ad670
MW
320
321AC_CONFIG_FILES(
322 [Makefile]
323 [common/Makefile]
49f86fe4 324 [uslip/Makefile]
c64d8cd5 325 [pathmtu/Makefile]
6b6ad670 326 [client/Makefile]
388e0319 327 [priv/Makefile]
6b6ad670
MW
328 [server/Makefile]
329 [proxy/Makefile]
330 [pkstream/Makefile]
331 [wireshark/Makefile]
332 [init/Makefile]
2fa80010 333 [py/Makefile]
6005ef9b 334 [peerdb/Makefile]
6b6ad670 335 [keys/Makefile]
2aff5dbb 336 [svc/Makefile]
1c5f4539
MW
337 [mon/Makefile]
338 [t/Makefile t/atlocal])
6b6ad670
MW
339AC_OUTPUT
340
341dnl ----- That's all, folks -------------------------------------------------