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