chiark / gitweb /
svc/conntrack.in: Maintain config groups in a dictionary.
[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 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.
16dnl
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.
21dnl
22dnl You should have received a copy of the GNU General Public License
23dnl along with TrIPE. If not, see <https://www.gnu.org/licenses/>.
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])
33mdw_SILENT_RULES
34
35AC_PROG_CC
36AM_PROG_CC_C_O
37AX_CFLAGS_WARN_ALL
38AX_TYPE_SOCKLEN_T
39AC_CANONICAL_HOST
40AC_PROG_RANLIB
41
42AC_CHECK_PROGS([AUTOM4TE], [autom4te])
43
44mdw_ORIG_CFLAGS=$CFLAGS
45mdw_ORIG_CPPFLAGS=$CPPFLAGS
46AC_SUBST(AM_CFLAGS)
47AC_SUBST(AM_CPPFLAGS)
48
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],
59 AS_HELP_STRING(
60 [--with-linux-includes=DIR],
61 [Linux kernel includes]),
62 [AM_CPPFLAGS="AM_CPPFLAGS -I$withval"], [:])
63 ;;
64esac
65
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
87PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
88PKG_CHECK_MODULES([catacomb], [catacomb >= 2.2.2-38])
89
90AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
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(
119 [initconfig], [FILE],
120 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
121 ['${sysconfdir}/tripe.conf'])
122
123TRIPE_DEFINE_PATH(
124 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
125
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
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
204dnl Find out whether we can use the various external modules.
205if test $python = yes; then
206 AC_PYTHON_MODULE([pygtk])
207 AC_PYTHON_MODULE([cdb])
208 AC_PYTHON_MODULE([mLib])
209 AC_PYTHON_MODULE([catacomb])
210fi
211AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
212AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
213AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
214AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
215
216dnl--------------------------------------------------------------------------
217dnl Wireshark.
218
219dnl Get the user to help.
220wireshark_plugindir=unknown
221AC_ARG_WITH([wireshark],
222 AS_HELP_STRING(
223 [--with-wireshark],
224 [build and install Wireshark plugin]),
225 [case "$withval" in
226 no) wantshark=no mustshark=no ;;
227 yes) wantshark=yes mustshark=yes ;;
228 *) wantshark=yes mustshark=yes
229 wireshark_plugindir=$withval ;;
230 esac],
231 [wantshark=yes mustshark=no])
232
233case "$wantshark,$wireshark_plugindir" in
234 yes,unknown)
235 AC_CACHE_CHECK([where to put Wireshark plugins],
236 [mdw_cv_wireshark_plugin_dir], [
237 mdw_cv_wireshark_plugin_dir=$(
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])
246 case "$mdw_cv_wireshark_plugin_dir" in
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 ;;
256 *)
257 AC_MSG_WARN([failed to read Wireshark plugin directory])
258 haveshark=no
259 ;;
260 esac
261 ;;
262 no,*)
263 haveshark=no
264 ;;
265esac
266
267case "$haveshark,$needshark" in
268 no,yes)
269 AC_MSG_ERROR([failed to configure Wireshark plugin])
270 ;;
271 yes,*)
272 AC_SUBST(wireshark_plugindir)
273 ;;
274esac
275
276AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
277
278dnl--------------------------------------------------------------------------
279dnl Produce output.
280
281CFLAGS=$mdw_ORIG_CFLAGS
282CPPFLAGS=$mdw_ORIG_CPPFLAGS
283
284AC_CONFIG_HEADER([config/config.h])
285AC_CONFIG_TESTDIR([t])
286
287AC_CONFIG_FILES(
288 [Makefile]
289 [common/Makefile]
290 [uslip/Makefile]
291 [pathmtu/Makefile]
292 [client/Makefile]
293 [priv/Makefile]
294 [server/Makefile]
295 [proxy/Makefile]
296 [pkstream/Makefile]
297 [wireshark/Makefile]
298 [init/Makefile]
299 [py/Makefile]
300 [peerdb/Makefile]
301 [keys/Makefile]
302 [svc/Makefile]
303 [mon/Makefile]
304 [contrib/Makefile]
305 [t/Makefile t/atlocal])
306AC_OUTPUT
307
308dnl----- That's all, folks --------------------------------------------------