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