chiark / gitweb /
Remove buf, and add Ethereal analysis.
[tripe] / configure.in
index 700f36dc75fa3c3d8c0a1f73a4c05e6db572b1b1..b2049dcde2b0885de9a1df04923b07af99232fad 100644 (file)
@@ -1,6 +1,6 @@
-dnl -*-fundamental-*-
+dnl -*-autoconf-*-
 dnl
-dnl $Id: configure.in,v 1.5 2001/03/03 12:30:39 mdw Exp $
+dnl $Id: configure.in,v 1.13 2003/10/15 09:30:18 mdw Exp $
 dnl
 dnl Configuration script for TrIPE
 dnl
@@ -28,6 +28,27 @@ dnl Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 dnl ----- Revision history --------------------------------------------------
 dnl
 dnl $Log: configure.in,v $
+dnl Revision 1.13  2003/10/15 09:30:18  mdw
+dnl Add support for Ethereal protocol analysis.
+dnl
+dnl Revision 1.12  2003/07/13 11:54:40  mdw
+dnl Version bump.
+dnl
+dnl Revision 1.11  2003/05/17 11:04:38  mdw
+dnl Ship new configuration and startup kit.
+dnl
+dnl Revision 1.9  2003/04/06 10:33:31  mdw
+dnl And again.  (Sigh.)
+dnl
+dnl Revision 1.8  2003/04/06 10:31:13  mdw
+dnl Fix stupid bug.
+dnl
+dnl Revision 1.7  2003/04/06 10:25:17  mdw
+dnl Support Linux TUN/TAP device.  Fix some bugs.
+dnl
+dnl Revision 1.6  2001/06/19 22:13:57  mdw
+dnl Version bump.
+dnl
 dnl Revision 1.5  2001/03/03 12:30:39  mdw
 dnl Make this a pre-release.
 dnl
@@ -45,18 +66,46 @@ dnl Initial checkin.
 dnl
 
 AC_INIT(tripe.c)
-AM_INIT_AUTOMAKE(tripe, 1.0.0pre1)
+AM_INIT_AUTOMAKE(tripe, 1.0.0pre5)
 AM_CONFIG_HEADER(config.h)
 AC_CANONICAL_HOST
 
+AC_PROG_MAKE_SET
 AC_PROG_CC
-mdw_GCC_FLAGS
+AM_PROG_LIBTOOL
+mdw_GCC_FLAGS([-Wall])
 mdw_OPT_TRACE
 
+AC_ARG_WITH([linux-includes],
+[  --with-linux-includes=DIR
+                          search for Linux kernel includes in DIR],
+[CFLAGS="$CFLAGS -I$withval"],
+[:])
+
+DIRS=""
+AC_ARG_WITH([ethereal],
+[  --with-ethereal        build and install Ethereal plugin],
+[case "$withval" in
+   no) ethereal=false;;
+   yes) ethereal='${prefix}/lib/ethereal/plugins';; 
+   *) ethereal=$withval;;
+esac],
+[ethereal=false])
+
 case $host_os in
   linux*)
-    tun=unet
-    AC_DEFINE([TUN_TYPE], [TUN_UNET])
+    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])
+       ;;
+      *)
+       tun=unet
+       AC_DEFINE([TUN_TYPE], [TUN_UNET])
+       ;;
+    esac
     ;;
   *bsd*)
     tun=bsd
@@ -68,9 +117,60 @@ case $host_os in
 esac
 AC_SUBST(tun)
 
-mdw_MLIB(2.0.0pre4)
-mdw_CATACOMB(2.0.0pre8, [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])
+  bad=true
+  mdw_CFLAGS=$CFLAGS
+  AC_CACHE_CHECK([how to find the Ethereal headers], 
+    [mdw_cv_ethereal_includes], [
+    for i in "" "-I/usr/include/ethereal"; do
+      CFLAGS="$GLIB_CFLAGS $i"
+      AC_TRY_COMPILE([
+#include <netinet/in.h>
+#include <glib.h>
+#include <epan/packet.h>
+], [
+       dissector_handle_t dh;
+       dh = creat_dissector_handle(0, 0);
+      ], [bad=false; break])
+    done
+    if $bad; then
+      AC_MSG_ERROR([failed to find Ethereal headers])
+    fi
+    mdw_cv_ethereal_includes=$i
+    CFLAGS=$mdw_CFLAGS
+  ])
+  AC_CACHE_CHECK([whether the Ethereal headers are broken],
+    [mdw_cv_ethereal_buggered], [
+    CFLAGS="$GLIB_CFLAGS $i"
+    AC_TRY_COMPILE([
+#include <netinet/in.h>
+#include <glib.h>
+#include <epan/packet.h>
+#include <plugins/plugin_api.h>
+], [
+      G_MODULE_EXPORT void plugin_init(plugin_address_table_t *pat)
+      {
+        plugin_address_table_init(pat);
+      }
+    ], [mdw_cv_ethereal_buggered=no], [mdw_cv_ethereal_buggered=yes])
+    CFLAGS=$mdw_CFLAGS
+  ])
+  if test $mdw_cv_ethereal_buggered = yes; then
+    AC_DEFINE(ETHEREAL_BUGGERED)
+  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_OUTPUT(Makefile doc/Makefile)
+AC_SUBST(DIRS)
+AC_OUTPUT(Makefile doc/Makefile ethereal/Makefile tripe-init)
 
 dnl ----- That's all, folks -------------------------------------------------