chiark / gitweb /
svc/conntrack.in: Maintain config groups in a dictionary.
[tripe] / configure.ac
1 dnl -*-autoconf-*-
2 dnl
3 dnl Configuration script for TrIPE
4 dnl
5 dnl (c) 2001 Straylight/Edgeware
6 dnl
7
8 dnl----- Licensing notice ---------------------------------------------------
9 dnl
10 dnl This file is part of Trivial IP Encryption (TrIPE).
11 dnl
12 dnl TrIPE is free software: you can redistribute it and/or modify it under
13 dnl the terms of the GNU General Public License as published by the Free
14 dnl Software Foundation; either version 3 of the License, or (at your
15 dnl option) any later version.
16 dnl
17 dnl TrIPE is distributed in the hope that it will be useful, but WITHOUT
18 dnl ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 dnl FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20 dnl for more details.
21 dnl
22 dnl You should have received a copy of the GNU General Public License
23 dnl along with TrIPE.  If not, see <https://www.gnu.org/licenses/>.
24
25 dnl--------------------------------------------------------------------------
26 dnl Initialization.
27
28 mdw_AUTO_VERSION
29 AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk])
30 AC_CONFIG_SRCDIR([server/tripe.h])
31 AC_CONFIG_AUX_DIR([config])
32 AM_INIT_AUTOMAKE([foreign])
33 mdw_SILENT_RULES
34
35 AC_PROG_CC
36 AM_PROG_CC_C_O
37 AX_CFLAGS_WARN_ALL
38 AX_TYPE_SOCKLEN_T
39 AC_CANONICAL_HOST
40 AC_PROG_RANLIB
41
42 AC_CHECK_PROGS([AUTOM4TE], [autom4te])
43
44 mdw_ORIG_CFLAGS=$CFLAGS
45 mdw_ORIG_CPPFLAGS=$CPPFLAGS
46 AC_SUBST(AM_CFLAGS)
47 AC_SUBST(AM_CPPFLAGS)
48
49 dnl--------------------------------------------------------------------------
50 dnl C programming environment.
51
52 AC_CHECK_HEADERS([stdarg.h])
53
54 AC_SEARCH_LIBS([socket], [socket])
55
56 case "$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     ;;
64 esac
65
66 AC_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])
71 case $want_adns in
72   no) ;;
73   *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;;
74 esac
75 AC_SUBST([ADNS_LIBS])
76 case $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     ;;
85 esac
86
87 PKG_CHECK_MODULES([mLib], [mLib >= 2.2.1])
88 PKG_CHECK_MODULES([catacomb], [catacomb >= 2.2.2-38])
89
90 AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
91
92 dnl--------------------------------------------------------------------------
93 dnl Directories to install things into.
94
95 dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP])
96 AC_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
105 dnl Actual options.
106 TRIPE_DEFINE_PATH(
107   [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]],
108   ['${localstatedir}/tripe'],
109   [CONFIGDIR], [Look for keys and other configuration here.])
110
111 TRIPE_DEFINE_PATH(
112   [socketdir], [DIR], [admin socket [[.]]], [.],
113   [SOCKETDIR], [Create or look for administration socket here.])
114
115 TRIPE_DEFINE_PATH(
116   [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid])
117
118 TRIPE_DEFINE_PATH(
119   [initconfig], [FILE],
120   [configuration for init script [[SYSCONFDIR/tripe.conf]]],
121   ['${sysconfdir}/tripe.conf'])
122
123 TRIPE_DEFINE_PATH(
124   [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log])
125
126 dnl--------------------------------------------------------------------------
127 dnl Privilege-separation helper.
128
129 mdw_DEFINE_PATHS([
130   AC_DEFINE_UNQUOTED([PRIVSEP_HELPER],
131     ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"],
132     [Pathname of privilege-separation helper.])
133 ])
134
135 dnl--------------------------------------------------------------------------
136 dnl Other options.
137
138 AC_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
146 dnl--------------------------------------------------------------------------
147 dnl Tunnel devices.
148
149 dnl Provide the user with a choice.
150 AC_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
156 dnl If he doesn't choose, pick something sensible.
157 if 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
178 fi
179
180 tunnels=""
181 for 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, "
193 done
194 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
195   [List of tunnel drivers to install.])
196
197 dnl--------------------------------------------------------------------------
198 dnl Python.
199
200 dnl Find out whether Python exists at all.
201 AM_PATH_PYTHON([2.4], [python=yes], [python=no])
202 AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes])
203
204 dnl Find out whether we can use the various external modules.
205 if test $python = yes; then
206   AC_PYTHON_MODULE([pygtk])
207   AC_PYTHON_MODULE([cdb])
208   AC_PYTHON_MODULE([mLib])
209   AC_PYTHON_MODULE([catacomb])
210 fi
211 AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes])
212 AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes])
213 AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes])
214 AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes])
215
216 dnl--------------------------------------------------------------------------
217 dnl Wireshark.
218
219 dnl Get the user to help.
220 wireshark_plugindir=unknown
221 AC_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
233 case "$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     ;;
265 esac
266
267 case "$haveshark,$needshark" in
268   no,yes)
269     AC_MSG_ERROR([failed to configure Wireshark plugin])
270     ;;
271   yes,*)
272     AC_SUBST(wireshark_plugindir)
273     ;;
274 esac
275
276 AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes])
277
278 dnl--------------------------------------------------------------------------
279 dnl Produce output.
280
281 CFLAGS=$mdw_ORIG_CFLAGS
282 CPPFLAGS=$mdw_ORIG_CPPFLAGS
283
284 AC_CONFIG_HEADER([config/config.h])
285 AC_CONFIG_TESTDIR([t])
286
287 AC_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])
306 AC_OUTPUT
307
308 dnl----- That's all, folks --------------------------------------------------