server/admin.c: Remove spurious `ping' in usage message.
[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_CHECK_FUNCS([getifaddrs])
67
68AC_ARG_WITH([adns],
69 AS_HELP_STRING([--with-adns],
70 [use ADNS library for background name resolution]),
71 [want_adns=$withval],
72 [want_adns=auto])
73case $want_adns in
74 no) ;;
75 *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;;
76esac
77AC_SUBST([ADNS_LIBS])
78case $want_adns,$have_adns in
79 yes,no)
80 AC_MSG_ERROR([ADNS library not found but explicitly requested])
81 ;;
82 yes,yes | auto,yes)
83 ADNS_LIBS="-ladns"
84 AC_DEFINE([HAVE_LIBADNS], [1],
85 [Define if the GNU adns library is available.])
86 ;;
87esac
88
89PKG_CHECK_MODULES([mLib], [mLib >= 2.4.1])
90PKG_CHECK_MODULES([catacomb], [catacomb >= 2.5.0])
91
92AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
93
94dnl--------------------------------------------------------------------------
95dnl Directories to install things into.
96
97dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
98AC_DEFUN([TRIPE_DEFINE_PATH], [
99 AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]),
100 [$1=$withval], [$1=$4])
101 AC_SUBST([$1])
102 m4_if([$5], [], [], [
103 mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])])
104 ])
105])
106
107dnl Actual options.
108TRIPE_DEFINE_PATH(
109 [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
110 ['${localstatedir}/tripe'],
111 [CONFIGDIR], [Look for keys and other configuration here.])
112
113TRIPE_DEFINE_PATH(
114 [socketdir], [DIR], [admin socket [[.]]], [.],
115 [SOCKETDIR], [Create or look for administration socket here.])
116
117TRIPE_DEFINE_PATH(
118 [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
119
120TRIPE_DEFINE_PATH(
121 [initconfig], [FILE],
122 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
123 ['${sysconfdir}/tripe.conf'])
124
125TRIPE_DEFINE_PATH(
126 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
127
128dnl--------------------------------------------------------------------------
129dnl Privilege-separation helper.
130
131mdw_DEFINE_PATHS([
132 AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
133 ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
134 [Pathname of privilege-separation helper.])
135])
136
137dnl--------------------------------------------------------------------------
138dnl Other options.
139
140AC_ARG_WITH([tracing],
141 AS_HELP_STRING(
142 [--without-tracing],
143 [compile out tracing support (not recommended)]),
144 [test "$withval" = no &&
145 AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
146 [:])
147
148dnl--------------------------------------------------------------------------
149dnl Tunnel devices.
150
151dnl Provide the user with a choice.
152AC_ARG_WITH([tunnel],
153 AS_HELP_STRING(
154 [--with-tunnel=KIND],
155 [kinds of tunnel device to use (linux, unet, bsd, slip)]),
156 [tun=$withval], [tun=auto])
157
158dnl If he doesn't choose, pick something sensible.
159if test "$tun" = auto; then
160 AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
161 mdw_cv_tunnel=""
162 case $host_os in
163 linux*)
164 case `uname -r` in
165 [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
166 mdw_cv_tunnel=linux
167 ;;
168 *)
169 mdw_cv_tunnel=unet
170 ;;
171 esac
172 ;;
173 *bsd*)
174 mdw_cv_tunnel=bsd
175 ;;
176 esac
177 mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
178 ])
179 tun=$mdw_cv_tunnel
180fi
181
182tunnels=""
183for i in $tun; do
184 case $i in
185 linux) AC_DEFINE([TUN_LINUX], [1],
186 [Install the Linux TUN/TAP driver.]) ;;
187 bsd) AC_DEFINE([TUN_BSD], [1],
188 [Install the BSD tunnel driver.]) ;;
189 unet) AC_DEFINE([TUN_UNET], [1],
190 [Install the obsolete Linux Usernet driver.]) ;;
191 slip) ;;
192 *) AC_MSG_ERROR([Unknown tunnel type]) ;;
193 esac
194 tunnels="$tunnels&tun_$i, "
195done
196AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
197 [List of tunnel drivers to install.])
198
199dnl--------------------------------------------------------------------------
200dnl Python.
201
202dnl Find out whether Python exists at all.
203AM_PATH_PYTHON([2.4], [python=yes], [python=no])
204AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
205
206dnl Find out whether we can use the various external modules.
207if test $python = yes; then
208 AC_PYTHON_MODULE([pygtk])
209 AC_PYTHON_MODULE([cdb])
210 AC_PYTHON_MODULE([mLib])
211 AC_PYTHON_MODULE([catacomb])
212fi
213AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
214AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
215AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
216AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
217
218dnl--------------------------------------------------------------------------
219dnl Wireshark.
220
221dnl Get the user to help.
222wireshark_plugindir=unknown
223AC_ARG_WITH([wireshark],
224 AS_HELP_STRING(
225 [--with-wireshark],
226 [build and install Wireshark plugin]),
227 [case "$withval" in
228 no) wantshark=no mustshark=no ;;
229 yes) wantshark=yes mustshark=yes ;;
230 *) wantshark=yes mustshark=yes
231 wireshark_plugindir=$withval ;;
232 esac],
233 [wantshark=yes mustshark=no])
234
235case "$wantshark,$wireshark_plugindir" in
236 yes,unknown)
237 AC_CACHE_CHECK([where to put Wireshark plugins],
238 [mdw_cv_wireshark_plugin_dir], [
239 mdw_cv_wireshark_plugin_dir=$(
240 $PKG_CONFIG --variable=plugindir "wireshark >= 1.12.1")
241 dnl It seems that the Debian package has a habit of bungling the
242 dnl plugin path (#779788, #857729, ...).
243 case "$mdw_cv_wireshark_plugin_dir" in
244 /usr//usr/*)
245 mdw_cv_wireshark_plugin_dir=${mdw_cv_wireshark_plugin_dir#/usr/}
246 ;;
247 esac])
248 case "$mdw_cv_wireshark_plugin_dir" in
249 /*)
250 if test ! -d "$mdw_cv_wireshark_plugin_dir"; then
251 AC_MSG_WARN([alleged Wireshark plugin directory $mdw_cv_wireshark_plugin_dir doesn't exist])
252 haveshark=no
253 else
254 wireshark_plugindir=$mdw_cv_wireshark_plugin_dir
255 haveshark=yes
256 fi
257 ;;
258 *)
259 AC_MSG_WARN([failed to read Wireshark plugin directory])
260 haveshark=no
261 ;;
262 esac
263 ;;
264 no,*)
265 haveshark=no
266 ;;
267esac
268
269case "$haveshark,$needshark" in
270 no,yes)
271 AC_MSG_ERROR([failed to configure Wireshark plugin])
272 ;;
273 yes,*)
274 AC_SUBST(wireshark_plugindir)
275 ;;
276esac
277
278AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
279
280dnl--------------------------------------------------------------------------
281dnl Produce output.
282
283CFLAGS=$mdw_ORIG_CFLAGS
284CPPFLAGS=$mdw_ORIG_CPPFLAGS
285
286AC_CONFIG_HEADER([config/config.h])
287AC_CONFIG_TESTDIR([t])
288
289AC_CONFIG_FILES(
290 [Makefile]
291 [common/Makefile]
292 [uslip/Makefile]
293 [pathmtu/Makefile]
294 [client/Makefile]
295 [priv/Makefile]
296 [server/Makefile]
297 [proxy/Makefile]
298 [pkstream/Makefile]
299 [wireshark/Makefile]
300 [init/Makefile]
301 [py/Makefile]
302 [peerdb/Makefile]
303 [keys/Makefile]
304 [svc/Makefile]
305 [mon/Makefile]
306 [contrib/Makefile]
307 [t/Makefile t/atlocal])
308AC_OUTPUT
309
310dnl----- That's all, folks --------------------------------------------------