chiark / gitweb /
svc/tripe-ifup.in: Trim prefix length from IPv6 address used as gateway.
[tripe] / configure.ac
CommitLineData
6b6ad670
MW
1dnl -*-autoconf-*-
2dnl
3dnl Configuration script for TrIPE
4dnl
5dnl (c) 2001 Straylight/Edgeware
6dnl
7
8f3f3ac7 8dnl----- Licensing notice ---------------------------------------------------
6b6ad670
MW
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
99deb7e8 66PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
04ed79b8 67PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.4])
6b6ad670 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
388e0319
MW
105dnl--------------------------------------------------------------------------
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
6b6ad670
MW
114dnl--------------------------------------------------------------------------
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--------------------------------------------------------------------------
126dnl Tunnel devices.
127
128dnl Provide the user with a choice.
129AC_ARG_WITH([tunnel],
130 AS_HELP_STRING(
131 [--with-tunnel=KIND],
132 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
133 [tun=$withval], [tun=auto])
134
135dnl If he doesn't choose, pick something sensible.
136if test "$tun" = auto; then
137 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
138 mdw_cv_tunnel=""
139 case $host_os in
140 linux*)
141 case `uname -r` in
142 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
143 mdw_cv_tunnel=linux
144 ;;
145 *)
146 mdw_cv_tunnel=unet
147 ;;
148 esac
149 ;;
150 *bsd*)
151 mdw_cv_tunnel=bsd
152 ;;
153 esac
154 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
155 ])
156 tun=$mdw_cv_tunnel
157fi
158
159tunnels=""
160for i in $tun; do
161 case $i in
162 linux) AC_DEFINE([TUN_LINUX], [1],
163 [Install the Linux TUN/TAP driver.]) ;;
164 bsd) AC_DEFINE([TUN_BSD], [1],
165 [Install the BSD tunnel driver.]) ;;
166 unet) AC_DEFINE([TUN_UNET], [1],
167 [Install the obsolete Linux Usernet driver.]) ;;
168 slip) ;;
169 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
170 esac
171 tunnels="$tunnels&tun_$i, "
172done
173AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
174 [List of tunnel drivers to install.])
175
176dnl--------------------------------------------------------------------------
177dnl Python.
178
179dnl Find out whether Python exists at all.
180AM_PATH_PYTHON([2.4], [python=yes], [python=no])
181AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
182
183dnl Find out whether we can use Catacomb and GTK.
184if test $python = yes; then
185 AC_PYTHON_MODULE([pygtk])
186 AC_PYTHON_MODULE([catacomb])
187fi
188AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
189AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
190
191dnl--------------------------------------------------------------------------
192dnl Wireshark.
193dnl
194dnl This is all distressingly ugly and complicated. Why they can't just
195dnl provide a pkg-config dropping containing all the useful information about
196dnl the installation I don't know.
197
198WIRESHARK_CFLAGS=""
199: ${wireshark_plugindir=unknown}
200
201dnl Get the user to help.
202AC_ARG_WITH([wireshark],
203 AS_HELP_STRING(
204 [--with-wireshark[=DIR]],
205 [build and install Wireshark plugin]),
206 [case "$withval" in
207 no) haveshark=no needshark=no ;;
208 yes) haveshark=yes needshark=yes ;;
209 *) haveshark=yes needshark=yes
63efe3ef 210 wireshark_plugindir=$withval ;;
6b6ad670
MW
211 esac],
212 [haveshark=yes needshark=no])
213
e0603e88
MW
214dnl Try to find the Wireshark installation directory the hard way. This is
215dnl remarkably annoying. This is, unfortunately, very likely to guess wrong,
216dnl but there doesn't seem to be a better way.
6b6ad670
MW
217case "$haveshark,$wireshark_plugindir" in
218 yes,unknown)
219 AC_CACHE_CHECK([where to put Wireshark plugins],
220 [mdw_cv_wireshark_plugin_dir], [
e0603e88
MW
221 mdw_cv_wireshark_plugin_dir=$(
222 for i in \
223 $libexecdir $libdir $exec_prefix/lib $prefix/lib \
224 /usr/local/lib /usr/lib
225 do
226 for j in \
227 wireshark/plugins/* wireshark/*/plugins \
228 */wireshark/plugins/* */wireshark/*/plugins
229 do
230 for k in $i/$j/*.so; do
231 if test -f "$k"; then
232 echo $(AS_DIRNAME(["$k"]))
233 exit
234 fi
235 done
236 done
237 done
238 echo "failed"
239 )
6b6ad670
MW
240 ])
241 case $mdw_cv_wireshark_plugin_dir in
242 failed) haveshark=no ;;
243 *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;;
244 esac
245esac
246
247dnl If we're still interested, find Glib.
248case "$haveshark" in
9db701ca 249 yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;;
6b6ad670
MW
250esac
251
252dnl Find the include directory. This would be much easier if they just
253dnl provided a pkg-config file.
254case "$haveshark" in
255 yes)
256 bad=yes
257 mdw_CFLAGS=$CFLAGS
258 wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'`
259 AC_CACHE_CHECK([how to find the Wireshark headers],
63efe3ef 260 [mdw_cv_wireshark_includes], [
6b6ad670
MW
261 mdw_cv_wireshark_includes=failed
262 for i in \
263 "" \
264 "-I${wsprefix}/include/wireshark" \
265 "-I${wsprefix}/include" \
266 "-I${prefix}/include/wireshark" \
267 "-I${prefix}/include" \
268 "-I/usr/include/wireshark" \
269 "-I/usr/local/include/wireshark" \
270 "-I/usr/local/include"; do
271 CFLAGS="$GLIB_CFLAGS $i"
272 AC_TRY_COMPILE([
273#include <netinet/in.h>
274#include <glib.h>
275#include <wireshark/config.h>
276#include <wireshark/epan/packet.h>],
277 [dissector_handle_t dh; dh = create_dissector_handle(0, 0);],
278 [bad=no; break])
279 done
280 case "$bad" in
281 no) mdw_cv_wireshark_includes=$i ;;
282 esac
283 CFLAGS=$mdw_CFLAGS
284 ])
285 case "$mdw_cv_wireshark_includes" in
286 failed) haveshark=no ;;
287 esac
288esac
289
290case "$haveshark,$needshark" in
291 no,yes)
292 AC_MSG_ERROR([failed to configure Wireshark plugin])
293 ;;
294 yes,*)
b90b8384 295 WIRESHARK_CFLAGS="$GLIB_CFLAGS $mdw_cv_wireshark_includes"
6b6ad670
MW
296 AC_SUBST(WIRESHARK_CFLAGS)
297 AC_SUBST(wireshark_plugindir)
298 ;;
299esac
300
301AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
302
303dnl--------------------------------------------------------------------------
304dnl Produce output.
305
b90b8384
MW
306CFLAGS=$mdw_ORIG_CFLAGS
307CPPFLAGS=$mdw_ORIG_CPPFLAGS
308
6b6ad670 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 328 [mon/Makefile]
a4f886c3 329 [contrib/Makefile]
1c5f4539 330 [t/Makefile t/atlocal])
6b6ad670
MW
331AC_OUTPUT
332
8f3f3ac7 333dnl----- That's all, folks --------------------------------------------------