-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