chiark / gitweb /
svc/conntrack.in: Maintain config groups in a dictionary.
[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
11ad66c2
MW
12dnl TrIPE is free software: you can redistribute it and/or modify it under
13dnl the terms of the GNU General Public License as published by the Free
14dnl Software Foundation; either version 3 of the License, or (at your
15dnl option) any later version.
6b6ad670 16dnl
11ad66c2
MW
17dnl TrIPE is distributed in the hope that it will be useful, but WITHOUT
18dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20dnl for more details.
6b6ad670
MW
21dnl
22dnl You should have received a copy of the GNU General Public License
11ad66c2 23dnl along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
6b6ad670
MW
24
25dnl--------------------------------------------------------------------------
26dnl Initialization.
27
28mdw_AUTO_VERSION
29AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk])
30AC_CONFIG_SRCDIR([server/tripe.h])
31AC_CONFIG_AUX_DIR([config])
32AM_INIT_AUTOMAKE([foreign])
2171b19e 33mdw_SILENT_RULES
6b6ad670
MW
34
35AC_PROG_CC
36AM_PROG_CC_C_O
37AX_CFLAGS_WARN_ALL
cb160b86 38AX_TYPE_SOCKLEN_T
6b6ad670 39AC_CANONICAL_HOST
408f7a2c 40AC_PROG_RANLIB
6b6ad670 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
971e5689
MW
66AC_ARG_WITH([adns],
67 AS_HELP_STRING([--with-adns],
68 [use ADNS library for background name resolution]),
69 [want_adns=$withval],
70 [want_adns=auto])
71case $want_adns in
72 no) ;;
73 *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;;
74esac
75AC_SUBST([ADNS_LIBS])
76case $want_adns,$have_adns in
77 yes,no)
78 AC_MSG_ERROR([ADNS library not found but explicitly requested])
79 ;;
80 yes,yes | auto,yes)
81 ADNS_LIBS="-ladns"
82 AC_DEFINE([HAVE_LIBADNS], [1],
83 [Define if the GNU adns library is available.])
84 ;;
85esac
86
99deb7e8 87PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
36b9f99a 88PKG_CHECK_MODULES([catacomb], [catacomb >= 2.2.2-38])
6b6ad670 89
b90b8384 90AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
6b6ad670
MW
91
92dnl--------------------------------------------------------------------------
93dnl Directories to install things into.
94
95dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
96AC_DEFUN([TRIPE_DEFINE_PATH], [
97 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
98 [$1=$withval], [$1=$4])
99 AC_SUBST([$1])
100 m4_if([$5], [], [], [
101 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
102 ])
103])
104
105dnl Actual options.
106TRIPE_DEFINE_PATH(
107 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
108 ['${localstatedir}/tripe'],
109 [CONFIGDIR], [Look for keys and other configuration here.])
110
111TRIPE_DEFINE_PATH(
112 [socketdir], [DIR], [admin socket [[.]]], [.],
113 [SOCKETDIR], [Create or look for administration socket here.])
114
115TRIPE_DEFINE_PATH(
116 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
117
118TRIPE_DEFINE_PATH(
288fc12b
MW
119 [initconfig], [FILE],
120 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
121 ['${sysconfdir}/tripe.conf'])
6b6ad670
MW
122
123TRIPE_DEFINE_PATH(
124 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
125
388e0319
MW
126dnl--------------------------------------------------------------------------
127dnl Privilege-separation helper.
128
129mdw_DEFINE_PATHS([
130 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
131 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
132 [Pathname of privilege-separation helper.])
133])
134
6b6ad670
MW
135dnl--------------------------------------------------------------------------
136dnl Other options.
137
138AC_ARG_WITH([tracing],
139 AS_HELP_STRING(
140 [--without-tracing],
141 [compile out tracing support (not recommended)]),
142 [test "$withval" = no &&
143 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
144 [:])
145
146dnl--------------------------------------------------------------------------
147dnl Tunnel devices.
148
149dnl Provide the user with a choice.
150AC_ARG_WITH([tunnel],
151 AS_HELP_STRING(
152 [--with-tunnel=KIND],
153 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
154 [tun=$withval], [tun=auto])
155
156dnl If he doesn't choose, pick something sensible.
157if test "$tun" = auto; then
158 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
159 mdw_cv_tunnel=""
160 case $host_os in
161 linux*)
162 case `uname -r` in
163 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
164 mdw_cv_tunnel=linux
165 ;;
166 *)
167 mdw_cv_tunnel=unet
168 ;;
169 esac
170 ;;
171 *bsd*)
172 mdw_cv_tunnel=bsd
173 ;;
174 esac
175 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
176 ])
177 tun=$mdw_cv_tunnel
178fi
179
180tunnels=""
181for i in $tun; do
182 case $i in
183 linux) AC_DEFINE([TUN_LINUX], [1],
184 [Install the Linux TUN/TAP driver.]) ;;
185 bsd) AC_DEFINE([TUN_BSD], [1],
186 [Install the BSD tunnel driver.]) ;;
187 unet) AC_DEFINE([TUN_UNET], [1],
188 [Install the obsolete Linux Usernet driver.]) ;;
189 slip) ;;
190 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
191 esac
192 tunnels="$tunnels&tun_$i, "
193done
194AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
195 [List of tunnel drivers to install.])
196
197dnl--------------------------------------------------------------------------
198dnl Python.
199
200dnl Find out whether Python exists at all.
201AM_PATH_PYTHON([2.4], [python=yes], [python=no])
202AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
203
207f030a 204dnl Find out whether we can use the various external modules.
6b6ad670
MW
205if test $python = yes; then
206 AC_PYTHON_MODULE([pygtk])
207f030a
MW
207 AC_PYTHON_MODULE([cdb])
208 AC_PYTHON_MODULE([mLib])
6b6ad670
MW
209 AC_PYTHON_MODULE([catacomb])
210fi
211AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
207f030a
MW
212AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
213AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
6b6ad670
MW
214AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
215
216dnl--------------------------------------------------------------------------
217dnl Wireshark.
6b6ad670
MW
218
219dnl Get the user to help.
4da9fb4c 220wireshark_plugindir=unknown
6b6ad670
MW
221AC_ARG_WITH([wireshark],
222 AS_HELP_STRING(
4da9fb4c 223 [--with-wireshark],
6b6ad670
MW
224 [build and install Wireshark plugin]),
225 [case "$withval" in
4da9fb4c
MW
226 no) wantshark=no mustshark=no ;;
227 yes) wantshark=yes mustshark=yes ;;
228 *) wantshark=yes mustshark=yes
63efe3ef 229 wireshark_plugindir=$withval ;;
6b6ad670 230 esac],
4da9fb4c
MW
231 [wantshark=yes mustshark=no])
232
3949f61c 233case "$wantshark,$wireshark_plugindir" in
6b6ad670
MW
234 yes,unknown)
235 AC_CACHE_CHECK([where to put Wireshark plugins],
236 [mdw_cv_wireshark_plugin_dir], [
e0603e88 237 mdw_cv_wireshark_plugin_dir=$(
77781be8
MW
238 $PKG_CONFIG --variable=plugindir "wireshark >= 1.12.1")
239 dnl It seems that the Debian package has a habit of bungling the
240 dnl plugin path (#779788, #857729, ...).
241 case "$mdw_cv_wireshark_plugin_dir" in
242 /usr//usr/*)
243 mdw_cv_wireshark_plugin_dir=${mdw_cv_wireshark_plugin_dir#/usr/}
244 ;;
245 esac])
4da9fb4c 246 case "$mdw_cv_wireshark_plugin_dir" in
7b00539c
MW
247 /*)
248 if test ! -d "$mdw_cv_wireshark_plugin_dir"; then
249 AC_MSG_WARN([alleged Wireshark plugin directory $mdw_cv_wireshark_plugin_dir doesn't exist])
250 haveshark=no
251 else
252 wireshark_plugindir=$mdw_cv_wireshark_plugin_dir
253 haveshark=yes
254 fi
255 ;;
4da9fb4c
MW
256 *)
257 AC_MSG_WARN([failed to read Wireshark plugin directory])
258 haveshark=no
259 ;;
6b6ad670 260 esac
4da9fb4c 261 ;;
3949f61c
MW
262 no,*)
263 haveshark=no
264 ;;
6b6ad670
MW
265esac
266
6b6ad670
MW
267case "$haveshark,$needshark" in
268 no,yes)
269 AC_MSG_ERROR([failed to configure Wireshark plugin])
270 ;;
271 yes,*)
6b6ad670
MW
272 AC_SUBST(wireshark_plugindir)
273 ;;
274esac
275
276AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
277
278dnl--------------------------------------------------------------------------
279dnl Produce output.
280
b90b8384
MW
281CFLAGS=$mdw_ORIG_CFLAGS
282CPPFLAGS=$mdw_ORIG_CPPFLAGS
283
6b6ad670 284AC_CONFIG_HEADER([config/config.h])
1c5f4539 285AC_CONFIG_TESTDIR([t])
6b6ad670
MW
286
287AC_CONFIG_FILES(
288 [Makefile]
289 [common/Makefile]
49f86fe4 290 [uslip/Makefile]
c64d8cd5 291 [pathmtu/Makefile]
6b6ad670 292 [client/Makefile]
388e0319 293 [priv/Makefile]
6b6ad670
MW
294 [server/Makefile]
295 [proxy/Makefile]
296 [pkstream/Makefile]
297 [wireshark/Makefile]
298 [init/Makefile]
2fa80010 299 [py/Makefile]
6005ef9b 300 [peerdb/Makefile]
6b6ad670 301 [keys/Makefile]
2aff5dbb 302 [svc/Makefile]
1c5f4539 303 [mon/Makefile]
a4f886c3 304 [contrib/Makefile]
1c5f4539 305 [t/Makefile t/atlocal])
6b6ad670
MW
306AC_OUTPUT
307
8f3f3ac7 308dnl----- That's all, folks --------------------------------------------------