+ if test "$with_gnome" = yes; then
+ AC_PATH_PROGS(gnome_config, gnome-config,, $gtk_path)
+ fi
+
+ if test -n "$glib_config" -a -n "$gtk_config" ; then
+ have_gtk=yes
+ if test "$with_gnome" = yes -a -n "$gnome_config" ; then
+ have_gnome=yes
+ fi
+ fi
+
+ if test "$have_gtk" = yes; then
+ AC_CACHE_CHECK([Gtk version number], ac_cv_gtk_version_string,
+ [ac_cv_gtk_version_string=`$gtk_config --version`])
+ ac_gtk_version_string=$ac_cv_gtk_version_string
+ parse_gtk_version_string
+ fi
+
+ if test "$have_gtk" = yes; then
+ if test "$ac_gtk_version" = "unknown" || test "$ac_gtk_version" -lt 1002
+ then
+ have_gtk=no
+ have_gnome=no
+ jurassic_gtk=yes
+ fi
+ fi
+
+ if test "$have_gtk" = yes; then
+ AC_CACHE_CHECK([for Gtk includes], ac_cv_gtk_config_cflags,
+ [ac_cv_gtk_config_cflags=`$gtk_config --cflags`])
+ AC_CACHE_CHECK([for Gtk libs], ac_cv_gtk_config_libs,
+ [ac_cv_gtk_config_libs=`$gtk_config --libs`])
+ fi
+ ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
+ ac_gtk_config_libs=$ac_cv_gtk_config_libs
+
+ # Check for Gnome Capplet support.
+ # Note that this is only needed with Gnome 1.x, not Gnome 2.x.
+ # In a Gnome 2.x world, libcapplet will not exist.
+ # (In fact, this likely won't even be checked, since in a Gnome 2.x
+ # world, we will probably be up in the "$pkg_config" branch instead
+ # of here in the "$gnome_config" branch.)
+ #
+ if test "$have_gnome" = yes -a "$have_gtk" = yes; then
+ gnome_config_libs="gtk capplet gnomeui gdk_pixbuf"
+ AC_MSG_CHECKING(for Gnome capplet includes)
+ AC_CACHE_VAL(ac_cv_gnome_config_cflags,
+ [if ( $gnome_config --cflags $gnome_config_libs 2>&1 | \
+ grep Unknown >/dev/null ) ; then
+ ac_cv_gnome_config_cflags=''
+ else
+ ac_cv_gnome_config_cflags=`$gnome_config --cflags $gnome_config_libs`
+ fi])
+ ac_gnome_config_cflags=$ac_cv_gnome_config_cflags
+ if test "$ac_gnome_config_cflags" = "" ; then
+ have_gnome=no
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT($ac_gnome_config_cflags)
+ fi
+ fi
+
+ if test "$have_gnome" = yes -a "$have_gtk" = yes; then
+ AC_MSG_CHECKING(for Gnome capplet libs)
+ AC_CACHE_VAL(ac_cv_gnome_config_libs,
+ [if ( $gnome_config --libs $gnome_config_libs 2>&1 |
+ grep Unknown >/dev/null ) ; then
+ ac_cv_gnome_config_libs=''
+ else
+ ac_cv_gnome_config_libs=`$gnome_config --libs $gnome_config_libs`
+ fi])
+ ac_gnome_config_libs=$ac_cv_gnome_config_libs
+ if test "$ac_gnome_config_libs" = "" ; then
+ have_gnome=no
+ AC_MSG_RESULT(no)
+ else
+ AC_MSG_RESULT($ac_gnome_config_libs)
+ fi
+ fi
+
+ # If we have Gnome, then override the gtk-config values with
+ # the gnome-config values.
+ #
+ if test "$have_gnome" = yes -a "$have_gtk" = yes; then
+ ac_gtk_config_cflags=$ac_gnome_config_cflags
+ ac_gtk_config_libs=$ac_gnome_config_libs
+ AC_DEFINE(HAVE_CRAPPLET)
+ fi
+
+ fi # end of {gnome,gtk}-config based tests
+
+ if test "$have_gtk" = yes -a "$have_gtk2" = no; then
+ # check for this function that was not in libcapplet 1.2.
+ # (only needed in Gnome/Gtk 1.x, not Gnome/Gtk 2.x)
+ AC_CHECK_X_LIB(capplet, capplet_widget_changes_are_immediate,
+ [AC_DEFINE(HAVE_CRAPPLET_IMMEDIATE)], [true],
+ $ac_gnome_config_libs)
+ fi
+
+
+ GNOME_DATADIR=""
+ if test "$have_gtk" = yes; then
+ if test -n "$pkg_config"; then
+ if test "$have_gtk2" = yes; then
+ GNOME_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+ else
+ GNOME_DATADIR=`$pkg_config --variable=prefix gtk+`
+ fi
+ else
+ GNOME_DATADIR=`$gtk_config --prefix`
+ fi
+ GNOME_DATADIR="$GNOME_DATADIR/share"
+ fi
+
+ # .desktop files go in different places in Gnome 1.x and Gnome 2.x...
+ if test "$have_gtk2" = yes; then
+ GNOME_PANELDIR='$(GNOME_PANELDIR2)'
+ else
+ GNOME_PANELDIR='$(GNOME_PANELDIR1)'
+ fi
+
+
+ if test "$have_gtk" = yes; then
+ INCLUDES="$INCLUDES $ac_gtk_config_cflags"
+ GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
+ AC_DEFINE(HAVE_GTK)
+
+ if test "$have_gtk2" = yes; then
+ GTK_EXTRA_OBJS=""
+ else
+ GTK_EXTRA_OBJS="\$(GTK_EXTRA_OBJS)"
+ fi
+ fi
+
+fi
+
+
+# Check for the Gnome Help Browser.
+#
+if test "$have_gtk" = yes; then
+ AC_CHECK_PROGS(have_gnome_help, yelp gnome-help-browser, no)
+ if test "$have_gnome_help" != no; then
+ have_gnome_help=yes
+ fi
+fi
+
+
+###############################################################################
+#
+# Check for -lxml
+#
+###############################################################################
+
+have_xml=no
+with_xml_req=unspecified
+xml_halfassed=no
+AC_ARG_WITH(xml,
+[ --with-xml The XML toolkit is needed for some parts of
+ the Gtk interface. Without it, the configuration
+ interface will be much less featureful.],
+[with_xml="$withval"; with_xml_req="$withval"],[with_xml=yes])
+
+# if --with-xml=/directory/ was specified, remember that directory so that
+# we can also look for the `xml-config' program in that directory.
+case "$with_xml" in
+ /*)
+ xml_dir="$with_xml"
+ ;;
+ *)
+ xml_dir=""
+ ;;
+esac
+
+HANDLE_X_PATH_ARG(with_xml, --with-xml, XML)
+
+if test "$with_xml" != yes -a "$with_xml" != no ; then
+ echo "error: must be yes or no: --with-xml=$with_xml"
+ exit 1
+fi
+
+if test "$with_xml" = yes; then
+ have_xml=no
+ have_old_xml=no
+
+ # if the user specified --with-gtk=/foo/ or --with-gnome=/foo/ then
+ # look in /foo/bin/ for for xml-config.
+ #
+ xml_path="$PATH"
+
+ if test ! -z "$gtk_dir"; then
+ # canonicalize slashes.
+ foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
+ xml_path="$foo:$xml_path"
+ fi
+
+ if test ! -z "$gnome_dir"; then
+ # canonicalize slashes.
+ foo=`echo "${gnome_dir}/bin" | sed 's@//*@/@g'`
+ xml_path="$foo:$xml_path"
+ fi
+
+ if test -n "$pkg_config" ; then
+ #
+ # the new way...
+ # run pkg-config based tests.
+ #
+ pkgs=""
+ ok="yes"
+
+ # If we have Gtk 2.x, then *only* XML 2.x will work.
+ # If we have Gtk 1.x, or don't have Gtk at all, then
+ # either XML 1.x or 2.x will work.
+
+ # First check for XML 2.x.
+ #
+ pkg_check_version libxml-2.0 2.4.6
+
+ # If that didn't work (we don't have XML 2.x) and we *don't* have
+ # Gtk 2.x, then check to see if we have XML 1.x
+ #
+ if test "$ok" = no -a "$have_gtk2" = no; then
+ ok=yes
+ pkg_check_version libxml 1.0
+ fi
+
+ have_xml="$ok"
+
+ if test "$have_xml" = yes; then
+ AC_CACHE_CHECK([for XML includes], ac_cv_xml_config_cflags,
+ [ac_cv_xml_config_cflags=`$pkg_config --cflags $pkgs`])
+ AC_CACHE_CHECK([for XML libs], ac_cv_xml_config_libs,
+ [ac_cv_xml_config_libs=`$pkg_config --libs $pkgs`])
+ ac_xml_config_cflags=$ac_cv_xml_config_cflags
+ ac_xml_config_libs=$ac_cv_xml_config_libs
+ fi
+
+ else
+ #
+ # the old way...
+ # run {xml2,xml}-config based tests.
+ #
+
+ AC_PATH_PROGS(xml_config, xml2-config xml-config,, $xml_path)
+
+ # If we found the xml-config program, run it to get flags.
+ #
+ if test -n "$xml_config" ; then
+ AC_CACHE_CHECK([for XML includes], ac_cv_xml_config_cflags,
+ [ac_cv_xml_config_cflags=`$xml_config --cflags`])
+ AC_CACHE_CHECK([for XML libs], ac_cv_xml_config_libs,
+ [ac_cv_xml_config_libs=`$xml_config --libs`])
+ ac_xml_config_cflags=$ac_cv_xml_config_cflags
+ ac_xml_config_libs=$ac_cv_xml_config_libs
+ fi
+
+ ac_save_xml_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $ac_xml_config_cflags"
+
+ # first try <libxml/parser.h> which is the new way...
+ #
+ AC_CHECK_X_HEADER(libxml/xmlIO.h, [have_xml=yes],,
+ [#include <libxml/parser.h>])
+
+ # if that didn't work, then try just <parser.h> which is the old way...
+ #
+ if test "$have_xml" = no; then
+ AC_CHECK_X_HEADER(xmlIO.h, [have_xml=yes; have_old_xml=yes],,
+ [#include <parser.h>])
+ fi
+
+ CPPFLAGS="$ac_save_xml_CPPFLAGS"
+ fi
+
+
+ have_zlib=no
+ if test "$have_xml" = yes; then
+ # we have the XML headers; now make sure zlib is around.
+ # yes, it's stupid we have to do this too, but there is
+ # dependency screwage in Gnome.
+ AC_CHECK_X_LIB(z, zlibVersion, [have_zlib=yes])
+ if test "$have_zlib" = no; then
+ xml_halfassed=yes
+ have_xml=no
+ fi
+ fi
+
+ if test "$have_xml" = yes; then
+ # we have the header, now check for the library
+ have_xml=no
+ xml_halfassed=yes
+ AC_CHECK_X_LIB(c, xmlParseChunk,
+ [have_xml=yes
+ xml_halfassed=no
+ XML_LIBS="$ac_xml_config_libs"
+ AC_DEFINE(HAVE_XML)],
+ [true],
+ $ac_xml_config_libs)
+ fi
+
+ if test "$have_xml" = yes; then
+ INCLUDES="$INCLUDES $ac_xml_config_cflags"
+ GTK_LIBS="$GTK_LIBS $ac_xml_config_libs"
+ AC_DEFINE(HAVE_XML)
+ if test "$have_old_xml" = yes; then
+ AC_DEFINE(HAVE_OLD_XML_HEADERS)
+ fi
+ fi