+# GLib checks
+# This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
+# GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
+# However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
+# set when generating the Makefile, so we can make programs that require
+# only GLib link with @GLIB_LIBS@ and make programs that require GTK+
+# link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
+# We don't add $GLIB_LIBS to LIBS, because we don't want to force all
+# programs to be built with GLib.
+#
+if test "$GTK_OK" = "yes" -a "x$enable_ethereal" = "xyes" ; then
+ ethereal_bin="ethereal"
+ ethereal_man="ethereal.1"
+ ethereal_SUBDIRS="gtk"
+
+ # Ignore GLIB_CFLAGS
+ AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
+else
+ enable_ethereal="no"
+ ethereal_bin=""
+ ethereal_man=""
+ # Honor GLIB_CFLAGS
+ AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
+fi
+
+#
+# Check whether GLib modules are supported, to determine whether we
+# can support plugins.
+#
+AC_MSG_CHECKING(whether GLib supports loadable modules)
+ac_save_CFLAGS="$CFLAGS"
+ac_save_LIBS="$LIBS"
+CFLAGS="$CFLAGS $GLIB_CFLAGS"
+LIBS="$GLIB_LIBS $LIBS"
+AC_TRY_RUN([
+#include <glib.h>
+#include <gmodule.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+int
+main ()
+{
+ if (g_module_supported())
+ return 0; /* success */
+ else
+ return 1; /* failure */
+}
+], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
+ [echo $ac_n "cross compiling; assumed OK... $ac_c"])
+CFLAGS="$ac_save_CFLAGS"
+LIBS="$ac_save_LIBS"
+if test "$ac_cv_glib_supports_modules" = yes ; then
+ AC_MSG_RESULT(yes)
+ have_plugins=yes
+else
+ AC_MSG_RESULT(no)
+ have_plugins=no
+fi
+
+
+AC_SUBST(ethereal_bin)
+AC_SUBST(ethereal_man)
+
+
+
+# Enable/disable tethereal
+
+AC_ARG_ENABLE(tethereal,
+[ --enable-tethereal build tethereal. [default=yes]],,enable_tethereal=yes)
+
+if test "x$enable_tethereal" = "xyes" ; then
+ tethereal_bin="tethereal"
+ tethereal_man="tethereal.1"
+else
+ tethereal_bin=""
+ tethereal_man=""
+fi
+AC_SUBST(tethereal_bin)
+AC_SUBST(tethereal_man)
+
+
+
+# Enable/disable editcap
+
+AC_ARG_ENABLE(editcap,
+[ --enable-editcap build editcap. [default=yes]],,enable_editcap=yes)
+
+if test "x$enable_editcap" = "xyes" ; then
+ editcap_bin="editcap"
+ editcap_man="editcap.1"
+else
+ editcap_bin=""
+ editcap_man=""
+fi
+AC_SUBST(editcap_bin)
+AC_SUBST(editcap_man)
+
+
+# Enable/disable mergecap
+
+AC_ARG_ENABLE(mergecap,
+[ --enable-mergecap build mergecap. [default=yes]],,enable_mergecap=yes)
+
+if test "x$enable_mergecap" = "xyes" ; then
+ mergecap_bin="mergecap"
+ mergecap_man="mergecap.1"
+else
+ mergecap_bin=""
+ mergecap_man=""
+fi
+AC_SUBST(mergecap_bin)
+AC_SUBST(mergecap_man)
+
+
+# Enable/disable text2pcap
+
+AC_ARG_ENABLE(text2pcap,
+[ --enable-text2pcap build text2pcap. [default=yes]],,enable_text2pcap=yes)
+
+if test "x$enable_text2pcap" = "xyes" ; then
+ text2pcap_bin="text2pcap"
+ text2pcap_man="text2pcap.1"
+else
+ text2pcap_bin=""
+ text2pcap_man=""
+fi
+AC_SUBST(text2pcap_bin)
+AC_SUBST(text2pcap_man)
+
+# Enable/disable idl2eth
+
+AC_ARG_ENABLE(idl2eth,
+[ --enable-idl2eth build idl2eth. [default=yes]],,enable_idl2eth=yes)