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