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