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