ftp://ftp.krokus.ru/pub/OpenBSD/distfiles/xscreensaver-5.01.tar.gz
[xscreensaver] / configure
index ea00c0dde750fe22f2cc24a4af97e5b579fdad96..bbfafcef908a9963fe49a8bba4167318653bae96 100755 (executable)
--- a/configure
+++ b/configure
@@ -309,7 +309,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE EGREP PERL X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XML_RULE INTLTOOL_CAVES_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL GETTEXT_PACKAGE RANLIB ac_ct_RANLIB ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB MKINSTALLDIRS pkg_config glib_config gtk_config gnome_config have_gnome_help xml_config gdk_pixbuf_config fortune_tmp INCLUDES PREFERRED_DEMO_PROGRAM ALL_DEMO_PROGRAMS SAVER_LIBS MOTIF_LIBS GTK_LIBS XML_LIBS JPEG_LIBS HACK_LIBS XPM_LIBS PTY_LIBS GL_LIBS GLE_LIBS XDPMS_LIBS PASSWD_LIBS INSTALL_SETUID SETUID_HACKS INSTALL_DIRS NEED_SETUID INSTALL_PAM OBJCC EXES_OSX SCRIPTS_OSX MEN_OSX PASSWD_SRCS PASSWD_OBJS XMU_SRCS XMU_OBJS XMU_LIBS SAVER_GL_SRCS SAVER_GL_OBJS SAVER_GL_LIBS LOCK_SRCS LOCK_OBJS JPEG_EXES GL_EXES GL_UTIL_EXES GL_MEN GL_KLUDGE GLE_EXES GLE_KLUDGE GNOMEHELP_Y GNOMEHELP_N HACKDIR GNOME_DATADIR GLADE_DATADIR PO_DATADIR GNOME_PANELDIR HACK_CONF_DIR GTK_EXTRA_OBJS APPDEFAULTS DEPEND DEPEND_FLAGS DEPEND_DEFINES LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA SET_MAKE EGREP PERL X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS INTLTOOL_DESKTOP_RULE INTLTOOL_DIRECTORY_RULE INTLTOOL_KEYS_RULE INTLTOOL_OAF_RULE INTLTOOL_PONG_RULE INTLTOOL_SERVER_RULE INTLTOOL_SHEET_RULE INTLTOOL_SOUNDLIST_RULE INTLTOOL_UI_RULE INTLTOOL_XML_RULE INTLTOOL_CAVES_RULE INTLTOOL_EXTRACT INTLTOOL_MERGE INTLTOOL_UPDATE INTLTOOL_PERL GETTEXT_PACKAGE RANLIB ac_ct_RANLIB ALLOCA USE_NLS MSGFMT GMSGFMT XGETTEXT CATALOGS CATOBJEXT DATADIRNAME GMOFILES INSTOBJEXT INTLDEPS INTLLIBS INTLOBJS POFILES POSUB MKINSTALLDIRS login_manager_tmp pkg_config gnome_open_program gnome_url_show_program INCLUDES PREFERRED_DEMO_PROGRAM ALL_DEMO_PROGRAMS SAVER_LIBS MOTIF_LIBS GTK_LIBS XML_LIBS JPEG_LIBS HACK_LIBS XPM_LIBS PTY_LIBS GL_LIBS GLE_LIBS XDPMS_LIBS XINERAMA_LIBS PASSWD_LIBS INSTALL_SETUID SETUID_HACKS INSTALL_DIRS NEED_SETUID INSTALL_PAM HAVE_PAM_FAIL_DELAY NEW_LOGIN_COMMAND NEW_LOGIN_COMMAND_P DEFAULT_IMAGES_P DEFAULT_IMAGE_DIRECTORY DEFAULT_TEXT_FILE WITH_BROWSER OBJCC EXES_OSX SCRIPTS_OSX MEN_OSX PASSWD_SRCS PASSWD_OBJS XMU_SRCS XMU_OBJS XMU_LIBS SAVER_GL_SRCS SAVER_GL_OBJS SAVER_GL_LIBS LOCK_SRCS LOCK_OBJS JPEG_EXES GL_EXES GL_UTIL_EXES GL_MEN GL_KLUDGE GLE_EXES GLE_KLUDGE GNOME24 GNOME22 NOGNOME HACKDIR HACKDIR_FULL GTK_DATADIR PO_DATADIR HACK_CONF_DIR GTK_EXTRA_OBJS APPDEFAULTS DEPEND DEPEND_FLAGS DEPEND_DEFINES LIBOBJS LTLIBOBJS'
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -348,7 +348,7 @@ libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
 infodir='${prefix}/info'
-mandir='${prefix}/man'
+mandir=\${datadir}/man
 
 ac_prev=
 for ac_option
