Commit | Line | Data |
---|---|---|
6b6ad670 MW |
1 | dnl -*-autoconf-*- |
2 | dnl | |
3 | dnl Configuration script for TrIPE | |
4 | dnl | |
5 | dnl (c) 2001 Straylight/Edgeware | |
6 | dnl | |
7 | ||
8f3f3ac7 | 8 | dnl----- Licensing notice --------------------------------------------------- |
6b6ad670 MW |
9 | dnl |
10 | dnl This file is part of Trivial IP Encryption (TrIPE). | |
11 | dnl | |
11ad66c2 MW |
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. | |
6b6ad670 | 16 | dnl |
11ad66c2 MW |
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. | |
6b6ad670 MW |
21 | dnl |
22 | dnl You should have received a copy of the GNU General Public License | |
11ad66c2 | 23 | dnl along with TrIPE. If not, see <https://www.gnu.org/licenses/>. |
6b6ad670 MW |
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]) | |
2171b19e | 33 | mdw_SILENT_RULES |
6b6ad670 MW |
34 | |
35 | AC_PROG_CC | |
36 | AM_PROG_CC_C_O | |
37 | AX_CFLAGS_WARN_ALL | |
cb160b86 | 38 | AX_TYPE_SOCKLEN_T |
6b6ad670 | 39 | AC_CANONICAL_HOST |
408f7a2c | 40 | AC_PROG_RANLIB |
6b6ad670 | 41 | |
1c5f4539 MW |
42 | AC_CHECK_PROGS([AUTOM4TE], [autom4te]) |
43 | ||
b90b8384 MW |
44 | mdw_ORIG_CFLAGS=$CFLAGS |
45 | mdw_ORIG_CPPFLAGS=$CPPFLAGS | |
46 | AC_SUBST(AM_CFLAGS) | |
47 | AC_SUBST(AM_CPPFLAGS) | |
48 | ||
6b6ad670 MW |
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], | |
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 | ;; |
64 | esac | |
65 | ||
85ccca5f MW |
66 | AC_CHECK_FUNCS([getifaddrs]) |
67 | ||
971e5689 MW |
68 | AC_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]) | |
73 | case $want_adns in | |
74 | no) ;; | |
75 | *) AC_CHECK_LIB([adns], [adns_submit], [have_adns=yes], [have_adns=no]) ;; | |
76 | esac | |
77 | AC_SUBST([ADNS_LIBS]) | |
78 | case $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 | ;; | |
87 | esac | |
88 | ||
71887b00 | 89 | PKG_CHECK_MODULES([mLib], [mLib >= 2.4.1]) |
a97b7d4e | 90 | PKG_CHECK_MODULES([catacomb], [catacomb >= 2.5.0]) |
6b6ad670 | 91 | |
b90b8384 | 92 | AM_CFLAGS="$AM_CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" |
6b6ad670 MW |
93 | |
94 | dnl-------------------------------------------------------------------------- | |
95 | dnl Directories to install things into. | |
96 | ||
97 | dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP]) | |
98 | AC_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 | ||
107 | dnl Actual options. | |
108 | TRIPE_DEFINE_PATH( | |
109 | [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]], | |
110 | ['${localstatedir}/tripe'], | |
111 | [CONFIGDIR], [Look for keys and other configuration here.]) | |
112 | ||
113 | TRIPE_DEFINE_PATH( | |
114 | [socketdir], [DIR], [admin socket [[.]]], [.], | |
115 | [SOCKETDIR], [Create or look for administration socket here.]) | |
116 | ||
117 | TRIPE_DEFINE_PATH( | |
118 | [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid]) | |
119 | ||
120 | TRIPE_DEFINE_PATH( | |
288fc12b MW |
121 | [initconfig], [FILE], |
122 | [configuration for init script [[SYSCONFDIR/tripe.conf]]], | |
123 | ['${sysconfdir}/tripe.conf']) | |
6b6ad670 MW |
124 | |
125 | TRIPE_DEFINE_PATH( | |
126 | [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log]) | |
127 | ||
128 | dnl-------------------------------------------------------------------------- | |
388e0319 MW |
129 | dnl Privilege-separation helper. |
130 | ||
131 | mdw_DEFINE_PATHS([ | |
132 | AC_DEFINE_UNQUOTED([PRIVSEP_HELPER], | |
133 | ["mdw_PATH([$libexecdir])/mdw_PROG([tripe-privhelper])"], | |
134 | [Pathname of privilege-separation helper.]) | |
135 | ]) | |
136 | ||
137 | dnl-------------------------------------------------------------------------- | |
6b6ad670 MW |
138 | dnl Other options. |
139 | ||
140 | AC_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 | ||
148 | dnl-------------------------------------------------------------------------- | |
149 | dnl Tunnel devices. | |
150 | ||
151 | dnl Provide the user with a choice. | |
152 | AC_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 | ||
158 | dnl If he doesn't choose, pick something sensible. | |
159 | if 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 | |
180 | fi | |
181 | ||
182 | tunnels="" | |
183 | for 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, " | |
195 | done | |
196 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], | |
197 | [List of tunnel drivers to install.]) | |
198 | ||
199 | dnl-------------------------------------------------------------------------- | |
200 | dnl Python. | |
201 | ||
202 | dnl Find out whether Python exists at all. | |
203 | AM_PATH_PYTHON([2.4], [python=yes], [python=no]) | |
204 | AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes]) | |
205 | ||
207f030a | 206 | dnl Find out whether we can use the various external modules. |
6b6ad670 MW |
207 | if 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]) |
212 | fi | |
213 | AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes]) | |
207f030a MW |
214 | AM_CONDITIONAL([HAVE_PYCDB], [test ${HAVE_PYMOD_CDB-no} = yes]) |
215 | AM_CONDITIONAL([HAVE_PYMLIB], [test ${HAVE_PYMOD_MLIB-no} = yes]) | |
6b6ad670 MW |
216 | AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes]) |
217 | ||
218 | dnl-------------------------------------------------------------------------- | |
219 | dnl Wireshark. | |
6b6ad670 MW |
220 | |
221 | dnl Get the user to help. | |
4da9fb4c | 222 | wireshark_plugindir=unknown |
6b6ad670 MW |
223 | AC_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 | 235 | case "$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 |
267 | esac |
268 | ||
6b6ad670 MW |
269 | case "$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 | ;; | |
276 | esac | |
277 | ||
278 | AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes]) | |
279 | ||
280 | dnl-------------------------------------------------------------------------- | |
281 | dnl Produce output. | |
282 | ||
b90b8384 MW |
283 | CFLAGS=$mdw_ORIG_CFLAGS |
284 | CPPFLAGS=$mdw_ORIG_CPPFLAGS | |
285 | ||
6b6ad670 | 286 | AC_CONFIG_HEADER([config/config.h]) |
1c5f4539 | 287 | AC_CONFIG_TESTDIR([t]) |
6b6ad670 MW |
288 | |
289 | AC_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 |
308 | AC_OUTPUT |
309 | ||
8f3f3ac7 | 310 | dnl----- That's all, folks -------------------------------------------------- |