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 | ||
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 | |
13 | dnl it under the terms of the GNU General Public License as published by | |
14 | dnl the Free Software Foundation; either version 2 of the License, or | |
15 | dnl (at your option) any later version. | |
16 | dnl | |
17 | dnl TrIPE is distributed in the hope that it will be useful, | |
18 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 | dnl GNU General Public License 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, write to the Free Software Foundation, | |
24 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
25 | ||
26 | dnl-------------------------------------------------------------------------- | |
27 | dnl Initialization. | |
28 | ||
29 | mdw_AUTO_VERSION | |
30 | AC_INIT([tripe], AUTO_VERSION, [mdw@distorted.org.uk]) | |
31 | AC_CONFIG_SRCDIR([server/tripe.h]) | |
32 | AC_CONFIG_AUX_DIR([config]) | |
33 | AM_INIT_AUTOMAKE([foreign]) | |
34 | ||
35 | AC_PROG_CC | |
36 | AM_PROG_CC_C_O | |
37 | AX_CFLAGS_WARN_ALL | |
38 | AC_CANONICAL_HOST | |
39 | AM_PROG_LIBTOOL | |
40 | ||
1c5f4539 MW |
41 | AC_CHECK_PROGS([AUTOM4TE], [autom4te]) |
42 | ||
6b6ad670 MW |
43 | dnl-------------------------------------------------------------------------- |
44 | dnl C programming environment. | |
45 | ||
46 | AC_CHECK_HEADERS([stdarg.h]) | |
47 | ||
48 | AC_SEARCH_LIBS([socket], [socket]) | |
49 | ||
50 | case "$host_os" in | |
51 | linux) | |
52 | AC_ARG_WITH([linux-includes], | |
53 | AS_HELP_STRING( | |
54 | [--with-linux-includes=DIR], | |
55 | [Linux kernel includes]), | |
56 | [CFLAGS="$CFLAGS -I$withval"], [:]) | |
57 | ;; | |
58 | esac | |
59 | ||
60 | PKG_CHECK_MODULES([mLib], [mLib >= 2.0.4]) | |
61 | PKG_CHECK_MODULES([catacomb], [catacomb >= 2.1.1]) | |
62 | ||
63 | CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" | |
6b6ad670 MW |
64 | |
65 | dnl-------------------------------------------------------------------------- | |
66 | dnl Directories to install things into. | |
67 | ||
68 | dnl TRIPE_DEFINE_PATH(VAR, ARG, HELP, DEFAULT, [DEFINE, DEFINEHELP]) | |
69 | AC_DEFUN([TRIPE_DEFINE_PATH], [ | |
70 | AC_ARG_WITH([$1], AS_HELP_STRING([--with-$1=$2], [$3]), | |
71 | [$1=$withval], [$1=$4]) | |
72 | AC_SUBST([$1]) | |
73 | m4_if([$5], [], [], [ | |
74 | mdw_DEFINE_PATHS([mdw_DEFINE_PATH([$5], [$][$1], [$6])]) | |
75 | ]) | |
76 | ]) | |
77 | ||
78 | dnl Actual options. | |
79 | TRIPE_DEFINE_PATH( | |
80 | [configdir], [DIR], [keys and other configuration [[LOCALSTATE/tripe]]], | |
81 | ['${localstatedir}/tripe'], | |
82 | [CONFIGDIR], [Look for keys and other configuration here.]) | |
83 | ||
84 | TRIPE_DEFINE_PATH( | |
85 | [socketdir], [DIR], [admin socket [[.]]], [.], | |
86 | [SOCKETDIR], [Create or look for administration socket here.]) | |
87 | ||
88 | TRIPE_DEFINE_PATH( | |
89 | [pidfile], [FILE], [process-id [[./tripectl.pid]]], [tripectl.pid]) | |
90 | ||
91 | TRIPE_DEFINE_PATH( | |
92 | [initconfig], [FILE], [configuration for init script [[/etc/tripe.conf]]], | |
93 | [/etc/tripe.conf]) | |
94 | ||
95 | TRIPE_DEFINE_PATH( | |
96 | [logfile], [FILE], [logging output [[./tripe.log]]], [tripe.log]) | |
97 | ||
98 | dnl-------------------------------------------------------------------------- | |
99 | dnl Other options. | |
100 | ||
101 | AC_ARG_WITH([tracing], | |
102 | AS_HELP_STRING( | |
103 | [--without-tracing], | |
104 | [compile out tracing support (not recommended)]), | |
105 | [test "$withval" = no && | |
106 | AC_DEFINE([NTRACE], [1], [Disable all tracing.])], | |
107 | [:]) | |
108 | ||
c64d8cd5 MW |
109 | dnl-------------------------------------------------------------------------- |
110 | dnl Path MTU discovery. | |
111 | ||
112 | case $host_os in | |
113 | linux*) | |
114 | pmtu=yes | |
115 | ;; | |
116 | *) | |
117 | pmtu=no | |
118 | ;; | |
119 | esac | |
120 | AM_CONDITIONAL([PATHMTU], [test $pmtu = yes]) | |
121 | ||
6b6ad670 MW |
122 | dnl-------------------------------------------------------------------------- |
123 | dnl Tunnel devices. | |
124 | ||
125 | dnl Provide the user with a choice. | |
126 | AC_ARG_WITH([tunnel], | |
127 | AS_HELP_STRING( | |
128 | [--with-tunnel=KIND], | |
129 | [kinds of tunnel device to use (linux, unet, bsd, slip)]), | |
130 | [tun=$withval], [tun=auto]) | |
131 | ||
132 | dnl If he doesn't choose, pick something sensible. | |
133 | if test "$tun" = auto; then | |
134 | AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [ | |
135 | mdw_cv_tunnel="" | |
136 | case $host_os in | |
137 | linux*) | |
138 | case `uname -r` in | |
139 | [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*]) | |
140 | mdw_cv_tunnel=linux | |
141 | ;; | |
142 | *) | |
143 | mdw_cv_tunnel=unet | |
144 | ;; | |
145 | esac | |
146 | ;; | |
147 | *bsd*) | |
148 | mdw_cv_tunnel=bsd | |
149 | ;; | |
150 | esac | |
151 | mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip | |
152 | ]) | |
153 | tun=$mdw_cv_tunnel | |
154 | fi | |
155 | ||
156 | tunnels="" | |
157 | for i in $tun; do | |
158 | case $i in | |
159 | linux) AC_DEFINE([TUN_LINUX], [1], | |
160 | [Install the Linux TUN/TAP driver.]) ;; | |
161 | bsd) AC_DEFINE([TUN_BSD], [1], | |
162 | [Install the BSD tunnel driver.]) ;; | |
163 | unet) AC_DEFINE([TUN_UNET], [1], | |
164 | [Install the obsolete Linux Usernet driver.]) ;; | |
165 | slip) ;; | |
166 | *) AC_MSG_ERROR([Unknown tunnel type]) ;; | |
167 | esac | |
168 | tunnels="$tunnels&tun_$i, " | |
169 | done | |
170 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], | |
171 | [List of tunnel drivers to install.]) | |
172 | ||
173 | dnl-------------------------------------------------------------------------- | |
174 | dnl Python. | |
175 | ||
176 | dnl Find out whether Python exists at all. | |
177 | AM_PATH_PYTHON([2.4], [python=yes], [python=no]) | |
178 | AM_CONDITIONAL([HAVE_PYTHON], [test $python = yes]) | |
179 | ||
180 | dnl Find out whether we can use Catacomb and GTK. | |
181 | if test $python = yes; then | |
182 | AC_PYTHON_MODULE([pygtk]) | |
183 | AC_PYTHON_MODULE([catacomb]) | |
184 | fi | |
185 | AM_CONDITIONAL([HAVE_PYGTK], [test ${HAVE_PYMOD_PYGTK-no} = yes]) | |
186 | AM_CONDITIONAL([HAVE_PYCATACOMB], [test ${HAVE_PYMOD_CATACOMB-no} = yes]) | |
187 | ||
188 | dnl-------------------------------------------------------------------------- | |
189 | dnl Wireshark. | |
190 | dnl | |
191 | dnl This is all distressingly ugly and complicated. Why they can't just | |
192 | dnl provide a pkg-config dropping containing all the useful information about | |
193 | dnl the installation I don't know. | |
194 | ||
195 | WIRESHARK_CFLAGS="" | |
196 | : ${wireshark_plugindir=unknown} | |
197 | ||
198 | dnl Get the user to help. | |
199 | AC_ARG_WITH([wireshark], | |
200 | AS_HELP_STRING( | |
201 | [--with-wireshark[=DIR]], | |
202 | [build and install Wireshark plugin]), | |
203 | [case "$withval" in | |
204 | no) haveshark=no needshark=no ;; | |
205 | yes) haveshark=yes needshark=yes ;; | |
206 | *) haveshark=yes needshark=yes | |
63efe3ef | 207 | wireshark_plugindir=$withval ;; |
6b6ad670 MW |
208 | esac], |
209 | [haveshark=yes needshark=no]) | |
210 | ||
211 | dnl Try to find the Wireshark installation directory the hard way. | |
212 | case "$haveshark,$wireshark_plugindir" in | |
213 | yes,unknown) | |
214 | AC_CACHE_CHECK([where to put Wireshark plugins], | |
215 | [mdw_cv_wireshark_plugin_dir], [ | |
216 | mdw_cv_wireshark_plugin_dir="failed" | |
217 | wsprefix=none | |
218 | for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do | |
219 | if test -x "$i/bin/tshark"; then | |
220 | wsprefix=$i | |
221 | break | |
222 | fi | |
223 | done | |
224 | if test "$wsprefix" != none; then | |
225 | wsbin=$wsprefix/bin/tshark | |
226 | wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']` | |
227 | dir=$wsprefix/lib/wireshark/plugins | |
228 | test -d "$dir/$wsver" && dir="$dir/$wsver" | |
229 | if test -d "$dir"; then | |
230 | mdw_cv_wireshark_plugin_dir=$dir | |
231 | fi | |
232 | fi | |
233 | ]) | |
234 | case $mdw_cv_wireshark_plugin_dir in | |
235 | failed) haveshark=no ;; | |
236 | *) wireshark_plugindir=$mdw_cv_wireshark_plugin_dir ;; | |
237 | esac | |
238 | esac | |
239 | ||
240 | dnl If we're still interested, find Glib. | |
241 | case "$haveshark" in | |
9db701ca | 242 | yes) AM_PATH_GLIB_2_0([2.4.0], [], [haveshark=false], [gmodule]) ;; |
6b6ad670 MW |
243 | esac |
244 | ||
245 | dnl Find the include directory. This would be much easier if they just | |
246 | dnl provided a pkg-config file. | |
247 | case "$haveshark" in | |
248 | yes) | |
249 | bad=yes | |
250 | mdw_CFLAGS=$CFLAGS | |
251 | wsprefix=`echo $wireshark_plugindir | sed 's:/lib/.*$::'` | |
252 | AC_CACHE_CHECK([how to find the Wireshark headers], | |
63efe3ef | 253 | [mdw_cv_wireshark_includes], [ |
6b6ad670 MW |
254 | mdw_cv_wireshark_includes=failed |
255 | for i in \ | |
256 | "" \ | |
257 | "-I${wsprefix}/include/wireshark" \ | |
258 | "-I${wsprefix}/include" \ | |
259 | "-I${prefix}/include/wireshark" \ | |
260 | "-I${prefix}/include" \ | |
261 | "-I/usr/include/wireshark" \ | |
262 | "-I/usr/local/include/wireshark" \ | |
263 | "-I/usr/local/include"; do | |
264 | CFLAGS="$GLIB_CFLAGS $i" | |
265 | AC_TRY_COMPILE([ | |
266 | #include <netinet/in.h> | |
267 | #include <glib.h> | |
268 | #include <wireshark/config.h> | |
269 | #include <wireshark/epan/packet.h>], | |
270 | [dissector_handle_t dh; dh = create_dissector_handle(0, 0);], | |
271 | [bad=no; break]) | |
272 | done | |
273 | case "$bad" in | |
274 | no) mdw_cv_wireshark_includes=$i ;; | |
275 | esac | |
276 | CFLAGS=$mdw_CFLAGS | |
277 | ]) | |
278 | case "$mdw_cv_wireshark_includes" in | |
279 | failed) haveshark=no ;; | |
280 | esac | |
281 | esac | |
282 | ||
283 | case "$haveshark,$needshark" in | |
284 | no,yes) | |
285 | AC_MSG_ERROR([failed to configure Wireshark plugin]) | |
286 | ;; | |
287 | yes,*) | |
288 | WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes" | |
289 | AC_SUBST(WIRESHARK_CFLAGS) | |
290 | AC_SUBST(wireshark_plugindir) | |
291 | ;; | |
292 | esac | |
293 | ||
294 | AM_CONDITIONAL([HAVE_WIRESHARK], [test "$haveshark" = yes]) | |
295 | ||
296 | dnl-------------------------------------------------------------------------- | |
297 | dnl Produce output. | |
298 | ||
299 | AC_CONFIG_HEADER([config/config.h]) | |
1c5f4539 | 300 | AC_CONFIG_TESTDIR([t]) |
6b6ad670 MW |
301 | |
302 | AC_CONFIG_FILES( | |
303 | [Makefile] | |
304 | [common/Makefile] | |
49f86fe4 | 305 | [uslip/Makefile] |
c64d8cd5 | 306 | [pathmtu/Makefile] |
6b6ad670 MW |
307 | [client/Makefile] |
308 | [server/Makefile] | |
309 | [proxy/Makefile] | |
310 | [pkstream/Makefile] | |
311 | [wireshark/Makefile] | |
312 | [init/Makefile] | |
313 | [keys/Makefile] | |
1c5f4539 MW |
314 | [mon/Makefile] |
315 | [t/Makefile t/atlocal]) | |
6b6ad670 MW |
316 | AC_OUTPUT |
317 | ||
318 | dnl ----- That's all, folks ------------------------------------------------- |