@@ -818,6 +818,8 @@ For better control, use the options below.
 
 Fine tuning of the installation directories:
   --bindir=DIR           user executables [EPREFIX/bin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
   --libdir=DIR           object code libraries [EPREFIX/lib]
   --includedir=DIR       C header files [PREFIX/include]
   --x-includes=DIR        X include files are in DIR
@@ -845,24 +847,26 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
 
-
 Screen locking options:
-
   --enable-locking        Compile in support for locking the display.
   --disable-locking       Do not allow locking at all.
 
+  --enable-root-passwd       Allow root passwd to unlock screen.
+  --disable-root-passwd       Do not allow that.
+
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-Installation options:
 
+
+Installation options:
   --with-hackdir=DIR      Where to install the hundreds of demo executables.
-                          Default: `PREFIX/lib/xscreensaver/'
+                          Default: `PREFIX/libexec/xscreensaver/'
   --with-configdir=DIR    Where to install the data files that describe each
                           of the display modes to the GUI.
-                          Default: `GNOMEPREFIX/control-center/screensavers/'
-                          or `PREFIX/lib/xscreensaver/config/', depending on
-                          whether GNOME is available.
+                          Default: `PREFIX/share/xscreensaver/config/'
+  --with-x-app-defaults=DIR
+                          Where to install xscreensaver configuration file.
 
 Except where noted, all of the --with options below can also take a
 directory argument: for example, `--with-motif=/opt/Motif'.  That would
@@ -878,7 +882,6 @@ at all.
 Screen blanking and idle-detection options:
 
   --with-sgi-ext          Include support for the SGI SCREEN_SAVER extension.
-  --with-mit-ext          Include support for the MIT-SCREEN-SAVER extension.
   --with-xidle-ext        Include support for the XIDLE extension.
   --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL extension.
   --with-dpms-ext         Include support for the DPMS extension.
@@ -889,43 +892,40 @@ Screen blanking and idle-detection options:
   --with-proc-interrupts  Include support for consulting the /proc/interrupts
                           file to notice keyboard activity.
   --with-pam              Include support for PAM (Pluggable Auth Modules.)
+  --with-pam-service-name=NAME
+                          NAME is the name of the PAM service that
+                          xscreensaver will authenticate as.
   --with-kerberos         Include support for Kerberos authentication.
   --with-shadow           Include support for shadow password authentication.
   --with-passwd-helper    Include support for an external password
                           verification helper program.
+  --with-login-manager    Put a "New Login" button on the unlock dialog that
+                          runs a login manager such as gdmflexiserver.
 
 User interface options:
 
+  --with-gtk              Use the Gtk toolkit for the user interface.
   --with-motif            Use the Motif toolkit for the user interface
                           (not recommended.)
-  --with-gtk              Use the Gtk toolkit for the user interface.
-  --with-gnome            Include support for the Gnome 1.x Control Center.
-                          (This option is not needed with GTK 2.x / Gnome 2.x.)
-
-  --with-xml              The XML toolkit is needed for some parts of
-                          the Gtk interface.  Without it, the configuration
-                          interface will be much less featureful.
 
 Graphics options:
 
   --with-gl               Build those demos which depend on OpenGL.
   --with-gle              Build those demos which depend on GLE
                           (the OpenGL "extrusion" library.)
-  --with-xpm              Include support for XPM files in some demos.
-                          (Not needed if Pixbuf is used.)
   --with-pixbuf           Include support for the GDK-Pixbuf library in some
                           demos, which will make it possible for them to read
-                          GIF, JPEG, and PNG files as well.  (The path here is
-                         ignored if GTK 2.x is being used.)
+                          GIF, JPEG, and PNG files as well.
+  --with-xpm              Include support for XPM files in some demos.
+                          (Not needed if Pixbuf is used.)
   --with-jpeg             Include support for the JPEG library.
   --with-xshm-ext         Include support for the Shared Memory extension.
   --with-xdbe-ext         Include support for the DOUBLE-BUFFER extension.
   --with-readdisplay      Include support for the XReadDisplay extension.
-
-  --with-fortune=PROGRAM  Some demos are able to run an external program and
-                          display its text; this names the program to use by
-                          default (though it can be overridden with X
-                          resources.)  Default is "/usr/games/fortune".
+  --with-image-directory=DIR  By default, some demos may display random images
+                          from this directory.
+  --with-text-file=FILE   By default, some demos may display this file.
+  --with-browser=BROWSER   Specify the browser to show help URL.
   --with-setuid-hacks     Allow some demos to be installed `setuid root'
                           (which is needed in order to ping other hosts.)
 
@@ -1382,6 +1382,175 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 echo "current directory: `pwd`"
 echo "command line was: $0 $@"
+
+###############################################################################
+#
+#       Autoheader stuff
+#
+###############################################################################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 # After checking to see that --srcdir is correct (which AC_INIT does)
@@ -1508,6 +1677,22 @@ perl_version_cmd='print $]'
 #
 
 
+###############################################################################
+#
+#       Handle the --with-x-app-defaults option HERE
+#
+###############################################################################
+
+
+# Check whether --with-x-app-defaults or --without-x-app-defaults was given.
+if test "${with_x_app_defaults+set}" = set; then
+  withval="$with_x_app_defaults"
+  ac_cv_x_app_defaults="$withval"
+else
+  eval ac_x_app_defaults="$withval"
+fi;
+
+
 
 
 
@@ -2594,6 +2779,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
   if test -z "$GCC"; then
+    # not using GCC
     echo "$as_me:$LINENO: checking how to request ANSI compilation" >&5
 echo $ECHO_N "checking how to request ANSI compilation... $ECHO_C" >&6
     case "$host" in
@@ -2607,18 +2793,25 @@ echo "${ECHO_T}HPUX: adding -Ae" >&6
 echo "${ECHO_T}AIX: adding -qlanglvl=ansi -qhalt=e" >&6
         CC="$CC -qlanglvl=ansi -qhalt=e"
       ;;
-
       *-dec-* )
         echo "$as_me:$LINENO: result: DEC: adding -std1 -ieee" >&5
 echo "${ECHO_T}DEC: adding -std1 -ieee" >&6
         CC="$CC -std1"
       ;;
-
       *)
         echo "$as_me:$LINENO: result: no idea" >&5
 echo "${ECHO_T}no idea" >&6
       ;;
     esac
+  else
+    # using GCC
+    case "$host" in
+      *-solaris*)
+        echo "$as_me:$LINENO: result: Solaris: adding -D__EXTENSIONS__" >&5
+echo "${ECHO_T}Solaris: adding -D__EXTENSIONS__" >&6
+        CC="$CC -D__EXTENSIONS__"
+      ;;
+    esac
   fi
 
   OBJCC="$CC"
@@ -2669,7 +2862,7 @@ fi
   if test -n "$GCC"; then
     echo "$as_me:$LINENO: result: Turning on gcc compiler warnings." >&5
 echo "${ECHO_T}Turning on gcc compiler warnings." >&6
-    CC="$CC -pedantic -Wall -Wstrict-prototypes -Wnested-externs"
+    CC="$CC -pedantic -Wall -Wstrict-prototypes -Wnested-externs -Wmissing-prototypes"
     OBJCC="$OBJCC -Wall"
     # supposedly gcc 3.4 will have "-Wdeclaration-after-statement"
     # and then perhaps we can do without -pedantic?
@@ -4842,9 +5035,13 @@ _ACEOF
 fi
 done
 
-echo "$as_me:$LINENO: checking for struct icmp" >&5
-echo $ECHO_N "checking for struct icmp... $ECHO_C" >&6
-if test "${ac_cv_have_icmp+set}" = set; then
+
+for ac_func in setlocale
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -4853,53 +5050,151 @@ _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdlib.h>
-                   #include <stdio.h>
-                   #include <math.h>
-                   #include <unistd.h>
-                   #include <limits.h>
-                   #include <signal.h>
-                   #include <fcntl.h>
-                   #include <sys/types.h>
-                   #include <sys/time.h>
-                   #include <sys/ipc.h>
-                   #include <sys/shm.h>
-                   #include <sys/socket.h>
-                   #include <netinet/in_systm.h>
-                   #include <netinet/in.h>
-                   #include <netinet/ip.h>
-                   #include <netinet/ip_icmp.h>
-                   #include <netinet/udp.h>
-                   #include <arpa/inet.h>
-                   #include <netdb.h>
-int
-main ()
-{
-struct icmp i;
-                   struct sockaddr s;
-                   struct sockaddr_in si;
-                   struct ip ip;
-                   i.icmp_type = ICMP_ECHO;
-                   i.icmp_code = 0;
-                   i.icmp_cksum = 0;
-                   i.icmp_id = 0;
-                   i.icmp_seq = 0;
-                   si.sin_family = AF_INET;
-                   #if defined(__DECC) || defined(_IP_VHL)
-                   ip.ip_vhl = 0;
-                   #else
-                   ip.ip_hl = 0;
-                   #endif
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
 
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+echo "$as_me:$LINENO: checking for struct icmp" >&5
+echo $ECHO_N "checking for struct icmp... $ECHO_C" >&6
+if test "${ac_cv_have_icmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+                   #include <stdio.h>
+                   #include <math.h>
+                   #include <unistd.h>
+                   #include <limits.h>
+                   #include <signal.h>
+                   #include <fcntl.h>
+                   #include <sys/types.h>
+                   #include <sys/time.h>
+                   #include <sys/ipc.h>
+                   #include <sys/shm.h>
+                   #include <sys/socket.h>
+                   #include <netinet/in_systm.h>
+                   #include <netinet/in.h>
+                   #include <netinet/ip.h>
+                   #include <netinet/ip_icmp.h>
+                   #include <netinet/udp.h>
+                   #include <arpa/inet.h>
+                   #include <netdb.h>
+int
+main ()
+{
+struct icmp i;
+                   struct sockaddr s;
+                   struct sockaddr_in si;
+                   struct ip ip;
+                   i.icmp_type = ICMP_ECHO;
+                   i.icmp_code = 0;
+                   i.icmp_cksum = 0;
+                   i.icmp_id = 0;
+                   i.icmp_seq = 0;
+                   si.sin_family = AF_INET;
+                   #if defined(__DECC) || defined(_IP_VHL)
+                   ip.ip_vhl = 0;
+                   #else
+                   ip.ip_hl = 0;
+                   #endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
@@ -7000,6 +7295,15 @@ echo "$as_me:$LINENO: result: $ac_macosx" >&5
 echo "${ECHO_T}$ac_macosx" >&6
 
 
+if test "$ac_macosx" = yes; then
+  if test -n "$GCC"; then
+    # Without these, every link against libGL gets a bunch of useless warnings.
+    osx_crud="-bind_at_load -multiply_defined suppress"
+    echo "$as_me:$LINENO: result: adding \"$osx_crud\" to LDFLAGS" >&5
+echo "${ECHO_T}adding \"$osx_crud\" to LDFLAGS" >&6
+     LDFLAGS="$LDFLAGS $osx_crud"
+  fi
+fi
 
 ###############################################################################
 #
@@ -7128,17 +7432,19 @@ fi
 
 
 GETTEXT_PACKAGE=xscreensaver
+
 cat >>confdefs.h <<_ACEOF
 #define GETTEXT_PACKAGE "$GETTEXT_PACKAGE"
 _ACEOF
 
+
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE "$GETTEXT_PACKAGE"
 _ACEOF
 
 
 
-ALL_LINGUAS="ca da de es et fi fr hu it ja ko nl no pl pt pt_BR ru sk sv vi wa zh_CN zh_TW"
+ALL_LINGUAS="ca da de es et fi fr hu it ja ko nb nl no pl pt pt_BR ru sk sv vi wa zh_CN zh_TW"
 if test -n "$ac_tool_prefix"; then
   # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
 set dummy ${ac_tool_prefix}ranlib; ac_word=$2
@@ -9550,23 +9856,21 @@ else
 fi;
 
 if test x"$with_hackdir" = xyes; then
-  HACKDIR='${exec_prefix}/lib/xscreensaver'
+  HACKDIR='${libexecdir}/xscreensaver'
 elif test x"$with_hackdir" = xno; then
   HACKDIR='${bindir}'
 else
-  # there must be a better way than this...
-  if test -z "`echo $with_hackdir | sed 's@^/.*@@'`" ; then
-    # absolute path
-    HACKDIR=$with_hackdir
-  else
-    # relative path
-    HACKDIR="\${exec_prefix}$with_hackdir"
-  fi
+  HACKDIR=$with_hackdir
 fi
 
 # canonicalize slashes.
 HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
 
+# Expand HACKDIR as HACKDIR_FULL
+eval HACKDIR_FULL=${HACKDIR}
+eval HACKDIR_FULL=${HACKDIR_FULL}
+eval HACKDIR_FULL=${HACKDIR_FULL}
+
 # This option used to be called --enable-subdir; make sure that is no longer
 # used, since configure brain-damagedly ignores unknown --enable options.
 
@@ -9587,6 +9891,7 @@ fi
 ###############################################################################
 #
 #       Handle the --with-configdir option
+#       Help for --with-x-app-defaults option added..
 #
 ###############################################################################
 
@@ -9602,8 +9907,7 @@ else
 fi;
 
 if test x"$with_configdir" = xyes; then
-  # filled in later...
-  HACK_CONF_DIR=''
+  HACK_CONF_DIR='${datadir}/xscreensaver/config'
 elif test x"$with_configdir" = xno; then
   echo "error: must be yes, or a pathname: --with-configdir=$with_configdir"
   exit 1
 
 ###############################################################################
 #
-#       Check for the MIT-SCREEN-SAVER server extension.
+#       Check for the XIDLE server extension.
 #
 ###############################################################################
 
-have_mit=no
-with_mit_req=unspecified
+have_xidle=no
+with_xidle_req=unspecified
 
-# Check whether --with-mit-ext or --without-mit-ext was given.
-if test "${with_mit_ext+set}" = set; then
-  withval="$with_mit_ext"
-  with_mit="$withval"; with_mit_req="$withval"
+# Check whether --with-xidle-ext or --without-xidle-ext was given.
+if test "${with_xidle_ext+set}" = set; then
+  withval="$with_xidle_ext"
+  with_xidle="$withval"; with_xidle_req="$withval"
 else
-  with_mit=yes
+  with_xidle=yes
 fi;
 
 
-   case "$with_mit" in
+   case "$with_xidle" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for MIT-SCREEN-SAVER headers" >&5
-echo $ECHO_N "checking for MIT-SCREEN-SAVER headers... $ECHO_C" >&6
-     d=$with_mit/include
+     echo "$as_me:$LINENO: checking for XIDLE headers" >&5
+echo $ECHO_N "checking for XIDLE headers... $ECHO_C" >&6
+     d=$with_xidle/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -9790,9 +10094,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for MIT-SCREEN-SAVER libs" >&5
-echo $ECHO_N "checking for MIT-SCREEN-SAVER libs... $ECHO_C" >&6
-     d=$with_mit/lib
+     echo "$as_me:$LINENO: checking for XIDLE libs" >&5
+echo $ECHO_N "checking for XIDLE libs... $ECHO_C" >&6
+     d=$with_xidle/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -9803,13 +10107,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_mit_req="yes"
-     with_mit=$with_mit_req
+     with_xidle_req="yes"
+     with_xidle=$with_xidle_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-mit-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xidle-ext must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -9817,16 +10121,16 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_mit" = yes; then
+if test "$with_xidle" = yes; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/scrnsaver.h" >&5
-echo $ECHO_N "checking for X11/extensions/scrnsaver.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_scrnsaver_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/extensions/xidle.h" >&5
+echo $ECHO_N "checking for X11/extensions/xidle.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_xidle_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -9837,7 +10141,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
 
-#include <X11/extensions/scrnsaver.h>
+#include <X11/extensions/xidle.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -9861,172 +10165,122 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_scrnsaver_h=yes
+  ac_cv_header_X11_extensions_xidle_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_scrnsaver_h=no
+ac_cv_header_X11_extensions_xidle_h=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_scrnsaver_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_scrnsaver_h" >&6
-if test $ac_cv_header_X11_extensions_scrnsaver_h = yes; then
-  have_mit=yes
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xidle_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_xidle_h" >&6
+if test $ac_cv_header_X11_extensions_xidle_h = yes; then
+  have_xidle=yes
+                     cat >>confdefs.h <<\_ACEOF
+#define HAVE_XIDLE_EXTENSION 1
+_ACEOF
+
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
+elif test "$with_xidle" != no; then
+  echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
+  exit 1
+fi
 
-  # Now check to see if it's really in the library; XF86Free-3.3 ships
-  # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
-  #
-  if test "$have_mit" = yes; then
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
 
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  # note: $X_CFLAGS includes $x_includes
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+###############################################################################
+#
+#       Check for the SGI-VIDEO-CONTROL server extension.
+#
+###############################################################################
 
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+have_sgivc=no
+with_sgivc_req=unspecified
 
-  echo "$as_me:$LINENO: checking for XScreenSaverRegister in -lXext" >&5
-echo $ECHO_N "checking for XScreenSaverRegister in -lXext... $ECHO_C" >&6
-if test "${ac_cv_lib_Xext_XScreenSaverRegister+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
+# Check whether --with-sgivc-ext or --without-sgivc-ext was given.
+if test "${with_sgivc_ext+set}" = set; then
+  withval="$with_sgivc_ext"
+  with_sgivc="$withval"; with_sgivc_req="$withval"
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext -lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
+  with_sgivc=yes
+fi;
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char XScreenSaverRegister ();
-int
-main ()
-{
-XScreenSaverRegister ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_Xext_XScreenSaverRegister=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xext_XScreenSaverRegister=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XScreenSaverRegister" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XScreenSaverRegister" >&6
-if test $ac_cv_lib_Xext_XScreenSaverRegister = yes; then
-  true
-else
-  have_mit=no
-fi
+   case "$with_sgivc" in
+    yes) ;;
+    no)  ;;
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+    /*)
+     echo "$as_me:$LINENO: checking for SGI-VIDEO-CONTROL headers" >&5
+echo $ECHO_N "checking for SGI-VIDEO-CONTROL headers... $ECHO_C" >&6
+     d=$with_sgivc/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$as_me:$LINENO: result: $d" >&5
+echo "${ECHO_T}$d" >&6
+     else
+       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
+echo "${ECHO_T}not found ($d: no such directory)" >&6
+     fi
+
+     echo "$as_me:$LINENO: checking for SGI-VIDEO-CONTROL libs" >&5
+echo $ECHO_N "checking for SGI-VIDEO-CONTROL libs... $ECHO_C" >&6
+     d=$with_sgivc/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$as_me:$LINENO: result: $d" >&5
+echo "${ECHO_T}$d" >&6
+     else
+       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
+echo "${ECHO_T}not found ($d: no such directory)" >&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgivc_req="yes"
+     with_sgivc=$with_sgivc_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgivc-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
 
 
-    if test "$have_mit" = no; then
-      # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
-      # of in Xext.  Thank you master, may I have another.
+if test "$with_sgivc" = yes; then
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
+  # first check for XSGIvc.h
 
+  ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for XScreenSaverRegister in -lXExExt" >&5
-echo $ECHO_N "checking for XScreenSaverRegister in -lXExExt... $ECHO_C" >&6
-if test "${ac_cv_lib_XExExt_XScreenSaverRegister+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/extensions/XSGIvc.h" >&5
+echo $ECHO_N "checking for X11/extensions/XSGIvc.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_XSGIvc_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXExExt -lX11 -lXext -lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#include <X11/Xlib.h>
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char XScreenSaverRegister ();
-int
-main ()
-{
-XScreenSaverRegister ();
-  ;
-  return 0;
-}
+#include <X11/extensions/XSGIvc.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10040,42 +10294,33 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_XExExt_XScreenSaverRegister=yes
+  ac_cv_header_X11_extensions_XSGIvc_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_XExExt_XScreenSaverRegister=no
+ac_cv_header_X11_extensions_XSGIvc_h=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_XExExt_XScreenSaverRegister" >&5
-echo "${ECHO_T}$ac_cv_lib_XExExt_XScreenSaverRegister" >&6
-if test $ac_cv_lib_XExExt_XScreenSaverRegister = yes; then
-  have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"
-else
-  true
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_XSGIvc_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_XSGIvc_h" >&6
+if test $ac_cv_header_X11_extensions_XSGIvc_h = yes; then
+  have_sgivc=yes
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
 
-    fi
+  CPPFLAGS="$ac_save_CPPFLAGS"
 
-    if test "$have_mit" = no; then
-      # Double fuck!  Looks like some versions of XFree86 (whichever version
-      # it is that comes with RedHat Linux 2.0 -- I can't find a version
-      # number) put this garbage in Xss instead of Xext.  Thank you master,
-      #  may I have another.
+  # if that succeeded, then check for the -lXsgivc
+  if test "$have_sgivc" = yes; then
+    have_sgivc=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
   # note: $X_LIBS includes $x_libraries
   LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  echo "$as_me:$LINENO: checking for XScreenSaverRegister in -lXss" >&5
-echo $ECHO_N "checking for XScreenSaverRegister in -lXss... $ECHO_C" >&6
-if test "${ac_cv_lib_Xss_XScreenSaverRegister+set}" = set; then
+  echo "$as_me:$LINENO: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
+echo $ECHO_N "checking for XSGIvcQueryGammaMap in -lXsgivc... $ECHO_C" >&6
+if test "${ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXss -lX11 -lXext -lm $LIBS"
+LIBS="-lXsgivc -lXext -lX11 $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10113,11 +10358,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XScreenSaverRegister ();
+char XSGIvcQueryGammaMap ();
 int
 main ()
 {
-XScreenSaverRegister ();
+XSGIvcQueryGammaMap ();
   ;
   return 0;
 }
@@ -10144,21 +10389,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xss_XScreenSaverRegister=yes
+  ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xss_XScreenSaverRegister=no
+ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xss_XScreenSaverRegister" >&5
-echo "${ECHO_T}$ac_cv_lib_Xss_XScreenSaverRegister" >&6
-if test $ac_cv_lib_Xss_XScreenSaverRegister = yes; then
-  have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&5
+echo "${ECHO_T}$ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&6
+if test $ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap = yes; then
+  have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"
 else
   true
 fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
+  fi
 
-  if test "$have_mit" = yes; then
+  # if that succeeded, then we've really got it.
+  if test "$have_sgivc" = yes; then
     cat >>confdefs.h <<\_ACEOF
-#define HAVE_MIT_SAVER_EXTENSION 1
+#define HAVE_SGI_VC_EXTENSION 1
 _ACEOF
 
   fi
 
-  fi
-
-elif test "$with_mit" != no; then
-  echo "error: must be yes or no: --with-mit-ext=$with_mit"
+elif test "$with_sgivc" != no; then
+  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the XIDLE server extension.
+#       Check for the DPMS server extension.
 #
 ###############################################################################
 
-have_xidle=no
-with_xidle_req=unspecified
+have_dpms=no
+with_dpms_req=unspecified
 
-# Check whether --with-xidle-ext or --without-xidle-ext was given.
-if test "${with_xidle_ext+set}" = set; then
-  withval="$with_xidle_ext"
-  with_xidle="$withval"; with_xidle_req="$withval"
+# Check whether --with-dpms-ext or --without-dpms-ext was given.
+if test "${with_dpms_ext+set}" = set; then
+  withval="$with_dpms_ext"
+  with_dpms="$withval"; with_dpms_req="$withval"
 else
-  with_xidle=yes
+  with_dpms=yes
 fi;
 
 
-   case "$with_xidle" in
+   case "$with_dpms" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for XIDLE headers" >&5
-echo $ECHO_N "checking for XIDLE headers... $ECHO_C" >&6
-     d=$with_xidle/include
+     echo "$as_me:$LINENO: checking for DPMS headers" >&5
+echo $ECHO_N "checking for DPMS headers... $ECHO_C" >&6
+     d=$with_dpms/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10219,9 +10463,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for XIDLE libs" >&5
-echo $ECHO_N "checking for XIDLE libs... $ECHO_C" >&6
-     d=$with_xidle/lib
+     echo "$as_me:$LINENO: checking for DPMS libs" >&5
+echo $ECHO_N "checking for DPMS libs... $ECHO_C" >&6
+     d=$with_dpms/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10232,13 +10476,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_xidle_req="yes"
-     with_xidle=$with_xidle_req
+     with_dpms_req="yes"
+     with_dpms=$with_dpms_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xidle-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -10246,16 +10490,18 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_xidle" = yes; then
+if test "$with_dpms" = yes; then
+
+  # first check for dpms.h
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/xidle.h" >&5
-echo $ECHO_N "checking for X11/extensions/xidle.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_xidle_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/extensions/dpms.h" >&5
+echo $ECHO_N "checking for X11/extensions/dpms.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_dpms_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10265,8 +10511,9 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
+                    #include <X11/Xmd.h>
 
-#include <X11/extensions/xidle.h>
+#include <X11/extensions/dpms.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -10290,122 +10537,78 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_xidle_h=yes
+  ac_cv_header_X11_extensions_dpms_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_xidle_h=no
+ac_cv_header_X11_extensions_dpms_h=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xidle_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_xidle_h" >&6
-if test $ac_cv_header_X11_extensions_xidle_h = yes; then
-  have_xidle=yes
-                     cat >>confdefs.h <<\_ACEOF
-#define HAVE_XIDLE_EXTENSION 1
-_ACEOF
-
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_dpms_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_dpms_h" >&6
+if test $ac_cv_header_X11_extensions_dpms_h = yes; then
+  have_dpms=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-elif test "$with_xidle" != no; then
-  echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
-  exit 1
-fi
 
+  # if that succeeded, then check for the DPMS code in the libraries
+  if test "$have_dpms" = yes; then
 
-###############################################################################
-#
-#       Check for the SGI-VIDEO-CONTROL server extension.
-#
-###############################################################################
-
-have_sgivc=no
-with_sgivc_req=unspecified
+    # first look in -lXext (this is where it is with XFree86 4.0)
+    have_dpms=no
 
-# Check whether --with-sgivc-ext or --without-sgivc-ext was given.
-if test "${with_sgivc_ext+set}" = set; then
-  withval="$with_sgivc_ext"
-  with_sgivc="$withval"; with_sgivc_req="$withval"
-else
-  with_sgivc=yes
-fi;
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
 
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
-   case "$with_sgivc" in
-    yes) ;;
-    no)  ;;
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-    /*)
-     echo "$as_me:$LINENO: checking for SGI-VIDEO-CONTROL headers" >&5
-echo $ECHO_N "checking for SGI-VIDEO-CONTROL headers... $ECHO_C" >&6
-     d=$with_sgivc/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     echo "$as_me:$LINENO: checking for SGI-VIDEO-CONTROL libs" >&5
-echo $ECHO_N "checking for SGI-VIDEO-CONTROL libs... $ECHO_C" >&6
-     d=$with_sgivc/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     # replace the directory string with "yes".
-     with_sgivc_req="yes"
-     with_sgivc=$with_sgivc_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-sgivc-ext must be \"yes\", \"no\", or a directory."
-     echo "       If it is a directory, then \`DIR/include' will be added to"
-     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
-     exit 1
-     ;;
-   esac
-
-
-if test "$with_sgivc" = yes; then
-
-  # first check for XSGIvc.h
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/XSGIvc.h" >&5
-echo $ECHO_N "checking for X11/extensions/XSGIvc.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_XSGIvc_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for DPMSInfo in -lXext" >&5
+echo $ECHO_N "checking for DPMSInfo in -lXext... $ECHO_C" >&6
+if test "${ac_cv_lib_Xext_DPMSInfo+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext -lXext -lX11 $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Xlib.h>
 
-#include <X11/extensions/XSGIvc.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char DPMSInfo ();
+int
+main ()
+{
+DPMSInfo ();
+  ;
+  return 0;
+}
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -10419,33 +10622,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
+        { ac_try='test -s conftest$ac_exeext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_XSGIvc_h=yes
+  ac_cv_lib_Xext_DPMSInfo=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_XSGIvc_h=no
+ac_cv_lib_Xext_DPMSInfo=no
 fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_XSGIvc_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_XSGIvc_h" >&6
-if test $ac_cv_header_X11_extensions_XSGIvc_h = yes; then
-  have_sgivc=yes
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_DPMSInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_DPMSInfo" >&6
+if test $ac_cv_lib_Xext_DPMSInfo = yes; then
+  have_dpms=yes
+else
+  true
 fi
 
-
   CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-  # if that succeeded, then check for the -lXsgivc
-  if test "$have_sgivc" = yes; then
-    have_sgivc=no
+
+    # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
+    if test "$have_dpms" = no; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
   # note: $X_LIBS includes $x_libraries
   LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  echo "$as_me:$LINENO: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
-echo $ECHO_N "checking for XSGIvcQueryGammaMap in -lXsgivc... $ECHO_C" >&6
-if test "${ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap+set}" = set; then
+  echo "$as_me:$LINENO: checking for DPMSInfo in -lXdpms" >&5
+echo $ECHO_N "checking for DPMSInfo in -lXdpms... $ECHO_C" >&6
+if test "${ac_cv_lib_Xdpms_DPMSInfo+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXsgivc -lXext -lX11 $LIBS"
+LIBS="-lXdpms -lXext -lX11 $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10483,11 +10691,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XSGIvcQueryGammaMap ();
+char DPMSInfo ();
 int
 main ()
 {
-XSGIvcQueryGammaMap ();
+DPMSInfo ();
   ;
   return 0;
 }
@@ -10514,21 +10722,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=yes
+  ac_cv_lib_Xdpms_DPMSInfo=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap=no
+ac_cv_lib_Xdpms_DPMSInfo=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&5
-echo "${ECHO_T}$ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap" >&6
-if test $ac_cv_lib_Xsgivc_XSGIvcQueryGammaMap = yes; then
-  have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5
+echo "${ECHO_T}$ac_cv_lib_Xdpms_DPMSInfo" >&6
+if test $ac_cv_lib_Xdpms_DPMSInfo = yes; then
+  have_dpms=yes; XDPMS_LIBS="-lXdpms"
 else
   true
 fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
+    fi
   fi
 
+
   # if that succeeded, then we've really got it.
-  if test "$have_sgivc" = yes; then
+  if test "$have_dpms" = yes; then
     cat >>confdefs.h <<\_ACEOF
-#define HAVE_SGI_VC_EXTENSION 1
+#define HAVE_DPMS_EXTENSION 1
 _ACEOF
 
   fi
 
-elif test "$with_sgivc" != no; then
-  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
+elif test "$with_dpms" != no; then
+  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the DPMS server extension.
+#       Check for the XINERAMA server extension.
 #
 ###############################################################################
 
-have_dpms=no
-with_dpms_req=unspecified
+have_xinerama=no
+with_xinerama_req=unspecified
 
-# Check whether --with-dpms-ext or --without-dpms-ext was given.
-if test "${with_dpms_ext+set}" = set; then
-  withval="$with_dpms_ext"
-  with_dpms="$withval"; with_dpms_req="$withval"
+# Check whether --with-xinerama-ext or --without-xinerama-ext was given.
+if test "${with_xinerama_ext+set}" = set; then
+  withval="$with_xinerama_ext"
+  with_xinerama="$withval"; with_xinerama_req="$withval"
 else
-  with_dpms=yes
+  with_xinerama=yes
 fi;
 
 
-   case "$with_dpms" in
+   case "$with_xinerama" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for DPMS headers" >&5
-echo $ECHO_N "checking for DPMS headers... $ECHO_C" >&6
-     d=$with_dpms/include
+     echo "$as_me:$LINENO: checking for XINERAMA headers" >&5
+echo $ECHO_N "checking for XINERAMA headers... $ECHO_C" >&6
+     d=$with_xinerama/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10588,9 +10798,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for DPMS libs" >&5
-echo $ECHO_N "checking for DPMS libs... $ECHO_C" >&6
-     d=$with_dpms/lib
+     echo "$as_me:$LINENO: checking for XINERAMA libs" >&5
+echo $ECHO_N "checking for XINERAMA libs... $ECHO_C" >&6
+     d=$with_xinerama/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10601,13 +10811,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_dpms_req="yes"
-     with_dpms=$with_dpms_req
+     with_xinerama_req="yes"
+     with_xinerama=$with_xinerama_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xinerama-ext must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -10615,18 +10825,18 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_dpms" = yes; then
+if test "$with_xinerama" = yes; then
 
-  # first check for dpms.h
+  # first check for Xinerama.h
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/dpms.h" >&5
-echo $ECHO_N "checking for X11/extensions/dpms.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_dpms_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/extensions/Xinerama.h" >&5
+echo $ECHO_N "checking for X11/extensions/Xinerama.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_Xinerama_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10636,9 +10846,8 @@ cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
-                    #include <X11/Xmd.h>
 
-#include <X11/extensions/dpms.h>
+#include <X11/extensions/Xinerama.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -10662,29 +10871,29 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_dpms_h=yes
+  ac_cv_header_X11_extensions_Xinerama_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_dpms_h=no
+ac_cv_header_X11_extensions_Xinerama_h=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_dpms_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_dpms_h" >&6
-if test $ac_cv_header_X11_extensions_dpms_h = yes; then
-  have_dpms=yes
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_Xinerama_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_Xinerama_h" >&6
+if test $ac_cv_header_X11_extensions_Xinerama_h = yes; then
+  have_xinerama=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for the DPMS code in the libraries
-  if test "$have_dpms" = yes; then
+  # if that succeeded, then check for the XINERAMA code in the libraries
+  if test "$have_xinerama" = yes; then
 
-    # first look in -lXext (this is where it is with XFree86 4.0)
-    have_dpms=no
+    # first look in -lXext
+    have_xinerama=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -10702,9 +10911,9 @@ fi
   # note: $X_LIBS includes $x_libraries
   LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  echo "$as_me:$LINENO: checking for DPMSInfo in -lXext" >&5
-echo $ECHO_N "checking for DPMSInfo in -lXext... $ECHO_C" >&6
-if test "${ac_cv_lib_Xext_DPMSInfo+set}" = set; then
+  echo "$as_me:$LINENO: checking for XineramaQueryScreens in -lXext" >&5
+echo $ECHO_N "checking for XineramaQueryScreens in -lXext... $ECHO_C" >&6
+if test "${ac_cv_lib_Xext_XineramaQueryScreens+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
@@ -10722,11 +10931,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char DPMSInfo ();
+char XineramaQueryScreens ();
 int
 main ()
 {
-DPMSInfo ();
+XineramaQueryScreens ();
   ;
   return 0;
 }
@@ -10753,21 +10962,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xext_DPMSInfo=yes
+  ac_cv_lib_Xext_XineramaQueryScreens=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xext_DPMSInfo=no
+ac_cv_lib_Xext_XineramaQueryScreens=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_DPMSInfo" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_DPMSInfo" >&6
-if test $ac_cv_lib_Xext_DPMSInfo = yes; then
-  have_dpms=yes
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5
+echo "${ECHO_T}$ac_cv_lib_Xext_XineramaQueryScreens" >&6
+if test $ac_cv_lib_Xext_XineramaQueryScreens = yes; then
+  have_xinerama=yes
 else
   true
 fi
@@ -10777,8 +10986,8 @@ fi
 #  LIBS="$ac_save_LIBS"
 
 
-    # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
-    if test "$have_dpms" = no; then
+    # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.)
+    if test "$have_xinerama" = no; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
   # note: $X_LIBS includes $x_libraries
   LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  echo "$as_me:$LINENO: checking for DPMSInfo in -lXdpms" >&5
-echo $ECHO_N "checking for DPMSInfo in -lXdpms... $ECHO_C" >&6
-if test "${ac_cv_lib_Xdpms_DPMSInfo+set}" = set; then
+  echo "$as_me:$LINENO: checking for XineramaQueryScreens in -lXinerama" >&5
+echo $ECHO_N "checking for XineramaQueryScreens in -lXinerama... $ECHO_C" >&6
+if test "${ac_cv_lib_Xinerama_XineramaQueryScreens+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXdpms -lXext -lX11 $LIBS"
+LIBS="-lXinerama -lXext -lX11 $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -10816,11 +11025,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char DPMSInfo ();
+char XineramaQueryScreens ();
 int
 main ()
 {
-DPMSInfo ();
+XineramaQueryScreens ();
   ;
   return 0;
 }
@@ -10847,21 +11056,21 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xdpms_DPMSInfo=yes
+  ac_cv_lib_Xinerama_XineramaQueryScreens=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xdpms_DPMSInfo=no
+ac_cv_lib_Xinerama_XineramaQueryScreens=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5
-echo "${ECHO_T}$ac_cv_lib_Xdpms_DPMSInfo" >&6
-if test $ac_cv_lib_Xdpms_DPMSInfo = yes; then
-  have_dpms=yes; XDPMS_LIBS="-lXdpms"
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5
+echo "${ECHO_T}$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6
+if test $ac_cv_lib_Xinerama_XineramaQueryScreens = yes; then
+  have_xinerama=yes; XINERAMA_LIBS="-lXinerama"
 else
   true
 fi
     fi
   fi
 
-
   # if that succeeded, then we've really got it.
-  if test "$have_dpms" = yes; then
+  if test "$have_xinerama" = yes; then
     cat >>confdefs.h <<\_ACEOF
-#define HAVE_DPMS_EXTENSION 1
+#define HAVE_XINERAMA 1
 _ACEOF
 
   fi
 
-elif test "$with_dpms" != no; then
-  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
+elif test "$with_xinerama" != no; then
+  echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the XINERAMA server extension.
+#       Check for the XF86VMODE server extension (for virtual screens.)
 #
 ###############################################################################
 
-have_xinerama=no
-with_xinerama_req=unspecified
+have_xf86vmode=no
+with_xf86vmode_req=unspecified
 
-# Check whether --with-xinerama-ext or --without-xinerama-ext was given.
-if test "${with_xinerama_ext+set}" = set; then
-  withval="$with_xinerama_ext"
-  with_xinerama="$withval"; with_xinerama_req="$withval"
+# Check whether --with-xf86vmode-ext or --without-xf86vmode-ext was given.
+if test "${with_xf86vmode_ext+set}" = set; then
+  withval="$with_xf86vmode_ext"
+  with_xf86vmode="$withval"; with_xf86vmode_req="$withval"
 else
-  with_xinerama=yes
+  with_xf86vmode=yes
 fi;
 
 
-   case "$with_xinerama" in
+   case "$with_xf86vmode" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for XINERAMA headers" >&5
-echo $ECHO_N "checking for XINERAMA headers... $ECHO_C" >&6
-     d=$with_xinerama/include
+     echo "$as_me:$LINENO: checking for xf86vmode headers" >&5
+echo $ECHO_N "checking for xf86vmode headers... $ECHO_C" >&6
+     d=$with_xf86vmode/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10923,9 +11131,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for XINERAMA libs" >&5
-echo $ECHO_N "checking for XINERAMA libs... $ECHO_C" >&6
-     d=$with_xinerama/lib
+     echo "$as_me:$LINENO: checking for xf86vmode libs" >&5
+echo $ECHO_N "checking for xf86vmode libs... $ECHO_C" >&6
+     d=$with_xf86vmode/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -10936,13 +11144,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_xinerama_req="yes"
-     with_xinerama=$with_xinerama_req
+     with_xf86vmode_req="yes"
+     with_xf86vmode=$with_xf86vmode_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xinerama-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xf86vmode-ext must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -10950,18 +11158,20 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_xinerama" = yes; then
+VIDMODE_LIBS=""
 
-  # first check for Xinerama.h
+if test "$with_xf86vmode" = yes; then
+
+  # first check for xf86vmode.h
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/Xinerama.h" >&5
-echo $ECHO_N "checking for X11/extensions/Xinerama.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_Xinerama_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/extensions/xf86vmode.h" >&5
+echo $ECHO_N "checking for X11/extensions/xf86vmode.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_extensions_xf86vmode_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
@@ -10972,7 +11182,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <X11/Xlib.h>
 
-#include <X11/extensions/Xinerama.h>
+#include <X11/extensions/xf86vmode.h>
 _ACEOF
 rm -f conftest.$ac_objext
 if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
@@ -10996,123 +11206,27 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_Xinerama_h=yes
+  ac_cv_header_X11_extensions_xf86vmode_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_X11_extensions_Xinerama_h=no
+ac_cv_header_X11_extensions_xf86vmode_h=no
 fi
 rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_Xinerama_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_Xinerama_h" >&6
-if test $ac_cv_header_X11_extensions_Xinerama_h = yes; then
-  have_xinerama=yes
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xf86vmode_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_extensions_xf86vmode_h" >&6
+if test $ac_cv_header_X11_extensions_xf86vmode_h = yes; then
+  have_xf86vmode=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for the XINERAMA code in the libraries
-  if test "$have_xinerama" = yes; then
-
-    # first look in -lXext
-    have_xinerama=no
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
-
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  # note: $X_CFLAGS includes $x_includes
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for XineramaQueryScreens in -lXext" >&5
-echo $ECHO_N "checking for XineramaQueryScreens in -lXext... $ECHO_C" >&6
-if test "${ac_cv_lib_Xext_XineramaQueryScreens+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext -lXext -lX11 $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char XineramaQueryScreens ();
-int
-main ()
-{
-XineramaQueryScreens ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_Xext_XineramaQueryScreens=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xext_XineramaQueryScreens=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5
-echo "${ECHO_T}$ac_cv_lib_Xext_XineramaQueryScreens" >&6
-if test $ac_cv_lib_Xext_XineramaQueryScreens = yes; then
-  have_xinerama=yes
-else
-  true
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-
-    # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.)
-    if test "$have_xinerama" = no; then
+  # if that succeeded, then check for the -lXxf86vm
+  if test "$have_xf86vmode" = yes; then
+    have_xf86vmode=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
   # note: $X_LIBS includes $x_libraries
   LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  echo "$as_me:$LINENO: checking for XineramaQueryScreens in -lXinerama" >&5
-echo $ECHO_N "checking for XineramaQueryScreens in -lXinerama... $ECHO_C" >&6
-if test "${ac_cv_lib_Xinerama_XineramaQueryScreens+set}" = set; then
+  echo "$as_me:$LINENO: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5
+echo $ECHO_N "checking for XF86VidModeGetViewPort in -lXxf86vm... $ECHO_C" >&6
+if test "${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXinerama -lXext -lX11 $LIBS"
+LIBS="-lXxf86vm -lXext -lX11 $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11150,11 +11264,11 @@ extern "C"
 #endif
 /* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
-char XineramaQueryScreens ();
+char XF86VidModeGetViewPort ();
 int
 main ()
 {
-XineramaQueryScreens ();
+XF86VidModeGetViewPort ();
   ;
   return 0;
 }
@@ -11181,21 +11295,23 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_Xinerama_XineramaQueryScreens=yes
+  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xinerama_XineramaQueryScreens=no
+ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no
 fi
 rm -f conftest.err conftest.$ac_objext \
       conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5
-echo "${ECHO_T}$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6
-if test $ac_cv_lib_Xinerama_XineramaQueryScreens = yes; then
-  have_xinerama=yes; SAVER_LIBS="$SAVER_LIBS -lXinerama"
+echo "$as_me:$LINENO: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5
+echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6
+if test $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort = yes; then
+  have_xf86vmode=yes;
+                   VIDMODE_LIBS="-lXxf86vm";
+                   SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"
 else
   true
 fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
   fi
 
   # if that succeeded, then we've really got it.
-  if test "$have_xinerama" = yes; then
+  if test "$have_xf86vmode" = yes; then
     cat >>confdefs.h <<\_ACEOF
-#define HAVE_XINERAMA 1
+#define HAVE_XF86VMODE 1
 _ACEOF
 
   fi
 
-elif test "$with_xinerama" != no; then
-  echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
+elif test "$with_xf86vmode" != no; then
+  echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the XF86VMODE server extension (for virtual screens.)
+#       Check for the XF86VMODE server extension (for gamma fading.)
 #
 ###############################################################################
 
-have_xf86vmode=no
-with_xf86vmode_req=unspecified
+have_xf86gamma=no
+have_xf86gamma_ramp=no
+with_xf86gamma_req=unspecified
 
-# Check whether --with-xf86vmode-ext or --without-xf86vmode-ext was given.
-if test "${with_xf86vmode_ext+set}" = set; then
-  withval="$with_xf86vmode_ext"
-  with_xf86vmode="$withval"; with_xf86vmode_req="$withval"
+# Check whether --with-xf86gamma-ext or --without-xf86gamma-ext was given.
+if test "${with_xf86gamma_ext+set}" = set; then
+  withval="$with_xf86gamma_ext"
+  with_xf86gamma="$withval"; with_xf86gamma_req="$withval"
 else
-  with_xf86vmode=yes
+  with_xf86gamma=yes
 fi;
 
 
-   case "$with_xf86vmode" in
+   case "$with_xf86gamma" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for xf86vmode headers" >&5
-echo $ECHO_N "checking for xf86vmode headers... $ECHO_C" >&6
-     d=$with_xf86vmode/include
+     echo "$as_me:$LINENO: checking for xf86gamma headers" >&5
+echo $ECHO_N "checking for xf86gamma headers... $ECHO_C" >&6
+     d=$with_xf86gamma/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -11256,9 +11372,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for xf86vmode libs" >&5
-echo $ECHO_N "checking for xf86vmode libs... $ECHO_C" >&6
-     d=$with_xf86vmode/lib
+     echo "$as_me:$LINENO: checking for xf86gamma libs" >&5
+echo $ECHO_N "checking for xf86gamma libs... $ECHO_C" >&6
+     d=$with_xf86gamma/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -11269,13 +11385,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_xf86vmode_req="yes"
-     with_xf86vmode=$with_xf86vmode_req
+     with_xf86gamma_req="yes"
+     with_xf86gamma=$with_xf86gamma_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xf86vmode-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xf86gamma-ext must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -11283,11 +11399,12 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-VIDMODE_LIBS=""
-
-if test "$with_xf86vmode" = yes; then
+if test "$with_xf86gamma" = yes; then
 
-  # first check for xf86vmode.h
+  # first check for xf86vmode.h, if we haven't already
+  if test "$have_xf86vmode" = yes; then
+    have_xf86gamma=yes
+  else
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
 echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xf86vmode_h" >&5
 echo "${ECHO_T}$ac_cv_header_X11_extensions_xf86vmode_h" >&6
 if test $ac_cv_header_X11_extensions_xf86vmode_h = yes; then
-  have_xf86vmode=yes
+  have_xf86gamma=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-
-  # if that succeeded, then check for the -lXxf86vm
-  if test "$have_xf86vmode" = yes; then
-    have_xf86vmode=no
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
-
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  # note: $X_CFLAGS includes $x_includes
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5
-echo $ECHO_N "checking for XF86VidModeGetViewPort in -lXxf86vm... $ECHO_C" >&6
-if test "${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXxf86vm -lXext -lX11 $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char XF86VidModeGetViewPort ();
-int
-main ()
-{
-XF86VidModeGetViewPort ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5
-echo "${ECHO_T}$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6
-if test $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort = yes; then
-  have_xf86vmode=yes;
-                   VIDMODE_LIBS="-lXxf86vm";
-                   SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"
-else
-  true
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-  fi
-
-  # if that succeeded, then we've really got it.
-  if test "$have_xf86vmode" = yes; then
-    cat >>confdefs.h <<\_ACEOF
-#define HAVE_XF86VMODE 1
-_ACEOF
-
-  fi
-
-elif test "$with_xf86vmode" != no; then
-  echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
-  exit 1
-fi
-
-
-###############################################################################
-#
-#       Check for the XF86VMODE server extension (for gamma fading.)
-#
-###############################################################################
-
-have_xf86gamma=no
-have_xf86gamma_ramp=no
-with_xf86gamma_req=unspecified
-
-# Check whether --with-xf86gamma-ext or --without-xf86gamma-ext was given.
-if test "${with_xf86gamma_ext+set}" = set; then
-  withval="$with_xf86gamma_ext"
-  with_xf86gamma="$withval"; with_xf86gamma_req="$withval"
-else
-  with_xf86gamma=yes
-fi;
-
-
-   case "$with_xf86gamma" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     echo "$as_me:$LINENO: checking for xf86gamma headers" >&5
-echo $ECHO_N "checking for xf86gamma headers... $ECHO_C" >&6
-     d=$with_xf86gamma/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     echo "$as_me:$LINENO: checking for xf86gamma libs" >&5
-echo $ECHO_N "checking for xf86gamma libs... $ECHO_C" >&6
-     d=$with_xf86gamma/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     # replace the directory string with "yes".
-     with_xf86gamma_req="yes"
-     with_xf86gamma=$with_xf86gamma_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-xf86gamma-ext must be \"yes\", \"no\", or a directory."
-     echo "       If it is a directory, then \`DIR/include' will be added to"
-     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
-     exit 1
-     ;;
-   esac
-
-
-if test "$with_xf86gamma" = yes; then
-
-  # first check for xf86vmode.h, if we haven't already
-  if test "$have_xf86vmode" = yes; then
-    have_xf86gamma=yes
-  else
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/extensions/xf86vmode.h" >&5
-echo $ECHO_N "checking for X11/extensions/xf86vmode.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_extensions_xf86vmode_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-
-#include <X11/extensions/xf86vmode.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_X11_extensions_xf86vmode_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_X11_extensions_xf86vmode_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_extensions_xf86vmode_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_extensions_xf86vmode_h" >&6
-if test $ac_cv_header_X11_extensions_xf86vmode_h = yes; then
-  have_xf86gamma=yes
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  fi
+  fi
 
   # if that succeeded, then check for the -lXxf86vm
   if test "$have_xf86gamma" = yes; then
@@ -12411,13 +12286,20 @@ fi;
 
 if test "$with_proc_interrupts" = yes; then
 
+  # Note that we may be building in an environment (e.g. Debian buildd chroot)
+  # without a proper /proc filesystem. If /proc/interrupts exists, then we'll
+  # check that it has the bits we need, but otherwise we'll just go on faith.
+  #
+  have_proc_interrupts=yes
+
+  if test -f /proc/interrupts; then
    echo "$as_me:$LINENO: checking whether /proc/interrupts contains keyboard data" >&5
 echo $ECHO_N "checking whether /proc/interrupts contains keyboard data... $ECHO_C" >&6
 if test "${ac_cv_have_proc_interrupts+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_have_proc_interrupts=no
-     if grep keyboard /proc/interrupts >/dev/null 2>&1 ; then
+     if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then
        ac_cv_have_proc_interrupts=yes
      fi
 
@@ -12425,6 +12307,7 @@ fi
 echo "$as_me:$LINENO: result: $ac_cv_have_proc_interrupts" >&5
 echo "${ECHO_T}$ac_cv_have_proc_interrupts" >&6
    have_proc_interrupts=$ac_cv_have_proc_interrupts
+  fi
 
   if test "$have_proc_interrupts" = yes; then
     cat >>confdefs.h <<\_ACEOF
 
 ###############################################################################
 #
-#       The --enable-vt-locking option
+#       Whether to allow root password to unblank.
 #
 ###############################################################################
+# Check whether --enable-root-passwd or --disable-root-passwd was given.
+if test "${enable_root_passwd+set}" = set; then
+  enableval="$enable_root_passwd"
+  enable_root_passwd="$enableval"
+else
+  enable_root_passwd=yes
+fi;
+if test "$enable_root_passwd" = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define ALLOW_ROOT_PASSWD 1
+_ACEOF
 
-#ac_vt_lockswitch=no
-#AC_ARG_ENABLE(vt-locking,[
-#  --enable-vt-locking     Compile in support for locking Virtual Terminals.
-#                          This is the default if the system supports it, and
-#                          if locking support is included (--enable-locking.)
-#  --disable-vt-locking    Do not allow locking of VTs, even if locking is
-#                          enabled.],
-#  [enable_vt_locking="$enableval"],[enable_vt_locking=yes])
-#if test "$enable_vt_locking" = yes; then
-#
-#  AC_CACHE_CHECK([for the VT_LOCKSWITCH ioctl], ac_cv_vt_lockswitch,
-#   [AC_TRY_COMPILE([#include <fcntl.h>
-#                   #include <sys/ioctl.h>
-#                   #include <sys/vt.h>],
-#                  [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;],
-#                  [ac_cv_vt_lockswitch=yes],
-#                  [ac_cv_vt_lockswitch=no])])
-#  ac_vt_lockswitch=$ac_cv_vt_lockswitch
-#
-#elif test "$enable_vt_locking" = no; then
-#  true
-#else
-#  echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking"
-#  exit 1
-#fi
-#
-#if test "$ac_vt_lockswitch" = yes; then
-#  AC_DEFINE(HAVE_VT_LOCKSWITCH)
-#  # the VT_LOCKSWITCH ioctl can only be used when running as root.
-#  # #### but it doesn't work yet, so don't worry about that for now.
-##  need_setuid=yes
-#fi
-
+  true
+elif test "$enable_root_passwd" != no; then
+  echo "error: something wrong with root-passwd option. Check configure.in ."
+  exit 1
+fi
 
 ###############################################################################
 #
@@ -12550,7 +12416,16 @@ else
 fi;
 
 
-   case "$with_pam" in
+# Check whether --with-pam_service_name or --without-pam_service_name was given.
+if test "${with_pam_service_name+set}" = set; then
+  withval="$with_pam_service_name"
+  pam_service_name="$withval"
+else
+  pam_service_name="xscreensaver"
+fi;
+
+
+   case "$with_pam" in
     yes) ;;
     no)  ;;
 
@@ -12661,6 +12536,11 @@ echo "${ECHO_T}$ac_cv_pam" >&6
 #define HAVE_PAM 1
 _ACEOF
 
+    cat >>confdefs.h <<_ACEOF
+#define PAM_SERVICE_NAME "$pam_service_name"
+_ACEOF
+
+
     PASSWD_LIBS="${PASSWD_LIBS} -lpam"
 
     # libpam typically requires dlopen and dlsym.  On FreeBSD,
@@ -12993,6 +12873,80 @@ echo "${ECHO_T}two arguments" >&6
       echo "$as_me:$LINENO: result: unknown" >&5
 echo "${ECHO_T}unknown" >&6
     fi
+
+# Check pam_fail_delay
+    echo "$as_me:$LINENO: checking pam_fail_delay in -lpam" >&5
+echo $ECHO_N "checking pam_fail_delay in -lpam... $ECHO_C" >&6
+    if test "${ac_cv_pam_fail_delay+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_LDFLAGS="$LDFLAGS"
+      LDFLAGS="-lpam"
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <security/pam_appl.h>
+int
+main ()
+{
+pam_handle_t *pamh = 0;
+                  unsigned int usec = 1;
+                  int status = pam_fail_delay (pamh, usec);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_pam_fail_delay=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_pam_fail_delay=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+      ac_cv_pam_fail_delay=$ac_pam_fail_delay,
+      LD_FLAGS=$ac_save_LDFLAGS
+fi
+
+
+      if test "$ac_pam_fail_delay" = yes ; then
+        echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+        cat >>confdefs.h <<\_ACEOF
+#define HAVE_PAM_FAIL_DELAY 1
+_ACEOF
+
+      else
+        echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+      fi
+
   fi
 fi
 
@@ -14601,30 +14555,157 @@ esac
 
 ###############################################################################
 #
-#       Check for -lXm.
+#       Check for a login manager for a "New Login" button on the lock dialog.
+#      Usually this will be "/usr/bin/gdmflexiserver".
 #
 ###############################################################################
 
-have_motif=no
-with_motif_req=unspecified
+have_login_manager=no
+with_login_manager_req=unspecified
+default_login_manager='gdmflexiserver -l'
 
-# Check whether --with-motif or --without-motif was given.
-if test "${with_motif+set}" = set; then
-  withval="$with_motif"
-  with_motif="$withval"; with_motif_req="$withval"
+
+# Check whether --with-login-manager or --without-login-manager was given.
+if test "${with_login_manager+set}" = set; then
+  withval="$with_login_manager"
+  with_login_manager="$withval"; with_login_manager_req="$withval"
 else
-  with_motif=no
+  with_login_manager=no
 fi;
+# no HANDLE_X_PATH_ARG for this one
 
+if test "$enable_locking" = no ; then
+  with_login_manager_req=no
+  with_login_manager=no
+fi
 
-   case "$with_motif" in
+if test -n "$with_login_manager_req" ; then
+  ac_cv_login_manager_program=""
+
+ if test "$with_login_manager_req" = "yes" ; then
+   with_login_manager_req=$default_login_manager
+ fi
+
+  case "$with_login_manager_req" in
+    /*)
+      # absolute path
+      set dummy $with_login_manager_req ; login_manager_tmp=$2
+      echo "$as_me:$LINENO: checking for $login_manager_tmp" >&5
+echo $ECHO_N "checking for $login_manager_tmp... $ECHO_C" >&6
+      if test -x "$login_manager_tmp" ; then
+        echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+      else
+        echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+        with_login_manager=""
+      fi
+    ;;
+    *)
+      # relative path
+      set dummy $with_login_manager_req ; login_manager_tmp=$2
+      # don't cache
+      unset ac_cv_path_login_manager_tmp
+      # Extract the first word of "$login_manager_tmp", so it can be a program name with args.
+set dummy $login_manager_tmp; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_login_manager_tmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  case $login_manager_tmp in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_login_manager_tmp="$login_manager_tmp" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  ;;
+esac
+fi
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+
+if test -n "$login_manager_tmp"; then
+  echo "$as_me:$LINENO: result: $login_manager_tmp" >&5
+echo "${ECHO_T}$login_manager_tmp" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+      if test -z "$login_manager_tmp" ; then
+        with_login_manager=""
+      else
+        with_login_manager="$login_manager_tmp"
+      fi
+    ;;
+  esac
+  ac_cv_login_manager_program="$with_login_manager"
+
+elif test -n "$ac_cv_login_manager_program"; then
+  echo "$as_me:$LINENO: result: checking for login_manager... (cached) $ac_cv_login_manager_program" >&5
+echo "${ECHO_T}checking for login_manager... (cached) $ac_cv_login_manager_program" >&6
+fi
+
+NEW_LOGIN_COMMAND_P=''
+NEW_LOGIN_COMMAND="$ac_cv_login_manager_program"
+
+if test -z "$NEW_LOGIN_COMMAND" ; then
+  NEW_LOGIN_COMMAND="$default_login_manager"
+  NEW_LOGIN_COMMAND_P='! '
+fi
+
+
+
+###############################################################################
+#
+#       Check for -lgtk (and Gnome stuff)
+#
+###############################################################################
+
+have_gtk=no
+with_gtk_req=unspecified
+
+# Check whether --with-gtk or --without-gtk was given.
+if test "${with_gtk+set}" = set; then
+  withval="$with_gtk"
+  with_gtk="$withval"; with_gtk_req="$withval"
+else
+  with_gtk=yes
+fi;
+
+# if --with-gtk=/directory/ was specified, remember that directory so that
+# we can also look for the `gtk-config' program in that directory.
+case "$with_gtk" in
+  /*)
+    gtk_dir="$with_gtk"
+    ;;
+  *)
+    gtk_dir=""
+    ;;
+esac
+
+
+   case "$with_gtk" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for Motif headers" >&5
-echo $ECHO_N "checking for Motif headers... $ECHO_C" >&6
-     d=$with_motif/include
+     echo "$as_me:$LINENO: checking for Gtk headers" >&5
+echo $ECHO_N "checking for Gtk headers... $ECHO_C" >&6
+     d=$with_gtk/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -14634,9 +14715,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for Motif libs" >&5
-echo $ECHO_N "checking for Motif libs... $ECHO_C" >&6
-     d=$with_motif/lib
+     echo "$as_me:$LINENO: checking for Gtk libs" >&5
+echo $ECHO_N "checking for Gtk libs... $ECHO_C" >&6
+     d=$with_gtk/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -14647,13 +14728,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_motif_req="yes"
-     with_motif=$with_motif_req
+     with_gtk_req="yes"
+     with_gtk=$with_gtk_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-motif must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-gtk must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -14661,902 +14742,177 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_motif" != yes -a "$with_motif" != no ; then
-  echo "error: must be yes or no: --with-motif=$with_motif"
+if test "$with_gtk" != yes -a "$with_gtk" != no ; then
+  echo "error: must be yes or no: --with-gtk=$with_gtk"
   exit 1
 fi
 
-if test "$with_motif" = yes; then
-  have_motif=no
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
+parse_gtk_version_string() {
+  # M4 sucks!!
+
+  maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'`
+  min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'`
+
+  ac_gtk_version=`echo "$maj * 1000 + $min" | bc`
+  if test -z "$ac_gtk_version"; then
+    ac_gtk_version=unknown
+    ac_gtk_version_string=unknown
   fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for Xm/Xm.h" >&5
-echo $ECHO_N "checking for Xm/Xm.h... $ECHO_C" >&6
-if test "${ac_cv_header_Xm_Xm_h+set}" = set; then
+}
+
+# Find pkg-config... (need this for both gtk and gdk_pixbuf.)
+# if the user specified --with-gtk=/foo/ then look there.
+#
+gtk_path="$PATH"
+if test ! -z "$gtk_dir"; then
+  # canonicalize slashes.
+  foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
+  gtk_path="$foo:$gtk_path"
+fi
+
+for ac_prog in pkg-config
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_pkg_config+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-                     #include <stdio.h>
-                     #include <X11/Intrinsic.h>
-
-#include <Xm/Xm.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_Xm_Xm_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_Xm_Xm_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_Xm_Xm_h" >&5
-echo "${ECHO_T}$ac_cv_header_Xm_Xm_h" >&6
-if test $ac_cv_header_Xm_Xm_h = yes; then
-  have_motif=yes
-                     cat >>confdefs.h <<\_ACEOF
-#define HAVE_MOTIF 1
-_ACEOF
-
-                     MOTIF_LIBS="$MOTIF_LIBS -lXm"
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-
-
-if test "$have_motif" = yes; then
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for Xm/ComboBox.h" >&5
-echo $ECHO_N "checking for Xm/ComboBox.h... $ECHO_C" >&6
-if test "${ac_cv_header_Xm_ComboBox_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-                     #include <stdio.h>
-                     #include <X11/Intrinsic.h>
-
-#include <Xm/ComboBox.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_Xm_ComboBox_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_Xm_ComboBox_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_Xm_ComboBox_h" >&5
-echo "${ECHO_T}$ac_cv_header_Xm_ComboBox_h" >&6
-if test $ac_cv_header_Xm_ComboBox_h = yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_XMCOMBOBOX 1
-_ACEOF
-
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-
-
-###############################################################################
-#
-#       Check for -lgtk (and Gnome stuff)
-#
-###############################################################################
-
-have_gtk=no
-have_gtk2=no
-with_gtk_req=unspecified
-
-# Check whether --with-gtk or --without-gtk was given.
-if test "${with_gtk+set}" = set; then
-  withval="$with_gtk"
-  with_gtk="$withval"; with_gtk_req="$withval"
-else
-  with_gtk=yes
-fi;
-
-# if --with-gtk=/directory/ was specified, remember that directory so that
-# we can also look for the `gtk-config' program in that directory.
-case "$with_gtk" in
-  /*)
-    gtk_dir="$with_gtk"
-    ;;
-  *)
-    gtk_dir=""
-    ;;
-esac
-
-
-   case "$with_gtk" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     echo "$as_me:$LINENO: checking for Gtk headers" >&5
-echo $ECHO_N "checking for Gtk headers... $ECHO_C" >&6
-     d=$with_gtk/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     echo "$as_me:$LINENO: checking for Gtk libs" >&5
-echo $ECHO_N "checking for Gtk libs... $ECHO_C" >&6
-     d=$with_gtk/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     # replace the directory string with "yes".
-     with_gtk_req="yes"
-     with_gtk=$with_gtk_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-gtk must be \"yes\", \"no\", or a directory."
-     echo "       If it is a directory, then \`DIR/include' will be added to"
-     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
-     exit 1
-     ;;
-   esac
-
-
-if test "$with_gtk" != yes -a "$with_gtk" != no ; then
-  echo "error: must be yes or no: --with-gtk=$with_gtk"
-  exit 1
-fi
-
-have_gnome=no
-with_gnome_req=unspecified
-
-# Check whether --with-gnome or --without-gnome was given.
-if test "${with_gnome+set}" = set; then
-  withval="$with_gnome"
-  with_gnome="$withval"; with_gnome_req="$withval"
-else
-  with_gnome=yes
-fi;
-
-# if --with-gnome=/directory/ was specified, remember that directory so that
-# we can also look for the `gnome-config' program in that directory.
-case "$with_gnome" in
-  /*)
-    gnome_dir="$with_gnome"
-    ;;
-  *)
-    gnome_dir=""
-    ;;
-esac
-
-
-   case "$with_gnome" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     echo "$as_me:$LINENO: checking for Gnome headers" >&5
-echo $ECHO_N "checking for Gnome headers... $ECHO_C" >&6
-     d=$with_gnome/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     echo "$as_me:$LINENO: checking for Gnome libs" >&5
-echo $ECHO_N "checking for Gnome libs... $ECHO_C" >&6
-     d=$with_gnome/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     # replace the directory string with "yes".
-     with_gnome_req="yes"
-     with_gnome=$with_gnome_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-gnome must be \"yes\", \"no\", or a directory."
-     echo "       If it is a directory, then \`DIR/include' will be added to"
-     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
-     exit 1
-     ;;
-   esac
-
-
-if test "$with_gnome" != yes -a "$with_gnome" != no ; then
-  echo "error: must be yes or no: --with-gnome=$with_gnome"
-  exit 1
-fi
-
-parse_gtk_version_string() {
-  # M4 sucks!!
-
-  maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'`
-  min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'`
-
-  ac_gtk_version=`echo "$maj * 1000 + $min" | bc`
-  if test -z "$ac_gtk_version"; then
-    ac_gtk_version=unknown
-    ac_gtk_version_string=unknown
-  fi
-}
-
-
-jurassic_gtk=no
-gtk2_halfassed=no
-
-if test "$with_gtk" = yes; then
-  have_gtk=no
-
-  # if the user specified --with-gtk=/foo/ or --with-gnome=/foo/ then
-  # look in /foo/bin/ for glib-config, gtk-config, and gnome-config.
-  #
-  gtk_path="$PATH"
-
-  if test ! -z "$gtk_dir"; then
-    # canonicalize slashes.
-    foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
-    gtk_path="$foo:$gtk_path"
-  fi
-
-  if test ! -z "$gnome_dir"; then
-    # canonicalize slashes.
-    foo=`echo "${gnome_dir}/bin" | sed 's@//*@/@g'`
-    gtk_path="$foo:$gtk_path"
-  fi
-
-  for ac_prog in pkg-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_pkg_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $pkg_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_pkg_config="$pkg_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $gtk_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  ;;
-esac
-fi
-pkg_config=$ac_cv_path_pkg_config
-
-if test -n "$pkg_config"; then
-  echo "$as_me:$LINENO: result: $pkg_config" >&5
-echo "${ECHO_T}$pkg_config" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$pkg_config" && break
-done
-
-
-  if test -n "$pkg_config" ; then
-    #
-    # the new way...
-    # run pkg-config based tests.
-    #
-    pkgs=''
-    pkg_check_version() {
-      if test "$ok" = yes ; then
-        req="$1"
-        min="$2"
-        echo "$as_me:$LINENO: checking for $req" >&5
-echo $ECHO_N "checking for $req... $ECHO_C" >&6
-        if $pkg_config --exists "$req" ; then
-          vers=`$pkg_config --modversion "$req"`
-          if $pkg_config --exists "$req >= $min" ; then
-            echo "$as_me:$LINENO: result: $vers" >&5
-echo "${ECHO_T}$vers" >&6
-            pkgs="$pkgs $req"
-            return 1
-          else
-            echo "$as_me:$LINENO: result: $vers (wanted >= $min)" >&5
-echo "${ECHO_T}$vers (wanted >= $min)" >&6
-            ok=no
-            return 0
-          fi
-        else
-          echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-          ok=no
-          return 0
-        fi
-      fi
-    }
-
-    echo "$as_me:$LINENO: result: checking for GTK 2.x with pkg-config based tests..." >&5
-echo "${ECHO_T}checking for GTK 2.x with pkg-config based tests..." >&6
-
-    ok="yes"
-    pkg_check_version       gtk+-2.0  2.0.1  ; ac_gtk_version_string="$vers"
-    pkg_check_version    gmodule-2.0  2.0.0
-    pkg_check_version     libxml-2.0  2.4.6
-    pkg_check_version   libglade-2.0  1.99.0
-#   pkg_check_version gdk_pixbuf      0.1
-    have_gtk="$ok"
-
-    if test "$have_gtk" = yes; then
-      have_gtk2=yes
-      cat >>confdefs.h <<\_ACEOF
-#define HAVE_GTK2 1
-_ACEOF
-
-    else
-      if test -n "$ac_gtk_version_string" ; then
-        gtk2_halfassed="$ac_gtk_version_string"
-        gtk2_halfassed_lib="$req"
-      fi
-    fi
-
-    if test "$have_gtk" = no; then
-      #
-      # we don't have GTK 2.  Let's look for GTK 1.
-      #
-      echo "$as_me:$LINENO: result: checking for GTK 1.x with pkg-config based tests..." >&5
-echo "${ECHO_T}checking for GTK 1.x with pkg-config based tests..." >&6
-
-      pkgs=''
-      ok="yes"
-      pkg_check_version gtk+       1.2     ; ac_gtk_version_string="$vers"
-      pkg_check_version glib       1.0
-      pkg_check_version gdk_pixbuf 0.1
-      have_gtk="$ok"
-
-      # Now check for Gnome...
-      #
-      if test "$have_gtk" = yes -a "$with_gnome" = yes; then
-        old_pkgs="$pkgs"
-        ok=yes
-        pkg_check_version capplet    1.0
-        pkg_check_version gnomeui    1.0
-        pkg_check_version gdk_pixbuf 0.1
-        have_gnome="$ok"
-
-        if test "$have_gnome" = no; then
-          pkgs="$old_pkgs"
-        else
-          cat >>confdefs.h <<\_ACEOF
-#define HAVE_CRAPPLET 1
-_ACEOF
-
-        fi
-      fi
-    fi
-
-    if test "$have_gtk" = yes; then
-      parse_gtk_version_string
-      jurassic_gtk=no
-    else
-      have_gnome=no
-    fi
-
-    if test "$have_gtk" = yes; then
-      echo "$as_me:$LINENO: checking for Gtk includes" >&5
-echo $ECHO_N "checking for Gtk includes... $ECHO_C" >&6
-if test "${ac_cv_gtk_config_cflags+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gtk_config_cflags" >&5
-echo "${ECHO_T}$ac_cv_gtk_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for Gtk libs" >&5
-echo $ECHO_N "checking for Gtk libs... $ECHO_C" >&6
-if test "${ac_cv_gtk_config_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gtk_config_libs" >&5
-echo "${ECHO_T}$ac_cv_gtk_config_libs" >&6
-    fi
-    ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
-    ac_gtk_config_libs=$ac_cv_gtk_config_libs
-
-    ac_gnome_config_cflags=$ac_gtk_config_cflags
-    ac_gnome_config_libs=$ac_gtk_config_libs
-
-  else
-    #
-    # the old way...
-    # run {gnome,gtk}-config based tests.
-    #
-    echo "$as_me:$LINENO: result: checking for GTK 1.x with gtk-config based tests..." >&5
-echo "${ECHO_T}checking for GTK 1.x with gtk-config based tests..." >&6
-
-    for ac_prog in glib12-config glib-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_glib_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $glib_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_glib_config="$glib_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $gtk_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_glib_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+  case $pkg_config in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_pkg_config="$pkg_config" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $gtk_path
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
   ;;
 esac
 fi
-glib_config=$ac_cv_path_glib_config
+pkg_config=$ac_cv_path_pkg_config
 
-if test -n "$glib_config"; then
-  echo "$as_me:$LINENO: result: $glib_config" >&5
-echo "${ECHO_T}$glib_config" >&6
+if test -n "$pkg_config"; then
+  echo "$as_me:$LINENO: result: $pkg_config" >&5
+echo "${ECHO_T}$pkg_config" >&6
 else
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-  test -n "$glib_config" && break
-done
-
-    for ac_prog in gtk12-config  gtk-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_gtk_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $gtk_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_gtk_config="$gtk_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $gtk_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_gtk_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
+  test -n "$pkg_config" && break
 done
 
-  ;;
-esac
-fi
-gtk_config=$ac_cv_path_gtk_config
 
-if test -n "$gtk_config"; then
-  echo "$as_me:$LINENO: result: $gtk_config" >&5
-echo "${ECHO_T}$gtk_config" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+if test -z "$pkg_config" ; then
+  { echo "$as_me:$LINENO: WARNING: pkg-config not found!" >&5
+echo "$as_me: WARNING: pkg-config not found!" >&2;}
+  pkg_config="false"
 fi
 
-  test -n "$gtk_config" && break
-done
-
-
-    if test "$with_gnome" = yes; then
-      for ac_prog in gnome-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_gnome_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $gnome_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_gnome_config="$gnome_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $gtk_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_gnome_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  ;;
-esac
-fi
-gnome_config=$ac_cv_path_gnome_config
 
-if test -n "$gnome_config"; then
-  echo "$as_me:$LINENO: result: $gnome_config" >&5
-echo "${ECHO_T}$gnome_config" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
+# Utility function for running pkg-config-based tests...
+#
+pkgs=''
+pkg_check_version() {
+  if test "$ok" = yes ; then
+    req="$1"
+    min="$2"
+    echo "$as_me:$LINENO: checking for $req" >&5
+echo $ECHO_N "checking for $req... $ECHO_C" >&6
+    if $pkg_config --exists "$req" ; then
+      vers=`$pkg_config --modversion "$req"`
+      if $pkg_config --exists "$req >= $min" ; then
+        echo "$as_me:$LINENO: result: $vers" >&5
+echo "${ECHO_T}$vers" >&6
+        pkgs="$pkgs $req"
+        return 1
+      else
+        echo "$as_me:$LINENO: result: $vers (wanted >= $min)" >&5
+echo "${ECHO_T}$vers (wanted >= $min)" >&6
+        ok=no
+        return 0
+      fi
+    else
+      echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
-fi
+      ok=no
+      return 0
+    fi
+  fi
+}
 
-  test -n "$gnome_config" && break
-done
 
-    fi
+jurassic_gtk=no
+gtk_halfassed=no
 
-    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 "$with_gtk" = yes; then
+  have_gtk=no
 
-    if test "$have_gtk" = yes; then
-      echo "$as_me:$LINENO: checking Gtk version number" >&5
-echo $ECHO_N "checking Gtk version number... $ECHO_C" >&6
-if test "${ac_cv_gtk_version_string+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_gtk_version_string=`$gtk_config --version`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gtk_version_string" >&5
-echo "${ECHO_T}$ac_cv_gtk_version_string" >&6
-      ac_gtk_version_string=$ac_cv_gtk_version_string
-      parse_gtk_version_string
+  ok="yes"
+  pkg_check_version            gtk+-2.0  2.0.1  ; ac_gtk_version_string="$vers"
+  pkg_check_version         gmodule-2.0  2.0.0
+  pkg_check_version          libxml-2.0  2.4.6
+  pkg_check_version        libglade-2.0  1.99.0
+  pkg_check_version      gdk-pixbuf-2.0  2.0.0
+  pkg_check_version gdk-pixbuf-xlib-2.0  2.0.0
+  have_gtk="$ok"
+
+  if test "$have_gtk" = no; then
+    if test -n "$ac_gtk_version_string" ; then
+      gtk_halfassed="$ac_gtk_version_string"
+      gtk_halfassed_lib="$req"
     fi
+  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
+    parse_gtk_version_string
+    jurassic_gtk=no
+  fi
 
-    if test "$have_gtk" = yes; then
-      echo "$as_me:$LINENO: checking for Gtk includes" >&5
+  if test "$have_gtk" = yes; then
+    echo "$as_me:$LINENO: checking for Gtk includes" >&5
 echo $ECHO_N "checking for Gtk includes... $ECHO_C" >&6
 if test "${ac_cv_gtk_config_cflags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_gtk_config_cflags=`$gtk_config --cflags`
+  ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`
 fi
 echo "$as_me:$LINENO: result: $ac_cv_gtk_config_cflags" >&5
 echo "${ECHO_T}$ac_cv_gtk_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for Gtk libs" >&5
+    echo "$as_me:$LINENO: checking for Gtk libs" >&5
 echo $ECHO_N "checking for Gtk libs... $ECHO_C" >&6
 if test "${ac_cv_gtk_config_libs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_gtk_config_libs=`$gtk_config --libs`
+  ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`
 fi
 echo "$as_me:$LINENO: result: $ac_cv_gtk_config_libs" >&5
 echo "${ECHO_T}$ac_cv_gtk_config_libs" >&6
-    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"
-      echo "$as_me:$LINENO: checking for Gnome capplet includes" >&5
-echo $ECHO_N "checking for Gnome capplet includes... $ECHO_C" >&6
-      if test "${ac_cv_gnome_config_cflags+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  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
-fi
-
-      ac_gnome_config_cflags=$ac_cv_gnome_config_cflags
-      if test "$ac_gnome_config_cflags" = "" ; then
-        have_gnome=no
-        echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-      else
-        echo "$as_me:$LINENO: result: $ac_gnome_config_cflags" >&5
-echo "${ECHO_T}$ac_gnome_config_cflags" >&6
-      fi
-    fi
-
-    if test "$have_gnome" = yes -a "$have_gtk" = yes; then
-      echo "$as_me:$LINENO: checking for Gnome capplet libs" >&5
-echo $ECHO_N "checking for Gnome capplet libs... $ECHO_C" >&6
-      if test "${ac_cv_gnome_config_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  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
-fi
-
-      ac_gnome_config_libs=$ac_cv_gnome_config_libs
-      if test "$ac_gnome_config_libs" = "" ; then
-        have_gnome=no
-        echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-      else
-        echo "$as_me:$LINENO: result: $ac_gnome_config_libs" >&5
-echo "${ECHO_T}$ac_gnome_config_libs" >&6
-      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
-      cat >>confdefs.h <<\_ACEOF
-#define HAVE_CRAPPLET 1
-_ACEOF
-
-    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_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
-
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  # note: $X_CFLAGS includes $x_includes
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for capplet_widget_changes_are_immediate in -lcapplet" >&5
-echo $ECHO_N "checking for capplet_widget_changes_are_immediate in -lcapplet... $ECHO_C" >&6
-if test "${ac_cv_lib_capplet_capplet_widget_changes_are_immediate+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcapplet $ac_gnome_config_libs $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char capplet_widget_changes_are_immediate ();
-int
-main ()
-{
-capplet_widget_changes_are_immediate ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_capplet_capplet_widget_changes_are_immediate=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_lib_capplet_capplet_widget_changes_are_immediate=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_capplet_capplet_widget_changes_are_immediate" >&5
-echo "${ECHO_T}$ac_cv_lib_capplet_capplet_widget_changes_are_immediate" >&6
-if test $ac_cv_lib_capplet_capplet_widget_changes_are_immediate = yes; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_CRAPPLET_IMMEDIATE 1
-_ACEOF
-
-else
-  true
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
   fi
 
+  ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
+  ac_gtk_config_libs=$ac_cv_gtk_config_libs
 
-  GNOME_DATADIR=""
+  GTK_EXTRA_OBJS=""
+  GTK_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)'
+    GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+    GTK_DATADIR="$GTK_DATADIR/share"
   fi
 
-
   if test "$have_gtk" = yes; then
     INCLUDES="$INCLUDES $ac_gtk_config_cflags"
     GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
 #define HAVE_GTK 1
 _ACEOF
 
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_GTK2 1
+_ACEOF
+
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_XML 1
+_ACEOF
 
-    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.
+# Check for the various Gnome help and URL loading programs.
 #
+WITH_BROWSER=gnome-open
 if test "$have_gtk" = yes; then
-  for ac_prog in yelp gnome-help-browser
+  for ac_prog in gnome-open
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo "$as_me:$LINENO: checking for $ac_word" >&5
 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_have_gnome_help+set}" = set; then
+if test "${ac_cv_prog_gnome_open_program+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$have_gnome_help"; then
-  ac_cv_prog_have_gnome_help="$have_gnome_help" # Let the user override the test.
+  if test -n "$gnome_open_program"; then
+  ac_cv_prog_gnome_open_program="$gnome_open_program" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -15597,7 +14956,7 @@ do
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
   if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_have_gnome_help="$ac_prog"
+    ac_cv_prog_gnome_open_program="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -15606,63 +14965,87 @@ done
 
 fi
 fi
-have_gnome_help=$ac_cv_prog_have_gnome_help
-if test -n "$have_gnome_help"; then
-  echo "$as_me:$LINENO: result: $have_gnome_help" >&5
-echo "${ECHO_T}$have_gnome_help" >&6
+gnome_open_program=$ac_cv_prog_gnome_open_program
+if test -n "$gnome_open_program"; then
+  echo "$as_me:$LINENO: result: $gnome_open_program" >&5
+echo "${ECHO_T}$gnome_open_program" >&6
 else
   echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
 fi
 
-  test -n "$have_gnome_help" && break
+  test -n "$gnome_open_program" && break
 done
-test -n "$have_gnome_help" || have_gnome_help="no"
 
-  if test "$have_gnome_help" != no; then
-    have_gnome_help=yes
+  for ac_prog in gnome-url-show
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_gnome_url_show_program+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$gnome_url_show_program"; then
+  ac_cv_prog_gnome_url_show_program="$gnome_url_show_program" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_gnome_url_show_program="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
+done
+done
+
+fi
+fi
+gnome_url_show_program=$ac_cv_prog_gnome_url_show_program
+if test -n "$gnome_url_show_program"; then
+  echo "$as_me:$LINENO: result: $gnome_url_show_program" >&5
+echo "${ECHO_T}$gnome_url_show_program" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$gnome_url_show_program" && break
+done
+
 fi
 
 
 ###############################################################################
 #
-#       Check for -lxml
+#       Check for -lXm.
 #
 ###############################################################################
 
-have_xml=no
-with_xml_req=unspecified
-xml_halfassed=no
+have_motif=no
+with_motif_req=unspecified
 
-# Check whether --with-xml or --without-xml was given.
-if test "${with_xml+set}" = set; then
-  withval="$with_xml"
-  with_xml="$withval"; with_xml_req="$withval"
+# Check whether --with-motif or --without-motif was given.
+if test "${with_motif+set}" = set; then
+  withval="$with_motif"
+  with_motif="$withval"; with_motif_req="$withval"
 else
-  with_xml=yes
+  with_motif=no
 fi;
 
-# 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
-
 
-   case "$with_xml" in
+   case "$with_motif" in
     yes) ;;
     no)  ;;
 
     /*)
-     echo "$as_me:$LINENO: checking for XML headers" >&5
-echo $ECHO_N "checking for XML headers... $ECHO_C" >&6
-     d=$with_xml/include
+     echo "$as_me:$LINENO: checking for Motif headers" >&5
+echo $ECHO_N "checking for Motif headers... $ECHO_C" >&6
+     d=$with_motif/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -15672,9 +15055,9 @@ echo "${ECHO_T}$d" >&6
 echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
-     echo "$as_me:$LINENO: checking for XML libs" >&5
-echo $ECHO_N "checking for XML libs... $ECHO_C" >&6
-     d=$with_xml/lib
+     echo "$as_me:$LINENO: checking for Motif libs" >&5
+echo $ECHO_N "checking for Motif libs... $ECHO_C" >&6
+     d=$with_motif/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        echo "$as_me:$LINENO: result: $d" >&5
@@ -15685,13 +15068,13 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
      fi
 
      # replace the directory string with "yes".
-     with_xml_req="yes"
-     with_xml=$with_xml_req
+     with_motif_req="yes"
+     with_motif=$with_motif_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xml must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-motif must be \"yes\", \"no\", or a directory."
      echo "       If it is a directory, then \`DIR/include' will be added to"
      echo "       the -I list, and \`DIR/lib' will be added to the -L list."
      exit 1
@@ -15699,346 +15082,39 @@ echo "${ECHO_T}not found ($d: no such directory)" >&6
    esac
 
 
-if test "$with_xml" != yes -a "$with_xml" != no ; then
-  echo "error: must be yes or no: --with-xml=$with_xml"
+if test "$with_motif" != yes -a "$with_motif" != no ; then
+  echo "error: must be yes or no: --with-motif=$with_motif"
   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
-      echo "$as_me:$LINENO: checking for XML includes" >&5
-echo $ECHO_N "checking for XML includes... $ECHO_C" >&6
-if test "${ac_cv_xml_config_cflags+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_xml_config_cflags=`$pkg_config --cflags $pkgs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_xml_config_cflags" >&5
-echo "${ECHO_T}$ac_cv_xml_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for XML libs" >&5
-echo $ECHO_N "checking for XML libs... $ECHO_C" >&6
-if test "${ac_cv_xml_config_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_xml_config_libs=`$pkg_config --libs $pkgs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_xml_config_libs" >&5
-echo "${ECHO_T}$ac_cv_xml_config_libs" >&6
-      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.
-    #
-
-    for ac_prog in xml2-config xml-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_xml_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $xml_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_xml_config="$xml_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $xml_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_xml_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  ;;
-esac
-fi
-xml_config=$ac_cv_path_xml_config
-
-if test -n "$xml_config"; then
-  echo "$as_me:$LINENO: result: $xml_config" >&5
-echo "${ECHO_T}$xml_config" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$xml_config" && break
-done
-
-
-    # If we found the xml-config program, run it to get flags.
-    #
-    if test -n "$xml_config" ; then
-      echo "$as_me:$LINENO: checking for XML includes" >&5
-echo $ECHO_N "checking for XML includes... $ECHO_C" >&6
-if test "${ac_cv_xml_config_cflags+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_xml_config_cflags=`$xml_config --cflags`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_xml_config_cflags" >&5
-echo "${ECHO_T}$ac_cv_xml_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for XML libs" >&5
-echo $ECHO_N "checking for XML libs... $ECHO_C" >&6
-if test "${ac_cv_xml_config_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_xml_config_libs=`$xml_config --libs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_xml_config_libs" >&5
-echo "${ECHO_T}$ac_cv_xml_config_libs" >&6
-      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_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for libxml/xmlIO.h" >&5
-echo $ECHO_N "checking for libxml/xmlIO.h... $ECHO_C" >&6
-if test "${ac_cv_header_libxml_xmlIO_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <libxml/parser.h>
-
-#include <libxml/xmlIO.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_libxml_xmlIO_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_libxml_xmlIO_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_libxml_xmlIO_h" >&5
-echo "${ECHO_T}$ac_cv_header_libxml_xmlIO_h" >&6
-if test $ac_cv_header_libxml_xmlIO_h = yes; then
-  have_xml=yes
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-
-    # if that didn't work, then try just <parser.h> which is the old way...
-    #
-    if test "$have_xml" = no; then
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for xmlIO.h" >&5
-echo $ECHO_N "checking for xmlIO.h... $ECHO_C" >&6
-if test "${ac_cv_header_xmlIO_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <parser.h>
-
-#include <xmlIO.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_xmlIO_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_xmlIO_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_xmlIO_h" >&5
-echo "${ECHO_T}$ac_cv_header_xmlIO_h" >&6
-if test $ac_cv_header_xmlIO_h = yes; then
-  have_xml=yes; have_old_xml=yes
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-    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.
+if test "$with_motif" = yes; then
+  have_motif=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
-
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for zlibVersion in -lz" >&5
-echo $ECHO_N "checking for zlibVersion in -lz... $ECHO_C" >&6
-if test "${ac_cv_lib_z_zlibVersion+set}" = set; then
+  echo "$as_me:$LINENO: checking for Xm/Xm.h" >&5
+echo $ECHO_N "checking for Xm/Xm.h... $ECHO_C" >&6
+if test "${ac_cv_header_Xm_Xm_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lz  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#include <stdlib.h>
+                     #include <stdio.h>
+                     #include <X11/Intrinsic.h>
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char zlibVersion ();
-int
-main ()
-{
-zlibVersion ();
-  ;
-  return 0;
-}
+#include <Xm/Xm.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -16052,92 +15128,64 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_z_zlibVersion=yes
+  ac_cv_header_Xm_Xm_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_z_zlibVersion=no
+ac_cv_header_Xm_Xm_h=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_z_zlibVersion" >&5
-echo "${ECHO_T}$ac_cv_lib_z_zlibVersion" >&6
-if test $ac_cv_lib_z_zlibVersion = yes; then
-  have_zlib=yes
+echo "$as_me:$LINENO: result: $ac_cv_header_Xm_Xm_h" >&5
+echo "${ECHO_T}$ac_cv_header_Xm_Xm_h" >&6
+if test $ac_cv_header_Xm_Xm_h = yes; then
+  have_motif=yes
+                     cat >>confdefs.h <<\_ACEOF
+#define HAVE_MOTIF 1
+_ACEOF
+
+                     MOTIF_LIBS="$MOTIF_LIBS -lXm"
 fi
 
+
   CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+fi
 
-    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
+if test "$have_motif" = yes; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
-
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for xmlParseChunk in -lc" >&5
-echo $ECHO_N "checking for xmlParseChunk in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_xmlParseChunk+set}" = set; then
+  echo "$as_me:$LINENO: checking for Xm/ComboBox.h" >&5
+echo $ECHO_N "checking for Xm/ComboBox.h... $ECHO_C" >&6
+if test "${ac_cv_header_Xm_ComboBox_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $ac_xml_config_libs $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#include <stdlib.h>
+                     #include <stdio.h>
+                     #include <X11/Intrinsic.h>
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char xmlParseChunk ();
-int
-main ()
-{
-xmlParseChunk ();
-  ;
-  return 0;
-}
+#include <Xm/ComboBox.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -16151,58 +15199,32 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_c_xmlParseChunk=yes
+  ac_cv_header_Xm_ComboBox_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_c_xmlParseChunk=no
+ac_cv_header_Xm_ComboBox_h=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_xmlParseChunk" >&5
-echo "${ECHO_T}$ac_cv_lib_c_xmlParseChunk" >&6
-if test $ac_cv_lib_c_xmlParseChunk = yes; then
-  have_xml=yes
-                    xml_halfassed=no
-                    XML_LIBS="$ac_xml_config_libs"
-                    cat >>confdefs.h <<\_ACEOF
-#define HAVE_XML 1
+echo "$as_me:$LINENO: result: $ac_cv_header_Xm_ComboBox_h" >&5
+echo "${ECHO_T}$ac_cv_header_Xm_ComboBox_h" >&6
+if test $ac_cv_header_Xm_ComboBox_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_XMCOMBOBOX 1
 _ACEOF
 
-else
-  true
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-  fi
-
-  if test "$have_xml" = yes; then
-    INCLUDES="$INCLUDES $ac_xml_config_cflags"
-    GTK_LIBS="$GTK_LIBS $ac_xml_config_libs"
-    cat >>confdefs.h <<\_ACEOF
-#define HAVE_XML 1
-_ACEOF
-
-    if test "$have_old_xml" = yes; then
-      cat >>confdefs.h <<\_ACEOF
-#define HAVE_OLD_XML_HEADERS 1
-_ACEOF
-
-    fi
-  fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
 
@@ -17299,7 +16321,7 @@ if test "${ac_cv_mesagl_version_string+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 17308 "configure"
+#line 16328 "configure"
 #include "confdefs.h"
 #include <GL/gl.h>
 #ifndef MESA_MAJOR_VERSION
@@ -18048,162 +17070,23 @@ _ACEOF
 #define HAVE_GLE3 1
 _ACEOF
 
-    fi
-  fi
-
-elif test "$with_gle" != no; then
-  echo "error: must be yes or no: --with-gle=$with_gle"
-  exit 1
-
-fi
-
-
-
-###############################################################################
-#
-#       Check for -lXpm.
-#
-###############################################################################
-
-have_xpm=no
-with_xpm_req=unspecified
-
-# Check whether --with-xpm or --without-xpm was given.
-if test "${with_xpm+set}" = set; then
-  withval="$with_xpm"
-  with_xpm="$withval"; with_xpm_req="$withval"
-else
-  with_xpm=yes
-fi;
-
-
-   case "$with_xpm" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     echo "$as_me:$LINENO: checking for XPM headers" >&5
-echo $ECHO_N "checking for XPM headers... $ECHO_C" >&6
-     d=$with_xpm/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     echo "$as_me:$LINENO: checking for XPM libs" >&5
-echo $ECHO_N "checking for XPM libs... $ECHO_C" >&6
-     d=$with_xpm/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       echo "$as_me:$LINENO: result: $d" >&5
-echo "${ECHO_T}$d" >&6
-     else
-       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
-echo "${ECHO_T}not found ($d: no such directory)" >&6
-     fi
-
-     # replace the directory string with "yes".
-     with_xpm_req="yes"
-     with_xpm=$with_xpm_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-xpm must be \"yes\", \"no\", or a directory."
-     echo "       If it is a directory, then \`DIR/include' will be added to"
-     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
-     exit 1
-     ;;
-   esac
-
-
-if test "$with_xpm" = yes; then
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  echo "$as_me:$LINENO: checking for X11/xpm.h" >&5
-echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6
-if test "${ac_cv_header_X11_xpm_h+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <X11/Xlib.h>
-
-#include <X11/xpm.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag"
-                        || test ! -s conftest.err'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_X11_xpm_h=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-ac_cv_header_X11_xpm_h=no
-fi
-rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5
-echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6
-if test $ac_cv_header_X11_xpm_h = yes; then
-  have_xpm=yes
-                    cat >>confdefs.h <<\_ACEOF
-#define HAVE_XPM 1
-_ACEOF
-
-                    XPM_LIBS="-lXpm"
-fi
-
+    fi
+  fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-elif test "$with_xpm" != no; then
-  echo "error: must be yes or no: --with-xpm=$with_xpm"
+elif test "$with_gle" != no; then
+  echo "error: must be yes or no: --with-gle=$with_gle"
   exit 1
-fi
 
-# See comment near $motif_requires_xpm, above.
-# Need to do this here, after both Motif and XPM have been checked for.
-#
-if test "$have_motif" = yes -a "$have_xpm" = yes ; then
-  if test "$motif_requires_xpm" = yes ; then
-    MOTIF_LIBS="$MOTIF_LIBS $XPM_LIBS"
-  fi
 fi
 
+
 ###############################################################################
 #
 #       Check for -lgdk_pixbuf.
+#       These tests are for gdk_pixbuf usage of the hacks,
+#       not xscreensaver-demo (thus we have to test again to get
+#       the libraries right: don't want to pull in all of GTK
+#       for the hacks.)
 #
 ###############################################################################
 
 
 if test "$with_gdk_pixbuf" = yes; then
   have_gdk_pixbuf=no
-  have_gdk_pixbuf2=no
-
-  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* gdk-pixbuf 2.x will work.
-    # If we have Gtk 1.x, then *only* gdk-pixbuf 1.x will work.
-    # If we don't have Gtk at all, then either will work.
 
-    if test "$have_gtk" = no -o "$have_gtk2" = yes; then
-      #
-      # we don't have Gtk; or we have Gtk 2.x.  Check for pixbuf 2.x.
-      #
-      echo "$as_me:$LINENO: result: checking for gdk_pixbuf 2.x with gtk-config based tests..." >&5
-echo "${ECHO_T}checking for gdk_pixbuf 2.x with gtk-config based tests..." >&6
-      pkg_check_version gdk-pixbuf-2.0      2.0.0
-      pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
-      have_gdk_pixbuf="$ok"
-      have_gdk_pixbuf2="$ok"
-    fi
+  pkgs=''
+  ok="yes"
 
-    if test "$have_gtk" = no -o "$have_gtk2" = no; then
-      #
-      # we don't have Gtk; or we have Gtk 1.x.
-      # If we don't have pixbuf 2.x, then check for pixbuf 1.x.
-      #
-      if test "$have_gdk_pixbuf2" = no; then
-        pkgs=''
-        ok="yes"
-      echo "$as_me:$LINENO: result: checking for gdk_pixbuf 1.x with gtk-config based tests..." >&5
-echo "${ECHO_T}checking for gdk_pixbuf 1.x with gtk-config based tests..." >&6
-        pkg_check_version gdk_pixbuf      0.0
-        pkg_check_version gdk_pixbuf_xlib 0.0
-        have_gdk_pixbuf="$ok"
-      fi
-    fi
+  pkg_check_version gdk-pixbuf-2.0      2.0.0
+  pkg_check_version gdk-pixbuf-xlib-2.0 2.0.0
+  have_gdk_pixbuf="$ok"
 
-    if test "$have_gdk_pixbuf" = yes; then
-      echo "$as_me:$LINENO: checking for gdk-pixbuf includes" >&5
+  if test "$have_gdk_pixbuf" = yes; then
+    echo "$as_me:$LINENO: checking for gdk-pixbuf includes" >&5
 echo $ECHO_N "checking for gdk-pixbuf includes... $ECHO_C" >&6
 if test "${ac_cv_gdk_pixbuf_config_cflags+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18333,7 +17182,7 @@ else
 fi
 echo "$as_me:$LINENO: result: $ac_cv_gdk_pixbuf_config_cflags" >&5
 echo "${ECHO_T}$ac_cv_gdk_pixbuf_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for gdk-pixbuf libs" >&5
+    echo "$as_me:$LINENO: checking for gdk-pixbuf libs" >&5
 echo $ECHO_N "checking for gdk-pixbuf libs... $ECHO_C" >&6
 if test "${ac_cv_gdk_pixbuf_config_libs+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -18342,130 +17191,18 @@ else
 fi
 echo "$as_me:$LINENO: result: $ac_cv_gdk_pixbuf_config_libs" >&5
 echo "${ECHO_T}$ac_cv_gdk_pixbuf_config_libs" >&6
-    fi
-    ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags
-    ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
   fi
 
+  ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags
+  ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
 
-  if test "$have_gdk_pixbuf" = no; then
-    #
-    # the old way...
-    # run gdk-pixbuf-config based tests.
-    # note that we can't assume that the existence of "pkg-config" means
-    # that we don't have to look for gdk-pixbuf-config -- in Gnome 1.4,
-    # pkg-config exists, but doesn't know about pixbuf.
-    #
-
-   echo "$as_me:$LINENO: result: checking for gdk_pixbuf with gdk-pixbuf-config based tests..." >&5
-echo "${ECHO_T}checking for gdk_pixbuf with gdk-pixbuf-config based tests..." >&6
-
-    # if the user specified --with-gtk=/foo/ or --with-gnome=/foo/ then
-    # look in /foo/bin/ for for gdk-pixbuf-config.
-    #
-    gdk_pixbuf_path="$PATH"
-
-    if test ! -z "$gtk_dir"; then
-      # canonicalize slashes.
-      foo=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
-      gdk_pixbuf_path="$foo:$gdk_pixbuf_path"
-    fi
-
-    if test ! -z "$gnome_dir"; then
-      # canonicalize slashes.
-      foo=`echo "${gnome_dir}/bin" | sed 's@//*@/@g'`
-      gdk_pixbuf_path="$foo:$gdk_pixbuf_path"
-    fi
-
-    for ac_prog in gdk-pixbuf-config
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_gdk_pixbuf_config+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $gdk_pixbuf_config in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_gdk_pixbuf_config="$gdk_pixbuf_config" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $gdk_pixbuf_path
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_gdk_pixbuf_config="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
-  ;;
-esac
-fi
-gdk_pixbuf_config=$ac_cv_path_gdk_pixbuf_config
-
-if test -n "$gdk_pixbuf_config"; then
-  echo "$as_me:$LINENO: result: $gdk_pixbuf_config" >&5
-echo "${ECHO_T}$gdk_pixbuf_config" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$gdk_pixbuf_config" && break
-done
-
-
-    # If we found the gdk-pixbuf-config program, run it to get flags.
-    #
-    if test -n "$gdk_pixbuf_config" ; then
-      echo "$as_me:$LINENO: checking for gdk-pixbuf includes" >&5
-echo $ECHO_N "checking for gdk-pixbuf includes... $ECHO_C" >&6
-if test "${ac_cv_gdk_pixbuf_config_cflags+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_gdk_pixbuf_config_cflags=`$gdk_pixbuf_config --cflags`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gdk_pixbuf_config_cflags" >&5
-echo "${ECHO_T}$ac_cv_gdk_pixbuf_config_cflags" >&6
-      echo "$as_me:$LINENO: checking for gdk-pixbuf libs" >&5
-echo $ECHO_N "checking for gdk-pixbuf libs... $ECHO_C" >&6
-if test "${ac_cv_gdk_pixbuf_config_libs+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_gdk_pixbuf_config_libs=`$gdk_pixbuf_config --libs`
-fi
-echo "$as_me:$LINENO: result: $ac_cv_gdk_pixbuf_config_libs" >&5
-echo "${ECHO_T}$ac_cv_gdk_pixbuf_config_libs" >&6
-
-      # note that "gdk-pixbuf-config --libs" produces a link line including
-      # -lgdk_pixbuf, but there's no way to get it to produce one that also
-      # includes -lgdk_pixbuf_xlib.  Since we don't know *exactly* what the
-      # name of the library will be, construct it with sed...
-      # M4 sucks!!
-
-      ac_cv_gdk_pixbuf_config_libs=`echo $ac_cv_gdk_pixbuf_config_libs | \
-       sed 's@ \(-lgdk_pixbuf\([-_a-zA-Z0-9.]*\)\) @ \1 -lgdk_pixbuf_xlib\2 @'`
-
-
-      ac_gdk_pixbuf_config_cflags=$ac_cv_gdk_pixbuf_config_cflags
-      ac_gdk_pixbuf_config_libs=$ac_cv_gdk_pixbuf_config_libs
-    fi
-  fi
-
-  ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS"
-  CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags"
 
-  if test "$have_gdk_pixbuf" = no; then
+  if test "$have_gdk_pixbuf" = yes; then
     #
     # we appear to have pixbuf; check for headers/libs to be sure.
     #
+    ac_save_gdk_pixbuf_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $ac_gdk_pixbuf_config_cflags"
 
     have_gdk_pixbuf=no
 
   CPPFLAGS="$ac_save_CPPFLAGS"
       fi
     fi
+    CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
   fi
 
-  CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
-
   if test "$have_gdk_pixbuf" = yes; then
     # we have the headers, now check for the libraries
     have_gdk_pixbuf=no
     gdk_pixbuf_halfassed=yes
 
+    echo "$as_me:$LINENO: result: checking for gdk_pixbuf usability..." >&5
+echo "${ECHO_T}checking for gdk_pixbuf usability..." >&6
+
     # library A...
 
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -19014,74 +17753,219 @@ else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_c_gdk_pixbuf_new_from_file=no
-fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5
-echo "${ECHO_T}$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6
-if test $ac_cv_lib_c_gdk_pixbuf_new_from_file = yes; then
-  have_gdk_pixbuf=yes
-fi
+ac_cv_lib_c_gdk_pixbuf_new_from_file=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5
+echo "${ECHO_T}$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6
+if test $ac_cv_lib_c_gdk_pixbuf_new_from_file = yes; then
+  have_gdk_pixbuf=yes
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+    # library B...
+    if test "$have_gdk_pixbuf" = yes; then
+      have_gdk_pixbuf=no
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo "$as_me:$LINENO: checking for gdk_pixbuf_xlib_init in -lc" >&5
+echo $ECHO_N "checking for gdk_pixbuf_xlib_init in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_gdk_pixbuf_xlib_init+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gdk_pixbuf_xlib_init ();
+int
+main ()
+{
+gdk_pixbuf_xlib_init ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_c_gdk_pixbuf_xlib_init=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_gdk_pixbuf_xlib_init=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5
+echo "${ECHO_T}$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6
+if test $ac_cv_lib_c_gdk_pixbuf_xlib_init = yes; then
+  have_gdk_pixbuf=yes
+                      gdk_pixbuf_halfassed=no
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+    fi
+  fi
+
+  if test "$have_gdk_pixbuf" = yes; then
+    INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
+    XPM_LIBS="$ac_gdk_pixbuf_config_libs"
+    cat >>confdefs.h <<\_ACEOF
+#define HAVE_GDK_PIXBUF 1
+_ACEOF
+
+  else
+    echo "$as_me:$LINENO: result: checking for gdk_pixbuf usability... no" >&5
+echo "${ECHO_T}checking for gdk_pixbuf usability... no" >&6
+  fi
+fi
+
+
+###############################################################################
+#
+#       Check for -lXpm.
+#
+###############################################################################
+
+have_xpm=no
+with_xpm_req=unspecified
+
+# Check whether --with-xpm or --without-xpm was given.
+if test "${with_xpm+set}" = set; then
+  withval="$with_xpm"
+  with_xpm="$withval"; with_xpm_req="$withval"
+else
+  with_xpm=yes
+fi;
+
+
+   case "$with_xpm" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo "$as_me:$LINENO: checking for XPM headers" >&5
+echo $ECHO_N "checking for XPM headers... $ECHO_C" >&6
+     d=$with_xpm/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$as_me:$LINENO: result: $d" >&5
+echo "${ECHO_T}$d" >&6
+     else
+       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
+echo "${ECHO_T}not found ($d: no such directory)" >&6
+     fi
+
+     echo "$as_me:$LINENO: checking for XPM libs" >&5
+echo $ECHO_N "checking for XPM libs... $ECHO_C" >&6
+     d=$with_xpm/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$as_me:$LINENO: result: $d" >&5
+echo "${ECHO_T}$d" >&6
+     else
+       echo "$as_me:$LINENO: result: not found ($d: no such directory)" >&5
+echo "${ECHO_T}not found ($d: no such directory)" >&6
+     fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+     # replace the directory string with "yes".
+     with_xpm_req="yes"
+     with_xpm=$with_xpm_req
+     ;;
 
-    # library B...
-    if test "$have_gdk_pixbuf" = yes; then
-      have_gdk_pixbuf=no
+    *)
+     echo ""
+     echo "error: argument to --with-xpm must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
 
+if test "$with_xpm" = yes; then
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
-
-  echo "$as_me:$LINENO: checking for gdk_pixbuf_xlib_init in -lc" >&5
-echo $ECHO_N "checking for gdk_pixbuf_xlib_init in -lc... $ECHO_C" >&6
-if test "${ac_cv_lib_c_gdk_pixbuf_xlib_init+set}" = set; then
+  echo "$as_me:$LINENO: checking for X11/xpm.h" >&5
+echo $ECHO_N "checking for X11/xpm.h... $ECHO_C" >&6
+if test "${ac_cv_header_X11_xpm_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
+  cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+#include <X11/Xlib.h>
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char gdk_pixbuf_xlib_init ();
-int
-main ()
-{
-gdk_pixbuf_xlib_init ();
-  ;
-  return 0;
-}
+#include <X11/xpm.h>
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>conftest.er1
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
@@ -19095,47 +17979,50 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
+        { ac_try='test -s conftest.$ac_objext'
   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
   (eval $ac_try) 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  ac_cv_lib_c_gdk_pixbuf_xlib_init=yes
+  ac_cv_header_X11_xpm_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_c_gdk_pixbuf_xlib_init=no
+ac_cv_header_X11_xpm_h=no
 fi
-rm -f conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5
-echo "${ECHO_T}$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6
-if test $ac_cv_lib_c_gdk_pixbuf_xlib_init = yes; then
-  have_gdk_pixbuf=yes
-                      gdk_pixbuf_halfassed=no
+echo "$as_me:$LINENO: result: $ac_cv_header_X11_xpm_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_xpm_h" >&6
+if test $ac_cv_header_X11_xpm_h = yes; then
+  have_xpm=yes
+                    cat >>confdefs.h <<\_ACEOF
+#define HAVE_XPM 1
+_ACEOF
+
+                    XPM_LIBS="-lXpm $XPM_LIBS"
 fi
 
+
   CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+elif test "$with_xpm" != no; then
+  echo "error: must be yes or no: --with-xpm=$with_xpm"
+  exit 1
+fi
 
-    fi
+# See comment near $motif_requires_xpm, above.
+# Need to do this here, after both Motif and XPM have been checked for.
+#
+if test "$have_motif" = yes -a "$have_xpm" = yes ; then
+  if test "$motif_requires_xpm" = yes ; then
+    MOTIF_LIBS="$MOTIF_LIBS $XPM_LIBS"
   fi
+fi
 
-  if test "$have_gdk_pixbuf" = yes; then
-    INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
-    XPM_LIBS="$ac_gdk_pixbuf_config_libs"
-    cat >>confdefs.h <<\_ACEOF
-#define HAVE_GDK_PIXBUF 1
-_ACEOF
-
-  else
-    have_gdk_pixbuf2=no
-  fi
+if test "$XPM_LIBS" = "" ; then
+  XPM_LIBS=$(MINIXPM)
 fi
 
 
@@ -19465,7 +18352,8 @@ fi
 
 ###############################################################################
 #
-#       Check for pty support for 'phosphor'
+#       Check for pty support: this allows 'phosphor' and 'apple2'
+#      to run curses-based programs, or be used as terminal windows.
 #
 ###############################################################################
 
@@ -19704,6 +18592,7 @@ echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5
 echo "${ECHO_T}$ac_cv_lib_util_forkpty" >&6
 if test $ac_cv_lib_util_forkpty = yes; then
   PTY_LIBS="-lutil"
+                ac_have_forkpty=yes
                 cat >>confdefs.h <<\_ACEOF
 #define HAVE_FORKPTY 1
 _ACEOF
 #  LIBS="$ac_save_LIBS"
 
 
+if test "$ac_have_forkpty" != yes ; then
+  # we don't need (or have) -lutil on MacOS 10.4.2...
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo "$as_me:$LINENO: checking for forkpty in -lc" >&5
+echo $ECHO_N "checking for forkpty in -lc... $ECHO_C" >&6
+if test "${ac_cv_lib_c_forkpty+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char forkpty ();
+int
+main ()
+{
+forkpty ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+        { ac_try='test -z "$ac_c_werror_flag"
+                        || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+        { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_c_forkpty=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_c_forkpty=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_c_forkpty" >&5
+echo "${ECHO_T}$ac_cv_lib_c_forkpty" >&6
+if test $ac_cv_lib_c_forkpty = yes; then
+  PTY_LIBS=""
+                  cat >>confdefs.h <<\_ACEOF
+#define HAVE_FORKPTY 1
+_ACEOF
+
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+fi
 
 ###############################################################################
 #
@@ -20532,241 +19517,211 @@ if test $ac_cv_header_X11_extensions_readdisplay_h = yes; then
 #define HAVE_READ_DISPLAY_EXTENSION 1
 _ACEOF
 
-fi
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+elif test "$with_readdisplay" != no; then
+  echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for a directory full of images to use as the default value
+#      of the "imageDirectory" preference.
+#
+###############################################################################
+
+have_imagedir=no
+with_imagedir_req=unspecified
+
+
+# Check whether --with-image-directory or --without-image-directory was given.
+if test "${with_image_directory+set}" = set; then
+  withval="$with_image_directory"
+  with_imagedir="$withval"; with_imagedir_req="$withval"
+else
+  with_imagedir=yes
+fi;
+# no HANDLE_X_PATH_ARG for this one
+
+case "$with_imagedir" in
+  /*)
+    # absolute path
+    echo "$as_me:$LINENO: checking for image directory $with_imagedir" >&5
+echo $ECHO_N "checking for image directory $with_imagedir... $ECHO_C" >&6
+    if test -d "$with_imagedir" ; then
+      echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+    else
+      echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+      with_imagedir=""
+    fi
+  ;;
+  yes)
+    with_imagedir=""
+
+    #### Could use some more defaults here...
+    for dd in \
+      "/usr/share/backgrounds/images/"          \
+      "/usr/share/wallpapers/"                  \
+      "/Library/Desktop Pictures/"              \
+    ; do
+      if test -z "$with_imagedir"; then
+        echo "$as_me:$LINENO: checking for image directory $dd" >&5
+echo $ECHO_N "checking for image directory $dd... $ECHO_C" >&6
+        if test -d "$dd" ; then
+          echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+          with_imagedir="$dd"
+        else
+          echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+        fi
+      fi
+    done
+
+  ;;
+  no)
+    with_imagedir=""
+  ;;
+
+  *)
+    echo "error: must be an absolute path: --with-image-directory=$with_imagedir_req"
+    exit 1
+  ;;
+esac
+ac_cv_imagedir="$with_imagedir"
 
+DEFAULT_IMAGES_P='True'
+DEFAULT_IMAGE_DIRECTORY="$ac_cv_imagedir"
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-elif test "$with_readdisplay" != no; then
-  echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
-  exit 1
+if test -z "$DEFAULT_IMAGE_DIRECTORY" ; then
+  DEFAULT_IMAGES_P='False'
 fi
 
 
 ###############################################################################
 #
-#       Check for a program to generate random text.
-#
-#       Zippy is funnier than the idiocy generally spat out by `fortune',
-#       so first see if "fortune zippy" works.  Else, use plain "fortune".
-#
-#       We used to dig around in Emacs to look for the "yow" program, but
-#       most people who have Emacs also have "fortune zippy", so nevermind.
+#       Pick a text file to use as the default of the "textFile" preference.
+#      Any old file will do, but preferably one that will make interesting
+#      shapes when displayed by "starwars" and "fontglide".
 #
 ###############################################################################
 
-with_fortune_req=""
+have_textfile=no
+with_textfile_req=unspecified
+
 
-# Check whether --with-fortune or --without-fortune was given.
-if test "${with_fortune+set}" = set; then
-  withval="$with_fortune"
-  with_fortune_req="$withval"; with_fortune="$withval"
+# Check whether --with-text-file or --without-text-file was given.
+if test "${with_text_file+set}" = set; then
+  withval="$with_text_file"
+  with_textfile="$withval"; with_textfile_req="$withval"
 else
-  with_fortune=yes
+  with_textfile=yes
 fi;
+# no HANDLE_X_PATH_ARG for this one
 
-if test "$with_fortune" = no || test "$with_fortune" = yes ; then
-  with_fortune=""
-  with_fortune_req=""
-fi
-
-if test -n "$with_fortune_req" ; then
-  ac_cv_fortune_program=""
-  case "$with_fortune_req" in
-    /*)
-
-      set dummy $with_fortune_req ; fortune_tmp=$2
-      echo "$as_me:$LINENO: checking for $fortune_tmp" >&5
-echo $ECHO_N "checking for $fortune_tmp... $ECHO_C" >&6
-      if test -x "$fortune_tmp" ; then
-        echo "$as_me:$LINENO: result: yes" >&5
+case "$with_textfile" in
+  /*)
+    # absolute path
+    echo "$as_me:$LINENO: checking for text file $with_textfile" >&5
+echo $ECHO_N "checking for text file $with_textfile... $ECHO_C" >&6
+    if test -f "$with_textfile" ; then
+      echo "$as_me:$LINENO: result: yes" >&5
 echo "${ECHO_T}yes" >&6
-      else
-        echo "$as_me:$LINENO: result: no" >&5
+    else
+      echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
-        with_fortune=""
-      fi
-    ;;
-    *)
-      set dummy $with_fortune_req ; fortune_tmp=$2
-      # don't cache
-      unset ac_cv_path_fortune_tmp
-      # Extract the first word of "$fortune_tmp", so it can be a program name with args.
-set dummy $fortune_tmp; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_fortune_tmp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $fortune_tmp in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a path.
-  ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_fortune_tmp="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-
+      with_textfile=""
+    fi
   ;;
-esac
-fi
-fortune_tmp=$ac_cv_path_fortune_tmp
-
-if test -n "$fortune_tmp"; then
-  echo "$as_me:$LINENO: result: $fortune_tmp" >&5
-echo "${ECHO_T}$fortune_tmp" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
+  yes)
+    with_textfile=""
+
+    #### Could use some more defaults here...
+    for f in \
+      "/usr/X11R6/lib/X11/doc/README"          \
+      "/usr/share/doc/xserver-common/copyright"        \
+      "/usr/X11R6/README"                      \
+    ; do
+      if test -z "$with_textfile"; then
+        echo "$as_me:$LINENO: checking for text file $f" >&5
+echo $ECHO_N "checking for text file $f... $ECHO_C" >&6
+        if test -f "$f" ; then
+          echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+          with_textfile="$f"
+        else
+          echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
-fi
-
-      if test -z "$fortune_tmp" ; then
-        with_fortune=""
+        fi
       fi
-    ;;
-  esac
-  ac_cv_fortune_program="$with_fortune"
-
-elif test -n "$ac_cv_fortune_program"; then
-  echo "$as_me:$LINENO: result: checking for fortune... (cached) $ac_cv_fortune_program" >&5
-echo "${ECHO_T}checking for fortune... (cached) $ac_cv_fortune_program" >&6
-fi
-
-unset ac_cv_path_fortune_tmp
-unset fortune_tmp
-
-if test -z "$ac_cv_fortune_program" ; then
+    done
 
-  # first look for fortune in /usr/games/ (and use absolute path)
-  for ac_prog in fortune
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_path_fortune_tmp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  case $fortune_tmp in
-  [\\/]* | ?:[\\/]*)
-  ac_cv_path_fortune_tmp="$fortune_tmp" # Let the user override the test with a path.
   ;;
-  *)
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in "/usr/games"
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_fortune_tmp="$as_dir/$ac_word$ac_exec_ext"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+  no)
+    with_textfile=""
+  ;;
 
+  *)
+    echo "error: must be an absolute path: --with-text-file=$with_textfile_req"
+    exit 1
   ;;
 esac
-fi
-fortune_tmp=$ac_cv_path_fortune_tmp
-
-if test -n "$fortune_tmp"; then
-  echo "$as_me:$LINENO: result: $fortune_tmp" >&5
-echo "${ECHO_T}$fortune_tmp" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
-  test -n "$fortune_tmp" && break
-done
-
+ac_cv_textfile="$with_textfile"
 
-  # if it's not there, look on $PATH (and don't use absolute path)
-  if test -z "$fortune_tmp" ; then
-     for ac_prog in fortune
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_fortune_tmp+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$fortune_tmp"; then
-  ac_cv_prog_fortune_tmp="$fortune_tmp" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_fortune_tmp="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
+DEFAULT_TEXT_FILE="$ac_cv_textfile"
 
-fi
-fi
-fortune_tmp=$ac_cv_prog_fortune_tmp
-if test -n "$fortune_tmp"; then
-  echo "$as_me:$LINENO: result: $fortune_tmp" >&5
-echo "${ECHO_T}$fortune_tmp" >&6
-else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
 
-  test -n "$fortune_tmp" && break
-done
+###############################################################################
+#
+#       Check the browser to see help URL
+#
+###############################################################################
 
-  fi
+have_browser=no
+with_browser_req=unspecified
 
-  # if we didn't find anything, then just assume /usr/games/
-  if test -z "$fortune_tmp" ; then
-     fortune_tmp="/usr/games/fortune"
-  fi
 
-  ac_cv_fortune_program="$fortune_tmp"
+# Check whether --with-browser or --without-browser was given.
+if test "${with_browser+set}" = set; then
+  withval="$with_browser"
+  with_browser="$withval"; with_browser_req="$withval"
+else
+  with_browser=no
+fi;
+# no HANDLE_X_PATH_ARG for this one
 
-  # now check to see whether "fortune zippy" works.
-  #
-  fortune_tmp="$fortune_tmp zippy"
-  echo "$as_me:$LINENO: checking for zippy quotes" >&5
-echo $ECHO_N "checking for zippy quotes... $ECHO_C" >&6
-  if ( $fortune_tmp >/dev/null 2>&1 ); then
-    ac_cv_fortune_program="$fortune_tmp"
-    echo "$as_me:$LINENO: result: $fortune_tmp" >&5
-echo "${ECHO_T}$fortune_tmp" >&6
-  else
-    echo "$as_me:$LINENO: result: no" >&5
+case "$with_browser" in
+  no )
+  ;;
+  * )
+    WITH_BROWSER=$with_browser
+    gnome_open_program=$with_browser
+    echo "$as_me:$LINENO: checking for browser $with_browser" >&5
+echo $ECHO_N "checking for browser $with_browser... $ECHO_C" >&6
+    with_browser_fullpath=`which $with_browser 2>/dev/null`
+    case $with_browser_fullpath in
+        /* )
+               echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+                have_browser=yes
+                ;;
+       * )
+              echo "$as_me:$LINENO: result: no" >&5
 echo "${ECHO_T}no" >&6
-  fi
-
-fi
-
-unset ac_cv_path_fortune_tmp
-unset fortune_tmp
-
-cat >>confdefs.h <<_ACEOF
-#define FORTUNE_PROGRAM "$ac_cv_fortune_program"
-_ACEOF
-
-
+# Only warning: we don't want to install all packages for the
+# dependency of the browser in building stage...
+              echo "WARNING: browser not found: --with-browser=$with_browser"
+              ;;
+    esac
+  ;;
+esac
+ac_cv_browser="$with_browser"
 
 ###############################################################################
 #
 
 # Another substitution in the XScreenSaver.ad.in file:
 #
-if test "$have_gnome_help" = yes; then
-  GNOMEHELP_Y=''
-  GNOMEHELP_N='!    '
-else
-  GNOMEHELP_Y='!    '
-  GNOMEHELP_N=''
-fi
-
-
-# Now that we know whether we have Gnome, we can decide where the XML
-# config files get installed.
-#
-if test -z "$HACK_CONF_DIR" ; then
-  if test -n "$GNOME_DATADIR" ; then
-    HACK_CONF_DIR='${GNOME_DATADIR}/control-center/screensavers'
-  else
-    HACK_CONF_DIR='${prefix}/lib/xscreensaver/config'
-  fi
-fi
-
-
-
-# After computing $HACK_CONF_DIR, make sure $GLADE_DATADIR has a value
-# so that we know where to install the Gtk pixmaps.
-#
-# It should usually be "/usr/share/pixmaps/", but we can't just use
-# "$(prefix)/share/pixmaps" because that would usually result in
-# "/usr/X11R6/share/pixmaps/", which is wrong.  It needs to be the
-# Gnome/Gtk prefix, not the overall prefix.
-#
-if test -n "$GNOME_DATADIR" ; then
-  GLADE_DATADIR='$(GNOME_DATADIR)/xscreensaver'
-elif test "$have_gtk" = yes; then
-  if test -n "$pkg_config"; then
-    if test "$have_gtk2" = yes; then
-      GLADE_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
-    else
-      GLADE_DATADIR=`$pkg_config --variable=prefix gtk+`
-    fi
-  else
-    GLADE_DATADIR=`$gtk_config --prefix`
-  fi
-  GLADE_DATADIR="$GLADE_DATADIR/share/xscreensaver"
+if test "$gnome_open_program" != ''; then
+  GNOME24=''
+  GNOME22='!   '
+  NOGNOME='!   '
+elif test "$gnome_url_show_program" != ''; then
+  GNOME24='!   '
+  GNOME22=''
+  NOGNOME='!   '
 else
-  GLADE_DATADIR=''
+  GNOME24='!   '
+  GNOME22='!   '
+  NOGNOME=''
 fi
 
 
 #
 echo "$as_me:$LINENO: checking for locale directory" >&5
 echo $ECHO_N "checking for locale directory... $ECHO_C" >&6
-if test -n "$GNOME_DATADIR" ; then
-  PO_DATADIR="$GNOME_DATADIR"
+if test -n "$GTK_DATADIR" ; then
+  PO_DATADIR="$GTK_DATADIR"
 elif test "$have_gtk" = yes; then
-  if test -n "$pkg_config"; then
-    if test "$have_gtk2" = yes; then
-      PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
-    else
-      PO_DATADIR=`$pkg_config --variable=prefix gtk+`
-    fi
-  else
-    PO_DATADIR=`$gtk_config --prefix`
-  fi
+  PO_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
   PO_DATADIR="$PO_DATADIR/share"
 fi
 
@@ -21097,6 +20011,14 @@ INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
 
 
 
+
+
+
+
+
+
+
+
 
 
 
@@ -21114,7 +20036,7 @@ APPDEFAULTS=$ac_x_app_defaults
 
 
 
-                                                                                ac_config_files="$ac_config_files Makefile utils/Makefile driver/Makefile hacks/Makefile hacks/glx/Makefile po/Makefile.in driver/XScreenSaver.ad driver/xscreensaver.kss"
+                                                                      ac_config_files="$ac_config_files Makefile utils/Makefile driver/Makefile hacks/Makefile hacks/glx/Makefile po/Makefile.in driver/XScreenSaver.ad"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -21665,7 +20587,6 @@ do
   "hacks/glx/Makefile" ) CONFIG_FILES="$CONFIG_FILES hacks/glx/Makefile" ;;
   "po/Makefile.in" ) CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;;
   "driver/XScreenSaver.ad" ) CONFIG_FILES="$CONFIG_FILES driver/XScreenSaver.ad" ;;
-  "driver/xscreensaver.kss" ) CONFIG_FILES="$CONFIG_FILES driver/xscreensaver.kss" ;;
   "default-1" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-1" ;;
   "default-2" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default-2" ;;
   "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
@@ -21814,14 +20735,10 @@ s,@INTLOBJS@,$INTLOBJS,;t t
 s,@POFILES@,$POFILES,;t t
 s,@POSUB@,$POSUB,;t t
 s,@MKINSTALLDIRS@,$MKINSTALLDIRS,;t t
+s,@login_manager_tmp@,$login_manager_tmp,;t t
 s,@pkg_config@,$pkg_config,;t t
-s,@glib_config@,$glib_config,;t t
-s,@gtk_config@,$gtk_config,;t t
-s,@gnome_config@,$gnome_config,;t t
-s,@have_gnome_help@,$have_gnome_help,;t t
-s,@xml_config@,$xml_config,;t t
-s,@gdk_pixbuf_config@,$gdk_pixbuf_config,;t t
-s,@fortune_tmp@,$fortune_tmp,;t t
+s,@gnome_open_program@,$gnome_open_program,;t t
+s,@gnome_url_show_program@,$gnome_url_show_program,;t t
 s,@INCLUDES@,$INCLUDES,;t t
 s,@PREFERRED_DEMO_PROGRAM@,$PREFERRED_DEMO_PROGRAM,;t t
 s,@ALL_DEMO_PROGRAMS@,$ALL_DEMO_PROGRAMS,;t t
@@ -21836,12 +20753,20 @@ s,@PTY_LIBS@,$PTY_LIBS,;t t
 s,@GL_LIBS@,$GL_LIBS,;t t
 s,@GLE_LIBS@,$GLE_LIBS,;t t
 s,@XDPMS_LIBS@,$XDPMS_LIBS,;t t
+s,@XINERAMA_LIBS@,$XINERAMA_LIBS,;t t
 s,@PASSWD_LIBS@,$PASSWD_LIBS,;t t
 s,@INSTALL_SETUID@,$INSTALL_SETUID,;t t
 s,@SETUID_HACKS@,$SETUID_HACKS,;t t
 s,@INSTALL_DIRS@,$INSTALL_DIRS,;t t
 s,@NEED_SETUID@,$NEED_SETUID,;t t
 s,@INSTALL_PAM@,$INSTALL_PAM,;t t
+s,@HAVE_PAM_FAIL_DELAY@,$HAVE_PAM_FAIL_DELAY,;t t
+s,@NEW_LOGIN_COMMAND@,$NEW_LOGIN_COMMAND,;t t
+s,@NEW_LOGIN_COMMAND_P@,$NEW_LOGIN_COMMAND_P,;t t
+s,@DEFAULT_IMAGES_P@,$DEFAULT_IMAGES_P,;t t
+s,@DEFAULT_IMAGE_DIRECTORY@,$DEFAULT_IMAGE_DIRECTORY,;t t
+s,@DEFAULT_TEXT_FILE@,$DEFAULT_TEXT_FILE,;t t
+s,@WITH_BROWSER@,$WITH_BROWSER,;t t
 s,@OBJCC@,$OBJCC,;t t
 s,@EXES_OSX@,$EXES_OSX,;t t
 s,@SCRIPTS_OSX@,$SCRIPTS_OSX,;t t
@@ -21863,13 +20788,13 @@ s,@GL_MEN@,$GL_MEN,;t t
 s,@GL_KLUDGE@,$GL_KLUDGE,;t t
 s,@GLE_EXES@,$GLE_EXES,;t t
 s,@GLE_KLUDGE@,$GLE_KLUDGE,;t t
-s,@GNOMEHELP_Y@,$GNOMEHELP_Y,;t t
-s,@GNOMEHELP_N@,$GNOMEHELP_N,;t t
+s,@GNOME24@,$GNOME24,;t t
+s,@GNOME22@,$GNOME22,;t t
+s,@NOGNOME@,$NOGNOME,;t t
 s,@HACKDIR@,$HACKDIR,;t t
-s,@GNOME_DATADIR@,$GNOME_DATADIR,;t t
-s,@GLADE_DATADIR@,$GLADE_DATADIR,;t t
+s,@HACKDIR_FULL@,$HACKDIR_FULL,;t t
+s,@GTK_DATADIR@,$GTK_DATADIR,;t t
 s,@PO_DATADIR@,$PO_DATADIR,;t t
-s,@GNOME_PANELDIR@,$GNOME_PANELDIR,;t t
 s,@HACK_CONF_DIR@,$HACK_CONF_DIR,;t t
 s,@GTK_EXTRA_OBJS@,$GTK_EXTRA_OBJS,;t t
 s,@APPDEFAULTS@,$APPDEFAULTS,;t t
@@ -22580,10 +21505,6 @@ if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
   warn 'The SGI saver extension was requested, but was not found.'
 fi
 
-if test "$with_mit_req" = yes -a "$have_mit" = no ; then
-  warn 'The MIT saver extension was requested, but was not found.'
-fi
-
 if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
   warn 'The XIdle extension was requested, but was not found.'
 fi
@@ -22620,6 +21541,32 @@ if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then
   warn "Checking of /proc/interrupts was requested, but it's bogus."
 fi
 
+if test "$pkg_config" = false ; then
+  warnL 'The "pkg-config" program was not found.  Without that,'
+  warn2 "detection of the various GTK libraries won't work."
+else
+  pkgerr=`$pkg_config --list-all 2>&1 >/dev/null`
+  if test "x$pkgerr" != "x" ; then
+    warnL 'The "pkg-config" program produces errors.  This often causes'
+    warn2 "detection of the various GTK libraries to malfunction."
+    warn2 "The errors are:"
+    echo ''
+    echo "$pkgerr" | sed 's/^/             > /g'
+  fi
+fi
+
+if test "$gtk_halfassed" != no ; then
+  warnL "GTK version $gtk_halfassed was found, but at least one supporting"
+  warn2 "library ($gtk_halfassed_lib) was not, so GTK can't be used."
+  warn2 "Perhaps some of the development packages are not installed?"
+  if test "$have_gtk" = yes ; then
+    v="$ac_gtk_version_string"
+    warn2 "GTK $v is also installed, so it will be used instead."
+    warn2 "Please read the above output and the \`config.log' file"
+    warn2 "for more details."
+  fi
+fi
+
 motif_warn2() {
   warn2 'Though the Motif front-end to xscreensaver is still'
   warn2 'maintained, it is no longer being updated with new'
@@ -22639,10 +21586,10 @@ if test "$have_motif" = no -a "$have_gtk" = no; then
   else
     warnL "The GTK libraries do not seem to be available; the"
     warn2 "\`xscreensaver-demo' program requires them."
-    echo ''
-    warn2 'You can use Motif or Lesstif instead of GTK (use the'
-    warn2 "\`--with-motif' option) but that is NOT recommended."
-    motif_warn2
+#   echo ''
+#   warn2 'You can use Motif or Lesstif instead of GTK (use the'
+#   warn2 "\`--with-motif' option) but that is NOT recommended."
+#   motif_warn2
   fi
 
 elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
@@ -22651,7 +21598,7 @@ elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
 
 elif test "$jurassic_gtk" = yes ; then
 
-  pref_gtk=1.2
+  pref_gtk=2.0
 
   v="$ac_gtk_version_string"
   if test "$with_gtk_req" = yes -a "$ac_gtk_version" = "unknown" ; then
@@ -22668,56 +21615,6 @@ elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
   warnL "Use of Gtk was requested, but it wasn't found."
 fi
 
-if test "$gtk2_halfassed" != no ; then
-  warnL "GTK version $gtk2_halfassed was found, but at least one supporting"
-  warn2 "library ($gtk2_halfassed_lib) was not, so GTK 2.x can't be used."
-  if test "$have_gtk" = yes ; then
-    v="$ac_gtk_version_string"
-    warn2 "GTK $v is also installed, so it will be used instead."
-    warn2 "Please read the above output and the \`config.log' file"
-    warn2 "for more details."
-  fi
-fi
-
-
-if test "$with_gnome_req" = yes -a "$have_gnome" = no \
-        -a "$have_gtk2" = no; then
-  # don't issue this warning if we have GTK2 -- in that case, the
-  # Gnome-specific code isn't needed.
-  warn  'Use of the Gnome Control Panel was requested, but the necessary'
-  warn2 'headers and/or libraries were not found.'
-fi
-
-if test "$have_gtk" = yes ; then
-  if test "$have_xml" = no ; then
-    if test "$with_xml_req" = yes ; then
-      warn  'Use of the XML library was requested, but the necessary'
-      warn2 'headers and/or libraries were not found.'
-    else
-      warn  'GTK is being used, but the XML library was not found.'
-    fi
-
-    if test "$xml_halfassed" = yes ; then
-
-      if test "$have_zlib" = yes ; then
-        which="XML libraries"
-      else
-        which="\`zlib' library"
-      fi
-
-      echo ''
-      warn2 'More specifically, we found the headers, but not the'
-      warn2 "$which; so either XML is half-installed on this"
-      warn2 "system, or something else went wrong.  The \`config.log'"
-      warn2 'file might contain some clues.'
-    fi
-
-    echo ''
-    warn2 "Without XML, the per-display-mode \`Settings' dialogs"
-    warn2 'will not be available.  Specify the location of the XML'
-    warn2 'library through the --with-xml option to configure.'
-  fi
-fi
 
 if test "$have_gtk" = yes -a "$have_gdk_pixbuf" = no ; then
   warn  "GTK is being used, but the GDK-Pixbuf library and/or"
@@ -22759,8 +21656,16 @@ if test "$with_gdk_pixbuf_req" = yes  -a "$have_gdk_pixbuf" = no; then
   warnL 'Use of GDK-Pixbuf was requested, but it was not found.'
 fi
 
-if test "$have_xpm" = no -a "$have_gdk_pixbuf" = no || \
-   test "$gdk_pixbuf_halfassed" = yes; then
+if test "$have_gdk_pixbuf" = no -o "$gdk_pixbuf_halfassed" = yes || \
+   test "$have_gdk_pixbuf" = no -a "$have_xpm" = no ; then
+
+  if test "$with_gdk_pixbuf_req" = yes ; then
+    true
+  elif test "$with_gdk_pixbuf_req" = no ; then
+    warnL 'The GDK-Pixbuf library is not being used.'
+  else
+    warnL 'The GDK-Pixbuf library was not found.'
+  fi
 
   if test "$with_xpm_req" = yes -o "$have_xpm" = yes ; then
     true
@@ -22770,12 +21675,8 @@ if test "$have_xpm" = no -a "$have_gdk_pixbuf" = no || \
     warnL 'The XPM library was not found.'
   fi
 
-  if test "$with_gdk_pixbuf_req" = yes ; then
-    true
-  elif test "$with_gdk_pixbuf_req" = no ; then
-    warnL 'The GDK-Pixbuf library is not being used.'
-  else
-    warnL 'The GDK-Pixbuf library was not found.'
+  if test "$have_gdk_pixbuf" = no -a "$have_xpm" = yes ; then
+    warn2 'The XPM library is being used instead.'
   fi
 
   if test "$gdk_pixbuf_halfassed" = yes ; then
@@ -22787,15 +21688,10 @@ if test "$have_xpm" = no -a "$have_gdk_pixbuf" = no || \
   fi
 
   echo ''
-  warn2 'Some of the demos will not be as colorful as they'
-  warn2 'could be.  You should consider installing Pixbuf or'
-  warn2 'XPM and re-running configure.  The Pixbuf library is'
-  warn2 'a part of GNOME.  The XPM library comes with most'
-  warn2 'X11 installations; you can also find it at the X11'
-  warn2 'archive sites, such as <http://sunsite.unc.edu/>.'
-  echo  ''
-  warn2 'GDK-Pixbuf is recommended over XPM, as it provides'
-  warn2 'support for more image formats.'
+  warn2 'Some of the demos will not use images as much as they could.'
+  warn2 'You should consider installing GDK-Pixbuf and re-running'
+  warn2 'configure.  (GDK-Pixbuf is recommended over XPM, as it'
+  warn2 'provides support for more image formats.)'
 fi
 
 
@@ -22917,13 +21813,6 @@ if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
   warn 'Use of XReadDisplay was requested, but it was not found.'
 fi
 
-if test -n "$with_fortune_req"; then
-  if test "$with_fortune_req" != "$ac_cv_fortune_program" ; then
-    warnL "$with_fortune_req was requested as the Fortune program,"
-    warn2 "but was not found.  The default will be used instead."
-  fi
-fi
-
 if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
   warn 'Use of Kerberos was requested, but it was not found.'
 fi
@@ -22984,39 +21873,44 @@ done
 
 do_dir_warning=no
 
-# Now let's see if there's a previous RPM version already installed.  Blargh!
+# Now let's warn if there's a previous RPM version already installed.
+# But don't bother with this test if we are currently *building* an RPM.
 
-# M4 sucks!!
+if test -z "$RPM_PACKAGE_VERSION" ; then
 
-rpmv=`(rpm -qv xscreensaver) 2>/dev/null | \
-      sed -n 's/^xscreensaver-\([0-9][0-9]*[.][0-9][0-9]*\)-.*$/\1/p'`
+  rpmnames="xscreensaver xscreensaver-base xscreensaver-extras"
 
+  # M4 sucks!!
 
-if test \! -z "$rpmv" ; then
-  rpmbdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'`
-  rpmhdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/attraction$@\1@p'`
+  rpmv=`(rpm -qv $rpmnames) 2>/dev/null | \
+        sed -n 's/^[-a-z]*-\([0-9][0-9]*[.][0-9][0-9a-z]*\)-.*$/\1/p' | \
+        head -1`
 
-  warning=no
-  warnL "There is already an installed RPM of xscreensaver $rpmv"
-  warn2 "on this system.  You might want to remove it (with"
-  warn2 '"rpm -ve xscreensaver") before running "make install"'
-  warn2 "from this directory."
-  echo ""
-  warn2 "Alternately, you could build this version of xscreensaver"
-  warn2 'as an RPM, and then install that.  An "xscreensaver.spec"'
-  warn2 "file is included.  See the RPM documentation for more info."
-  echo ""
 
-  if test "$rpmbdir" = "$rpmhdir" ; then
-    warn2 "The RPM version was installed in $rpmbdir/."
-  else
-    warn2 "The RPM version was installed in $rpmbdir/,"
-    warn2 "with demos in $rpmhdir/."
-  fi
+  if test \! -z "$rpmv" ; then
+    rpmbdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'`
+    rpmhdir=`rpm -ql $rpmnames | sed -n 's@^\(.*\)/attraction$@\1@p'`
 
-  do_dir_warning=yes
-fi
+    warning=no
+    warnL "There is already an installed RPM of xscreensaver $rpmv"
+    warn2 'on this system.  You might want to remove it ("rpm -ve")'
+    warn2 'before running "make install" in this directory.'
+    echo ""
+    warn2 "Alternately, you could build this version of xscreensaver"
+    warn2 'as an RPM, and then install that.  An "xscreensaver.spec"'
+    warn2 'file is included.  Try "rpmbuild -v -ba xscreensaver.spec".'
+    warn2 "See the RPM documentation for more info."
+    echo ""
 
+    if test "$rpmbdir" = "$rpmhdir" ; then
+      warn2 "The RPM version was installed in $rpmbdir/."
+      do_dir_warning=yes
+    else
+      warn2 "The RPM version was installed in $rpmbdir/,"
+      warn2 "with demos in $rpmhdir/."
+    fi
+  fi
+fi
 
 if test "${bindir}" = "${HACKDIR}" ; then
   do_dir_warning=yes
@@ -23030,7 +21924,7 @@ if test "$do_dir_warning" = yes; then
   echo '      "xscreensaver-demo", and "xscreensaver-command" executables'
   echo "      will be installed in ${bindir}/."
   echo ""
-  echo "      The various graphics demos (180+ different executables) will"
+  echo "      The various graphics demos (190+ different executables) will"
   echo "      be installed in ${HACKDIR}/."
   echo ""
   echo "      If you would prefer the demos to be installed elsewhere,"
@@ -23049,6 +21943,7 @@ if test "$do_dir_warning" = no; then
   fi
   echo "User programs will be installed in ${bindir}/"
   echo "Screen savers will be installed in ${HACKDIR}/"
-  echo "Configuration will be installed in ${HACK_CONF_DIR}/"
+  echo "Hack configurations will be installed in ${HACK_CONF_DIR}/"
+  echo "Saver configuration will be installed in ${APPDEFAULTS}/"
   echo ''
 fi