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 |
3cdc3f3a |
36 | AC_CHECK_HEADERS([stdarg.h]) |
37075862 |
37 | mdw_GCC_FLAGS([-Wall]) |
73189848 |
38 | mdw_OPT_TRACE |
410c8acf |
39 | |
37075862 |
40 | AC_ARG_WITH([linux-includes], |
41 | [ --with-linux-includes=DIR |
42 | search for Linux kernel includes in DIR], |
43 | [CFLAGS="$CFLAGS -I$withval"], |
44 | [:]) |
45 | |
ef4a1ab7 |
46 | AC_ARG_WITH([configdir], |
47 | [ --with-configdir=DIR look for keys and other configuration in DIR |
48 | [default=/var/lib/tripe]], |
49 | [configdir=$withval], |
50 | [configdir=/var/lib/tripe]) |
51 | |
52 | AC_ARG_WITH([socketdir], |
53 | [ --with-socketdir=DIR put admin socket in DIR [default=.]], |
54 | [socketdir=$withval], |
55 | [socketdir=.]) |
56 | |
57 | AC_ARG_WITH([pidfile], |
58 | [ --with-pidfile=FILE make tripectl write its pid to FILE |
59 | [default=./tripectl.pid]], |
60 | [pidfile=$withval], |
61 | [pidfile=tripectl.pid]) |
62 | |
63 | AC_ARG_WITH([initconfig], |
64 | [ --with-initconfig=FILE read definitions from FILE in init script |
65 | [default=/etc/tripe.conf]], |
66 | [initconfig=$withval], |
67 | [initconfig=/etc/tripe.conf]) |
68 | |
69 | AC_ARG_WITH([logfile], |
70 | [ --with-logfile=DIR make tripectl write its log to FILE |
71 | [default=./tripe.log]], |
72 | [logfile=$withval], |
73 | [logfile=tripe.log]) |
74 | |
165db1a8 |
75 | DIRS="" |
ef4a1ab7 |
76 | ETHEREAL_CFLAGS="" |
77 | ETHEREAL_PLUGIN_DIR="unknown" |
165db1a8 |
78 | AC_ARG_WITH([ethereal], |
ef4a1ab7 |
79 | [ --with-ethereal build and install Ethereal plugin], |
165db1a8 |
80 | [case "$withval" in |
ef4a1ab7 |
81 | no) ethereal=false requireethereal=false;; |
82 | yes) ethereal=true; requireethereal=true;; |
83 | *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;; |
165db1a8 |
84 | esac], |
ef4a1ab7 |
85 | [ethereal=true requireethereal=false]) |
165db1a8 |
86 | |
42da2a58 |
87 | tun=auto |
b9066fbb |
88 | AC_ARG_WITH([tunnel], |
42da2a58 |
89 | [ --with-tunnel=KIND kinds of tunnel device to use |
b9066fbb |
90 | (linux, unet, bsd, slip)], |
91 | [tun=$withval]) |
92 | |
42da2a58 |
93 | if test "$tun" = auto; then |
94 | AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [ |
95 | mdw_cv_tunnel="" |
b9066fbb |
96 | case $host_os in |
97 | linux*) |
98 | case `uname -r` in |
7dd8b2bb |
99 | changequote(,)dnl |
b9066fbb |
100 | 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*) |
7dd8b2bb |
101 | changequote([,])dnl |
b9066fbb |
102 | mdw_cv_tunnel=linux |
103 | ;; |
104 | *) |
105 | mdw_cv_tunnel=unet |
106 | ;; |
107 | esac |
108 | ;; |
109 | *bsd*) |
110 | mdw_cv_tunnel=bsd |
37075862 |
111 | ;; |
37075862 |
112 | esac |
42da2a58 |
113 | mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip |
b9066fbb |
114 | ]) |
115 | tun=$mdw_cv_tunnel |
116 | fi |
117 | |
42da2a58 |
118 | tunnels="" |
119 | for i in $tun; do |
120 | case $i in |
121 | linux) AC_DEFINE([TUN_LINUX], [1], |
122 | [Install the Linux TUN/TAP driver.]) ;; |
123 | bsd) AC_DEFINE([TUN_BSD], [1], |
124 | [Install the BSD tunnel driver.]) ;; |
125 | unet) AC_DEFINE([TUN_UNET], [1], |
126 | [Install the obsolete Linux Usernet driver.]) ;; |
127 | slip) ;; |
128 | *) AC_MSG_ERROR([Unknown tunnel type]) ;; |
129 | esac |
130 | tunnels="$tunnels&tun_$i, " |
131 | done |
410c8acf |
132 | AC_SUBST(tun) |
42da2a58 |
133 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], |
134 | [List of tunnel drivers to install.]) |
410c8acf |
135 | |
cc1668bb |
136 | mdw_MLIB(2.0.0) |
c55f55af |
137 | mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"]) |
165db1a8 |
138 | |
ef4a1ab7 |
139 | if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then |
140 | AC_CACHE_CHECK([where to put Ethereal plugins], |
141 | [mdw_cv_ethereal_plugin_dir], [ |
142 | changequote(,) |
143 | mdw_cv_ethereal_plugin_dir="failed" |
144 | ethprefix=none |
145 | for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do |
3cdc3f3a |
146 | if test -x "$i/bin/tethereal"; then |
ef4a1ab7 |
147 | ethprefix=$i |
148 | break |
149 | fi |
150 | done |
151 | if test "$ethprefix" != none; then |
3cdc3f3a |
152 | ethbin=$ethprefix/bin/tethereal |
153 | ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q'` |
ef4a1ab7 |
154 | dir=$ethprefix/lib/ethereal/plugins/$ethver |
155 | if test -d "$dir"; then |
156 | mdw_cv_ethereal_plugin_dir=$dir |
157 | fi |
158 | fi |
159 | changequote([, ]) |
160 | ]) |
161 | case $mdw_cv_ethereal_plugin_dir in |
162 | failed) ethereal=false;; |
163 | *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;; |
164 | esac |
165 | fi |
166 | |
167 | if test "$ethereal" = true; then |
168 | AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule]) |
169 | fi |
170 | if test "$ethereal" = true; then |
165db1a8 |
171 | bad=true |
172 | mdw_CFLAGS=$CFLAGS |
ef4a1ab7 |
173 | ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'` |
165db1a8 |
174 | AC_CACHE_CHECK([how to find the Ethereal headers], |
175 | [mdw_cv_ethereal_includes], [ |
ef4a1ab7 |
176 | mdw_cv_ethereal_includes=failed |
177 | for i in \ |
178 | "" \ |
179 | "-I${ethprefix}/include/ethereal" \ |
180 | "-I${ethprefix}/include" \ |
181 | "-I${prefix}/include/ethereal" \ |
182 | "-I${prefix}/include" \ |
183 | "-I/usr/include/ethereal" \ |
184 | "-I/usr/local/include/ethereal" \ |
185 | "-I/usr/local/include"; do |
165db1a8 |
186 | CFLAGS="$GLIB_CFLAGS $i" |
187 | AC_TRY_COMPILE([ |
188 | #include <netinet/in.h> |
189 | #include <glib.h> |
3cdc3f3a |
190 | #include <ethereal/config.h> |
191 | #include <ethereal/epan/packet.h> |
165db1a8 |
192 | ], [ |
193 | dissector_handle_t dh; |
3cdc3f3a |
194 | dh = create_dissector_handle(0, 0); |
165db1a8 |
195 | ], [bad=false; break]) |
196 | done |
ef4a1ab7 |
197 | if test $bad = false; then |
198 | mdw_cv_ethereal_includes=$i |
165db1a8 |
199 | fi |
165db1a8 |
200 | CFLAGS=$mdw_CFLAGS |
201 | ]) |
0e6502d3 |
202 | case $mdw_cv_ethereal_includes in |
ef4a1ab7 |
203 | failed) ethereal=false;; |
ef4a1ab7 |
204 | esac |
205 | fi |
206 | |
207 | if test "$ethereal" = true; then |
165db1a8 |
208 | ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes" |
165db1a8 |
209 | AC_SUBST(ETHEREAL_CFLAGS) |
210 | AC_SUBST(ETHEREAL_PLUGIN_DIR) |
211 | DIRS="$DIRS ethereal" |
212 | fi |
410c8acf |
213 | |
ef4a1ab7 |
214 | if test "$ethereal" = false -a "$requireethereal" = true; then |
215 | AC_MSG_ERROR([failed to configure Ethereal plugin]) |
216 | fi |
217 | |
3cdc3f3a |
218 | AH_TEMPLATE([CONFIGDIR], |
219 | [Tripe should look here for keys and other configuration.]) |
220 | AH_TEMPLATE([SOCKETDIR], |
221 | [Tripe should make its administration socket here.]) |
ef4a1ab7 |
222 | mdw_DEFINE_PATHS([ |
223 | mdw_DEFINE_PATH([CONFIGDIR], [$configdir]) |
224 | mdw_DEFINE_PATH([SOCKETDIR], [$socketdir]) |
225 | AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile) |
226 | AC_SUBST(initconfig) |
227 | ]) |
165db1a8 |
228 | AC_SUBST(DIRS) |
229 | AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init) |
410c8acf |
230 | |
231 | dnl ----- That's all, folks ------------------------------------------------- |