chiark / gitweb /
Debianization.
[tripe] / configure.in
index b2049dcde2b0885de9a1df04923b07af99232fad..38fb539c8ed8e3f7e439085941e63bbbd90ab897 100644 (file)
@@ -1,6 +1,6 @@
 dnl -*-autoconf-*-
 dnl
 dnl -*-autoconf-*-
 dnl
-dnl $Id: configure.in,v 1.13 2003/10/15 09:30:18 mdw Exp $
+dnl $Id: configure.in,v 1.14 2003/11/29 23:49:32 mdw Exp $
 dnl
 dnl Configuration script for TrIPE
 dnl
 dnl
 dnl Configuration script for TrIPE
 dnl
@@ -28,6 +28,9 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 dnl ----- Revision history --------------------------------------------------
 dnl
 dnl $Log: configure.in,v $
 dnl ----- Revision history --------------------------------------------------
 dnl
 dnl $Log: configure.in,v $
+dnl Revision 1.14  2003/11/29 23:49:32  mdw
+dnl Debianization.
+dnl
 dnl Revision 1.13  2003/10/15 09:30:18  mdw
 dnl Add support for Ethereal protocol analysis.
 dnl
 dnl Revision 1.13  2003/10/15 09:30:18  mdw
 dnl Add support for Ethereal protocol analysis.
 dnl
@@ -66,7 +69,7 @@ dnl Initial checkin.
 dnl
 
 AC_INIT(tripe.c)
 dnl
 
 AC_INIT(tripe.c)
-AM_INIT_AUTOMAKE(tripe, 1.0.0pre5)
+AM_INIT_AUTOMAKE(tripe, 1.0.0pre6)
 AM_CONFIG_HEADER(config.h)
 AC_CANONICAL_HOST
 
 AM_CONFIG_HEADER(config.h)
 AC_CANONICAL_HOST
 
@@ -82,15 +85,46 @@ AC_ARG_WITH([linux-includes],
 [CFLAGS="$CFLAGS -I$withval"],
 [:])
 
 [CFLAGS="$CFLAGS -I$withval"],
 [:])
 
+AC_ARG_WITH([configdir],
+[  --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=.]],
+[socketdir=$withval],
+[socketdir=.])
+
+AC_ARG_WITH([pidfile],
+[  --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]],
+[initconfig=$withval],
+[initconfig=/etc/tripe.conf])
+
+AC_ARG_WITH([logfile],
+[  --with-logfile=DIR       make tripectl write its log to FILE 
+                           [default=./tripe.log]],
+[logfile=$withval],
+[logfile=tripe.log])
+
 DIRS=""
 DIRS=""
+ETHEREAL_CFLAGS=""
+ETHEREAL_PLUGIN_DIR="unknown"
 AC_ARG_WITH([ethereal],
 AC_ARG_WITH([ethereal],
-[  --with-ethereal        build and install Ethereal plugin],
+[  --with-ethereal         build and install Ethereal plugin],
 [case "$withval" in
 [case "$withval" in
-   no) ethereal=false;;
-   yes) ethereal='${prefix}/lib/ethereal/plugins';; 
-   *) ethereal=$withval;;
+   no) ethereal=false requireethereal=false;;
+   yes) ethereal=true; requireethereal=true;;
+   *) ethereal=true requireethereal=true ETHEREAL_PLUGIN_DIR=$withval;;
 esac],
 esac],
-[ethereal=false])
+[ethereal=true requireethereal=false])
 
 case $host_os in
   linux*)
 
 case $host_os in
   linux*)
