chiark / gitweb /
Provide a pkg-config file for use by separately compiled services.
[tripe] / configure.in
index 6163a8d87fed39f15e96709ade8f83f57dbf5ff5..6beb3b190c30efda14c13d37ae6426a5168e3a6a 100644 (file)
@@ -1,7 +1,5 @@
 dnl -*-autoconf-*-
 dnl
-dnl $Id$
-dnl
 dnl Configuration script for TrIPE
 dnl
 dnl (c) 2001 Straylight/Edgeware
@@ -15,197 +13,262 @@ dnl TrIPE is free software; you can redistribute it and/or modify
 dnl it under the terms of the GNU General Public License as published by
 dnl the Free Software Foundation; either version 2 of the License, or
 dnl (at your option) any later version.
-dnl 
+dnl
 dnl TrIPE is distributed in the hope that it will be useful,
 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 dnl GNU General Public License for more details.
-dnl 
+dnl
 dnl You should have received a copy of the GNU General Public License
 dnl along with TrIPE; if not, write to the Free Software Foundation,
 dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-AC_INIT(tripe.c)
-AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
-AM_CONFIG_HEADER(config.h)
+AC_INIT(server/tripe.c)
+AM_INIT_AUTOMAKE(tripe, 1.0.0pre7)
+AM_CONFIG_HEADER(common/config.h)
 AC_CANONICAL_HOST
 
 AC_PROG_MAKE_SET
 AC_PROG_CC
 AM_PROG_LIBTOOL
+DIRS="" AC_SUBST([DIRS])
+
+AX_WITH_PYTHON([2.3], [missing])
+if test "$PYTHON" = "missing"; then
+  python=no
+else
+  python=yes
+   pyscripts='${PYTHONSCRIPTS}'
+   DIRS="$DIRS keys"
+   pymans='${PYTHONMANS}'
+fi
+AC_SUBST([pyscripts]) AC_SUBST([pymans])
+
+if test $python = yes; then
+  AC_CACHE_CHECK([for pygtk], [mdw_cv_pygtk], [
+    mdw_cv_pygtk=no
+    python -c >&5 2>&5 '
+import pygtk
+pygtk.require("2.0")
+import gtk
+' && mdw_cv_pygtk=yes
+  ])
+  if test $mdw_cv_pygtk = yes; then
+    pygtkscripts='${PYGTKSCRIPTS}'
+    DIRS="$DIRS mon"
+    pygtkmans='${PYGTKMANS}'
+  fi
+fi
+AC_SUBST([pygtkscripts]) AC_SUBST([pygtkmans])
+
+
+tun=auto
+AC_ARG_WITH([tunnel],
+[  --with-tunnel=KIND     kinds of tunnel device to use
+                           (linux, unet, bsd, slip)],
+[tun=$withval])
+
+if test "$tun" = auto; then
+  AC_CACHE_CHECK([tunnel drivers to use], [mdw_cv_tunnel], [
+    mdw_cv_tunnel=""
+    case $host_os in
+      linux*)
+       case `uname -r` in
+         [2.[4-9].*] | [2.[1-9][0-9]*.*] | [[3-9].*] | [[1-9][0-9]*.*])
+           mdw_cv_tunnel=linux
+           ;;
+         *)
+           mdw_cv_tunnel=unet
+           ;;
+       esac
+       ;;
+      *bsd*)
+       mdw_cv_tunnel=bsd
+       ;;
+    esac
+    mdw_cv_tunnel=$mdw_cv_tunnel${mdw_cv_tunnel:+ }slip
+  ])
+  tun=$mdw_cv_tunnel
+fi
+
+tunnels=""
+for i in $tun; do
+  case $i in
+    linux) AC_DEFINE([TUN_LINUX], [1],
+                    [Install the Linux TUN/TAP driver.]) ;;
+    bsd) AC_DEFINE([TUN_BSD], [1],
+                  [Install the BSD tunnel driver.]) ;;
+    unet) AC_DEFINE([TUN_UNET], [1],
+                   [Install the obsolete Linux Usernet driver.]) ;;
+    slip) ;;
+    *) AC_MSG_ERROR([Unknown tunnel type]) ;;
+  esac
+  tunnels="$tunnels&tun_$i, "
+done
+AC_SUBST(tun)
+AC_DEFINE_UNQUOTED([TUN_LIST], [$tunnels 0],
+  [List of tunnel drivers to install.])
+
+
+
+
+
 AC_CHECK_HEADERS([stdarg.h])
