Allow admin clients to filter out async messages. Send notifications
[tripe] / configure.in
1 dnl -*-autoconf-*-
2 dnl
3 dnl $Id$
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 AC_INIT(tripe.c)
29 AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
30 AM_CONFIG_HEADER(config.h)
31 AC_CANONICAL_HOST
32
33 AC_PROG_MAKE_SET
34 AC_PROG_CC
35 AM_PROG_LIBTOOL
36 AC_CHECK_HEADERS([stdarg.h])
37 mdw_GCC_FLAGS([-Wall])
38 mdw_OPT_TRACE
39
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
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
75 DIRS=""
76 ETHEREAL_CFLAGS=""
77 ETHEREAL_PLUGIN_DIR="unknown"
78 AC_ARG_WITH([ethereal],
79 [ --with-ethereal build and install Ethereal plugin],
80 [case "$withval" in
81 no) ethereal=false requireethereal=false;;
82 yes) ethereal=true; requireethereal=true;;
83 *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
84 esac],
85 [ethereal=true requireethereal=false])
86
87 case $host_os in
88 linux*)
89 case `uname -r` in
90 changequote(,)dnl
91 2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
92 changequote([,])dnl
93 tun=linux
94 AC_DEFINE([TUN_TYPE], [TUN_LINUX],
95 [Set to the tunnel driver for your OS. See TUN_* in tripe.h.])
96 ;;
97 *)
98 tun=unet
99 AC_DEFINE([TUN_TYPE], [TUN_UNET],
100 [Set to the tunnel driver for your OS. See TUN_* in tripe.h.])
101 ;;
102 esac
103 ;;
104 *bsd*)
105 tun=bsd
106 AC_DEFINE([TUN_TYPE], [TUN_BSD],
107 [Set to the tunnel driver for your OS. See TUN_* in tripe.h.])
108 ;;
109 *)
110 AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
111 ;;
112 esac
113 AC_SUBST(tun)
114
115 mdw_MLIB(2.0.0)
116 mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
117
118 if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
119 AC_CACHE_CHECK([where to put Ethereal plugins],
120 [mdw_cv_ethereal_plugin_dir], [
121 changequote(,)
122 mdw_cv_ethereal_plugin_dir="failed"
123 ethprefix=none
124 for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
125 if test -x "$i/bin/tethereal"; then
126 ethprefix=$i
127 break
128 fi
129 done
130 if test "$ethprefix" != none; then
131 ethbin=$ethprefix/bin/tethereal
132 ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q'`
133 dir=$ethprefix/lib/ethereal/plugins/$ethver
134 if test -d "$dir"; then
135 mdw_cv_ethereal_plugin_dir=$dir
136 fi
137 fi
138 changequote([, ])
139 ])
140 case $mdw_cv_ethereal_plugin_dir in
141 failed) ethereal=false;;
142 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
143 esac
144 fi
145
146 if test "$ethereal" = true; then
147 AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
148 fi
149 if test "$ethereal" = true; then
150 bad=true
151 mdw_CFLAGS=$CFLAGS
152 ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
153 AC_CACHE_CHECK([how to find the Ethereal headers],
154 [mdw_cv_ethereal_includes], [
155 mdw_cv_ethereal_includes=failed
156 for i in \
157 "" \
158 "-I${ethprefix}/include/ethereal" \
159 "-I${ethprefix}/include" \
160 "-I${prefix}/include/ethereal" \
161 "-I${prefix}/include" \
162 "-I/usr/include/ethereal" \
163 "-I/usr/local/include/ethereal" \
164 "-I/usr/local/include"; do
165 CFLAGS="$GLIB_CFLAGS $i"
166 AC_TRY_COMPILE([
167 #include <netinet/in.h>
168 #include <glib.h>
169 #include <ethereal/config.h>
170 #include <ethereal/epan/packet.h>
171 ], [
172 dissector_handle_t dh;
173 dh = create_dissector_handle(0, 0);
174 ], [bad=false; break])
175 done
176 if test $bad = false; then
177 mdw_cv_ethereal_includes=$i
178 fi
179 CFLAGS=$mdw_CFLAGS
180 ])
181 case $mdw_cv_ethereal_plugin_dir in
182 failed) ethereal=false;;
183 *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
184 esac
185 fi
186
187 if test "$ethereal" = true; then
188 ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
189 AC_SUBST(ETHEREAL_CFLAGS)
190 AC_SUBST(ETHEREAL_PLUGIN_DIR)
191 DIRS="$DIRS ethereal"
192 fi
193
194 if test "$ethereal" = false -a "$requireethereal" = true; then
195 AC_MSG_ERROR([failed to configure Ethereal plugin])
196 fi
197
198 AH_TEMPLATE([CONFIGDIR],
199 [Tripe should look here for keys and other configuration.])
200 AH_TEMPLATE([SOCKETDIR],
201 [Tripe should make its administration socket here.])
202 mdw_DEFINE_PATHS([
203 mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
204 mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
205 AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
206 AC_SUBST(initconfig)
207 ])
208 AC_SUBST(DIRS)
209 AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
210
211 dnl ----- That's all, folks -------------------------------------------------