Commit | Line | Data |
---|---|---|
165db1a8 | 1 | dnl -*-autoconf-*- |
410c8acf | 2 | dnl |
3cdc3f3a | 3 | dnl $Id$ |
410c8acf | 4 | dnl |
5 | dnl Configuration script for TrIPE | |
6 | dnl | |
7 | dnl (c) 2001 Straylight/Edgeware | |
8 | dnl | |
9 | ||
10 | dnl ----- Licensing notice -------------------------------------------------- | |
11 | dnl | |
12 | dnl This file is part of Trivial IP Encryption (TrIPE). | |
13 | dnl | |
14 | dnl TrIPE is free software; you can redistribute it and/or modify | |
15 | dnl it under the terms of the GNU General Public License as published by | |
16 | dnl the Free Software Foundation; either version 2 of the License, or | |
17 | dnl (at your option) any later version. | |
18 | dnl | |
19 | dnl TrIPE is distributed in the hope that it will be useful, | |
20 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of | |
21 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
22 | dnl GNU General Public License for more details. | |
23 | dnl | |
24 | dnl You should have received a copy of the GNU General Public License | |
25 | dnl along with TrIPE; if not, write to the Free Software Foundation, | |
26 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
27 | ||
410c8acf | 28 | AC_INIT(tripe.c) |
d36eda2a | 29 | AM_INIT_AUTOMAKE(tripe, 1.0.0pre7) |
73189848 | 30 | AM_CONFIG_HEADER(config.h) |
410c8acf | 31 | AC_CANONICAL_HOST |
32 | ||
165db1a8 | 33 | AC_PROG_MAKE_SET |
410c8acf | 34 | AC_PROG_CC |
165db1a8 | 35 | AM_PROG_LIBTOOL |
060ca767 | 36 | python=no |
37 | mdw_PROG_PYTHON([2.3], | |
38 | [python=yes | |
39 | pyscripts='${PYTHONSCRIPTS}' | |
40 | pymans='${PYTHONMANS}']) | |
41 | AC_SUBST([pyscripts]) AC_SUBST([pymans]) | |
42 | ||
43 | if test $python = yes; then | |
44 | mdw_CHECK_PYTHON([2.3]) | |
45 | AC_CACHE_CHECK([for pygtk], [mdw_cv_pygtk], [ | |
46 | mdw_cv_pygtk=no | |
47 | python -c >&5 2>&5 ' | |
48 | import pygtk | |
49 | pygtk.require("2.0") | |
50 | import gtk | |
51 | ' && mdw_cv_pygtk=yes | |
52 | ]) | |
53 | if test $mdw_cv_pygtk = yes; then | |
54 | pygtkscripts='${PYGTKSCRIPTS}' | |
55 | pygtkmans='${PYGTKMANS}' | |
56 | fi | |
57 | fi | |
58 | AC_SUBST([pygtkscripts]) AC_SUBST([pygtkmans]) | |
59 | ||
3cdc3f3a | 60 | AC_CHECK_HEADERS([stdarg.h]) |
37075862 | 61 | mdw_GCC_FLAGS([-Wall]) |
73189848 | 62 | mdw_OPT_TRACE |
410c8acf | 63 | |
37075862 | 64 | AC_ARG_WITH([linux-includes], |
65 | [ --with-linux-includes=DIR | |
66 | search for Linux kernel includes in DIR], | |
67 | [CFLAGS="$CFLAGS -I$withval"], | |
68 | [:]) | |
69 | ||
ef4a1ab7 | 70 | AC_ARG_WITH([configdir], |
71 | [ --with-configdir=DIR look for keys and other configuration in DIR | |
72 | [default=/var/lib/tripe]], | |
73 | [configdir=$withval], | |
74 | [configdir=/var/lib/tripe]) | |
75 | ||
76 | AC_ARG_WITH([socketdir], | |
77 | [ --with-socketdir=DIR put admin socket in DIR [default=.]], | |
78 | [socketdir=$withval], | |
79 | [socketdir=.]) | |
80 | ||
81 | AC_ARG_WITH([pidfile], | |
82 | [ --with-pidfile=FILE make tripectl write its pid to FILE | |
83 | [default=./tripectl.pid]], | |
84 | [pidfile=$withval], | |
85 | [pidfile=tripectl.pid]) | |
86 | ||
87 | AC_ARG_WITH([initconfig], | |
88 | [ --with-initconfig=FILE read definitions from FILE in init script | |
89 | [default=/etc/tripe.conf]], | |
90 | [initconfig=$withval], | |
91 | [initconfig=/etc/tripe.conf]) | |
92 | ||
93 | AC_ARG_WITH([logfile], | |
94 | [ --with-logfile=DIR make tripectl write its log to FILE | |
95 | [default=./tripe.log]], | |
96 | [logfile=$withval], | |
97 | [logfile=tripe.log]) | |
98 | ||
165db1a8 | 99 | DIRS="" |
28461f0e MW |
100 | WIRESHARK_CFLAGS="" |
101 | WIRESHARK_PLUGIN_DIR="unknown" | |
102 | AC_ARG_WITH([wireshark], | |
0a5d7a35 | 103 | [ --with-wireshark build and install Wireshark plugin], |
165db1a8 | 104 | [case "$withval" in |
28461f0e MW |
105 | no) wireshark=false requirewireshark=false;; |
106 | yes) wireshark=true; requirewireshark=true;; | |
107 | *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;; | |
165db1a8 | 108 | esac], |
28461f0e | 109 | [wireshark=true requirewireshark=false]) |
165db1a8 | 110 | |
42da2a58 | 111 | tun=auto |
b9066fbb | 112 | AC_ARG_WITH([tunnel], |
42da2a58 | 113 | [ --with-tunnel=KIND kinds of tunnel device to use |
b9066fbb | 114 | (linux, unet, bsd, slip)], |
115 | [tun=$withval]) | |
116 | ||
42da2a58 | 117 | if test "$tun" = auto; then |
118 | AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [ | |
119 | mdw_cv_tunnel="" | |
b9066fbb | 120 | case $host_os in |
121 | linux*) | |
122 | case `uname -r` in | |
7dd8b2bb | 123 | changequote(,)dnl |
b9066fbb | 124 | 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*) |
7dd8b2bb | 125 | changequote([,])dnl |
b9066fbb | 126 | mdw_cv_tunnel=linux |
127 | ;; | |
128 | *) | |
129 | mdw_cv_tunnel=unet | |
130 | ;; | |
131 | esac | |
132 | ;; | |
133 | *bsd*) | |
134 | mdw_cv_tunnel=bsd | |
37075862 | 135 | ;; |
37075862 | 136 | esac |
42da2a58 | 137 | mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip |
b9066fbb | 138 | ]) |
139 | tun=$mdw_cv_tunnel | |
140 | fi | |
141 | ||
42da2a58 | 142 | tunnels="" |
143 | for i in $tun; do | |
144 | case $i in | |
145 | linux) AC_DEFINE([TUN_LINUX], [1], | |
146 | [Install the Linux TUN/TAP driver.]) ;; | |
147 | bsd) AC_DEFINE([TUN_BSD], [1], | |
148 | [Install the BSD tunnel driver.]) ;; | |
149 | unet) AC_DEFINE([TUN_UNET], [1], | |
150 | [Install the obsolete Linux Usernet driver.]) ;; | |
151 | slip) ;; | |
152 | *) AC_MSG_ERROR([Unknown tunnel type]) ;; | |
153 | esac | |
154 | tunnels="$tunnels&tun_$i, " | |
155 | done | |
410c8acf | 156 | AC_SUBST(tun) |
42da2a58 | 157 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], |
158 | [List of tunnel drivers to install.]) | |
410c8acf | 159 | |
cc1668bb | 160 | mdw_MLIB(2.0.0) |
c55f55af | 161 | mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"]) |
165db1a8 | 162 | |
28461f0e MW |
163 | if test "$wireshark" = true -a "$WIRESHARK_PLUGIN_DIR" = unknown; then |
164 | AC_CACHE_CHECK([where to put Wireshark plugins], | |
165 | [mdw_cv_wireshark_plugin_dir], [ | |
ef4a1ab7 | 166 | changequote(,) |
28461f0e MW |
167 | mdw_cv_wireshark_plugin_dir="failed" |
168 | wsprefix=none | |
ef4a1ab7 | 169 | for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do |
28461f0e MW |
170 | if test -x "$i/bin/tshark"; then |
171 | wsprefix=$i | |
ef4a1ab7 | 172 | break |
173 | fi | |
174 | done | |
28461f0e MW |
175 | if test "$wsprefix" != none; then |
176 | wsbin=$wsprefix/bin/tshark | |
177 | wsver=`$wsbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q'` | |
178 | dir=$wsprefix/lib/wireshark/plugins/$wsver | |
ef4a1ab7 | 179 | if test -d "$dir"; then |
28461f0e | 180 | mdw_cv_wireshark_plugin_dir=$dir |
ef4a1ab7 | 181 | fi |
182 | fi | |
183 | changequote([, ]) | |
184 | ]) | |
28461f0e MW |
185 | case $mdw_cv_wireshark_plugin_dir in |
186 | failed) wireshark=false;; | |
187 | *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;; | |
ef4a1ab7 | 188 | esac |
189 | fi | |
190 | ||
28461f0e MW |
191 | if test "$wireshark" = true; then |
192 | AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule]) | |
ef4a1ab7 | 193 | fi |
28461f0e | 194 | if test "$wireshark" = true; then |
165db1a8 | 195 | bad=true |
196 | mdw_CFLAGS=$CFLAGS | |
28461f0e MW |
197 | wsprefix=`echo $WIRESHARK_PLUGIN_DIR | sed 's:/lib/.*$::'` |
198 | AC_CACHE_CHECK([how to find the Wireshark headers], | |
199 | [mdw_cv_wireshark_includes], [ | |
200 | mdw_cv_wireshark_includes=failed | |
ef4a1ab7 | 201 | for i in \ |
202 | "" \ | |
28461f0e MW |
203 | "-I${wsprefix}/include/wireshark" \ |
204 | "-I${wsprefix}/include" \ | |
205 | "-I${prefix}/include/wireshark" \ | |
ef4a1ab7 | 206 | "-I${prefix}/include" \ |
28461f0e MW |
207 | "-I/usr/include/wireshark" \ |
208 | "-I/usr/local/include/wireshark" \ | |
ef4a1ab7 | 209 | "-I/usr/local/include"; do |
165db1a8 | 210 | CFLAGS="$GLIB_CFLAGS $i" |
211 | AC_TRY_COMPILE([ | |
212 | #include <netinet/in.h> | |
213 | #include <glib.h> | |
28461f0e MW |
214 | #include <wireshark/config.h> |
215 | #include <wireshark/epan/packet.h> | |
165db1a8 | 216 | ], [ |
217 | dissector_handle_t dh; | |
3cdc3f3a | 218 | dh = create_dissector_handle(0, 0); |
165db1a8 | 219 | ], [bad=false; break]) |
220 | done | |
ef4a1ab7 | 221 | if test $bad = false; then |
28461f0e | 222 | mdw_cv_wireshark_includes=$i |
165db1a8 | 223 | fi |
165db1a8 | 224 | CFLAGS=$mdw_CFLAGS |
225 | ]) | |
28461f0e MW |
226 | case $mdw_cv_wireshark_includes in |
227 | failed) wireshark=false;; | |
ef4a1ab7 | 228 | esac |
229 | fi | |
230 | ||
28461f0e MW |
231 | if test "$wireshark" = true; then |
232 | WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes" | |
233 | AC_SUBST(WIRESHARK_CFLAGS) | |
234 | AC_SUBST(WIRESHARK_PLUGIN_DIR) | |
235 | DIRS="$DIRS wireshark" | |
165db1a8 | 236 | fi |
410c8acf | 237 | |
28461f0e MW |
238 | if test "$wireshark" = false -a "$requirewireshark" = true; then |
239 | AC_MSG_ERROR([failed to configure Wireshark plugin]) | |
ef4a1ab7 | 240 | fi |
241 | ||
3cdc3f3a | 242 | AH_TEMPLATE([CONFIGDIR], |
243 | [Tripe should look here for keys and other configuration.]) | |
244 | AH_TEMPLATE([SOCKETDIR], | |
245 | [Tripe should make its administration socket here.]) | |
ef4a1ab7 | 246 | mdw_DEFINE_PATHS([ |
247 | mdw_DEFINE_PATH([CONFIGDIR], [$configdir]) | |
248 | mdw_DEFINE_PATH([SOCKETDIR], [$socketdir]) | |
249 | AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile) | |
250 | AC_SUBST(initconfig) | |
251 | ]) | |
165db1a8 | 252 | AC_SUBST(DIRS) |
060ca767 | 253 | AC_OUTPUT( \ |
28461f0e | 254 | Makefile doc/Makefile wireshark/Makefile \ |
060ca767 | 255 | tripe-init tripe-keys tripemon) |
410c8acf | 256 | |
257 | dnl ----- That's all, folks ------------------------------------------------- |