server/admin.c: Remove spurious `ping' in usage message.
[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
85ccca5f
MW
66AC_CHECK_FUNCS([getifaddrs])
67
971e5689
MW
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
71887b00 89PKG_CHECK_MODULES([mLib], [mLib >= 2.4.1])
a97b7d4e 90PKG_CHECK_MODULES([catacomb], [catacomb >= 2.5.0])
6b6ad670 91
b90b8384 92AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
6b6ad670
MW
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(
288fc12b
MW
121 [initconfig], [FILE],
122 [configuration for init script [[SYSCONFDIR/tripe.conf]]],
123 ['${sysconfdir}/tripe.conf'])
6b6ad670
MW
124
125TRIPE_DEFINE_PATH(
126 [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
127
128dnl--------------------------------------------------------------------------
388e0319
MW
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--------------------------------------------------------------------------
6b6ad670
MW
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
207f030a 206dnl Find out whether we can use the various external modules.
6b6ad670
MW
207if test $python = yes; then
208 AC_PYTHON_MODULE([pygtk])
207f030a
MW
209 AC_PYTHON_MODULE([cdb])
210 AC_PYTHON_MODULE([mLib])
6b6ad670
MW
211 AC_PYTHON_MODULE([catacomb])
212fi
213AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
207f030a
MW
214AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
215AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
6b6ad670
MW
216AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
217
218dnl--------------------------------------------------------------------------
219dnl Wireshark.
6b6ad670
MW
220
221dnl Get the user to help.
4da9fb4c 222wireshark_plugindir=unknown
6b6ad670
MW
223AC_ARG_WITH([wireshark],
224 AS_HELP_STRING(
4da9fb4c 225 [--with-wireshark],
6b6ad670
MW
226 [build and install Wireshark plugin]),
227 [case "$withval" in
4da9fb4c
MW
228 no) wantshark=no mustshark=no ;;
229 yes) wantshark=yes mustshark=yes ;;
230 *) wantshark=yes mustshark=yes
63efe3ef 231 wireshark_plugindir=$withval ;;
6b6ad670 232 esac],
4da9fb4c
MW
233 [wantshark=yes mustshark=no])
234
3949f61c 235case "$wantshark,$wireshark_plugindir" in
6b6ad670
MW
236 yes,unknown)
237 AC_CACHE_CHECK([where to put Wireshark plugins],
238 [mdw_cv_wireshark_plugin_dir], [
e0603e88 239 mdw_cv_wireshark_plugin_dir=$(
77781be8
MW
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])
4da9fb4c 248 case "$mdw_cv_wireshark_plugin_dir" in
7b00539c
MW
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 ;;
4da9fb4c
MW
258 *)
259 AC_MSG_WARN([failed to read Wireshark plugin directory])
260 haveshark=no
261 ;;
6b6ad670 262 esac
4da9fb4c 263 ;;
3949f61c
MW
264 no,*)
265 haveshark=no
266 ;;
6b6ad670
MW
267esac
268
6b6ad670
MW
269case "$haveshark,$needshark" in
270 no,yes)
271 AC_MSG_ERROR([failed to configure Wireshark plugin])
272 ;;
273 yes,*)
6b6ad670
MW
274 AC_SUBST(wireshark_plugindir)
275 ;;
276esac
277
278AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
279
280dnl--------------------------------------------------------------------------
281dnl Produce output.
282
b90b8384
MW
283CFLAGS=$mdw_ORIG_CFLAGS
284CPPFLAGS=$mdw_ORIG_CPPFLAGS
285
6b6ad670 286AC_CONFIG_HEADER([config/config.h])
1c5f4539 287AC_CONFIG_TESTDIR([t])
6b6ad670
MW
288
289AC_CONFIG_FILES(
290 [Makefile]
291 [common/Makefile]
49f86fe4 292 [uslip/Makefile]
c64d8cd5 293 [pathmtu/Makefile]
6b6ad670 294 [client/Makefile]
388e0319 295 [priv/Makefile]
6b6ad670
MW
296 [server/Makefile]
297 [proxy/Makefile]
298 [pkstream/Makefile]
299 [wireshark/Makefile]
300 [init/Makefile]
2fa80010 301 [py/Makefile]
6005ef9b 302 [peerdb/Makefile]
6b6ad670 303 [keys/Makefile]
2aff5dbb 304 [svc/Makefile]
1c5f4539 305 [mon/Makefile]
a4f886c3 306 [contrib/Makefile]
1c5f4539 307 [t/Makefile t/atlocal])
6b6ad670
MW
308AC_OUTPUT
309
8f3f3ac7 310dnl----- That's all, folks --------------------------------------------------