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