-mdw_GCC_FLAGS([-Wall])
-mdw_OPT_TRACE
+AX_CFLAGS_WARN_ALL
+
+AC_ARG_WITH([tracing],
+[  --without-tracing      compile out tracing support (not recommended)],
+[test "$withval" = no && AC_DEFINE([NTRACE], [1], [Disable all tracing.])],
+[:])
 
 AC_ARG_WITH([linux-includes],
 [  --with-linux-includes=DIR
-                          search for Linux kernel includes in DIR],
+                         search for Linux kernel includes in DIR],
 [CFLAGS="$CFLAGS -I$withval"],
 [:])
 
 AC_ARG_WITH([configdir],
-[  --with-configdir=DIR    look for keys and other configuration in DIR
-                          [default=/var/lib/tripe]],
+[  --with-configdir=DIR           look for keys and other configuration in DIR
+                         [default=/var/lib/tripe]],
 [configdir=$withval],
 [configdir=/var/lib/tripe])
 
 AC_ARG_WITH([socketdir],
-[  --with-socketdir=DIR    put admin socket in DIR [default=.]],
+[  --with-socketdir=DIR           put admin socket in DIR [default=.]],
 [socketdir=$withval],
 [socketdir=.])
 
 AC_ARG_WITH([pidfile],
-[  --with-pidfile=FILE     make tripectl write its pid to FILE
-                          [default=./tripectl.pid]],
+[  --with-pidfile=FILE    make tripectl write its pid to FILE
+                         [default=./tripectl.pid]],
 [pidfile=$withval],
 [pidfile=tripectl.pid])
 
 AC_ARG_WITH([initconfig],
 [  --with-initconfig=FILE  read definitions from FILE in init script
-                          [default=/etc/tripe.conf]],
+                         [default=/etc/tripe.conf]],
 [initconfig=$withval],
 [initconfig=/etc/tripe.conf])
 
 AC_ARG_WITH([logfile],
-[  --with-logfile=DIR       make tripectl write its log to FILE 
-                           [default=./tripe.log]],
+[  --with-logfile=DIR     make tripectl write its log to FILE
+                         [default=./tripe.log]],
 [logfile=$withval],
 [logfile=tripe.log])
 
-DIRS=""
-ETHEREAL_CFLAGS=""
-ETHEREAL_PLUGIN_DIR="unknown"
-AC_ARG_WITH([ethereal],
-[  --with-ethereal         build and install Ethereal plugin],
+WIRESHARK_CFLAGS=""
+WIRESHARK_PLUGIN_DIR="unknown"
+AC_ARG_WITH([wireshark],
+[  --with-wireshark       build and install Wireshark plugin],
 [case "$withval" in
-   no) ethereal=false requireethereal=false;;
-   yes) ethereal=true; requireethereal=true;;
-   *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
+   no) wireshark=false requirewireshark=false;;
+   yes) wireshark=true; requirewireshark=true;;
+   *) wireshark=true requirewireshark=true WIRESHARK_PLUGIN_DIR=$withval;;
 esac],
-[ethereal=true requireethereal=false])
-
-case $host_os in
-  linux*)
-    case `uname -r` in
-changequote(,)dnl
-      2.[4-9].* | 2.[1-9][0-9]*.* | [3-9].* | [1-9][0-9]*.*)
-changequote([,])dnl
-       tun=linux
-       AC_DEFINE([TUN_TYPE], [TUN_LINUX], 
-        [Set to the tunnel driver for your OS.  See TUN_* in tripe.h.])
-       ;;
-      *)
-       tun=unet
-       AC_DEFINE([TUN_TYPE], [TUN_UNET],
-        [Set to the tunnel driver for your OS.  See TUN_* in tripe.h.])
-       ;;
-    esac
-    ;;
-  *bsd*)
-    tun=bsd
-    AC_DEFINE([TUN_TYPE], [TUN_BSD],
-    [Set to the tunnel driver for your OS.  See TUN_* in tripe.h.])
-    ;;
-  *)
-    AC_MSG_ERROR([Unsupported OS: no tunnel interface available])
-    ;;
-esac
-AC_SUBST(tun)
+[wireshark=true requirewireshark=false])
 
-mdw_MLIB(2.0.0)
-mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
+PKG_CHECK_MODULES(mLib, mLib >= 2.0.4)
+PKG_CHECK_MODULES(catacomb, catacomb >= 2.1.1)
+CFLAGS="$CFLAGS $mLib_CFLAGS $catacomb_CFLAGS"
+LIBS="$LIBS $mLib_LIBS"
 
-if test "$ethereal" = true -a "$ETHEREAL_PLUGIN_DIR" = unknown; then
-  AC_CACHE_CHECK([where to put Ethereal plugins], 
-    [mdw_cv_ethereal_plugin_dir], [
-    changequote(,)
-    mdw_cv_ethereal_plugin_dir="failed"
-    ethprefix=none
+if test "$wireshark" = true -a "$WIRESHARK_PLUGIN_DIR" = unknown; then
+  AC_CACHE_CHECK([where to put Wireshark plugins],
+    [mdw_cv_wireshark_plugin_dir], [
+    mdw_cv_wireshark_plugin_dir="failed"
+    wsprefix=none
     for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
-      if test -x "$i/bin/tethereal"; then
-        ethprefix=$i
+      if test -x "$i/bin/tshark"; then
+        wsprefix=$i
         break
       fi
     done
-    if test "$ethprefix" != none; then
-      ethbin=$ethprefix/bin/tethereal
-      ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q'`
-      dir=$ethprefix/lib/ethereal/plugins/$ethver
+    if test "$wsprefix" != none; then
+      wsbin=$wsprefix/bin/tshark
+      wsver=`$wsbin -v | sed ['s/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/;q']`
+      dir=$wsprefix/lib/wireshark/plugins
+      test -d "$dir/$wsver" && dir="$dir/$wsver"
       if test -d "$dir"; then
-        mdw_cv_ethereal_plugin_dir=$dir
+       mdw_cv_wireshark_plugin_dir=$dir
       fi
     fi
-    changequote([, ])
   ])
-  case $mdw_cv_ethereal_plugin_dir in
-    failed) ethereal=false;;
-    *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
+  case $mdw_cv_wireshark_plugin_dir in
+    failed) wireshark=false;;
+    *) WIRESHARK_PLUGIN_DIR=$mdw_cv_wireshark_plugin_dir;;
   esac
 fi
 
