+mdw_MLIB(2.0.0)
+mdw_CATACOMB(2.1.0, [CFLAGS="$CFLAGS $CATACOMB_CFLAGS"])
+
+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
+ 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
+ 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>
+#include <glib.h>
+#include <epan/packet.h>
+], [
+ dissector_handle_t dh;
+ dh = creat_dissector_handle(0, 0);
+ ], [bad=false; break])
+ done
+ if test $bad = false; then
+ mdw_cv_ethereal_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
+fi
+
+if test "$ethereal" = true; then
+ 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"
+ 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