| 1 | dnl -*-autoconf-*- |
| 2 | dnl |
| 3 | dnl Configuration script for TrIPE |
| 4 | dnl |
| 5 | dnl (c) 2001 Straylight/Edgeware |
| 6 | dnl |
| 7 | |
| 8 | dnl ----- Licensing notice -------------------------------------------------- |
| 9 | dnl |
| 10 | dnl This file is part of Trivial IP Encryption (TrIPE). |
| 11 | dnl |
| 12 | dnl TrIPE is free software; you can redistribute it and/or modify |
| 13 | dnl it under the terms of the GNU General Public License as published by |
| 14 | dnl the Free Software Foundation; either version 2 of the License, or |
| 15 | dnl (at your option) any later version. |
| 16 | dnl |
| 17 | dnl TrIPE is distributed in the hope that it will be useful, |
| 18 | dnl but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | dnl GNU General Public License for more details. |
| 21 | dnl |
| 22 | dnl You should have received a copy of the GNU General Public License |
| 23 | dnl along with TrIPE; if not, write to the Free Software Foundation, |
| 24 | dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 25 | |
| 26 | AC_INIT(server/tripe.c) |
| 27 | AM_INIT_AUTOMAKE(tripe, 1.0.0pre7) |
| 28 | AM_CONFIG_HEADER(common/config.h) |
| 29 | AC_CANONICAL_HOST |
| 30 | |
| 31 | AC_PROG_MAKE_SET |
| 32 | AC_PROG_CC |
| 33 | AM_PROG_LIBTOOL |
| 34 | DIRS="" AC_SUBST([DIRS]) |
| 35 | |
| 36 | AX_WITH_PYTHON([2.3], [missing]) |
| 37 | if test "$PYTHON" = "missing"; then |
| 38 | python=no |
| 39 | else |
| 40 | python=yes |
| 41 | pyscripts='${PYTHONSCRIPTS}' |
| 42 | DIRS="$DIRS keys" |
| 43 | pymans='${PYTHONMANS}' |
| 44 | fi |
| 45 | AC_SUBST([pyscripts]) AC_SUBST([pymans]) |
| 46 | |
| 47 | if test $python = yes; then |
| 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 | |
| 65 | tun=auto |
| 66 | AC_ARG_WITH([tunnel], |
| 67 | [ --with-tunnel=KIND kinds of tunnel device to use |
| 68 | (linux, unet, bsd, slip)], |
| 69 | [tun=$withval]) |
| 70 | |
| 71 | if test "$tun" = auto; then |
| 72 | AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [ |
| 73 | mdw_cv_tunnel="" |
| 74 | case $host_os in |
| 75 | linux*) |
| 76 | case `uname -r` in |
| 77 | [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*]) |
| 78 | mdw_cv_tunnel=linux |
| 79 | ;; |
| 80 | *) |
| 81 | mdw_cv_tunnel=unet |
| 82 | ;; |
| 83 | esac |
| 84 | ;; |
| 85 | *bsd*) |
| 86 | mdw_cv_tunnel=bsd |
| 87 | ;; |
| 88 | esac |
| 89 | mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip |
| 90 | ]) |
| 91 | tun=$mdw_cv_tunnel |
| 92 | fi |
| 93 | |
| 94 | tunnels="" |
| 95 | for i in $tun; do |
| 96 | case $i in |
| 97 | linux) AC_DEFINE([TUN_LINUX], [1], |
| 98 | [Install the Linux TUN/TAP driver.]) ;; |
| 99 | bsd) AC_DEFINE([TUN_BSD], [1], |
| 100 | [Install the BSD tunnel driver.]) ;; |
| 101 | unet) AC_DEFINE([TUN_UNET], [1], |
| 102 | [Install the obsolete Linux Usernet driver.]) ;; |
| 103 | slip) ;; |
| 104 | *) AC_MSG_ERROR([Unknown tunnel type]) ;; |
| 105 | esac |
| 106 | tunnels="$tunnels&tun_$i, " |
| 107 | done |
| 108 | AC_SUBST(tun) |
| 109 | AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0], |
| 110 | [List of tunnel drivers to install.]) |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | AC_CHECK_HEADERS([stdarg.h]) |
| 117 | AX_CFLAGS_WARN_ALL |
| 118 | |
| 119 | AC_ARG_WITH([tracing], |
| 120 | [ --without-tracing compile out tracing support (not recommended)], |
| 121 | [test "$withval" = no && AC_DEFINE([NTRACE], [1], [Disable all tracing.])], |
| 122 | [:]) |
| 123 | |
| 124 | AC_ARG_WITH([linux-includes], |
| 125 | [ --with-linux-includes=DIR |
| 126 | search for Linux kernel includes in DIR], |
| 127 | [CFLAGS="$CFLAGS -I$withval"], |
| 128 | [:]) |
| 129 | |
| 130 | AC_ARG_WITH([configdir], |
| 131 | [ --with-configdir=DIR look for keys and other configuration in DIR |
| 132 | [default=/var/lib/tripe]], |
| 133 | [configdir=$withval], |
| 134 | [configdir=/var/lib/tripe]) |
| 135 | |
| 136 | AC_ARG_WITH([socketdir], |
| 137 | [ --with-socketdir=DIR put admin socket in DIR [default=.]], |
| 138 | [socketdir=$withval], |
| 139 | [socketdir=.]) |
| 140 | |
| 141 | AC_ARG_WITH([pidfile], |
| 142 | [ --with-pidfile=FILE make tripectl write its pid to FILE |
| 143 | [default=./tripectl.pid]], |
| 144 | [pidfile=$withval], |
| 145 | [pidfile=tripectl.pid]) |
| 146 | |
| 147 | AC_ARG_WITH([initconfig], |
| 148 | [ --with-initconfig=FILE read definitions from FILE in init script |
| 149 | [default=/etc/tripe.conf]], |
| 150 | [initconfig=$withval], |
| 151 | [initconfig=/etc/tripe.conf]) |
| 152 | |
| 153 | AC_ARG_WITH([logfile], |
| 154 | [ --with-logfile=DIR make tripectl write its log to FILE |
| 155 | [default=./tripe.log]], |
| 156 | [logfile=$withval], |
| 157 | [logfile=tripe.log]) |
| 158 | |
| 159 | WIRESHARK_CFLAGS="" |
| 160 | WIRESHARK_PLUGIN_DIR="unknown" |
| 161 | AC_ARG_WITH([wireshark], |
| 162 | [ --with-wireshark build and install Wireshark plugin], |
| 163 | [case "$withval" in |
| 164 | no) wireshark=false requirewireshark=false;; |
| 165 | yes) wireshark=true; requirewireshark=true;; |
| 166 | *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;; |
| 167 | esac], |
| 168 | [wireshark=true requirewireshark=false]) |
| 169 | |
| 170 | PKG_CHECK_MODULES(mLib, mLib >= 2.0.4) |
| 171 | PKG_CHECK_MODULES(catacomb, catacomb >= 2.1.1) |
| 172 | CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS" |
| 173 | LIBS="$LIBS $mLib_LIBS" |
| 174 | |
| 175 | if test "$wireshark" = true -a "$WIRESHARK_PLUGIN_DIR" = unknown; then |
| 176 | AC_CACHE_CHECK([where to put Wireshark plugins], |
| 177 | [mdw_cv_wireshark_plugin_dir], [ |
| 178 | mdw_cv_wireshark_plugin_dir="failed" |
| 179 | wsprefix=none |
| 180 | for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do |
| 181 | if test -x "$i/bin/tshark"; then |
| 182 | wsprefix=$i |
| 183 | break |
| 184 | fi |
| 185 | done |
| 186 | if test "$wsprefix" != none; then |
| 187 | wsbin=$wsprefix/bin/tshark |
| 188 | wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']` |
| 189 | dir=$wsprefix/lib/wireshark/plugins |
| 190 | test -d "$dir/$wsver" && dir="$dir/$wsver" |
| 191 | if test -d "$dir"; then |
| 192 | mdw_cv_wireshark_plugin_dir=$dir |
| 193 | fi |
| 194 | fi |
| 195 | ]) |
| 196 | case $mdw_cv_wireshark_plugin_dir in |
| 197 | failed) wireshark=false;; |
| 198 | *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;; |
| 199 | esac |
| 200 | fi |
| 201 | |
| 202 | if test "$wireshark" = true; then |
| 203 | AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule]) |
| 204 | fi |
| 205 | if test "$wireshark" = true; then |
| 206 | bad=true |
| 207 | mdw_CFLAGS=$CFLAGS |
| 208 | wsprefix=`echo $WIRESHARK_PLUGIN_DIR | sed 's:/lib/.*$::'` |
| 209 | AC_CACHE_CHECK([how to find the Wireshark headers], |
| 210 | [mdw_cv_wireshark_includes], [ |
| 211 | mdw_cv_wireshark_includes=failed |
| 212 | for i in \ |
| 213 | "" \ |
| 214 | "-I${wsprefix}/include/wireshark" \ |
| 215 | "-I${wsprefix}/include" \ |
| 216 | "-I${prefix}/include/wireshark" \ |
| 217 | "-I${prefix}/include" \ |
| 218 | "-I/usr/include/wireshark" \ |
| 219 | "-I/usr/local/include/wireshark" \ |
| 220 | "-I/usr/local/include"; do |
| 221 | CFLAGS="$GLIB_CFLAGS $i" |
| 222 | AC_TRY_COMPILE([ |
| 223 | #include <netinet/in.h> |
| 224 | #include <glib.h> |
| 225 | #include <wireshark/config.h> |
| 226 | #include <wireshark/epan/packet.h> |
| 227 | ], [ |
| 228 | dissector_handle_t dh; |
| 229 | dh = create_dissector_handle(0, 0); |
| 230 | ], [bad=false; break]) |
| 231 | done |
| 232 | if test $bad = false; then |
| 233 | mdw_cv_wireshark_includes=$i |
| 234 | fi |
| 235 | CFLAGS=$mdw_CFLAGS |
| 236 | ]) |
| 237 | case $mdw_cv_wireshark_includes in |
| 238 | failed) wireshark=false;; |
| 239 | esac |
| 240 | fi |
| 241 | |
| 242 | if test "$wireshark" = true; then |
| 243 | WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes" |
| 244 | AC_SUBST(WIRESHARK_CFLAGS) |
| 245 | AC_SUBST(WIRESHARK_PLUGIN_DIR) |
| 246 | DIRS="$DIRS wireshark" |
| 247 | fi |
| 248 | |
| 249 | if test "$wireshark" = false -a "$requirewireshark" = true; then |
| 250 | AC_MSG_ERROR([failed to configure Wireshark plugin]) |
| 251 | fi |
| 252 | |
| 253 | AH_TEMPLATE([CONFIGDIR], |
| 254 | [Tripe should look here for keys and other configuration.]) |
| 255 | AH_TEMPLATE([SOCKETDIR], |
| 256 | [Tripe should make its administration socket here.]) |
| 257 | mdw_DEFINE_PATHS([ |
| 258 | mdw_DEFINE_PATH([CONFIGDIR], [$configdir]) |
| 259 | mdw_DEFINE_PATH([SOCKETDIR], [$socketdir]) |
| 260 | AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile) |
| 261 | AC_SUBST(initconfig) |
| 262 | ]) |
| 263 | AC_OUTPUT( \ |
| 264 | Makefile \ |
| 265 | common/Makefile client/Makefile server/Makefile \ |
| 266 | proxy/Makefile pkstream/Makefile \ |
| 267 | doc/Makefile \ |
| 268 | doc/tripe.8 doc/tripectl.1 doc/tripemon.1 \ |
| 269 | wireshark/Makefile \ |
| 270 | init/Makefile init/tripe-init \ |
| 271 | keys/Makefile keys/tripe-keys \ |
| 272 | mon/Makefile mon/tripemon) |
| 273 | |
| 274 | dnl ----- That's all, folks ------------------------------------------------- |