chiark / gitweb /
Infrastructure: Get it building again, using pkg-config.
[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(server/tripe.c)
29 AM_INIT_AUTOMAKE(tripe, 1.0.0pre7)
30 AM_CONFIG_HEADER(common/config.h)
31 AC_CANONICAL_HOST
32
33 AC_PROG_MAKE_SET
34 AC_PROG_CC
35 AM_PROG_LIBTOOL
36 DIRS="" AC_SUBST([DIRS])
37
38 AX_WITH_PYTHON([2.3], [missing])
39 if test "$PYTHON" = "missing"; then
40   python=no
41 else
42   python=yes
43    pyscripts='${PYTHONSCRIPTS}'
44    DIRS="$DIRS keys"
45    pymans='${PYTHONMANS}'
46 fi
47 AC_SUBST([pyscripts]) AC_SUBST([pymans])
48
49 if test $python = yes; then
50   AC_CACHE_CHECK([for pygtk], [mdw_cv_pygtk], [
51     mdw_cv_pygtk=no
52     python -c >&5 2>&5 '
53 import pygtk
54 pygtk.require("2.0")
55 import gtk
56 ' && mdw_cv_pygtk=yes
57   ])
58   if test $mdw_cv_pygtk = yes; then
59     pygtkscripts='${PYGTKSCRIPTS}'
60     DIRS="$DIRS mon"
61     pygtkmans='${PYGTKMANS}'
62   fi
63 fi
64 AC_SUBST([pygtkscripts]) AC_SUBST([pygtkmans])
65
66
67 tun=auto
68 AC_ARG_WITH([tunnel],
69 [  --with-tunnel=KIND      kinds of tunnel device to use
70                             (linux, unet, bsd, slip)],
71 [tun=$withval])
72
73 if test "$tun" = auto; then
74   AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
75     mdw_cv_tunnel=""
76     case $host_os in
77       linux*)
78         case `uname -r` in
79           [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
80             mdw_cv_tunnel=linux
81             ;;
82           *)
83             mdw_cv_tunnel=unet
84             ;;
85         esac
86         ;;
87       *bsd*)
88         mdw_cv_tunnel=bsd
89         ;;
90     esac
91     mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
92   ])
93   tun=$mdw_cv_tunnel
94 fi
95
96 tunnels=""
97 for i in $tun; do
98   case $i in
99     linux) AC_DEFINE([TUN_LINUX], [1],
100                      [Install the Linux TUN/TAP driver.]) ;;
101     bsd) AC_DEFINE([TUN_BSD], [1],
102                    [Install the BSD tunnel driver.]) ;;
103     unet) AC_DEFINE([TUN_UNET], [1],
104                     [Install the obsolete Linux Usernet driver.]) ;;
105     slip) ;;
106     *) AC_MSG_ERROR([Unknown tunnel type]) ;;
107   esac
108   tunnels="$tunnels&tun_$i, "
109 done
110 AC_SUBST(tun)
111 AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
112   [List of tunnel drivers to install.])
113
114
115
116
117
118 AC_CHECK_HEADERS([stdarg.h])
119 AX_CFLAGS_WARN_ALL
120
121 AC_ARG_WITH([tracing],
122 [  --without-tracing      compile out tracing support (not recommended)],
123 [test "$withval" = no && AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
124 [:])
125
126 AC_ARG_WITH([linux-includes],
127 [  --with-linux-includes=DIR
128                           search for Linux kernel includes in DIR],
129 [CFLAGS="$CFLAGS -I$withval"],
130 [:])
131
132 AC_ARG_WITH([configdir],
133 [  --with-configdir=DIR    look for keys and other configuration in DIR
134                           [default=/var/lib/tripe]],
135 [configdir=$withval],
136 [configdir=/var/lib/tripe])
137
138 AC_ARG_WITH([socketdir],
139 [  --with-socketdir=DIR    put admin socket in DIR [default=.]],
140 [socketdir=$withval],
141 [socketdir=.])
142
143 AC_ARG_WITH([pidfile],
144 [  --with-pidfile=FILE     make tripectl write its pid to FILE
145                           [default=./tripectl.pid]],
146 [pidfile=$withval],
147 [pidfile=tripectl.pid])
148
149 AC_ARG_WITH([initconfig],
150 [  --with-initconfig=FILE  read definitions from FILE in init script
151                           [default=/etc/tripe.conf]],
152 [initconfig=$withval],
153 [initconfig=/etc/tripe.conf])
154
155 AC_ARG_WITH([logfile],
156 [  --with-logfile=DIR      make tripectl write its log to FILE
157                           [default=./tripe.log]],
158 [logfile=$withval],
159 [logfile=tripe.log])
160
161 WIRESHARK_CFLAGS=""
162 WIRESHARK_PLUGIN_DIR="unknown"
163 AC_ARG_WITH([wireshark],
164 [  --with-wireshark        build and install Wireshark plugin],
165 [case "$withval" in
166    no) wireshark=false requirewireshark=false;;
167    yes) wireshark=true; requirewireshark=true;;
168    *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;;
169 esac],
170 [wireshark=true requirewireshark=false])
171
172 PKG_CHECK_MODULES(mLib, mLib >= 2.0.4)
173 PKG_CHECK_MODULES(catacomb, catacomb >= 2.1.1)
174 CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
175 LIBS="$LIBS $mLib_LIBS"
176
177 if test "$wireshark" = true -a "$WIRESHARK_PLUGIN_DIR" = unknown; then
178   AC_CACHE_CHECK([where to put Wireshark plugins],
179     [mdw_cv_wireshark_plugin_dir], [
180     mdw_cv_wireshark_plugin_dir="failed"
181     wsprefix=none
182     for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
183       if test -x "$i/bin/tshark"; then
184          wsprefix=$i
185          break
186       fi
187     done
188     if test "$wsprefix" != none; then
189       wsbin=$wsprefix/bin/tshark
190       wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
191       dir=$wsprefix/lib/wireshark/plugins
192       test -d "$dir/$wsver" && dir="$dir/$wsver"
193       if test -d "$dir"; then
194         mdw_cv_wireshark_plugin_dir=$dir
195       fi
196     fi
197   ])
198   case $mdw_cv_wireshark_plugin_dir in
199     failed) wireshark=false;;
200     *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;;
201   esac
202 fi
203
204 if test "$wireshark" = true; then
205   AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule])
206 fi
207 if test "$wireshark" = true; then
208   bad=true
209   mdw_CFLAGS=$CFLAGS
210   wsprefix=`echo $WIRESHARK_PLUGIN_DIR | sed 's:/lib/.*$::'`
211   AC_CACHE_CHECK([how to find the Wireshark headers],
212     [mdw_cv_wireshark_includes], [
213     mdw_cv_wireshark_includes=failed
214     for i in \
215         "" \
216         "-I${wsprefix}/include/wireshark" \
217         "-I${wsprefix}/include" \
218         "-I${prefix}/include/wireshark" \
219         "-I${prefix}/include" \
220         "-I/usr/include/wireshark" \
221         "-I/usr/local/include/wireshark" \
222         "-I/usr/local/include"; do
223       CFLAGS="$GLIB_CFLAGS $i"
224       AC_TRY_COMPILE([
225 #include <netinet/in.h>
226 #include <glib.h>
227 #include <wireshark/config.h>
228 #include <wireshark/epan/packet.h>
229 ], [
230         dissector_handle_t dh;
231         dh = create_dissector_handle(0, 0);
232       ], [bad=false; break])
233     done
234     if test $bad = false; then
235       mdw_cv_wireshark_includes=$i
236     fi
237     CFLAGS=$mdw_CFLAGS
238   ])
239   case $mdw_cv_wireshark_includes in
240     failed) wireshark=false;;
241   esac
242 fi
243
244 if test "$wireshark" = true; then
245   WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
246   AC_SUBST(WIRESHARK_CFLAGS)
247   AC_SUBST(WIRESHARK_PLUGIN_DIR)
248   DIRS="$DIRS wireshark"
249 fi
250
251 if test "$wireshark" = false -a "$requirewireshark" = true; then
252   AC_MSG_ERROR([failed to configure Wireshark plugin])
253 fi
254
255 AH_TEMPLATE([CONFIGDIR],
256             [Tripe should look here for keys and other configuration.])
257 AH_TEMPLATE([SOCKETDIR],
258             [Tripe should make its administration socket here.])
259 mdw_DEFINE_PATHS([
260   mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
261   mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
262   AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
263   AC_SUBST(initconfig)
264 ])
265 AC_OUTPUT( \
266         Makefile \
267         common/Makefile client/Makefile server/Makefile \
268         proxy/Makefile pkstream/Makefile \
269         doc/Makefile \
270           doc/tripe.8 doc/tripectl.1 doc/tripemon.1 \
271         wireshark/Makefile \
272         init/Makefile init/tripe-init \
273         keys/Makefile keys/tripe-keys \
274         mon/Makefile mon/tripemon)
275
276 dnl ----- That's all, folks -------------------------------------------------