-if test "$ethereal" = true; then
-  AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
+if test "$wireshark" = true; then
+  AM_PATH_GLIB([1.2.0], [], wireshark=false, [gmodule])
 fi
-if test "$ethereal" = true; then
+if test "$wireshark" = true; then
   bad=true
   mdw_CFLAGS=$CFLAGS
-  ethprefix=`echo $ETHEREAL_PLUGIN_DIR | sed 's:/lib/.*$::'`
-  AC_CACHE_CHECK([how to find the Ethereal headers], 
-    [mdw_cv_ethereal_includes], [
-    mdw_cv_ethereal_includes=failed
+  wsprefix=`echo $WIRESHARK_PLUGIN_DIR | sed 's:/lib/.*$::'`
+  AC_CACHE_CHECK([how to find the Wireshark headers],
+    [mdw_cv_wireshark_includes], [
+    mdw_cv_wireshark_includes=failed
     for i in \
        "" \
-       "-I${ethprefix}/include/ethereal" \
-       "-I${ethprefix}/include" \
-       "-I${prefix}/include/ethereal" \
+       "-I${wsprefix}/include/wireshark" \
+       "-I${wsprefix}/include" \
+       "-I${prefix}/include/wireshark" \
        "-I${prefix}/include" \
-       "-I/usr/include/ethereal" \
-       "-I/usr/local/include/ethereal" \
+       "-I/usr/include/wireshark" \
+       "-I/usr/local/include/wireshark" \
        "-I/usr/local/include"; do
       CFLAGS="$GLIB_CFLAGS $i"
       AC_TRY_COMPILE([
 #include <netinet/in.h>
 #include <glib.h>
-#include <ethereal/config.h>
-#include <ethereal/epan/packet.h>
+#include <wireshark/config.h>
+#include <wireshark/epan/packet.h>
 ], [
        dissector_handle_t dh;
        dh = create_dissector_handle(0, 0);
       ], [bad=false; break])
     done
     if test $bad = false; then
-      mdw_cv_ethereal_includes=$i
+      mdw_cv_wireshark_includes=$i
     fi
     CFLAGS=$mdw_CFLAGS
   ])
-  case $mdw_cv_ethereal_plugin_dir in
-    failed) ethereal=false;;
-    *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
-  esac  
+  case $mdw_cv_wireshark_includes in
+    failed) wireshark=false;;
+  esac
 fi
 
-if test "$ethereal" = true; then
-  ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
-  AC_SUBST(ETHEREAL_CFLAGS)
-  AC_SUBST(ETHEREAL_PLUGIN_DIR)
-  DIRS="$DIRS ethereal"
+if test "$wireshark" = true; then
+  WIRESHARK_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_wireshark_includes"
+  AC_SUBST(WIRESHARK_CFLAGS)
+  AC_SUBST(WIRESHARK_PLUGIN_DIR)
+  DIRS="$DIRS wireshark"
 fi
 
-if test "$ethereal" = false -a "$requireethereal" = true; then
-  AC_MSG_ERROR([failed to configure Ethereal plugin])
+if test "$wireshark" = false -a "$requirewireshark" = true; then
+  AC_MSG_ERROR([failed to configure Wireshark plugin])
 fi
 
 AH_TEMPLATE([CONFIGDIR],
-            [Tripe should look here for keys and other configuration.])
+           [Tripe should look here for keys and other configuration.])
 AH_TEMPLATE([SOCKETDIR],
-            [Tripe should make its administration socket here.])
+           [Tripe should make its administration socket here.])
 mdw_DEFINE_PATHS([
   mdw_DEFINE_PATH([CONFIGDIR], [$configdir])
   mdw_DEFINE_PATH([SOCKETDIR], [$socketdir])
   AC_SUBST(socketdir) AC_SUBST(configdir) AC_SUBST(logfile) AC_SUBST(pidfile)
   AC_SUBST(initconfig)
 ])
-AC_SUBST(DIRS)
-AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
+AC_OUTPUT( \
+       Makefile tripe.pc \
+       common/Makefile client/Makefile server/Makefile \
+       proxy/Makefile pkstream/Makefile \
+       doc/Makefile \
+         doc/tripe.8 doc/tripectl.1 doc/tripemon.1 \
+       wireshark/Makefile \
+       init/Makefile init/tripe-init \
+       keys/Makefile keys/tripe-keys \
+       mon/Makefile mon/tripemon)
 
 dnl ----- That's all, folks -------------------------------------------------