@@ -120,13 +154,53 @@ AC_SUBST(tun)
 mdw_MLIB(2.0.0)
 mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
 
 mdw_MLIB(2.0.0)
 mdw_CATACOMB(2.0.1, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
 
-if test "$ethereal" != false; then
-  AM_PATH_GLIB([1.2.0], [], AC_MSG_ERROR([failed to find GLib]), [gmodule])
+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
+    for i in "${prefix}" /usr/local /usr `echo $PATH | tr : " "`; do
+      if test -x "$i/bin/ethereal"; then
+        ethprefix=$i
+        break
+      fi
+    done
+    if test "$ethprefix" != none; then
+      ethbin=$ethprefix/bin/ethereal
+      ethver=`$ethbin -v | sed 's/^[^ ]* \([0-9A-Za-z.]*\).*$/\1/'`
+      dir=$ethprefix/lib/ethereal/plugins/$ethver
+      if test -d "$dir"; then
+        mdw_cv_ethereal_plugin_dir=$dir
+      fi
+    fi
+    changequote([, ])
+  ])
+  case $mdw_cv_ethereal_plugin_dir in
+    failed) ethereal=false;;
+    *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
+  esac
+fi
+
+if test "$ethereal" = true; then
+  AM_PATH_GLIB([1.2.0], [], ethereal=false, [gmodule])
+fi
+if test "$ethereal" = true; then
   bad=true
   mdw_CFLAGS=$CFLAGS
   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], [
   AC_CACHE_CHECK([how to find the Ethereal headers], 
     [mdw_cv_ethereal_includes], [
-    for i in "" "-I/usr/include/ethereal"; do
+    mdw_cv_ethereal_includes=failed
+    for i in \
+       "" \
+       "-I${ethprefix}/include/ethereal" \
+       "-I${ethprefix}/include" \
+       "-I${prefix}/include/ethereal" \
+       "-I${prefix}/include" \
+       "-I/usr/include/ethereal" \
+       "-I/usr/local/include/ethereal" \
+       "-I/usr/local/include"; do
       CFLAGS="$GLIB_CFLAGS $i"
       AC_TRY_COMPILE([
 #include <netinet/in.h>
       CFLAGS="$GLIB_CFLAGS $i"
       AC_TRY_COMPILE([
 #include <netinet/in.h>
@@ -137,12 +211,18 @@ if test "$ethereal" != false; then
        dh = creat_dissector_handle(0, 0);
       ], [bad=false; break])
     done
        dh = creat_dissector_handle(0, 0);
       ], [bad=false; break])
     done
-    if $bad; then
-      AC_MSG_ERROR([failed to find Ethereal headers])
+    if test $bad = false; then
+      mdw_cv_ethereal_includes=$i
     fi
     fi
-    mdw_cv_ethereal_includes=$i
     CFLAGS=$mdw_CFLAGS
   ])
     CFLAGS=$mdw_CFLAGS
   ])
+  case $mdw_cv_ethereal_plugin_dir in
+    failed) ethereal=false;;
+    *) ETHEREAL_PLUGIN_DIR=$mdw_cv_ethereal_plugin_dir;;
+  esac  
+fi
+
+if test "$ethereal" = true; then
   AC_CACHE_CHECK([whether the Ethereal headers are broken],
     [mdw_cv_ethereal_buggered], [
     CFLAGS="$GLIB_CFLAGS $i"
   AC_CACHE_CHECK([whether the Ethereal headers are broken],
     [mdw_cv_ethereal_buggered], [
     CFLAGS="$GLIB_CFLAGS $i"
@@ -164,12 +244,21 @@ if test "$ethereal" != false; then
   fi
 
   ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
   fi
 
   ETHEREAL_CFLAGS="$CFLAGS $GLIB_CFLAGS $mdw_cv_ethereal_includes"
-  ETHEREAL_PLUGIN_DIR=$ethereal
   AC_SUBST(ETHEREAL_CFLAGS)
   AC_SUBST(ETHEREAL_PLUGIN_DIR)
   DIRS="$DIRS ethereal"
 fi
 
   AC_SUBST(ETHEREAL_CFLAGS)
   AC_SUBST(ETHEREAL_PLUGIN_DIR)
   DIRS="$DIRS ethereal"
 fi
 
+if test "$ethereal" = false -a "$requireethereal" = true; then
+  AC_MSG_ERROR([failed to configure Ethereal plugin])
+fi
+
+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_SUBST(DIRS)
 AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)