Debianization.
[tripe] / configure.in
1 dnl -*-autoconf-*-
2 dnl
3 dnl $Id: configure.in,v 1.14 2003/11/29 23:49:32 mdw Exp $
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
28 dnl ----- Revision history --------------------------------------------------
29 dnl
30 dnl $Log: configure.in,v $
31 dnl Revision 1.14 2003/11/29 23:49:32 mdw
32 dnl Debianization.
33 dnl
34 dnl Revision 1.13 2003/10/15 09:30:18 mdw
35 dnl Add support for Ethereal protocol analysis.
36 dnl
37 dnl Revision 1.12 2003/07/13 11:54:40 mdw
38 dnl Version bump.
39 dnl
40 dnl Revision 1.11 2003/05/17 11:04:38 mdw
41 dnl Ship new configuration and startup kit.
42 dnl
43 dnl Revision 1.9 2003/04/06 10:33:31 mdw
44 dnl And again. (Sigh.)
45 dnl
46 dnl Revision 1.8 2003/04/06 10:31:13 mdw
47 dnl Fix stupid bug.
48 dnl
49 dnl Revision 1.7 2003/04/06 10:25:17 mdw
50 dnl Support Linux TUN/TAP device. Fix some bugs.
51 dnl
52 dnl Revision 1.6 2001/06/19 22:13:57 mdw
53 dnl Version bump.
54 dnl
55 dnl Revision 1.5 2001/03/03 12:30:39 mdw
56 dnl Make this a pre-release.
57 dnl
58 dnl Revision 1.4 2001/02/22 09:07:28 mdw
59 dnl Build documents now.
60 dnl
61 dnl Revision 1.3 2001/02/16 21:24:12 mdw
62 dnl Don't link the client against Catacomb.
63 dnl
64 dnl Revision 1.2 2001/02/04 01:17:54 mdw
65 dnl Create a configuration header file to tidy up command lines.
66 dnl
67 dnl Revision 1.1 2001/02/03 20:26:37 mdw
68 dnl Initial checkin.
69 dnl
70
71 AC_INIT(tripe.c)
72 AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
73 AM_CONFIG_HEADER(config.h)
74 AC_CANONICAL_HOST
75
76 AC_PROG_MAKE_SET
77 AC_PROG_CC
78 AM_PROG_LIBTOOL
79 mdw_GCC_FLAGS([-Wall])
80 mdw_OPT_TRACE
81
82 AC_ARG_WITH([linux-includes],
83 [ --with-linux-includes=DIR
84 search for Linux kernel includes in DIR],
85 [CFLAGS="$CFLAGS -I$withval"],
86 [:])
87
88 AC_ARG_WITH([configdir],
89 [ --with-configdir=DIR look for keys and other configuration in DIR
90 [default=/var/lib/tripe]],
91 [configdir=$withval],
92 [configdir=/var/lib/tripe])
93
94 AC_ARG_WITH([socketdir],
95 [ --with-socketdir=DIR put admin socket in DIR [default=.]],
96 [socketdir=$withval],
97 [socketdir=.])
98
99 AC_ARG_WITH([pidfile],
100 [ --with-pidfile=FILE make tripectl write its pid to FILE
101 [default=./tripectl.pid]],
102 [pidfile=$withval],
103 [pidfile=tripectl.pid])
104
105 AC_ARG_WITH([initconfig],
106 [ --with-initconfig=FILE read definitions from FILE in init script
107 [default=/etc/tripe.conf]],
108 [initconfig=$withval],
109 [initconfig=/etc/tripe.conf])
110
111 AC_ARG_WITH([logfile],
112 [ --with-logfile=DIR make tripectl write its log to FILE
113 [default=./tripe.log]],
114 [logfile=$withval],
115 [logfile=tripe.log])
116
117 DIRS=""
118 ETHEREAL_CFLAGS=""
119 ETHEREAL_PLUGIN_DIR="unknown"
120 AC_ARG_WITH([ethereal],
121 [ --with-ethereal build and install Ethereal plugin],
122 [case "$withval" in
123 no) ethereal=false requireethereal=false;;
124 yes) ethereal=true; requireethereal=true;;
125 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
126 esac],
127 [ethereal=true requireethereal=false])
128
129 case $host_os in
130 linux*)
131 case `uname -r` in
132 changequote(,)dnl
133 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
134 changequote([,])dnl
135 tun=linux
136 AC_DEFINE([TUN_TYPE], [TUN_LINUX])
137 ;;
138 *)
139 tun=unet
140 AC_DEFINE([TUN_TYPE], [TUN_UNET])
141 ;;
142 esac
143 ;;
144 *bsd*)
145 tun=bsd
146 AC_DEFINE([TUN_TYPE], [TUN_BSD])
147 ;;
148 *)
149 AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
150 ;;
151 esac
152 AC_SUBST(tun)
153
154 mdw_MLIB(2.0.0)
155 mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
156
157 if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
158 AC_CACHE_CHECK([where to put Ethereal plugins],
159 [mdw_cv_ethereal_plugin_dir], [
160 changequote(,)
161 mdw_cv_ethereal_plugin_dir="failed"
162 ethprefix=none
163 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
164 if test -x "$i/bin/ethereal"; then
165 ethprefix=$i
166 break
167 fi
168 done
169 if test "$ethprefix" != none; then
170 ethbin=$ethprefix/bin/ethereal
171 ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/'`
172 dir=$ethprefix/lib/ethereal/plugins/$ethver
173 if test -d "$dir"; then
174 mdw_cv_ethereal_plugin_dir=$dir
175 fi
176 fi
177 changequote([, ])
178 ])
179 case $mdw_cv_ethereal_plugin_dir in
180 failed) ethereal=false;;
181 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
182 esac
183 fi
184
185 if test "$ethereal" = true; then
186 AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
187 fi
188 if test "$ethereal" = true; then
189 bad=true
190 mdw_CFLAGS=$CFLAGS
191 ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
192 AC_CACHE_CHECK([how to find the Ethereal headers],
193 [mdw_cv_ethereal_includes], [
194 mdw_cv_ethereal_includes=failed
195 for i in \
196 "" \
197 "-I${ethprefix}/include/ethereal" \
198 "-I${ethprefix}/include" \
199 "-I${prefix}/include/ethereal" \
200 "-I${prefix}/include" \
201 "-I/usr/include/ethereal" \
202 "-I/usr/local/include/ethereal" \
203 "-I/usr/local/include"; do
204 CFLAGS="$GLIB_CFLAGS $i"
205 AC_TRY_COMPILE([
206 #include <netinet/in.h>
207 #include <glib.h>
208 #include <epan/packet.h>
209 ], [
210 dissector_handle_t dh;
211 dh = creat_dissector_handle(0, 0);
212 ], [bad=false; break])
213 done
214 if test $bad = false; then
215 mdw_cv_ethereal_includes=$i
216 fi
217 CFLAGS=$mdw_CFLAGS
218 ])
219 case $mdw_cv_ethereal_plugin_dir in
220 failed) ethereal=false;;
221 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
222 esac
223 fi
224
225 if test "$ethereal" = true; then
226 AC_CACHE_CHECK([whether the Ethereal headers are broken],
227 [mdw_cv_ethereal_buggered], [
228 CFLAGS="$GLIB_CFLAGS $i"
229 AC_TRY_COMPILE([
230 #include <netinet/in.h>
231 #include <glib.h>
232 #include <epan/packet.h>
233 #include <plugins/plugin_api.h>
234 ], [
235 G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)
236 {
237 plugin_address_table_init(pat);
238 }
239 ], [mdw_cv_ethereal_buggered=no], [mdw_cv_ethereal_buggered=yes])
240 CFLAGS=$mdw_CFLAGS
241 ])
242 if test $mdw_cv_ethereal_buggered = yes; then
243 AC_DEFINE(ETHEREAL_BUGGERED)
244 fi
245
246 ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
247 AC_SUBST(ETHEREAL_CFLAGS)
248 AC_SUBST(ETHEREAL_PLUGIN_DIR)
249 DIRS="$DIRS ethereal"
250 fi
251
252 if test "$ethereal" = false -a "$requireethereal" = true; then
253 AC_MSG_ERROR([failed to configure Ethereal plugin])
254 fi
255
256 mdw_DEFINE_PATHS([
257 mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
258 mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
259 AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
260 AC_SUBST(initconfig)
261 ])
262 AC_SUBST(DIRS)
263 AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
264
265 dnl ----- That's all, folks -------------------------------------------------