From http://www.jwz.org/xscreensaver/xscreensaver-5.33.tar.gz
[xscreensaver] / configure
index c12874b0cf366260b175710dc10b44251a66360c..55c535ee2374fd39365bd8c1464cb5430c89fd11 100755 (executable)
--- a/configure
+++ b/configure
@@ -619,13 +619,14 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_header_list=
 ac_subst_vars='LTLIBOBJS
 LIBOBJS
 DEPEND_DEFINES
 DEPEND_FLAGS
 DEPEND
 APPDEFAULTS
+ANIM_LIBS
+ANIM_OBJS
 GTK_EXTRA_OBJS
 HACK_CONF_DIR
 PO_DATADIR
@@ -635,8 +636,6 @@ HACKDIR
 NOGNOME
 GNOME22
 GNOME24
-GLFONT_OBJS
-GLFPS_OBJS
 JWZGLES_OBJS
 GLE_KLUDGE
 GLE_EXES
@@ -652,6 +651,9 @@ LOCK_SRCS
 SAVER_GL_LIBS
 SAVER_GL_OBJS
 SAVER_GL_SRCS
+XFT_LIBS
+XFT_OBJS
+XFT_SRCS
 XMU_LIBS
 XMU_OBJS
 XMU_SRCS
@@ -661,6 +663,8 @@ MEN_OSX
 SCRIPTS_OSX
 EXES_OSX
 OBJCC
+COMMENT_DEMO_GLADE2_GTK_2_22_TAIL
+COMMENT_DEMO_GLADE2_GTK_2_22_HEAD
 WITH_BROWSER
 DEFAULT_TEXT_FILE
 DEFAULT_IMAGE_DIRECTORY
@@ -697,21 +701,51 @@ login_manager_tmp
 MKINSTALLDIRS
 POSUB
 POFILES
-INTLOBJS
+PO_IN_DATADIR_FALSE
+PO_IN_DATADIR_TRUE
 INTLLIBS
-INTLDEPS
 INSTOBJEXT
 GMOFILES
-DATADIRNAME
 CATOBJEXT
 CATALOGS
-XGETTEXT
+MSGFMT_OPTS
+GETTEXT_PACKAGE
+DATADIRNAME
+ALL_LINGUAS
 GMSGFMT
 MSGFMT
+MSGMERGE
+XGETTEXT
+INTLTOOL_POLICY_RULE
+INTLTOOL_SERVICE_RULE
+INTLTOOL_THEME_RULE
+INTLTOOL_SCHEMAS_RULE
+INTLTOOL_CAVES_RULE
+INTLTOOL_XML_NOMERGE_RULE
+INTLTOOL_XML_RULE
+INTLTOOL_KBD_RULE
+INTLTOOL_XAM_RULE
+INTLTOOL_UI_RULE
+INTLTOOL_SOUNDLIST_RULE
+INTLTOOL_SHEET_RULE
+INTLTOOL_SERVER_RULE
+INTLTOOL_PONG_RULE
+INTLTOOL_OAF_RULE
+INTLTOOL_PROP_RULE
+INTLTOOL_KEYS_RULE
+INTLTOOL_DIRECTORY_RULE
+INTLTOOL_DESKTOP_RULE
+intltool__v_merge_options_0
+intltool__v_merge_options_
+INTLTOOL_V_MERGE_OPTIONS
+INTLTOOL__v_MERGE_0
+INTLTOOL__v_MERGE_
+INTLTOOL_V_MERGE
+AM_DEFAULT_VERBOSITY
+INTLTOOL_EXTRACT
+INTLTOOL_MERGE
+INTLTOOL_UPDATE
 USE_NLS
-ALLOCA
-RANLIB
-GETTEXT_PACKAGE
 X_EXTRA_LIBS
 X_LIBS
 X_PRE_LIBS
@@ -789,6 +823,7 @@ with_x_app_defaults
 with_pthread
 enable_largefile
 with_x
+enable_nls
 with_hackdir
 enable_subdir
 with_configdir
@@ -816,6 +851,7 @@ with_gles
 with_pixbuf
 with_xpm
 with_jpeg
+with_xft
 with_xshm_ext
 with_xdbe_ext
 with_readdisplay
@@ -823,6 +859,7 @@ with_image_directory
 with_text_file
 with_browser
 with_setuid_hacks
+with_record_animation
 '
       ac_precious_vars='build_alias
 host_alias
@@ -1448,6 +1485,7 @@ Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-largefile     omit support for large files
+  --disable-nls           do not use Native Language Support
 
 Screen locking options:
   --enable-locking        Compile in support for locking the display.
@@ -1511,6 +1549,7 @@ Graphics options:
   --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-xft              Include support for the X Freetype 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.
@@ -1521,6 +1560,8 @@ Graphics options:
   --with-setuid-hacks     Allow some demos to be installed `setuid root'
                           (which is needed in order to ping other hosts.)
 
+  --with-record-animation Include code for generating MP4 videos.
+
 
 Some influential environment variables:
   CC          C compiler command
@@ -2014,6 +2055,63 @@ $as_echo "$ac_res" >&6; }
   eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
 
 } # ac_fn_c_check_func
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval \${$4+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  eval "$4=yes"
+else
+  eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_member
 cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
@@ -2298,9 +2396,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;}
   >$cache_file
 fi
 
-as_fn_append ac_header_list " stdlib.h"
-as_fn_append ac_header_list " unistd.h"
-as_fn_append ac_header_list " sys/param.h"
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
@@ -2522,6 +2617,10 @@ echo "command line was: $0 $@"
 
 
 
+
+
+
+
 
 
 
@@ -4228,10 +4327,6 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
       $as_echo "#define HAVE_PTHREAD 1" >>confdefs.h
 
       CC=$PTHREAD_CC
-
-      # AX_PTHREAD documentation specifically suggests this...
-      LIBS="$PTHREAD_LIBS $LIBS"
-      CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
     fi
   fi
  # Needs ac_original_cc.
@@ -5169,12 +5264,13 @@ fi
 done
 
 
-for ac_header in unistd.h
+for ac_header in unistd.h inttypes.h
 do :
-  ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default"
-if test "x$ac_cv_header_unistd_h" = xyes; then :
+  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
   cat >>confdefs.h <<_ACEOF
-#define HAVE_UNISTD_H 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
 _ACEOF
 
 fi
@@ -5778,6 +5874,28 @@ _ACEOF
 fi
 done
 
+for ac_func in getaddrinfo
+do :
+  ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
+if test "x$ac_cv_func_getaddrinfo" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_GETADDRINFO 1
+_ACEOF
+
+fi
+done
+
+ac_fn_c_check_member "$LINENO" "struct sockaddr" "sa_len" "ac_cv_member_struct_sockaddr_sa_len" "#include <sys/socket.h>
+"
+if test "x$ac_cv_member_struct_sockaddr_sa_len" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_SOCKADDR_SA_LEN 1
+_ACEOF
+
+
+fi
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct icmp" >&5
 $as_echo_n "checking for struct icmp... " >&6; }
 if ${ac_cv_have_icmp+:} false; then :
@@ -6705,24 +6823,10 @@ $as_echo_n "checking for X app-defaults directory... " >&6; }
 if ${ac_cv_x_app_defaults+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  rm -fr conftestdir
-  if mkdir conftestdir; then
-    cd conftestdir 2>/dev/null
-    # Make sure to not put "make" in the Imakefile rules, since we grep it out.
-    cat > Imakefile <<'EOF'
-acfindx:
-       @echo 'ac_x_app_defaults="${XAPPLOADDIR}"'
-EOF
-    if (xmkmf) >/dev/null 2>&1 && test -f Makefile; then
-      # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
-      eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
-    fi
-    cd .. 2>/dev/null
-    rm -fr conftestdir
-  fi
+  # skip this, it's always wrong these days.
+      #  AC_PATH_X_APP_DEFAULTS_XMKMF
       if test x"$ac_x_app_defaults" = x; then
-
+        true
   # Look for the directory under a standard set of common directories.
   # Check X11 before X11Rn because it's often a symlink to the current release.
   for ac_dir in                                 \
@@ -6739,6 +6843,8 @@ EOF
     /usr/lib/X11R5/app-defaults                 \
     /usr/lib/X11R4/app-defaults                 \
                                                 \
+    /etc/X11/app-defaults                       \
+                                                \
     /usr/local/X11/lib/app-defaults             \
     /usr/local/X11R6/lib/app-defaults           \
     /usr/local/X11R5/lib/app-defaults           \
@@ -6782,6 +6888,7 @@ EOF
 
       fi
       if test x"$ac_x_app_defaults" = x; then
+        /bin/echo -n 'fallback: '
         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
       else
         # Record where we found app-defaults for the cache.
@@ -7016,40 +7123,62 @@ $as_echo "$ac_macosx" >&6; }
 #
 ###############################################################################
 
-IT_PROG_INTLTOOL
-GETTEXT_PACKAGE=xscreensaver
 
-cat >>confdefs.h <<_ACEOF
-#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE"
-_ACEOF
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5
+$as_echo_n "checking whether NLS is requested... " >&6; }
+    # Check whether --enable-nls was given.
+if test "${enable_nls+set}" = set; then :
+  enableval=$enable_nls; USE_NLS=$enableval
+else
+  USE_NLS=yes
+fi
 
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5
+$as_echo "$USE_NLS" >&6; }
 
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$GETTEXT_PACKAGE"
-_ACEOF
 
 
 
-ALL_LINGUAS="ca da de es et fi fr hu it ja ko nb nl 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
+case "$am__api_version" in
+    1.01234)
+       as_fn_error $? "Automake 1.5 or newer is required to use intltool" "$LINENO" 5
+    ;;
+    *)
+    ;;
+esac
+
+INTLTOOL_REQUIRED_VERSION_AS_INT=`echo  | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+INTLTOOL_APPLIED_VERSION=`intltool-update --version | head -1 | cut -d" " -f3`
+INTLTOOL_APPLIED_VERSION_AS_INT=`echo $INTLTOOL_APPLIED_VERSION | awk -F. '{ print $ 1 * 1000 + $ 2 * 100 + $ 3; }'`
+if test -n ""; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for intltool >= " >&5
+$as_echo_n "checking for intltool >= ... " >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_APPLIED_VERSION found" >&5
+$as_echo "$INTLTOOL_APPLIED_VERSION found" >&6; }
+    test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge "$INTLTOOL_REQUIRED_VERSION_AS_INT" ||
+       as_fn_error $? "Your intltool is too old.  You need intltool  or later." "$LINENO" 5
+fi
+
+# Extract the first word of "intltool-update", so it can be a program name with args.
+set dummy intltool-update; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
+if ${ac_cv_path_INTLTOOL_UPDATE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$RANLIB"; then
-  ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  case $INTLTOOL_UPDATE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INTLTOOL_UPDATE="$INTLTOOL_UPDATE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+    ac_cv_path_INTLTOOL_UPDATE="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7057,39 +7186,39 @@ done
   done
 IFS=$as_save_IFS
 
+  ;;
+esac
 fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
+INTLTOOL_UPDATE=$ac_cv_path_INTLTOOL_UPDATE
+if test -n "$INTLTOOL_UPDATE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_UPDATE" >&5
+$as_echo "$INTLTOOL_UPDATE" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
-  ac_ct_RANLIB=$RANLIB
-  # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
+# Extract the first word of "intltool-merge", so it can be a program name with args.
+set dummy intltool-merge; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+if ${ac_cv_path_INTLTOOL_MERGE+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  if test -n "$ac_ct_RANLIB"; then
-  ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+  case $INTLTOOL_MERGE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INTLTOOL_MERGE="$INTLTOOL_MERGE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_RANLIB="ranlib"
+    ac_cv_path_INTLTOOL_MERGE="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7097,245 +7226,120 @@ done
   done
 IFS=$as_save_IFS
 
+  ;;
+esac
 fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
+INTLTOOL_MERGE=$ac_cv_path_INTLTOOL_MERGE
+if test -n "$INTLTOOL_MERGE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_MERGE" >&5
+$as_echo "$INTLTOOL_MERGE" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-  if test "x$ac_ct_RANLIB" = x; then
-    RANLIB=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
-    RANLIB=$ac_ct_RANLIB
-  fi
-else
-  RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = xyes; then :
 
+# Extract the first word of "intltool-extract", so it can be a program name with args.
+set dummy intltool-extract; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_INTLTOOL_EXTRACT+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
+  case $INTLTOOL_EXTRACT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_INTLTOOL_EXTRACT="$INTLTOOL_EXTRACT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_INTLTOOL_EXTRACT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-cat >>confdefs.h <<_ACEOF
-#define off_t long int
-_ACEOF
-
+  ;;
+esac
 fi
-
-# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
-# for constant arguments.  Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if ${ac_cv_working_alloca_h+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <alloca.h>
-int
-main ()
-{
-char *p = (char *) alloca (2 * sizeof (int));
-                         if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_working_alloca_h=yes
+INTLTOOL_EXTRACT=$ac_cv_path_INTLTOOL_EXTRACT
+if test -n "$INTLTOOL_EXTRACT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INTLTOOL_EXTRACT" >&5
+$as_echo "$INTLTOOL_EXTRACT" >&6; }
 else
-  ac_cv_working_alloca_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5
-$as_echo "$ac_cv_working_alloca_h" >&6; }
-if test $ac_cv_working_alloca_h = yes; then
 
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
 
+if test -z "$INTLTOOL_UPDATE" -o -z "$INTLTOOL_MERGE" -o -z "$INTLTOOL_EXTRACT"; then
+    as_fn_error $? "The intltool scripts were not found. Please install intltool." "$LINENO" 5
 fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5
-$as_echo_n "checking for alloca... " >&6; }
-if ${ac_cv_func_alloca_works+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#ifdef __GNUC__
-# define alloca __builtin_alloca
-#else
-# ifdef _MSC_VER
-#  include <malloc.h>
-#  define alloca _alloca
-# else
-#  ifdef HAVE_ALLOCA_H
-#   include <alloca.h>
-#  else
-#   ifdef _AIX
- #pragma alloca
-#   else
-#    ifndef alloca /* predefined by HP cc +Olibcalls */
-void *alloca (size_t);
-#    endif
-#   endif
-#  endif
-# endif
-#endif
-
-int
-main ()
-{
-char *p = (char *) alloca (1);
-                                   if (p) return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_func_alloca_works=yes
-else
-  ac_cv_func_alloca_works=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
+if test -z "$AM_DEFAULT_VERBOSITY"; then
+  AM_DEFAULT_VERBOSITY=1
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5
-$as_echo "$ac_cv_func_alloca_works" >&6; }
 
-if test $ac_cv_func_alloca_works = yes; then
 
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+INTLTOOL_V_MERGE='$(INTLTOOL__v_MERGE_$(V))'
+INTLTOOL__v_MERGE_='$(INTLTOOL__v_MERGE_$(AM_DEFAULT_VERBOSITY))'
+INTLTOOL__v_MERGE_0='@echo "  ITMRG " $@;'
 
-else
-  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
-# that cause trouble.  Some versions do not even contain alloca or
-# contain a buggy version.  If you still want to use their alloca,
-# use ar to extract alloca.o from them instead of compiling alloca.c.
 
-ALLOCA=\${LIBOBJDIR}alloca.$ac_objext
 
-$as_echo "#define C_ALLOCA 1" >>confdefs.h
 
+INTLTOOL_V_MERGE_OPTIONS='$(intltool__v_merge_options_$(V))'
+intltool__v_merge_options_='$(intltool__v_merge_options_$(AM_DEFAULT_VERBOSITY))'
+intltool__v_merge_options_0='-q'
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5
-$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; }
-if ${ac_cv_os_cray+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#if defined CRAY && ! defined CRAY2
-webecray
-#else
-wenotbecray
-#endif
 
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "webecray" >/dev/null 2>&1; then :
-  ac_cv_os_cray=yes
+
+
+  INTLTOOL_DESKTOP_RULE='%.desktop:   %.desktop.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+INTLTOOL_DIRECTORY_RULE='%.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+     INTLTOOL_KEYS_RULE='%.keys:      %.keys.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+     INTLTOOL_PROP_RULE='%.prop:      %.prop.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+      INTLTOOL_OAF_RULE='%.oaf:       %.oaf.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -p $(top_srcdir)/po $< $@'
+     INTLTOOL_PONG_RULE='%.pong:      %.pong.in      $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+   INTLTOOL_SERVER_RULE='%.server:    %.server.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+    INTLTOOL_SHEET_RULE='%.sheet:     %.sheet.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+INTLTOOL_SOUNDLIST_RULE='%.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+       INTLTOOL_UI_RULE='%.ui:        %.ui.in        $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+      INTLTOOL_XML_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+if test "$INTLTOOL_APPLIED_VERSION_AS_INT" -ge 5000; then
+      INTLTOOL_XML_NOMERGE_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u --no-translations $< $@'
 else
-  ac_cv_os_cray=no
+      INTLTOOL_XML_NOMERGE_RULE='%.xml:       %.xml.in       $(INTLTOOL_MERGE) ; $(INTLTOOL_V_MERGE)_it_tmp_dir=tmp.intltool.$$RANDOM && mkdir $$_it_tmp_dir && LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u $$_it_tmp_dir $< $@ && rmdir $$_it_tmp_dir'
 fi
-rm -rf conftest*
+      INTLTOOL_XAM_RULE='%.xam:       %.xml.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+      INTLTOOL_KBD_RULE='%.kbd:       %.kbd.in       $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+    INTLTOOL_CAVES_RULE='%.caves:     %.caves.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+  INTLTOOL_SCHEMAS_RULE='%.schemas:   %.schemas.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+    INTLTOOL_THEME_RULE='%.theme:     %.theme.in     $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+    INTLTOOL_SERVICE_RULE='%.service: %.service.in   $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
+   INTLTOOL_POLICY_RULE='%.policy:    %.policy.in    $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; $(INTLTOOL_V_MERGE)LC_ALL=C $(INTLTOOL_MERGE) $(INTLTOOL_V_MERGE_OPTIONS) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@'
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5
-$as_echo "$ac_cv_os_cray" >&6; }
-if test $ac_cv_os_cray = yes; then
-  for ac_func in _getb67 GETB67 getb67; do
-    as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
 
-cat >>confdefs.h <<_ACEOF
-#define CRAY_STACKSEG_END $ac_func
-_ACEOF
 
-    break
-fi
 
-  done
-fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5
-$as_echo_n "checking stack direction for C alloca... " >&6; }
-if ${ac_cv_c_stack_direction+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_c_stack_direction=0
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-int
-find_stack_direction (int *addr, int depth)
-{
-  int dir, dummy = 0;
-  if (! addr)
-    addr = &dummy;
-  *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1;
-  dir = depth ? find_stack_direction (addr, depth - 1) : 0;
-  return dir + dummy;
-}
 
-int
-main (int argc, char **argv)
-{
-  return find_stack_direction (0, argc + !argv + 20) < 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_c_stack_direction=1
-else
-  ac_cv_c_stack_direction=-1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5
-$as_echo "$ac_cv_c_stack_direction" >&6; }
-cat >>confdefs.h <<_ACEOF
-#define STACK_DIRECTION $ac_cv_c_stack_direction
-_ACEOF
 
 
-fi
 
 
 
 
-  for ac_header in $ac_header_list
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
 
 
 
@@ -7344,443 +7348,171 @@ done
 
 
 
-for ac_func in getpagesize
-do :
-  ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize"
-if test "x$ac_cv_func_getpagesize" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_GETPAGESIZE 1
-_ACEOF
 
-fi
-done
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5
-$as_echo_n "checking for working mmap... " >&6; }
-if ${ac_cv_func_mmap_fixed_mapped+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  if test "$cross_compiling" = yes; then :
-  ac_cv_func_mmap_fixed_mapped=no
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$ac_includes_default
-/* malloc might have been renamed as rpl_malloc. */
-#undef malloc
-
-/* Thanks to Mike Haertel and Jim Avera for this test.
-   Here is a matrix of mmap possibilities:
-       mmap private not fixed
-       mmap private fixed at somewhere currently unmapped
-       mmap private fixed at somewhere already mapped
-       mmap shared not fixed
-       mmap shared fixed at somewhere currently unmapped
-       mmap shared fixed at somewhere already mapped
-   For private mappings, we should verify that changes cannot be read()
-   back from the file, nor mmap's back from the file at a different
-   address.  (There have been systems where private was not correctly
-   implemented like the infamous i386 svr4.0, and systems where the
-   VM page cache was not coherent with the file system buffer cache
-   like early versions of FreeBSD and possibly contemporary NetBSD.)
-   For shared mappings, we should conversely verify that changes get
-   propagated back to all the places they're supposed to be.
-
-   Grep wants private fixed already mapped.
-   The main things grep needs to know about mmap are:
-   * does it exist and is it safe to write into the mmap'd area
-   * how to use it (BSD variants)  */
-
-#include <fcntl.h>
-#include <sys/mman.h>
-
-#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H
-char *malloc ();
-#endif
 
-/* This mess was copied from the GNU getpagesize.h.  */
-#ifndef HAVE_GETPAGESIZE
-# ifdef _SC_PAGESIZE
-#  define getpagesize() sysconf(_SC_PAGESIZE)
-# else /* no _SC_PAGESIZE */
-#  ifdef HAVE_SYS_PARAM_H
-#   include <sys/param.h>
-#   ifdef EXEC_PAGESIZE
-#    define getpagesize() EXEC_PAGESIZE
-#   else /* no EXEC_PAGESIZE */
-#    ifdef NBPG
-#     define getpagesize() NBPG * CLSIZE
-#     ifndef CLSIZE
-#      define CLSIZE 1
-#     endif /* no CLSIZE */
-#    else /* no NBPG */
-#     ifdef NBPC
-#      define getpagesize() NBPC
-#     else /* no NBPC */
-#      ifdef PAGESIZE
-#       define getpagesize() PAGESIZE
-#      endif /* PAGESIZE */
-#     endif /* no NBPC */
-#    endif /* no NBPG */
-#   endif /* no EXEC_PAGESIZE */
-#  else /* no HAVE_SYS_PARAM_H */
-#   define getpagesize() 8192  /* punt totally */
-#  endif /* no HAVE_SYS_PARAM_H */
-# endif /* no _SC_PAGESIZE */
-
-#endif /* no HAVE_GETPAGESIZE */
 
-int
-main ()
-{
-  char *data, *data2, *data3;
-  const char *cdata2;
-  int i, pagesize;
-  int fd, fd2;
-
-  pagesize = getpagesize ();
-
-  /* First, make a file with some known garbage in it. */
-  data = (char *) malloc (pagesize);
-  if (!data)
-    return 1;
-  for (i = 0; i < pagesize; ++i)
-    *(data + i) = rand ();
-  umask (0);
-  fd = creat ("conftest.mmap", 0600);
-  if (fd < 0)
-    return 2;
-  if (write (fd, data, pagesize) != pagesize)
-    return 3;
-  close (fd);
-
-  /* Next, check that the tail of a page is zero-filled.  File must have
-     non-zero length, otherwise we risk SIGBUS for entire page.  */
-  fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600);
-  if (fd2 < 0)
-    return 4;
-  cdata2 = "";
-  if (write (fd2, cdata2, 1) != 1)
-    return 5;
-  data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L);
-  if (data2 == MAP_FAILED)
-    return 6;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data2 + i))
-      return 7;
-  close (fd2);
-  if (munmap (data2, pagesize))
-    return 8;
-
-  /* Next, try to mmap the file at a fixed address which already has
-     something else allocated at it.  If we can, also make sure that
-     we see the same garbage.  */
-  fd = open ("conftest.mmap", O_RDWR);
-  if (fd < 0)
-    return 9;
-  if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE,
-                    MAP_PRIVATE | MAP_FIXED, fd, 0L))
-    return 10;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data2 + i))
-      return 11;
-
-  /* Finally, make sure that changes to the mapped area do not
-     percolate back to the file as seen by read().  (This is a bug on
-     some variants of i386 svr4.0.)  */
-  for (i = 0; i < pagesize; ++i)
-    *(data2 + i) = *(data2 + i) + 1;
-  data3 = (char *) malloc (pagesize);
-  if (!data3)
-    return 12;
-  if (read (fd, data3, pagesize) != pagesize)
-    return 13;
-  for (i = 0; i < pagesize; ++i)
-    if (*(data + i) != *(data3 + i))
-      return 14;
-  close (fd);
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ac_cv_func_mmap_fixed_mapped=yes
-else
-  ac_cv_func_mmap_fixed_mapped=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5
-$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; }
-if test $ac_cv_func_mmap_fixed_mapped = yes; then
 
-$as_echo "#define HAVE_MMAP 1" >>confdefs.h
 
-fi
-rm -rf conftest.mmap conftest.txt
 
 
-   for ac_header in argz.h limits.h locale.h nl_types.h malloc.h string.h \
-unistd.h sys/param.h
-do :
-  as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
 
-fi
 
-done
 
-   for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \
-strdup __argz_count __argz_stringify __argz_next
-do :
-  as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
-  cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
 
-fi
-done
 
 
-   if test $ac_cv_header_locale_h = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5
-$as_echo_n "checking for LC_MESSAGES... " >&6; }
-if ${am_cv_val_LC_MESSAGES+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <locale.h>
-int
-main ()
-{
-return LC_MESSAGES
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  am_cv_val_LC_MESSAGES=yes
-else
-  am_cv_val_LC_MESSAGES=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_val_LC_MESSAGES" >&5
-$as_echo "$am_cv_val_LC_MESSAGES" >&6; }
-    if test $am_cv_val_LC_MESSAGES = yes; then
 
-$as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h
 
-    fi
-  fi
-     USE_NLS=yes
 
 
-        nls_cv_force_use_gnu_gettext="no"
 
-    nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext"
-    if test "$nls_cv_force_use_gnu_gettext" != "yes"; then
-                              nls_cv_header_intl=
-      nls_cv_header_libgt=
-      CATOBJEXT=NONE
 
-      ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default"
-if test "x$ac_cv_header_libintl_h" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libc" >&5
-$as_echo_n "checking for dgettext in libc... " >&6; }
-if ${gt_cv_func_dgettext_libc+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <libintl.h>
-int
-main ()
-{
-return (int) dgettext ("","")
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gt_cv_func_dgettext_libc=yes
-else
-  gt_cv_func_dgettext_libc=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libc" >&5
-$as_echo "$gt_cv_func_dgettext_libc" >&6; }
 
-         if test "$gt_cv_func_dgettext_libc" != "yes"; then
-           { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bindtextdomain in -lintl" >&5
-$as_echo_n "checking for bindtextdomain in -lintl... " >&6; }
-if ${ac_cv_lib_intl_bindtextdomain+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char bindtextdomain ();
-int
-main ()
-{
-return bindtextdomain ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_intl_bindtextdomain=yes
-else
-  ac_cv_lib_intl_bindtextdomain=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_bindtextdomain" >&5
-$as_echo "$ac_cv_lib_intl_bindtextdomain" >&6; }
-if test "x$ac_cv_lib_intl_bindtextdomain" = xyes; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libintl" >&5
-$as_echo_n "checking for dgettext in libintl... " >&6; }
-if ${gt_cv_func_dgettext_libintl+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5
-$as_echo_n "checking for dgettext in -lintl... " >&6; }
-if ${ac_cv_lib_intl_dgettext+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dgettext ();
-int
-main ()
-{
-return dgettext ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_intl_dgettext=yes
-else
-  ac_cv_lib_intl_dgettext=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5
-$as_echo "$ac_cv_lib_intl_dgettext" >&6; }
-if test "x$ac_cv_lib_intl_dgettext" = xyes; then :
-  gt_cv_func_dgettext_libintl=yes
-else
-  gt_cv_func_dgettext_libintl=no
-fi
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libintl" >&5
-$as_echo "$gt_cv_func_dgettext_libintl" >&6; }
-fi
 
-         fi
 
-          if test "$gt_cv_func_dgettext_libintl" = "yes"; then
-           LIBS="$LIBS -lintl";
-          fi
 
-         if test "$gt_cv_func_dgettext_libc" = "yes" \
-           || test "$gt_cv_func_dgettext_libintl" = "yes"; then
 
-$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
 
-           # Extract the first word of "msgfmt", so it can be a program name with args.
-set dummy msgfmt; ac_word=$2
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check the gettext tools to make sure they are GNU
+# Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_MSGFMT+:} false; then :
+if ${ac_cv_path_XGETTEXT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case "$MSGFMT" in
-  /*)
-  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+  case $XGETTEXT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
   ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
-       ac_cv_path_MSGFMT="$ac_dir/$ac_word"
-       break
-      fi
-    fi
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_XGETTEXT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+IFS=$as_save_IFS
+
   ;;
 esac
 fi
-MSGFMT="$ac_cv_path_MSGFMT"
-if test -n "$MSGFMT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
-$as_echo "$MSGFMT" >&6; }
+XGETTEXT=$ac_cv_path_XGETTEXT
+if test -n "$XGETTEXT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
-           if test "$MSGFMT" != "no"; then
-             for ac_func in dcgettext
-do :
-  ac_fn_c_check_func "$LINENO" "dcgettext" "ac_cv_func_dcgettext"
-if test "x$ac_cv_func_dcgettext" = xyes; then :
-  cat >>confdefs.h <<_ACEOF
-#define HAVE_DCGETTEXT 1
-_ACEOF
 
-fi
+
+# Extract the first word of "msgmerge", so it can be a program name with args.
+set dummy msgmerge; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGMERGE+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $MSGMERGE in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_MSGMERGE="$MSGMERGE" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_MSGMERGE="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
 done
+  done
+IFS=$as_save_IFS
 
-             # Extract the first word of "gmsgfmt", so it can be a program name with args.
-set dummy gmsgfmt; ac_word=$2
+  ;;
+esac
+fi
+MSGMERGE=$ac_cv_path_MSGMERGE
+if test -n "$MSGMERGE"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5
+$as_echo "$MSGMERGE" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+# Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_GMSGFMT+:} false; then :
+if ${ac_cv_path_MSGFMT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case $GMSGFMT in
+  case $MSGFMT in
   [\\/]* | ?:[\\/]*)
-  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
+  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
   ;;
   *)
   as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -7790,7 +7522,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_path_MSGFMT="$as_dir/$ac_word$ac_exec_ext"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -7798,426 +7530,1055 @@ done
   done
 IFS=$as_save_IFS
 
-  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
   ;;
 esac
 fi
-GMSGFMT=$ac_cv_path_GMSGFMT
-if test -n "$GMSGFMT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
-$as_echo "$GMSGFMT" >&6; }
+MSGFMT=$ac_cv_path_MSGFMT
+if test -n "$MSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-             # Extract the first word of "xgettext", so it can be a program name with args.
-set dummy xgettext; ac_word=$2
+# Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XGETTEXT+:} false; then :
+if ${ac_cv_path_GMSGFMT+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  case "$XGETTEXT" in
-  /*)
-  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
   ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
-       ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
-       break
-      fi
-    fi
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
   done
-  IFS="$ac_save_ifs"
-  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
   ;;
 esac
 fi
-XGETTEXT="$ac_cv_path_XGETTEXT"
-if test -n "$XGETTEXT"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
-$as_echo "$XGETTEXT" >&6; }
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
-             cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+if test -z "$XGETTEXT" -o -z "$MSGMERGE" -o -z "$MSGFMT"; then
+    as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5
+fi
+xgversion="`$XGETTEXT --version|grep '(GNU ' 2> /dev/null`"
+mmversion="`$MSGMERGE --version|grep '(GNU ' 2> /dev/null`"
+mfversion="`$MSGFMT --version|grep '(GNU ' 2> /dev/null`"
+if test -z "$xgversion" -o -z "$mmversion" -o -z "$mfversion"; then
+    as_fn_error $? "GNU gettext tools not found; required for intltool" "$LINENO" 5
+fi
+
+# Substitute ALL_LINGUAS so we can use it in po/Makefile
+
+
+# Set DATADIRNAME correctly if it is not set yet
+# (copied from glib-gettext.m4)
+if test -z "$DATADIRNAME"; then
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
 main ()
 {
 extern int _nl_msg_cat_cntr;
-                            return _nl_msg_cat_cntr
+                       return _nl_msg_cat_cntr
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  CATOBJEXT=.gmo
-                DATADIRNAME=share
+  DATADIRNAME=share
 else
-  CATOBJEXT=.mo
-                DATADIRNAME=lib
+  case $host in
+    *-*-solaris*)
+                        ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"
+if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
+  DATADIRNAME=share
+else
+  DATADIRNAME=lib
+fi
+
+    ;;
+    *)
+    DATADIRNAME=lib
+    ;;
+    esac
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-             INSTOBJEXT=.mo
-           fi
-         fi
-
-         # Added by Martin Baulig 12/15/98 for libc5 systems
-         if test "$gt_cv_func_dgettext_libc" != "yes" \
-           && test "$gt_cv_func_dgettext_libintl" = "yes"; then
-           INTLLIBS=-lintl
-           LIBS=`echo $LIBS | sed -e 's/-lintl//'`
-         fi
-
 fi
 
 
 
-      if test "$CATOBJEXT" = "NONE"; then
-                        nls_cv_use_gnu_gettext=yes
-      fi
-    fi
-
-    if test "$nls_cv_use_gnu_gettext" != "yes"; then
-
-$as_echo "#define ENABLE_NLS 1" >>confdefs.h
 
-    else
-            CATOBJEXT=
-    fi
 
-        if test "$XGETTEXT" != ":"; then
-                  if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
-        : ;
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5
-$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; }
-        XGETTEXT=":"
-      fi
-    fi
+GETTEXT_PACKAGE=xscreensaver
 
-    # We need to process the po/ directory.
-    POSUB=po
+cat >>confdefs.h <<_ACEOF
+#define GETTEXT_PACKAGE "$GETTEXT_PACKAGE"
+_ACEOF
 
-    ac_config_commands="$ac_config_commands default-1"
 
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$GETTEXT_PACKAGE"
+_ACEOF
 
-                for lang in $ALL_LINGUAS; do
-      GMOFILES="$GMOFILES $lang.gmo"
-      POFILES="$POFILES $lang.po"
-    done
 
 
+ALL_LINGUAS="ca da de es et fi fr hu it ja ko nb nl pl pt pt_BR ru sk sv vi wa zh_CN zh_TW"
 
+   for ac_header in locale.h
+do :
+  ac_fn_c_check_header_mongrel "$LINENO" "locale.h" "ac_cv_header_locale_h" "$ac_includes_default"
+if test "x$ac_cv_header_locale_h" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LOCALE_H 1
+_ACEOF
 
+fi
 
+done
 
+    if test $ac_cv_header_locale_h = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LC_MESSAGES" >&5
+$as_echo_n "checking for LC_MESSAGES... " >&6; }
+if ${am_cv_val_LC_MESSAGES+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <locale.h>
+int
+main ()
+{
+return LC_MESSAGES
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  am_cv_val_LC_MESSAGES=yes
+else
+  am_cv_val_LC_MESSAGES=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_val_LC_MESSAGES" >&5
+$as_echo "$am_cv_val_LC_MESSAGES" >&6; }
+    if test $am_cv_val_LC_MESSAGES = yes; then
 
+$as_echo "#define HAVE_LC_MESSAGES 1" >>confdefs.h
 
+    fi
+  fi
+     USE_NLS=yes
 
 
+    gt_cv_have_gettext=no
 
+    CATOBJEXT=NONE
+    XGETTEXT=:
+    INTLLIBS=
 
+    ac_fn_c_check_header_mongrel "$LINENO" "libintl.h" "ac_cv_header_libintl_h" "$ac_includes_default"
+if test "x$ac_cv_header_libintl_h" = xyes; then :
+  gt_cv_func_dgettext_libintl="no"
+      libintl_extra_libs=""
 
-   if test "x$CATOBJEXT" != "x"; then
-     if test "x$ALL_LINGUAS" = "x"; then
-       LINGUAS=
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5
-$as_echo_n "checking for catalogs to be installed... " >&6; }
-       NEW_LINGUAS=
-       for lang in ${LINGUAS=$ALL_LINGUAS}; do
-         case "$ALL_LINGUAS" in
-          *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;;
-         esac
-       done
-       LINGUAS=$NEW_LINGUAS
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5
-$as_echo "$LINGUAS" >&6; }
-     fi
+      #
+      # First check in libc
+      #
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in libc" >&5
+$as_echo_n "checking for ngettext in libc... " >&6; }
+if ${gt_cv_func_ngettext_libc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-          if test -n "$LINGUAS"; then
-       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
-     fi
-   fi
+#include <libintl.h>
 
-            test -d po || mkdir po
-   if test "$CATOBJEXT" = ".cat"; then
-     ac_fn_c_check_header_mongrel "$LINENO" "linux/version.h" "ac_cv_header_linux_version_h" "$ac_includes_default"
-if test "x$ac_cv_header_linux_version_h" = xyes; then :
-  msgformat=linux
+int
+main ()
+{
+return !ngettext ("","", 1)
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_ngettext_libc=yes
 else
-  msgformat=xopen
+  gt_cv_func_ngettext_libc=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_ngettext_libc" >&5
+$as_echo "$gt_cv_func_ngettext_libc" >&6; }
 
+      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
+             { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in libc" >&5
+$as_echo_n "checking for dgettext in libc... " >&6; }
+if ${gt_cv_func_dgettext_libc+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-               sed -e '/^#/d' $srcdir/po/$msgformat-msg.sed > po/po2msg.sed
-   fi
+#include <libintl.h>
 
-            MKINSTALLDIRS=
-#
-# jwz: fuck this!  it puts hardcoded pathnames into the generated Makefiles!
-#
-#   if test -n "$ac_aux_dir"; then
-#     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
-#   fi
-   if test -z "$MKINSTALLDIRS"; then
-     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
-   fi
+int
+main ()
+{
+return !dgettext ("","")
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  gt_cv_func_dgettext_libc=yes
+else
+  gt_cv_func_dgettext_libc=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
 
-   # jwz: you know what, screw it.  Let's just use the version that I
-   # already computed in configure.in, instead of this version that came
-   # with the i18n crud, ok?
-   MKINSTALLDIRS="$INSTALL_DIRS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_dgettext_libc" >&5
+$as_echo "$gt_cv_func_dgettext_libc" >&6; }
+      fi
 
+      if test "$gt_cv_func_ngettext_libc" = "yes" ; then
+        for ac_func in bind_textdomain_codeset
+do :
+  ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"
+if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_BIND_TEXTDOMAIN_CODESET 1
+_ACEOF
 
+fi
+done
 
+      fi
 
-         test -d po || mkdir po
-   if test "x$srcdir" != "x."; then
-     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
-       posrcprefix="$srcdir/"
-     else
-       posrcprefix="../$srcdir/"
-     fi
-   else
-     posrcprefix="../"
-   fi
-   rm -f po/POTFILES
-   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
-       < $srcdir/po/POTFILES.in > po/POTFILES
-
-MKINSTALLDIRS="$INSTALL_DIRS"
-
-
-###############################################################################
-#
-#       Check for -lXmu (some fucked up vendors don't ship it...)
-#
-###############################################################################
+      #
+      # If we don't have everything we want, check in libintl
+      #
+      if test "$gt_cv_func_dgettext_libc" != "yes" \
+        || test "$gt_cv_func_ngettext_libc" != "yes" \
+         || test "$ac_cv_func_bind_textdomain_codeset" != "yes" ; then
 
-have_xmu=no
+        { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bindtextdomain in -lintl" >&5
+$as_echo_n "checking for bindtextdomain in -lintl... " >&6; }
+if ${ac_cv_lib_intl_bindtextdomain+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/Xmu/Error.h" "ac_cv_header_X11_Xmu_Error_h" "#include <stdlib.h>
-                   #include <stdio.h>
-                   #include <X11/Intrinsic.h>
-"
-if test "x$ac_cv_header_X11_Xmu_Error_h" = xyes; then :
-  have_xmu=yes
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char bindtextdomain ();
+int
+main ()
+{
+return bindtextdomain ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_bindtextdomain=yes
+else
+  ac_cv_lib_intl_bindtextdomain=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_bindtextdomain" >&5
+$as_echo "$ac_cv_lib_intl_bindtextdomain" >&6; }
+if test "x$ac_cv_lib_intl_bindtextdomain" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5
+$as_echo_n "checking for ngettext in -lintl... " >&6; }
+if ${ac_cv_lib_intl_ngettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ngettext ();
+int
+main ()
+{
+return ngettext ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_ngettext=yes
+else
+  ac_cv_lib_intl_ngettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5
+$as_echo "$ac_cv_lib_intl_ngettext" >&6; }
+if test "x$ac_cv_lib_intl_ngettext" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5
+$as_echo_n "checking for dgettext in -lintl... " >&6; }
+if ${ac_cv_lib_intl_dgettext+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-if test "$have_xmu" = no ; then
-  XMU_SRCS='$(UTILS_SRC)/xmu.c'
-  XMU_OBJS='$(UTILS_BIN)/xmu.o'
-  XMU_LIBS=''
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dgettext ();
+int
+main ()
+{
+return dgettext ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_intl_dgettext=yes
 else
-  XMU_SRCS=''
-  XMU_OBJS=''
-  XMU_LIBS='-lXmu'
-  $as_echo "#define HAVE_XMU 1" >>confdefs.h
+  ac_cv_lib_intl_dgettext=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5
+$as_echo "$ac_cv_lib_intl_dgettext" >&6; }
+if test "x$ac_cv_lib_intl_dgettext" = xyes; then :
+  gt_cv_func_dgettext_libintl=yes
+fi
 
 fi
 
+fi
 
-###############################################################################
-#
-#       Check for the SunOS 4.1.x _get_wmShellWidgetClass bug.
-#       See comp.windows.x FAQ question 124.  The right fix is to
-#       get OpenWindows 3.0 patches 100512-02 and 100573-03.
-#
-###############################################################################
 
-if test "$have_xmu" = yes ; then
-  case "$host" in
-    *-sunos4*)
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
-$as_echo_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug... " >&6; }
-if ${ac_cv_sunos_xmu_bug+:} false; then :
+       if test "$gt_cv_func_dgettext_libintl" != "yes" ; then
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if -liconv is needed to use gettext" >&5
+$as_echo_n "checking if -liconv is needed to use gettext... " >&6; }
+         { $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
+$as_echo "" >&6; }
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ngettext in -lintl" >&5
+$as_echo_n "checking for ngettext in -lintl... " >&6; }
+if ${ac_cv_lib_intl_ngettext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_save_LDFLAGS="$LDFLAGS"
-                    if test \! -z "$x_libraries" ; then
-                      LDFLAGS="$LDFLAGS -L$x_libraries"
-                    fi
-                    # Note: this trick never works!  (Generally.)
-                    # We're only getting away with using AC_TRY_LINK
-                    # with X libraries because we know it's SunOS.
-                    LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
-                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl -liconv $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char ngettext ();
 int
 main ()
 {
-
+return ngettext ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_sunos_xmu_bug=no
+  ac_cv_lib_intl_ngettext=yes
 else
-  ac_cv_sunos_xmu_bug=yes
+  ac_cv_lib_intl_ngettext=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-                    LDFLAGS="$ac_save_LDFLAGS"
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sunos_xmu_bug" >&5
-$as_echo "$ac_cv_sunos_xmu_bug" >&6; }
-    if test "$ac_cv_sunos_xmu_bug" = yes ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -static" >&5
-$as_echo_n "checking whether the compiler understands -static... " >&6; }
-if ${ac_cv_ld_static+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_ngettext" >&5
+$as_echo "$ac_cv_lib_intl_ngettext" >&6; }
+if test "x$ac_cv_lib_intl_ngettext" = xyes; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dcgettext in -lintl" >&5
+$as_echo_n "checking for dcgettext in -lintl... " >&6; }
+if ${ac_cv_lib_intl_dcgettext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_save_LDFLAGS="$LDFLAGS"
-                      LDFLAGS="$LDFLAGS -static"
-                      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl -liconv $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dcgettext ();
 int
 main ()
 {
-
+return dcgettext ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_ld_static=yes
+  ac_cv_lib_intl_dcgettext=yes
 else
-  ac_cv_ld_static=no
+  ac_cv_lib_intl_dcgettext=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
-                    LDFLAGS="$ac_save_LDFLAGS"
+LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ld_static" >&5
-$as_echo "$ac_cv_ld_static" >&6; }
-      if test "$ac_cv_ld_static" = yes ; then
-        LDFLAGS="$LDFLAGS -static"
-      else
-        LDFLAGS="$LDFLAGS -Bstatic"
-      fi
-    fi
-    ;;
-  esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dcgettext" >&5
+$as_echo "$ac_cv_lib_intl_dcgettext" >&6; }
+if test "x$ac_cv_lib_intl_dcgettext" = xyes; then :
+  gt_cv_func_dgettext_libintl=yes
+                       libintl_extra_libs=-liconv
+else
+  :
 fi
 
+else
+  :
+fi
 
-###############################################################################
-#
-#       Handle the --with-hackdir option
-#
-###############################################################################
+        fi
 
-have_hackdir=yes
-with_hackdir_req=unspecified
+        #
+        # If we found libintl, then check in it for bind_textdomain_codeset();
+        # we'll prefer libc if neither have bind_textdomain_codeset(),
+        # and both have dgettext and ngettext
+        #
+        if test "$gt_cv_func_dgettext_libintl" = "yes" ; then
+          glib_save_LIBS="$LIBS"
+          LIBS="$LIBS -lintl $libintl_extra_libs"
+          unset ac_cv_func_bind_textdomain_codeset
+          for ac_func in bind_textdomain_codeset
+do :
+  ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"
+if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_BIND_TEXTDOMAIN_CODESET 1
+_ACEOF
 
-# Check whether --with-hackdir was given.
-if test "${with_hackdir+set}" = set; then :
-  withval=$with_hackdir; with_hackdir="$withval"; with_hackdir_req="$withval"
-else
-  with_hackdir=yes
 fi
+done
 
+          LIBS="$glib_save_LIBS"
 
-if test x"$with_hackdir" = xyes; then
-  HACKDIR='${libexecdir}/xscreensaver'
-elif test x"$with_hackdir" = xno; then
-  HACKDIR='${bindir}'
-else
-  HACKDIR=$with_hackdir
-fi
+          if test "$ac_cv_func_bind_textdomain_codeset" = "yes" ; then
+            gt_cv_func_dgettext_libc=no
+          else
+            if test "$gt_cv_func_dgettext_libc" = "yes" \
+               && test "$gt_cv_func_ngettext_libc" = "yes"; then
+              gt_cv_func_dgettext_libintl=no
+            fi
+          fi
+        fi
+      fi
 
-# canonicalize slashes.
-HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
+      if test "$gt_cv_func_dgettext_libc" = "yes" \
+       || test "$gt_cv_func_dgettext_libintl" = "yes"; then
+        gt_cv_have_gettext=yes
+      fi
 
-# Expand HACKDIR as HACKDIR_FULL
-HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR`
+      if test "$gt_cv_func_dgettext_libintl" = "yes"; then
+        INTLLIBS="-lintl $libintl_extra_libs"
+      fi
 
-# This option used to be called --enable-subdir; make sure that is no longer
-# used, since configure brain-damagedly ignores unknown --enable options.
+      if test "$gt_cv_have_gettext" = "yes"; then
 
-obsolete_enable=
-# Check whether --enable-subdir was given.
-if test "${enable_subdir+set}" = set; then :
-  enableval=$enable_subdir; obsolete_enable=yes
-fi
+$as_echo "#define HAVE_GETTEXT 1" >>confdefs.h
 
-if test -n "$obsolete_enable"; then
-  echo "error: the --enable-subdir option has been replaced with"
-  echo "       the new --with-hackdir option; see \`configure --help'"
-  echo "       for more information."
-  exit 1
+       # Extract the first word of "msgfmt", so it can be a program name with args.
+set dummy msgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_MSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  case "$MSGFMT" in
+  /*)
+  ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then
+       ac_cv_path_MSGFMT="$ac_dir/$ac_word"
+       break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no"
+  ;;
+esac
+fi
+MSGFMT="$ac_cv_path_MSGFMT"
+if test "$MSGFMT" != "no"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5
+$as_echo "$MSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
+       if test "$MSGFMT" != "no"; then
+          glib_save_LIBS="$LIBS"
+          LIBS="$LIBS $INTLLIBS"
+         for ac_func in dcgettext
+do :
+  ac_fn_c_check_func "$LINENO" "dcgettext" "ac_cv_func_dcgettext"
+if test "x$ac_cv_func_dcgettext" = xyes; then :
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_DCGETTEXT 1
+_ACEOF
 
+fi
+done
 
-###############################################################################
-#
-#       Handle the --with-configdir option
-#       Help for --with-x-app-defaults option added.
-#
-###############################################################################
+         MSGFMT_OPTS=
+         { $as_echo "$as_me:${as_lineno-$LINENO}: checking if msgfmt accepts -c" >&5
+$as_echo_n "checking if msgfmt accepts -c... " >&6; }
+         cat >conftest.foo <<_ACEOF
+
+msgid ""
+msgstr ""
+"Content-Type: text/plain; charset=UTF-8\n"
+"Project-Id-Version: test 1.0\n"
+"PO-Revision-Date: 2007-02-15 12:01+0100\n"
+"Last-Translator: test <foo@bar.xx>\n"
+"Language-Team: C <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Transfer-Encoding: 8bit\n"
 
-have_configdir=yes
-with_configdir_req=unspecified
+_ACEOF
+if { { $as_echo "$as_me:${as_lineno-$LINENO}: \$MSGFMT -c -o /dev/null conftest.foo"; } >&5
+  ($MSGFMT -c -o /dev/null conftest.foo) 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  MSGFMT_OPTS=-c; { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+echo "$as_me: failed input was:" >&5
+sed 's/^/| /' conftest.foo >&5
+fi
 
-# Check whether --with-configdir was given.
-if test "${with_configdir+set}" = set; then :
-  withval=$with_configdir; with_configdir="$withval"; with_configdir_req="$withval"
+         # Extract the first word of "gmsgfmt", so it can be a program name with args.
+set dummy gmsgfmt; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_GMSGFMT+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  with_configdir=yes
+  case $GMSGFMT in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_GMSGFMT="$GMSGFMT" # 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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_GMSGFMT="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT"
+  ;;
+esac
+fi
+GMSGFMT=$ac_cv_path_GMSGFMT
+if test -n "$GMSGFMT"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5
+$as_echo "$GMSGFMT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
 
-if test x"$with_configdir" = xyes; then
-  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
+         # Extract the first word of "xgettext", so it can be a program name with args.
+set dummy xgettext; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_XGETTEXT+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  # there must be a better way than this...
-  if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then
-    # absolute path
-    HACK_CONF_DIR=$with_configdir
-  else
-    # relative path
-    HACK_CONF_DIR="\${exec_prefix}$with_configdir"
-  fi
+  case "$XGETTEXT" in
+  /*)
+  ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then
+       ac_cv_path_XGETTEXT="$ac_dir/$ac_word"
+       break
+      fi
+    fi
+  done
+  IFS="$ac_save_ifs"
+  test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":"
+  ;;
+esac
+fi
+XGETTEXT="$ac_cv_path_XGETTEXT"
+if test "$XGETTEXT" != ":"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5
+$as_echo "$XGETTEXT" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+extern int _nl_msg_cat_cntr;
+                        return _nl_msg_cat_cntr
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  CATOBJEXT=.gmo
+             DATADIRNAME=share
+else
+  case $host in
+           *-*-solaris*)
+                                                               ac_fn_c_check_func "$LINENO" "bind_textdomain_codeset" "ac_cv_func_bind_textdomain_codeset"
+if test "x$ac_cv_func_bind_textdomain_codeset" = xyes; then :
+  CATOBJEXT=.gmo
+               DATADIRNAME=share
+else
+  CATOBJEXT=.mo
+               DATADIRNAME=lib
+fi
+
+           ;;
+           *-*-openbsd*)
+           CATOBJEXT=.mo
+            DATADIRNAME=share
+           ;;
+           *)
+           CATOBJEXT=.mo
+            DATADIRNAME=lib
+           ;;
+           esac
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+          LIBS="$glib_save_LIBS"
+         INSTOBJEXT=.mo
+       else
+         gt_cv_have_gettext=no
+       fi
+      fi
+
 fi
 
 
 
+    if test "$gt_cv_have_gettext" = "yes" ; then
+
+$as_echo "#define ENABLE_NLS 1" >>confdefs.h
+
+    fi
+
+        if test "$XGETTEXT" != ":"; then
+                  if $XGETTEXT --omit-header /dev/null 2> /dev/null; then
+        : ;
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: found xgettext program is not GNU xgettext; ignore it" >&5
+$as_echo "found xgettext program is not GNU xgettext; ignore it" >&6; }
+        XGETTEXT=":"
+      fi
+    fi
+
+    # We need to process the po/ directory.
+    POSUB=po
+
+    ac_config_commands="$ac_config_commands default-1"
+
+
+                for lang in $ALL_LINGUAS; do
+      GMOFILES="$GMOFILES $lang.gmo"
+      POFILES="$POFILES $lang.po"
+    done
+
+
+
+
+
+
+
+
+
+
+
+
+
+   if test "$gt_cv_have_gettext" = "yes"; then
+     if test "x$ALL_LINGUAS" = "x"; then
+       LINGUAS=
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking for catalogs to be installed" >&5
+$as_echo_n "checking for catalogs to be installed... " >&6; }
+       NEW_LINGUAS=
+       for presentlang in $ALL_LINGUAS; do
+         useit=no
+         if test "%UNSET%" != "${LINGUAS-%UNSET%}"; then
+           desiredlanguages="$LINGUAS"
+         else
+           desiredlanguages="$ALL_LINGUAS"
+         fi
+         for desiredlang in $desiredlanguages; do
+          # Use the presentlang catalog if desiredlang is
+           #   a. equal to presentlang, or
+           #   b. a variant of presentlang (because in this case,
+           #      presentlang can be used as a fallback for messages
+           #      which are not translated in the desiredlang catalog).
+           case "$desiredlang" in
+             "$presentlang"*) useit=yes;;
+           esac
+         done
+         if test $useit = yes; then
+           NEW_LINGUAS="$NEW_LINGUAS $presentlang"
+         fi
+       done
+       LINGUAS=$NEW_LINGUAS
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LINGUAS" >&5
+$as_echo "$LINGUAS" >&6; }
+     fi
+
+          if test -n "$LINGUAS"; then
+       for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+     fi
+   fi
+
+            MKINSTALLDIRS=
+   if test -n "$ac_aux_dir"; then
+     MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs"
+   fi
+   if test -z "$MKINSTALLDIRS"; then
+     MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs"
+   fi
+
+
+         test -d po || mkdir po
+   if test "x$srcdir" != "x."; then
+     if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
+       posrcprefix="$srcdir/"
+     else
+       posrcprefix="../$srcdir/"
+     fi
+   else
+     posrcprefix="../"
+   fi
+   rm -f po/POTFILES
+   sed -e "/^#/d" -e "/^\$/d" -e "s,.*,        $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
+       < $srcdir/po/POTFILES.in > po/POTFILES
+
+MKINSTALLDIRS="$INSTALL_DIRS"
+
 
 ###############################################################################
 #
-#       Check for the SGI SCREEN_SAVER server extension.
+#       Check for -lXmu (some fucked up vendors don't ship it...)
 #
 ###############################################################################
 
-#have_sgi=no
+have_xmu=no
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "X11/Xmu/Error.h" "ac_cv_header_X11_Xmu_Error_h" "#include <stdlib.h>
+                   #include <stdio.h>
+                   #include <X11/Intrinsic.h>
+"
+if test "x$ac_cv_header_X11_Xmu_Error_h" = xyes; then :
+  have_xmu=yes
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+if test "$have_xmu" = no ; then
+  XMU_SRCS='$(UTILS_SRC)/xmu.c'
+  XMU_OBJS='$(UTILS_BIN)/xmu.o'
+  XMU_LIBS=''
+else
+  XMU_SRCS=''
+  XMU_OBJS=''
+  XMU_LIBS='-lXmu'
+  $as_echo "#define HAVE_XMU 1" >>confdefs.h
+
+fi
+
+
+###############################################################################
+#
+#       Check for the SunOS 4.1.x _get_wmShellWidgetClass bug.
+#       See comp.windows.x FAQ question 124.  The right fix is to
+#       get OpenWindows 3.0 patches 100512-02 and 100573-03.
+#
+###############################################################################
+
+if test "$have_xmu" = yes ; then
+  case "$host" in
+    *-sunos4*)
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
+$as_echo_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug... " >&6; }
+if ${ac_cv_sunos_xmu_bug+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_LDFLAGS="$LDFLAGS"
+                    if test \! -z "$x_libraries" ; then
+                      LDFLAGS="$LDFLAGS -L$x_libraries"
+                    fi
+                    # Note: this trick never works!  (Generally.)
+                    # We're only getting away with using AC_TRY_LINK
+                    # with X libraries because we know it's SunOS.
+                    LDFLAGS="$LDFLAGS -lXmu -lXt -lX11 -lXext -lm"
+                    cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_sunos_xmu_bug=no
+else
+  ac_cv_sunos_xmu_bug=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+                    LDFLAGS="$ac_save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sunos_xmu_bug" >&5
+$as_echo "$ac_cv_sunos_xmu_bug" >&6; }
+    if test "$ac_cv_sunos_xmu_bug" = yes ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler understands -static" >&5
+$as_echo_n "checking whether the compiler understands -static... " >&6; }
+if ${ac_cv_ld_static+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_save_LDFLAGS="$LDFLAGS"
+                      LDFLAGS="$LDFLAGS -static"
+                      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_ld_static=yes
+else
+  ac_cv_ld_static=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+                    LDFLAGS="$ac_save_LDFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_ld_static" >&5
+$as_echo "$ac_cv_ld_static" >&6; }
+      if test "$ac_cv_ld_static" = yes ; then
+        LDFLAGS="$LDFLAGS -static"
+      else
+        LDFLAGS="$LDFLAGS -Bstatic"
+      fi
+    fi
+    ;;
+  esac
+fi
+
+
+###############################################################################
+#
+#       Handle the --with-hackdir option
+#
+###############################################################################
+
+have_hackdir=yes
+with_hackdir_req=unspecified
+
+# Check whether --with-hackdir was given.
+if test "${with_hackdir+set}" = set; then :
+  withval=$with_hackdir; with_hackdir="$withval"; with_hackdir_req="$withval"
+else
+  with_hackdir=yes
+fi
+
+
+if test x"$with_hackdir" = xyes; then
+  HACKDIR='${libexecdir}/xscreensaver'
+elif test x"$with_hackdir" = xno; then
+  HACKDIR='${bindir}'
+else
+  HACKDIR=$with_hackdir
+fi
+
+# canonicalize slashes.
+HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
+
+# Expand HACKDIR as HACKDIR_FULL
+HACKDIR_FULL=`eval eval eval eval eval eval eval eval eval echo $HACKDIR`
+
+# This option used to be called --enable-subdir; make sure that is no longer
+# used, since configure brain-damagedly ignores unknown --enable options.
+
+obsolete_enable=
+# Check whether --enable-subdir was given.
+if test "${enable_subdir+set}" = set; then :
+  enableval=$enable_subdir; obsolete_enable=yes
+fi
+
+if test -n "$obsolete_enable"; then
+  echo "error: the --enable-subdir option has been replaced with"
+  echo "       the new --with-hackdir option; see \`configure --help'"
+  echo "       for more information."
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Handle the --with-configdir option
+#       Help for --with-x-app-defaults option added.
+#
+###############################################################################
+
+have_configdir=yes
+with_configdir_req=unspecified
+
+# Check whether --with-configdir was given.
+if test "${with_configdir+set}" = set; then :
+  withval=$with_configdir; with_configdir="$withval"; with_configdir_req="$withval"
+else
+  with_configdir=yes
+fi
+
+
+if test x"$with_configdir" = xyes; then
+  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
+else
+  # there must be a better way than this...
+  if test -z "`echo $with_configdir | sed 's@^/.*@@'`" ; then
+    # absolute path
+    HACK_CONF_DIR=$with_configdir
+  else
+    # relative path
+    HACK_CONF_DIR="\${exec_prefix}$with_configdir"
+  fi
+fi
+
+
+
+
+###############################################################################
+#
+#       Check for the SGI SCREEN_SAVER server extension.
+#
+###############################################################################
+
+#have_sgi=no
 #with_sgi_req=unspecified
 #AC_ARG_WITH(sgi-ext,
 #[Except where noted, all of the --with options below can also take a
 #fi
 
 
-###############################################################################
-#
-#       Check for the SGI-VIDEO-CONTROL server extension.
-#
-###############################################################################
+###############################################################################
+#
+#       Check for the SGI-VIDEO-CONTROL server extension.
+#
+###############################################################################
+
+#have_sgivc=no
+#with_sgivc_req=unspecified
+#AC_ARG_WITH(sgivc-ext,
+#[  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL extension.],
+#  [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
+#
+#HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
+#
+#if test "$with_sgivc" = yes; then
+#
+#  # first check for XSGIvc.h
+#  AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],,
+#                    [#include <X11/Xlib.h>])
+#
+#  # if that succeeded, then check for the -lXsgivc
+#  if test "$have_sgivc" = yes; then
+#    have_sgivc=no
+#    AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
+#                  [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true],
+#                  -lXext -lX11)
+#  fi
+#
+#  # if that succeeded, then we've really got it.
+#  if test "$have_sgivc" = yes; then
+#    AC_DEFINE(HAVE_SGI_VC_EXTENSION)
+#  fi
+#
+#elif test "$with_sgivc" != no; then
+#  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
+#  exit 1
+#fi
+
+
+###############################################################################
+#
+#       Check for the DPMS server extension.
+#
+###############################################################################
+
+have_dpms=no
+with_dpms_req=unspecified
+
+# Check whether --with-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_dpms=yes
+fi
+
+
+
+   case "$with_dpms" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS headers" >&5
+$as_echo_n "checking for DPMS headers... " >&6; }
+     d=$with_dpms/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS libs" >&5
+$as_echo_n "checking for DPMS libs... " >&6; }
+     d=$with_dpms/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     # replace the directory string with "yes".
+     with_dpms_req="yes"
+     with_dpms=$with_dpms_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+
+
+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"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/dpms.h" "ac_cv_header_X11_extensions_dpms_h" "#include <X11/Xlib.h>
+                    #include <X11/Xmd.h>
+"
+if test "x$ac_cv_header_X11_extensions_dpms_h" = xyes; then :
+  have_dpms=yes
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+
+  # if that succeeded, then check for the DPMS code in the libraries
+  if test "$have_dpms" = yes; then
+
+    # first look in -lXext (this is where it is with XFree86 4.0)
+    have_dpms=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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXext" >&5
+$as_echo_n "checking for DPMSInfo in -lXext... " >&6; }
+if ${ac_cv_lib_Xext_DPMSInfo+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext -lXext -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char DPMSInfo ();
+int
+main ()
+{
+return DPMSInfo ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xext_DPMSInfo=yes
+else
+  ac_cv_lib_Xext_DPMSInfo=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_DPMSInfo" >&5
+$as_echo "$ac_cv_lib_Xext_DPMSInfo" >&6; }
+if test "x$ac_cv_lib_Xext_DPMSInfo" = xyes; then :
+  have_dpms=yes
+else
+  true
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  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
+
+  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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXdpms" >&5
+$as_echo_n "checking for DPMSInfo in -lXdpms... " >&6; }
+if ${ac_cv_lib_Xdpms_DPMSInfo+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXdpms -lXext -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char DPMSInfo ();
+int
+main ()
+{
+return DPMSInfo ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xdpms_DPMSInfo=yes
+else
+  ac_cv_lib_Xdpms_DPMSInfo=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5
+$as_echo "$ac_cv_lib_Xdpms_DPMSInfo" >&6; }
+if test "x$ac_cv_lib_Xdpms_DPMSInfo" = xyes; then :
+  have_dpms=yes; XDPMS_LIBS="-lXdpms"
+else
+  true
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+    fi
+  fi
+
+
+  # if that succeeded, then we've really got it.
+  if test "$have_dpms" = yes; then
+    $as_echo "#define HAVE_DPMS_EXTENSION 1" >>confdefs.h
+
+  fi
+
+elif test "$with_dpms" != no; then
+  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for the XINERAMA server extension.
+#
+###############################################################################
+
+have_xinerama=no
+with_xinerama_req=unspecified
+
+# Check whether --with-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_xinerama=yes
+fi
+
+
+
+   case "$with_xinerama" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA headers" >&5
+$as_echo_n "checking for XINERAMA headers... " >&6; }
+     d=$with_xinerama/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA libs" >&5
+$as_echo_n "checking for XINERAMA libs... " >&6; }
+     d=$with_xinerama/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     # replace the directory string with "yes".
+     with_xinerama_req="yes"
+     with_xinerama=$with_xinerama_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+
+
+if test "$with_xinerama" = yes; then
+
+  # first check for Xinerama.h
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include <X11/Xlib.h>
+"
+if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then :
+  have_xinerama=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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXext" >&5
+$as_echo_n "checking for XineramaQueryScreens in -lXext... " >&6; }
+if ${ac_cv_lib_Xext_XineramaQueryScreens+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXext -lXext -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XineramaQueryScreens ();
+int
+main ()
+{
+return XineramaQueryScreens ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xext_XineramaQueryScreens=yes
+else
+  ac_cv_lib_Xext_XineramaQueryScreens=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5
+$as_echo "$ac_cv_lib_Xext_XineramaQueryScreens" >&6; }
+if test "x$ac_cv_lib_Xext_XineramaQueryScreens" = xyes; 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
+
+  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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXinerama" >&5
+$as_echo_n "checking for XineramaQueryScreens in -lXinerama... " >&6; }
+if ${ac_cv_lib_Xinerama_XineramaQueryScreens+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXinerama -lXext -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XineramaQueryScreens ();
+int
+main ()
+{
+return XineramaQueryScreens ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xinerama_XineramaQueryScreens=yes
+else
+  ac_cv_lib_Xinerama_XineramaQueryScreens=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5
+$as_echo "$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6; }
+if test "x$ac_cv_lib_Xinerama_XineramaQueryScreens" = xyes; then :
+  have_xinerama=yes; XINERAMA_LIBS="-lXinerama"
+else
+  true
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+    fi
+  fi
 
-#have_sgivc=no
-#with_sgivc_req=unspecified
-#AC_ARG_WITH(sgivc-ext,
-#[  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL extension.],
-#  [with_sgivc="$withval"; with_sgivc_req="$withval"],[with_sgivc=yes])
-#
-#HANDLE_X_PATH_ARG(with_sgivc, --with-sgivc-ext, SGI-VIDEO-CONTROL)
-#
-#if test "$with_sgivc" = yes; then
-#
-#  # first check for XSGIvc.h
-#  AC_CHECK_X_HEADER(X11/extensions/XSGIvc.h, [have_sgivc=yes],,
-#                    [#include <X11/Xlib.h>])
-#
-#  # if that succeeded, then check for the -lXsgivc
-#  if test "$have_sgivc" = yes; then
-#    have_sgivc=no
-#    AC_CHECK_X_LIB(Xsgivc, XSGIvcQueryGammaMap,
-#                  [have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"], [true],
-#                  -lXext -lX11)
-#  fi
-#
-#  # if that succeeded, then we've really got it.
-#  if test "$have_sgivc" = yes; then
-#    AC_DEFINE(HAVE_SGI_VC_EXTENSION)
-#  fi
-#
-#elif test "$with_sgivc" != no; then
-#  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
-#  exit 1
-#fi
+  # if that succeeded, then we've really got it.
+  if test "$have_xinerama" = yes; then
+    $as_echo "#define HAVE_XINERAMA 1" >>confdefs.h
+
+  fi
+
+elif test "$with_xinerama" != no; then
+  echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
+  exit 1
+fi
 
 
 ###############################################################################
 #
-#       Check for the DPMS server extension.
+#       Check for the XINPUT server extension.
 #
 ###############################################################################
 
-have_dpms=no
-with_dpms_req=unspecified
+have_xinput=no
+with_xinput_req=unspecified
 
-# Check whether --with-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-xinput-ext was given.
+if test "${with_xinput_ext+set}" = set; then :
+  withval=$with_xinput_ext; with_xinput="$withval"; with_xinput_req="$withval"
 else
-  with_dpms=yes
+  with_xinput=yes
 fi
 
 
 
-   case "$with_dpms" in
+   case "$with_xinput" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS headers" >&5
-$as_echo_n "checking for DPMS headers... " >&6; }
-     d=$with_dpms/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT headers" >&5
+$as_echo_n "checking for XINPUT headers... " >&6; }
+     d=$with_xinput/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8349,9 +9180,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMS libs" >&5
-$as_echo_n "checking for DPMS libs... " >&6; }
-     d=$with_dpms/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT libs" >&5
+$as_echo_n "checking for XINPUT libs... " >&6; }
+     d=$with_xinput/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8362,13 +9193,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_dpms_req="yes"
-     with_dpms=$with_dpms_req
+     with_xinput_req="yes"
+     with_xinput=$with_xinput_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-dpms-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xinput-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
@@ -8376,9 +9207,9 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_dpms" = yes; then
+if test "$with_xinput" = yes; then
 
-  # first check for dpms.h
+  # first check for Xinput.h
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -8386,21 +9217,18 @@ if test "$with_dpms" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/dpms.h" "ac_cv_header_X11_extensions_dpms_h" "#include <X11/Xlib.h>
-                    #include <X11/Xmd.h>
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput.h" "ac_cv_header_X11_extensions_XInput_h" "#include <X11/Xlib.h>
 "
-if test "x$ac_cv_header_X11_extensions_dpms_h" = xyes; then :
-  have_dpms=yes
+if test "x$ac_cv_header_X11_extensions_XInput_h" = xyes; then :
+  have_xinput=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for the DPMS code in the libraries
-  if test "$have_dpms" = yes; then
-
-    # first look in -lXext (this is where it is with XFree86 4.0)
-    have_dpms=no
+  # if that succeeded, then check for libXi
+  if test "$have_xinput" = yes; then
+    have_xinput=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -8420,13 +9248,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXext" >&5
-$as_echo_n "checking for DPMSInfo in -lXext... " >&6; }
-if ${ac_cv_lib_Xext_DPMSInfo+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XListInputDevices in -lXi" >&5
+$as_echo_n "checking for XListInputDevices in -lXi... " >&6; }
+if ${ac_cv_lib_Xi_XListInputDevices+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext -lXext -lX11 $LIBS"
+LIBS="-lXi -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8436,28 +9264,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char DPMSInfo ();
+char XListInputDevices ();
 int
 main ()
 {
-return DPMSInfo ();
+return XListInputDevices ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xext_DPMSInfo=yes
+  ac_cv_lib_Xi_XListInputDevices=yes
 else
-  ac_cv_lib_Xext_DPMSInfo=no
+  ac_cv_lib_Xi_XListInputDevices=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_DPMSInfo" >&5
-$as_echo "$ac_cv_lib_Xext_DPMSInfo" >&6; }
-if test "x$ac_cv_lib_Xext_DPMSInfo" = xyes; then :
-  have_dpms=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XListInputDevices" >&5
+$as_echo "$ac_cv_lib_Xi_XListInputDevices" >&6; }
+if test "x$ac_cv_lib_Xi_XListInputDevices" = xyes; then :
+  have_xinput=yes; SAVER_LIBS="$SAVER_LIBS -lXi"
 else
   true
 fi
@@ -8466,9 +9294,106 @@ fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
+  fi
 
-    # if that failed, look in -lXdpms (this is where it was in XFree86 3.x)
-    if test "$have_dpms" = no; then
+  # if that succeeded, then we've really got it.
+  if test "$have_xinput" = yes; then
+    $as_echo "#define HAVE_XINPUT 1" >>confdefs.h
+
+  fi
+
+elif test "$with_xinput" != no; then
+  echo "error: must be yes or no: --with-xinput-ext=$with_xinput"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for the XF86VMODE server extension (for virtual screens.)
+#
+###############################################################################
+
+have_xf86vmode=no
+with_xf86vmode_req=unspecified
+
+# Check whether --with-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_xf86vmode=yes
+fi
+
+
+
+   case "$with_xf86vmode" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode headers" >&5
+$as_echo_n "checking for xf86vmode headers... " >&6; }
+     d=$with_xf86vmode/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode libs" >&5
+$as_echo_n "checking for xf86vmode libs... " >&6; }
+     d=$with_xf86vmode/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     # replace the directory string with "yes".
+     with_xf86vmode_req="yes"
+     with_xf86vmode=$with_xf86vmode_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+
+
+VIDMODE_LIBS=""
+
+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"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include <X11/Xlib.h>
+"
+if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then :
+  have_xf86vmode=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"
@@ -8488,13 +9413,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DPMSInfo in -lXdpms" >&5
-$as_echo_n "checking for DPMSInfo in -lXdpms... " >&6; }
-if ${ac_cv_lib_Xdpms_DPMSInfo+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5
+$as_echo_n "checking for XF86VidModeGetViewPort in -lXxf86vm... " >&6; }
+if ${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXdpms -lXext -lX11 $LIBS"
+LIBS="-lXxf86vm -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8504,28 +9429,30 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char DPMSInfo ();
+char XF86VidModeGetViewPort ();
 int
 main ()
 {
-return DPMSInfo ();
+return XF86VidModeGetViewPort ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xdpms_DPMSInfo=yes
+  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes
 else
-  ac_cv_lib_Xdpms_DPMSInfo=no
+  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xdpms_DPMSInfo" >&5
-$as_echo "$ac_cv_lib_Xdpms_DPMSInfo" >&6; }
-if test "x$ac_cv_lib_Xdpms_DPMSInfo" = xyes; then :
-  have_dpms=yes; XDPMS_LIBS="-lXdpms"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5
+$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6; }
+if test "x$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" = xyes; then :
+  have_xf86vmode=yes;
+                   VIDMODE_LIBS="-lXxf86vm";
+                   SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"
 else
   true
 fi
@@ -8534,48 +9461,47 @@ fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
   fi
 
-
   # if that succeeded, then we've really got it.
-  if test "$have_dpms" = yes; then
-    $as_echo "#define HAVE_DPMS_EXTENSION 1" >>confdefs.h
+  if test "$have_xf86vmode" = yes; then
+    $as_echo "#define HAVE_XF86VMODE 1" >>confdefs.h
 
   fi
 
-elif test "$with_dpms" != no; then
-  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
+elif test "$with_xf86vmode" != no; then
+  echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the XINERAMA server extension.
+#       Check for the XF86VMODE server extension (for gamma fading.)
 #
 ###############################################################################
 
-have_xinerama=no
-with_xinerama_req=unspecified
+have_xf86gamma=no
+have_xf86gamma_ramp=no
+with_xf86gamma_req=unspecified
 
-# Check whether --with-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-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_xinerama=yes
+  with_xf86gamma=yes
 fi
 
 
 
-   case "$with_xinerama" in
+   case "$with_xf86gamma" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA headers" >&5
-$as_echo_n "checking for XINERAMA headers... " >&6; }
-     d=$with_xinerama/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86gamma headers" >&5
+$as_echo_n "checking for xf86gamma headers... " >&6; }
+     d=$with_xf86gamma/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8585,9 +9511,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINERAMA libs" >&5
-$as_echo_n "checking for XINERAMA libs... " >&6; }
-     d=$with_xinerama/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86gamma libs" >&5
+$as_echo_n "checking for xf86gamma libs... " >&6; }
+     d=$with_xf86gamma/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8598,13 +9524,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_xinerama_req="yes"
-     with_xinerama=$with_xinerama_req
+     with_xf86gamma_req="yes"
+     with_xf86gamma=$with_xf86gamma_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xinerama-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
@@ -8612,9 +9538,12 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_xinerama" = yes; then
+if test "$with_xf86gamma" = yes; then
 
-  # first check for Xinerama.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
@@ -8622,20 +9551,19 @@ if test "$with_xinerama" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xinerama.h" "ac_cv_header_X11_extensions_Xinerama_h" "#include <X11/Xlib.h>
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include <X11/Xlib.h>
 "
-if test "x$ac_cv_header_X11_extensions_Xinerama_h" = xyes; then :
-  have_xinerama=yes
+if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then :
+  have_xf86gamma=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
 
-  # 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
+  # if that succeeded, then check for the -lXxf86vm
+  if test "$have_xf86gamma" = yes; then
+    have_xf86gamma=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -8655,13 +9583,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXext" >&5
-$as_echo_n "checking for XineramaQueryScreens in -lXext... " >&6; }
-if ${ac_cv_lib_Xext_XineramaQueryScreens+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeSetGamma in -lXxf86vm" >&5
+$as_echo_n "checking for XF86VidModeSetGamma in -lXxf86vm... " >&6; }
+if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGamma+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext -lXext -lX11 $LIBS"
+LIBS="-lXxf86vm -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8671,28 +9599,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XineramaQueryScreens ();
+char XF86VidModeSetGamma ();
 int
 main ()
 {
-return XineramaQueryScreens ();
+return XF86VidModeSetGamma ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xext_XineramaQueryScreens=yes
+  ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=yes
 else
-  ac_cv_lib_Xext_XineramaQueryScreens=no
+  ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XineramaQueryScreens" >&5
-$as_echo "$ac_cv_lib_Xext_XineramaQueryScreens" >&6; }
-if test "x$ac_cv_lib_Xext_XineramaQueryScreens" = xyes; then :
-  have_xinerama=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" >&5
+$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" >&6; }
+if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" = xyes; then :
+  have_xf86gamma=yes
 else
   true
 fi
@@ -8701,9 +9629,11 @@ fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
+  fi
 
-    # if that failed, look in -lXinerama (this is where it is in XFree86 4.1.)
-    if test "$have_xinerama" = no; then
+  # check for the Ramp versions of the functions too.
+  if test "$have_xf86gamma" = yes; then
+    have_xf86gamma_ramp=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -8723,13 +9653,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XineramaQueryScreens in -lXinerama" >&5
-$as_echo_n "checking for XineramaQueryScreens in -lXinerama... " >&6; }
-if ${ac_cv_lib_Xinerama_XineramaQueryScreens+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeSetGammaRamp in -lXxf86vm" >&5
+$as_echo_n "checking for XF86VidModeSetGammaRamp in -lXxf86vm... " >&6; }
+if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXinerama -lXext -lX11 $LIBS"
+LIBS="-lXxf86vm -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8739,28 +9669,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XineramaQueryScreens ();
+char XF86VidModeSetGammaRamp ();
 int
 main ()
 {
-return XineramaQueryScreens ();
+return XF86VidModeSetGammaRamp ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xinerama_XineramaQueryScreens=yes
+  ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=yes
 else
-  ac_cv_lib_Xinerama_XineramaQueryScreens=no
+  ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xinerama_XineramaQueryScreens" >&5
-$as_echo "$ac_cv_lib_Xinerama_XineramaQueryScreens" >&6; }
-if test "x$ac_cv_lib_Xinerama_XineramaQueryScreens" = xyes; then :
-  have_xinerama=yes; XINERAMA_LIBS="-lXinerama"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" >&5
+$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" >&6; }
+if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" = xyes; then :
+  have_xf86gamma_ramp=yes
 else
   true
 fi
@@ -8769,47 +9699,60 @@ 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
-    $as_echo "#define HAVE_XINERAMA 1" >>confdefs.h
+  # if those tests succeeded, then we've really got the functions.
+  if test "$have_xf86gamma" = yes; then
+    $as_echo "#define HAVE_XF86VMODE_GAMMA 1" >>confdefs.h
 
   fi
 
-elif test "$with_xinerama" != no; then
-  echo "error: must be yes or no: --with-xinerama-ext=$with_xinerama"
+  if test "$have_xf86gamma_ramp" = yes; then
+    $as_echo "#define HAVE_XF86VMODE_GAMMA_RAMP 1" >>confdefs.h
+
+  fi
+
+  # pull in the lib, if we haven't already
+  if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then
+    SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
+  fi
+
+elif test "$with_xf86gamma" != no; then
+  echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
   exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for the XINPUT server extension.
+#       Check for the RANDR (Resize and Rotate) server extension.
+#
+#       We need this to detect when the resolution of the desktop
+#       has changed out from under us (this is a newer, different
+#       mechanism than the XF86VMODE virtual viewports.)
 #
 ###############################################################################
 
-have_xinput=no
-with_xinput_req=unspecified
+have_randr=no
+with_randr_req=unspecified
 
-# Check whether --with-xinput-ext was given.
-if test "${with_xinput_ext+set}" = set; then :
-  withval=$with_xinput_ext; with_xinput="$withval"; with_xinput_req="$withval"
+# Check whether --with-randr-ext was given.
+if test "${with_randr_ext+set}" = set; then :
+  withval=$with_randr_ext; with_randr="$withval"; with_randr_req="$withval"
 else
-  with_xinput=yes
+  with_randr=yes
 fi
 
 
 
-   case "$with_xinput" in
+   case "$with_randr" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT headers" >&5
-$as_echo_n "checking for XINPUT headers... " >&6; }
-     d=$with_xinput/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR headers" >&5
+$as_echo_n "checking for RANDR headers... " >&6; }
+     d=$with_randr/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8819,9 +9762,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XINPUT libs" >&5
-$as_echo_n "checking for XINPUT libs... " >&6; }
-     d=$with_xinput/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR libs" >&5
+$as_echo_n "checking for RANDR libs... " >&6; }
+     d=$with_randr/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -8832,13 +9775,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_xinput_req="yes"
-     with_xinput=$with_xinput_req
+     with_randr_req="yes"
+     with_randr=$with_randr_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xinput-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-randr-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
@@ -8846,9 +9789,9 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_xinput" = yes; then
+if test "$with_randr" = yes; then
 
-  # first check for Xinput.h
+  # first check for Xrandr.h
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -8856,18 +9799,88 @@ if test "$with_xinput" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/XInput.h" "ac_cv_header_X11_extensions_XInput_h" "#include <X11/Xlib.h>
+  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include <X11/Xlib.h>
 "
-if test "x$ac_cv_header_X11_extensions_XInput_h" = xyes; then :
-  have_xinput=yes
+if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :
+  have_randr=yes
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+
+  # if that succeeded, then check for the XRR code in the libraries
+  if test "$have_randr" = yes; then
+
+    # RANDR probably needs -lXrender
+    xrender_libs=
+
+  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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderSetSubpixelOrder in -lXrender" >&5
+$as_echo_n "checking for XRenderSetSubpixelOrder in -lXrender... " >&6; }
+if ${ac_cv_lib_Xrender_XRenderSetSubpixelOrder+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXrender -lXext -lX11 $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XRenderSetSubpixelOrder ();
+int
+main ()
+{
+return XRenderSetSubpixelOrder ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xrender_XRenderSetSubpixelOrder=yes
+else
+  ac_cv_lib_Xrender_XRenderSetSubpixelOrder=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&5
+$as_echo "$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&6; }
+if test "x$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" = xyes; then :
+  xrender_libs="-lXrender"
+else
+  true
 fi
-
 
   CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-  # if that succeeded, then check for libXi
-  if test "$have_xinput" = yes; then
-    have_xinput=no
+
+    # first look for RANDR in -lXext
+    have_randr=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -8887,13 +9900,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XListInputDevices in -lXi" >&5
-$as_echo_n "checking for XListInputDevices in -lXi... " >&6; }
-if ${ac_cv_lib_Xi_XListInputDevices+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXext" >&5
+$as_echo_n "checking for XRRGetScreenInfo in -lXext... " >&6; }
+if ${ac_cv_lib_Xext_XRRGetScreenInfo+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXi -lXext -lX11 $LIBS"
+LIBS="-lXext $xrender_libs -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -8903,28 +9916,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XListInputDevices ();
+char XRRGetScreenInfo ();
 int
 main ()
 {
-return XListInputDevices ();
+return XRRGetScreenInfo ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xi_XListInputDevices=yes
+  ac_cv_lib_Xext_XRRGetScreenInfo=yes
 else
-  ac_cv_lib_Xi_XListInputDevices=no
+  ac_cv_lib_Xext_XRRGetScreenInfo=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xi_XListInputDevices" >&5
-$as_echo "$ac_cv_lib_Xi_XListInputDevices" >&6; }
-if test "x$ac_cv_lib_Xi_XListInputDevices" = xyes; then :
-  have_xinput=yes; SAVER_LIBS="$SAVER_LIBS -lXi"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XRRGetScreenInfo" >&5
+$as_echo "$ac_cv_lib_Xext_XRRGetScreenInfo" >&6; }
+if test "x$ac_cv_lib_Xext_XRRGetScreenInfo" = xyes; then :
+  have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs"
 else
   true
 fi
@@ -8933,106 +9946,9 @@ fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-  fi
-
-  # if that succeeded, then we've really got it.
-  if test "$have_xinput" = yes; then
-    $as_echo "#define HAVE_XINPUT 1" >>confdefs.h
-
-  fi
-
-elif test "$with_xinput" != no; then
-  echo "error: must be yes or no: --with-xinput-ext=$with_xinput"
-  exit 1
-fi
-
-
-###############################################################################
-#
-#       Check for the XF86VMODE server extension (for virtual screens.)
-#
-###############################################################################
-
-have_xf86vmode=no
-with_xf86vmode_req=unspecified
-
-# Check whether --with-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_xf86vmode=yes
-fi
-
-
-
-   case "$with_xf86vmode" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode headers" >&5
-$as_echo_n "checking for xf86vmode headers... " >&6; }
-     d=$with_xf86vmode/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86vmode libs" >&5
-$as_echo_n "checking for xf86vmode libs... " >&6; }
-     d=$with_xf86vmode/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     # replace the directory string with "yes".
-     with_xf86vmode_req="yes"
-     with_xf86vmode=$with_xf86vmode_req
-     ;;
-
-    *)
-     echo ""
-     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
-     ;;
-   esac
-
-
-VIDMODE_LIBS=""
-
-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"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include <X11/Xlib.h>
-"
-if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then :
-  have_xf86vmode=yes
-fi
-
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-
-  # if that succeeded, then check for the -lXxf86vm
-  if test "$have_xf86vmode" = yes; then
-    have_xf86vmode=no
+    # if that failed, look in -lXrandr
+    if test "$have_randr" = no; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -9052,13 +9968,13 @@ fi
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5
-$as_echo_n "checking for XF86VidModeGetViewPort in -lXxf86vm... " >&6; }
-if ${ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXrandr" >&5
+$as_echo_n "checking for XRRGetScreenInfo in -lXrandr... " >&6; }
+if ${ac_cv_lib_Xrandr_XRRGetScreenInfo+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXxf86vm -lXext -lX11 $LIBS"
+LIBS="-lXrandr $xrender_libs -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -9068,30 +9984,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XF86VidModeGetViewPort ();
+char XRRGetScreenInfo ();
 int
 main ()
 {
-return XF86VidModeGetViewPort ();
+return XRRGetScreenInfo ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=yes
+  ac_cv_lib_Xrandr_XRRGetScreenInfo=yes
 else
-  ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort=no
+  ac_cv_lib_Xrandr_XRRGetScreenInfo=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&5
-$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" >&6; }
-if test "x$ac_cv_lib_Xxf86vm_XF86VidModeGetViewPort" = xyes; then :
-  have_xf86vmode=yes;
-                   VIDMODE_LIBS="-lXxf86vm";
-                   SAVER_LIBS="$SAVER_LIBS $VIDMODE_LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRGetScreenInfo" >&5
+$as_echo "$ac_cv_lib_Xrandr_XRRGetScreenInfo" >&6; }
+if test "x$ac_cv_lib_Xrandr_XRRGetScreenInfo" = xyes; then :
+  have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_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_xf86vmode" = yes; then
-    $as_echo "#define HAVE_XF86VMODE 1" >>confdefs.h
-
-  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 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)  ;;
-
-    /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86gamma headers" >&5
-$as_echo_n "checking for xf86gamma headers... " >&6; }
-     d=$with_xf86gamma/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xf86gamma libs" >&5
-$as_echo_n "checking for xf86gamma libs... " >&6; }
-     d=$with_xf86gamma/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "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 "$have_randr" = yes; then
+    $as_echo "#define HAVE_RANDR 1" >>confdefs.h
 
-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
+    # Now check for version 1.2 in the same libs.
+    # Try to compile, since on MacOS 10.5.7, headers are older than libs!
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenResources" >&5
+$as_echo_n "checking for XRRGetScreenResources... " >&6; }
+if ${ac_cv_randr_12+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_randr_12=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -9190,19 +10037,54 @@ if test "$with_xf86gamma" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/xf86vmode.h" "ac_cv_header_X11_extensions_xf86vmode_h" "#include <X11/Xlib.h>
-"
-if test "x$ac_cv_header_X11_extensions_xf86vmode_h" = xyes; then :
-  have_xf86gamma=yes
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdlib.h>
+                         #include <X11/Xlib.h>
+                         #include <X11/extensions/Xrandr.h>
+int
+main ()
+{
+XRRScreenResources *res =
+                           XRRGetScreenResources (0, 0);
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_randr_12=yes
+else
+  ac_cv_randr_12=no
 fi
-
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_randr_12" >&5
+$as_echo "$ac_cv_randr_12" >&6; }
+    if test "$ac_cv_randr_12" = yes ; then
+      $as_echo "#define HAVE_RANDR_12 1" >>confdefs.h
+
+    fi
+#   AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)],
+#                  [true], $SAVER_LIBS)
   fi
 
-  # if that succeeded, then check for the -lXxf86vm
-  if test "$have_xf86gamma" = yes; then
-    have_xf86gamma=no
+
+elif test "$with_randr" != no; then
+  echo "error: must be yes or no: --with-randr-ext=$with_randr"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for XF86MiscSetGrabKeysState (but only bother if we are already
+#      using other XF86 stuff.)
+#
+###############################################################################
+
+have_xf86miscsetgrabkeysstate=no
+if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = yes; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeSetGamma in -lXxf86vm" >&5
-$as_echo_n "checking for XF86VidModeSetGamma in -lXxf86vm... " >&6; }
-if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGamma+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86MiscSetGrabKeysState in -lXxf86misc" >&5
+$as_echo_n "checking for XF86MiscSetGrabKeysState in -lXxf86misc... " >&6; }
+if ${ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXxf86vm -lXext -lX11 $LIBS"
+LIBS="-lXxf86misc -lXext -lX11 $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -9238,28 +10120,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XF86VidModeSetGamma ();
+char XF86MiscSetGrabKeysState ();
 int
 main ()
 {
-return XF86VidModeSetGamma ();
+return XF86MiscSetGrabKeysState ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=yes
+  ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=yes
 else
-  ac_cv_lib_Xxf86vm_XF86VidModeSetGamma=no
+  ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" >&5
-$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" >&6; }
-if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGamma" = xyes; then :
-  have_xf86gamma=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&5
+$as_echo "$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&6; }
+if test "x$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" = xyes; then :
+  have_xf86miscsetgrabkeysstate=yes
 else
   true
 fi
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
+  if test "$have_xf86miscsetgrabkeysstate" = yes ; then
+    SAVER_LIBS="$SAVER_LIBS -lXxf86misc"
+    $as_echo "#define HAVE_XF86MISCSETGRABKEYSSTATE 1" >>confdefs.h
+
   fi
+fi
 
-  # check for the Ramp versions of the functions too.
-  if test "$have_xf86gamma" = yes; then
-    have_xf86gamma_ramp=no
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
+###############################################################################
+#
+#       Check for HP XHPDisableReset and XHPEnableReset.
+#
+###############################################################################
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XHPDisableReset in X11/XHPlib.h" >&5
+$as_echo_n "checking for XHPDisableReset in X11/XHPlib.h... " >&6; }
 
+  ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <X11/XHPlib.h>
 
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "XHPDisableReset" >/dev/null 2>&1; then :
+  $as_echo "#define HAVE_XHPDISABLERESET 1" >>confdefs.h
 
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86VidModeSetGammaRamp in -lXxf86vm" >&5
-$as_echo_n "checking for XF86VidModeSetGammaRamp in -lXxf86vm... " >&6; }
-if ${ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp+:} false; then :
+                   SAVER_LIBS="-lXhp11 $SAVER_LIBS"
+                   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+rm -rf conftest*
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+
+
+###############################################################################
+#
+#       Check for /proc/interrupts.
+#
+###############################################################################
+
+have_proc_interrupts=no
+with_proc_interrupts_req=unspecified
+
+# Check whether --with-proc-interrupts was given.
+if test "${with_proc_interrupts+set}" = set; then :
+  withval=$with_proc_interrupts; with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"
+else
+  with_proc_interrupts=yes
+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
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /proc/interrupts contains keyboard data" >&5
+$as_echo_n "checking whether /proc/interrupts contains keyboard data... " >&6; }
+if ${ac_cv_have_proc_interrupts+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXxf86vm -lXext -lX11 $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  ac_cv_have_proc_interrupts=no
+     if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then
+       ac_cv_have_proc_interrupts=yes
+     fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char XF86VidModeSetGammaRamp ();
-int
-main ()
-{
-return XF86VidModeSetGammaRamp ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=yes
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_proc_interrupts" >&5
+$as_echo "$ac_cv_have_proc_interrupts" >&6; }
+   have_proc_interrupts=$ac_cv_have_proc_interrupts
+  fi
+
+  if test "$have_proc_interrupts" = yes; then
+    $as_echo "#define HAVE_PROC_INTERRUPTS 1" >>confdefs.h
+
+  fi
+
+elif test "$with_proc_interrupts" != no; then
+  echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       The --enable-locking option
+#
+###############################################################################
+
+# Check whether --enable-locking was given.
+if test "${enable_locking+set}" = set; then :
+  enableval=$enable_locking; enable_locking="$enableval"
 else
-  ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp=no
+  if test "$ac_macosx" = yes; then
+    # We can't lock on MacOS X, so default to not compiling in support for it.
+    # But allow --enable-locking to override that, so I can debug Linux locking
+    # under MacOS X11.
+    enable_locking=no
+   else
+    enable_locking=yes
+   fi
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+if test "$enable_locking" = yes; then
+  true
+elif test "$enable_locking" = no; then
+  $as_echo "#define NO_LOCKING 1" >>confdefs.h
+
+else
+  echo "error: must be yes or no: --enable-locking=$enable_locking"
+  exit 1
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" >&5
-$as_echo "$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" >&6; }
-if test "x$ac_cv_lib_Xxf86vm_XF86VidModeSetGammaRamp" = xyes; then :
-  have_xf86gamma_ramp=yes
+
+
+###############################################################################
+#
+#       Whether to allow root password to unblank.
+#
+###############################################################################
+# Check whether --enable-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
+  $as_echo "#define ALLOW_ROOT_PASSWD 1" >>confdefs.h
+
   true
+elif test "$enable_root_passwd" != no; then
+  echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd"
+  exit 1
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+###############################################################################
+#
+#       Check for PAM.
+#
+###############################################################################
 
-  fi
+case "$host" in
+  *-solaris*)
+   # Solaris systems tend to come with PAM misconfigured.
+   #  Don't build it by default, even if the headers exist.
+   with_pam_default=no
+   ;;
+  *)
+   # Default to building PAM support on all other systems, if it exists.
+   with_pam_default=yes
+  ;;
+esac
 
-  # if those tests succeeded, then we've really got the functions.
-  if test "$have_xf86gamma" = yes; then
-    $as_echo "#define HAVE_XF86VMODE_GAMMA 1" >>confdefs.h
+have_pam=no
+with_pam_req=unspecified
 
-  fi
 
-  if test "$have_xf86gamma_ramp" = yes; then
-    $as_echo "#define HAVE_XF86VMODE_GAMMA_RAMP 1" >>confdefs.h
+# Check whether --with-pam was given.
+if test "${with_pam+set}" = set; then :
+  withval=$with_pam; with_pam="$withval"; with_pam_req="$withval"
+else
+  with_pam=$with_pam_default
+fi
 
-  fi
 
-  # pull in the lib, if we haven't already
-  if test "$have_xf86gamma" = yes -a "$have_xf86vmode" = no; then
-    SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
-  fi
 
-elif test "$with_xf86gamma" != no; then
-  echo "error: must be yes or no: --with-xf86gamma-ext=$with_xf86vmode"
-  exit 1
+# Check whether --with-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
 
 
-###############################################################################
-#
-#       Check for the RANDR (Resize and Rotate) server extension.
-#
-#       We need this to detect when the resolution of the desktop
-#       has changed out from under us (this is a newer, different
-#       mechanism than the XF86VMODE virtual viewports.)
-#
-###############################################################################
-
-have_randr=no
-with_randr_req=unspecified
-
-# Check whether --with-randr-ext was given.
-if test "${with_randr_ext+set}" = set; then :
-  withval=$with_randr_ext; with_randr="$withval"; with_randr_req="$withval"
+# Check whether --enable-pam-check-account-type was given.
+if test "${enable_pam_check_account_type+set}" = set; then :
+  enableval=$enable_pam_check_account_type; enable_pam_check_account_type="$enableval"
 else
-  with_randr=yes
+  enable_pam_check_account_type=no
 fi
 
+if test "$enable_pam_check_account_type" = yes ; then
+  $as_echo "#define PAM_CHECK_ACCOUNT_TYPE 1" >>confdefs.h
+
+  true
+elif test "$enable_pam_check_account_type" != no ; then
+  echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type"
+  exit 1
+fi
 
 
-   case "$with_randr" in
+   case "$with_pam" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR headers" >&5
-$as_echo_n "checking for RANDR headers... " >&6; }
-     d=$with_randr/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM headers" >&5
+$as_echo_n "checking for PAM headers... " >&6; }
+     d=$with_pam/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -9401,9 +10372,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for RANDR libs" >&5
-$as_echo_n "checking for RANDR libs... " >&6; }
-     d=$with_randr/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM libs" >&5
+$as_echo_n "checking for PAM libs... " >&6; }
+     d=$with_pam/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -9414,13 +10385,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_randr_req="yes"
-     with_randr=$with_randr_req
+     with_pam_req="yes"
+     with_pam=$with_pam_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-randr-ext must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-pam 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
@@ -9428,9 +10399,12 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_randr" = yes; then
-
-  # first check for Xrandr.h
+if test "$enable_locking" = yes -a "$with_pam" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM" >&5
+$as_echo_n "checking for PAM... " >&6; }
+if ${ac_cv_pam+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -9438,46 +10412,47 @@ if test "$with_randr" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "#include <X11/Xlib.h>
-"
-if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then :
-  have_randr=yes
-fi
-
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <security/pam_appl.h>
+int
+main ()
+{
 
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_pam=yes
+else
+  ac_cv_pam=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pam" >&5
+$as_echo "$ac_cv_pam" >&6; }
+  if test "$ac_cv_pam" = yes ; then
+    have_pam=yes
+    $as_echo "#define HAVE_PAM 1" >>confdefs.h
 
-  # if that succeeded, then check for the XRR code in the libraries
-  if test "$have_randr" = yes; then
-
-    # RANDR probably needs -lXrender
-    xrender_libs=
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
+    cat >>confdefs.h <<_ACEOF
+#define PAM_SERVICE_NAME "$pam_service_name"
+_ACEOF
 
-  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"
+    PASSWD_LIBS="${PASSWD_LIBS} -lpam"
 
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRenderSetSubpixelOrder in -lXrender" >&5
-$as_echo_n "checking for XRenderSetSubpixelOrder in -lXrender... " >&6; }
-if ${ac_cv_lib_Xrender_XRenderSetSubpixelOrder+:} false; then :
+    # libpam typically requires dlopen and dlsym.  On FreeBSD,
+    # those are in libc.  On Linux and Solaris, they're in libdl.
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXrender -lXext -lX11 $LIBS"
+LIBS="-ldl  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -9487,65 +10462,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XRenderSetSubpixelOrder ();
+char dlopen ();
 int
 main ()
 {
-return XRenderSetSubpixelOrder ();
+return dlopen ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xrender_XRenderSetSubpixelOrder=yes
+  ac_cv_lib_dl_dlopen=yes
 else
-  ac_cv_lib_Xrender_XRenderSetSubpixelOrder=no
+  ac_cv_lib_dl_dlopen=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&5
-$as_echo "$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" >&6; }
-if test "x$ac_cv_lib_Xrender_XRenderSetSubpixelOrder" = xyes; then :
-  xrender_libs="-lXrender"
-else
-  true
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+  PASSWD_LIBS="${PASSWD_LIBS} -ldl"
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
 
-    # first look for RANDR in -lXext
-    have_randr=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"
-
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXext" >&5
-$as_echo_n "checking for XRRGetScreenInfo in -lXext... " >&6; }
-if ${ac_cv_lib_Xext_XRRGetScreenInfo+:} false; then :
+    # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
+    have_timedwait=no
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lc" >&5
+$as_echo_n "checking for sigtimedwait in -lc... " >&6; }
+if ${ac_cv_lib_c_sigtimedwait+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXext $xrender_libs -lXext -lX11 $LIBS"
+LIBS="-l $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -9555,65 +10505,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XRRGetScreenInfo ();
+char sigtimedwait ();
 int
 main ()
 {
-return XRRGetScreenInfo ();
+return sigtimedwait ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xext_XRRGetScreenInfo=yes
+  ac_cv_lib_c_sigtimedwait=yes
 else
-  ac_cv_lib_Xext_XRRGetScreenInfo=no
+  ac_cv_lib_c_sigtimedwait=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xext_XRRGetScreenInfo" >&5
-$as_echo "$ac_cv_lib_Xext_XRRGetScreenInfo" >&6; }
-if test "x$ac_cv_lib_Xext_XRRGetScreenInfo" = xyes; then :
-  have_randr=yes; SAVER_LIBS="$SAVER_LIBS $xrender_libs"
-else
-  true
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-
-    # if that failed, look in -lXrandr
-    if test "$have_randr" = no; 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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sigtimedwait" >&5
+$as_echo "$ac_cv_lib_c_sigtimedwait" >&6; }
+if test "x$ac_cv_lib_c_sigtimedwait" = xyes; then :
+  have_timedwait=yes
+                  $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
 
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  # note: $X_LIBS includes $x_libraries
-  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+fi
 
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenInfo in -lXrandr" >&5
-$as_echo_n "checking for XRRGetScreenInfo in -lXrandr... " >&6; }
-if ${ac_cv_lib_Xrandr_XRRGetScreenInfo+:} false; then :
+    if test "$have_timedwait" = no ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lrt" >&5
+$as_echo_n "checking for sigtimedwait in -lrt... " >&6; }
+if ${ac_cv_lib_rt_sigtimedwait+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXrandr $xrender_libs -lXext -lX11 $LIBS"
+LIBS="-lrt  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -9623,52 +10548,40 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XRRGetScreenInfo ();
+char sigtimedwait ();
 int
 main ()
 {
-return XRRGetScreenInfo ();
+return sigtimedwait ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xrandr_XRRGetScreenInfo=yes
+  ac_cv_lib_rt_sigtimedwait=yes
 else
-  ac_cv_lib_Xrandr_XRRGetScreenInfo=no
+  ac_cv_lib_rt_sigtimedwait=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xrandr_XRRGetScreenInfo" >&5
-$as_echo "$ac_cv_lib_Xrandr_XRRGetScreenInfo" >&6; }
-if test "x$ac_cv_lib_Xrandr_XRRGetScreenInfo" = xyes; then :
-  have_randr=yes; SAVER_LIBS="$SAVER_LIBS -lXrandr $xrender_libs"
-else
-  true
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sigtimedwait" >&5
+$as_echo "$ac_cv_lib_rt_sigtimedwait" >&6; }
+if test "x$ac_cv_lib_rt_sigtimedwait" = xyes; then :
+  have_timedwait=yes
+                                      $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+                                      PASSWD_LIBS="${PASSWD_LIBS} -lrt"
+fi
 
     fi
-  fi
 
-  # if that succeeded, then we've really got it.
-  if test "$have_randr" = yes; then
-    $as_echo "#define HAVE_RANDR 1" >>confdefs.h
-
-
-    # Now check for version 1.2 in the same libs.
-    # Try to compile, since on MacOS 10.5.7, headers are older than libs!
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XRRGetScreenResources" >&5
-$as_echo_n "checking for XRRGetScreenResources... " >&6; }
-if ${ac_cv_randr_12+:} false; then :
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call pam_strerror" >&5
+$as_echo_n "checking how to call pam_strerror... " >&6; }
+    if ${ac_cv_pam_strerror_args+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_randr_12=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -9678,330 +10591,144 @@ else
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-                         #include <X11/Xlib.h>
-                         #include <X11/extensions/Xrandr.h>
+#include <stdio.h>
+                        #include <stdlib.h>
+                        #include <security/pam_appl.h>
 int
 main ()
 {
-XRRScreenResources *res =
-                           XRRGetScreenResources (0, 0);
+pam_handle_t *pamh = 0;
+                        char *s = pam_strerror(pamh, PAM_SUCCESS);
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_randr_12=yes
+  ac_pam_strerror_args=2
 else
-  ac_cv_randr_12=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_randr_12" >&5
-$as_echo "$ac_cv_randr_12" >&6; }
-    if test "$ac_cv_randr_12" = yes ; then
-      $as_echo "#define HAVE_RANDR_12 1" >>confdefs.h
-
-    fi
-#   AC_CHECK_X_LIB(c, XRRGetOutputInfo, [AC_DEFINE(HAVE_RANDR_12)],
-#                  [true], $SAVER_LIBS)
-  fi
-
-
-elif test "$with_randr" != no; then
-  echo "error: must be yes or no: --with-randr-ext=$with_randr"
-  exit 1
-fi
-
-
-###############################################################################
-#
-#       Check for XF86MiscSetGrabKeysState (but only bother if we are already
-#      using other XF86 stuff.)
-#
-###############################################################################
-
-have_xf86miscsetgrabkeysstate=no
-if test "$have_xf86gamma" = yes -o "$have_xf86vmode" = 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"
-
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XF86MiscSetGrabKeysState in -lXxf86misc" >&5
-$as_echo_n "checking for XF86MiscSetGrabKeysState in -lXxf86misc... " >&6; }
-if ${ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXxf86misc -lXext -lX11 $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char XF86MiscSetGrabKeysState ();
+#include <stdio.h>
+                                          #include <stdlib.h>
+                                          #include <security/pam_appl.h>
 int
 main ()
 {
-return XF86MiscSetGrabKeysState ();
+char *s =
+                                           pam_strerror(PAM_SUCCESS);
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=yes
-else
-  ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&5
-$as_echo "$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" >&6; }
-if test "x$ac_cv_lib_Xxf86misc_XF86MiscSetGrabKeysState" = xyes; then :
-  have_xf86miscsetgrabkeysstate=yes
-else
-  true
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-  if test "$have_xf86miscsetgrabkeysstate" = yes ; then
-    SAVER_LIBS="$SAVER_LIBS -lXxf86misc"
-    $as_echo "#define HAVE_XF86MISCSETGRABKEYSSTATE 1" >>confdefs.h
-
-  fi
-fi
-
-
-###############################################################################
-#
-#       Check for HP XHPDisableReset and XHPEnableReset.
-#
-###############################################################################
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XHPDisableReset in X11/XHPlib.h" >&5
-$as_echo_n "checking for XHPDisableReset in X11/XHPlib.h... " >&6; }
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <X11/XHPlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "XHPDisableReset" >/dev/null 2>&1; then :
-  $as_echo "#define HAVE_XHPDISABLERESET 1" >>confdefs.h
-
-                   SAVER_LIBS="-lXhp11 $SAVER_LIBS"
-                   { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -rf conftest*
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-
-
-###############################################################################
-#
-#       Check for /proc/interrupts.
-#
-###############################################################################
-
-have_proc_interrupts=no
-with_proc_interrupts_req=unspecified
-
-# Check whether --with-proc-interrupts was given.
-if test "${with_proc_interrupts+set}" = set; then :
-  withval=$with_proc_interrupts; with_proc_interrupts="$withval"; with_proc_interrupts_req="$withval"
-else
-  with_proc_interrupts=yes
-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
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether /proc/interrupts contains keyboard data" >&5
-$as_echo_n "checking whether /proc/interrupts contains keyboard data... " >&6; }
-if ${ac_cv_have_proc_interrupts+:} false; then :
-  $as_echo_n "(cached) " >&6
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_pam_strerror_args=1
 else
-  ac_cv_have_proc_interrupts=no
-     if grep 'keyboard\|i8042' /proc/interrupts >/dev/null 2>&1 ; then
-       ac_cv_have_proc_interrupts=yes
-     fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_proc_interrupts" >&5
-$as_echo "$ac_cv_have_proc_interrupts" >&6; }
-   have_proc_interrupts=$ac_cv_have_proc_interrupts
-  fi
-
-  if test "$have_proc_interrupts" = yes; then
-    $as_echo "#define HAVE_PROC_INTERRUPTS 1" >>confdefs.h
-
-  fi
-
-elif test "$with_proc_interrupts" != no; then
-  echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
-  exit 1
+  ac_pam_strerror_args=0
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+      ac_cv_pam_strerror_args=$ac_pam_strerror_args
 fi
 
+    ac_pam_strerror_args=$ac_cv_pam_strerror_args
+    if test "$ac_pam_strerror_args" = 1 ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5
+$as_echo "one argument" >&6; }
+    elif test "$ac_pam_strerror_args" = 2 ; then
+      $as_echo "#define PAM_STRERROR_TWO_ARGS 1" >>confdefs.h
 
-###############################################################################
-#
-#       The --enable-locking option
-#
-###############################################################################
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5
+$as_echo "two arguments" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
+$as_echo "unknown" >&6; }
+    fi
 
-# Check whether --enable-locking was given.
-if test "${enable_locking+set}" = set; then :
-  enableval=$enable_locking; enable_locking="$enableval"
+# Check pam_fail_delay
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking pam_fail_delay in -lpam" >&5
+$as_echo_n "checking pam_fail_delay in -lpam... " >&6; }
+    if ${ac_cv_pam_fail_delay+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  if test "$ac_macosx" = yes; then
-    # We can't lock on MacOS X, so default to not compiling in support for it.
-    # But allow --enable-locking to override that, so I can debug Linux locking
-    # under MacOS X11.
-    enable_locking=no
-   else
-    enable_locking=yes
-   fi
-fi
-
-if test "$enable_locking" = yes; then
-  true
-elif test "$enable_locking" = no; then
-  $as_echo "#define NO_LOCKING 1" >>confdefs.h
-
+  ac_save_LDFLAGS="$LDFLAGS"
+      LDFLAGS="-lpam"
+      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_pam_fail_delay=yes
 else
-  echo "error: must be yes or no: --enable-locking=$enable_locking"
-  exit 1
+  ac_pam_fail_delay=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+      ac_cv_pam_fail_delay=$ac_pam_fail_delay,
+      LDFLAGS=$ac_save_LDFLAGS
 fi
 
 
-###############################################################################
-#
-#       Whether to allow root password to unblank.
-#
-###############################################################################
-# Check whether --enable-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 "$ac_pam_fail_delay" = yes ; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+        $as_echo "#define HAVE_PAM_FAIL_DELAY 1" >>confdefs.h
 
-if test "$enable_root_passwd" = yes; then
-  $as_echo "#define ALLOW_ROOT_PASSWD 1" >>confdefs.h
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      fi
 
-  true
-elif test "$enable_root_passwd" != no; then
-  echo "error: must be yes or no: --enable-root-passwd=$enable_root_passwd"
-  exit 1
+  fi
 fi
 
+
 ###############################################################################
 #
-#       Check for PAM.
+#       Check for Kerberos.
 #
 ###############################################################################
 
-case "$host" in
-  *-solaris*)
-   # Solaris systems tend to come with PAM misconfigured.
-   #  Don't build it by default, even if the headers exist.
-   with_pam_default=no
-   ;;
-  *)
-   # Default to building PAM support on all other systems, if it exists.
-   with_pam_default=yes
-  ;;
-esac
-
-have_pam=no
-with_pam_req=unspecified
-
-
-# Check whether --with-pam was given.
-if test "${with_pam+set}" = set; then :
-  withval=$with_pam; with_pam="$withval"; with_pam_req="$withval"
-else
-  with_pam=$with_pam_default
-fi
-
-
-
-# Check whether --with-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
+have_kerberos=no
+have_kerberos5=no
+with_kerberos_req=unspecified
 
 
-# Check whether --enable-pam-check-account-type was given.
-if test "${enable_pam_check_account_type+set}" = set; then :
-  enableval=$enable_pam_check_account_type; enable_pam_check_account_type="$enableval"
+# Check whether --with-kerberos was given.
+if test "${with_kerberos+set}" = set; then :
+  withval=$with_kerberos; with_kerberos="$withval"; with_kerberos_req="$withval"
 else
-  enable_pam_check_account_type=no
+  with_kerberos=yes
 fi
 
-if test "$enable_pam_check_account_type" = yes ; then
-  $as_echo "#define PAM_CHECK_ACCOUNT_TYPE 1" >>confdefs.h
-
-  true
-elif test "$enable_pam_check_account_type" != no ; then
-  echo "error: must be yes or no: --enable-pam-check-account-type=$enable_pam_check_account_type"
-  exit 1
-fi
 
 
-   case "$with_pam" in
+   case "$with_kerberos" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM headers" >&5
-$as_echo_n "checking for PAM headers... " >&6; }
-     d=$with_pam/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos headers" >&5
+$as_echo_n "checking for Kerberos headers... " >&6; }
+     d=$with_kerberos/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -10011,9 +10738,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM libs" >&5
-$as_echo_n "checking for PAM libs... " >&6; }
-     d=$with_pam/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos libs" >&5
+$as_echo_n "checking for Kerberos libs... " >&6; }
+     d=$with_kerberos/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -10024,13 +10751,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_pam_req="yes"
-     with_pam=$with_pam_req
+     with_kerberos_req="yes"
+     with_kerberos=$with_kerberos_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-pam must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-kerberos 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
@@ -10038,10 +10765,10 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$enable_locking" = yes -a "$with_pam" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for PAM" >&5
-$as_echo_n "checking for PAM... " >&6; }
-if ${ac_cv_pam+:} false; then :
+if test "$enable_locking" = yes -a "$with_kerberos" = yes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 4" >&5
+$as_echo_n "checking for Kerberos 4... " >&6; }
+if ${ac_cv_kerberos+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10053,7 +10780,7 @@ else
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <security/pam_appl.h>
+#include <krb.h>
 int
 main ()
 {
@@ -10063,35 +10790,93 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_pam=yes
+  ac_cv_kerberos=yes
 else
-  ac_cv_pam=no
+  ac_cv_kerberos=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_pam" >&5
-$as_echo "$ac_cv_pam" >&6; }
-  if test "$ac_cv_pam" = yes ; then
-    have_pam=yes
-    $as_echo "#define HAVE_PAM 1" >>confdefs.h
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos" >&5
+$as_echo "$ac_cv_kerberos" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 5" >&5
+$as_echo_n "checking for Kerberos 5... " >&6; }
+if ${ac_cv_kerberos5+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
 
-    cat >>confdefs.h <<_ACEOF
-#define PAM_SERVICE_NAME "$pam_service_name"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <kerberosIV/krb.h>
+int
+main ()
+{
+
+  ;
+  return 0;
+}
 _ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_kerberos5=yes
+else
+  ac_cv_kerberos5=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos5" >&5
+$as_echo "$ac_cv_kerberos5" >&6; }
+
+  if test "$ac_cv_kerberos" = yes ; then
+    have_kerberos=yes
+    $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h
 
+  fi
 
-    PASSWD_LIBS="${PASSWD_LIBS} -lpam"
+  if test "$ac_cv_kerberos5" = yes ; then
+
+    # Andrew Snare <ajs@pigpond.com> wrote:
+    #
+    # You were assuming that if kerberosV (krb5) was found, then kerberosIV
+    # (krb4) was also available.  This turns out not to be the case with
+    # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV
+    # is optional.
+    #
+    # So, disable kerberosV support if libkrb4 can't be found.
+    # This is not the best solution, but it makes the compile not fail.
+    #
+
+  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"
 
-    # libpam typically requires dlopen and dlsym.  On FreeBSD,
-    # those are in libc.  On Linux and Solaris, they're in libdl.
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_tf_realm in -lkrb4" >&5
+$as_echo_n "checking for krb_get_tf_realm in -lkrb4... " >&6; }
+if ${ac_cv_lib_krb4_krb_get_tf_realm+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl  $LIBS"
+LIBS="-lkrb4  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10101,40 +10886,83 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char dlopen ();
+char krb_get_tf_realm ();
 int
 main ()
 {
-return dlopen ();
+return krb_get_tf_realm ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_dl_dlopen=yes
+  ac_cv_lib_krb4_krb_get_tf_realm=yes
 else
-  ac_cv_lib_dl_dlopen=no
+  ac_cv_lib_krb4_krb_get_tf_realm=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
-  PASSWD_LIBS="${PASSWD_LIBS} -ldl"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_tf_realm" >&5
+$as_echo "$ac_cv_lib_krb4_krb_get_tf_realm" >&6; }
+if test "x$ac_cv_lib_krb4_krb_get_tf_realm" = xyes; then :
+  have_kerberos=yes
+else
+  have_kerberos=no
 fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-    # On Linux, sigtimedwait() is in libc; on Solaris, it's in librt.
-    have_timedwait=no
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lc" >&5
-$as_echo_n "checking for sigtimedwait in -lc... " >&6; }
-if ${ac_cv_lib_c_sigtimedwait+:} false; then :
+    if test "$have_kerberos" = yes ; then
+      have_kerberos5=yes
+      $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h
+
+      $as_echo "#define HAVE_KERBEROS5 1" >>confdefs.h
+
+    else
+      have_kerberos5=no
+      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&5
+$as_echo "$as_me: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&2;}
+    fi
+
+  fi
+
+  if test "$have_kerberos5" = yes ; then
+    # from Matt Knopp <mhat@infocalypse.netlag.com>
+    # (who got it from amu@mit.edu)
+
+    PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"
+
+    # jwz: MacOS X uses -lkrb5, but not -lcrypt
+
+  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"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
+$as_echo_n "checking for crypt in -lcrypt... " >&6; }
+if ${ac_cv_lib_crypt_crypt+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
+LIBS="-lcrypt  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10144,40 +10972,52 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char sigtimedwait ();
+char crypt ();
 int
 main ()
 {
-return sigtimedwait ();
+return crypt ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_sigtimedwait=yes
+  ac_cv_lib_crypt_crypt=yes
 else
-  ac_cv_lib_c_sigtimedwait=no
+  ac_cv_lib_crypt_crypt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_sigtimedwait" >&5
-$as_echo "$ac_cv_lib_c_sigtimedwait" >&6; }
-if test "x$ac_cv_lib_c_sigtimedwait" = xyes; then :
-  have_timedwait=yes
-                  $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5
+$as_echo "$ac_cv_lib_crypt_crypt" >&6; }
+if test "x$ac_cv_lib_crypt_crypt" = xyes; then :
+  PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
 fi
 
-    if test "$have_timedwait" = no ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigtimedwait in -lrt" >&5
-$as_echo_n "checking for sigtimedwait in -lrt... " >&6; }
-if ${ac_cv_lib_rt_sigtimedwait+:} false; then :
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+
+  elif test "$have_kerberos" = yes ; then
+    # from Tim Showalter <tjs@psaux.com> for FreeBSD 4.2
+    PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err"
+  fi
+
+  if test "$have_kerberos" = yes ; then
+    ac_fn_c_check_func "$LINENO" "res_search" "ac_cv_func_res_search"
+if test "x$ac_cv_func_res_search" = xyes; then :
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_search in -lresolv" >&5
+$as_echo_n "checking for res_search in -lresolv... " >&6; }
+if ${ac_cv_lib_resolv_res_search+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lrt  $LIBS"
+LIBS="-lresolv  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10187,154 +11027,35 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char sigtimedwait ();
+char res_search ();
 int
 main ()
 {
-return sigtimedwait ();
+return res_search ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_rt_sigtimedwait=yes
+  ac_cv_lib_resolv_res_search=yes
 else
-  ac_cv_lib_rt_sigtimedwait=no
+  ac_cv_lib_resolv_res_search=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_rt_sigtimedwait" >&5
-$as_echo "$ac_cv_lib_rt_sigtimedwait" >&6; }
-if test "x$ac_cv_lib_rt_sigtimedwait" = xyes; then :
-  have_timedwait=yes
-                                      $as_echo "#define HAVE_SIGTIMEDWAIT 1" >>confdefs.h
-
-                                      PASSWD_LIBS="${PASSWD_LIBS} -lrt"
-fi
-
-    fi
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call pam_strerror" >&5
-$as_echo_n "checking how to call pam_strerror... " >&6; }
-    if ${ac_cv_pam_strerror_args+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-                        #include <stdlib.h>
-                        #include <security/pam_appl.h>
-int
-main ()
-{
-pam_handle_t *pamh = 0;
-                        char *s = pam_strerror(pamh, PAM_SUCCESS);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_pam_strerror_args=2
-else
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdio.h>
-                                          #include <stdlib.h>
-                                          #include <security/pam_appl.h>
-int
-main ()
-{
-char *s =
-                                           pam_strerror(PAM_SUCCESS);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_pam_strerror_args=1
-else
-  ac_pam_strerror_args=0
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
-      ac_cv_pam_strerror_args=$ac_pam_strerror_args
-fi
-
-    ac_pam_strerror_args=$ac_cv_pam_strerror_args
-    if test "$ac_pam_strerror_args" = 1 ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: one argument" >&5
-$as_echo "one argument" >&6; }
-    elif test "$ac_pam_strerror_args" = 2 ; then
-      $as_echo "#define PAM_STRERROR_TWO_ARGS 1" >>confdefs.h
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: two arguments" >&5
-$as_echo "two arguments" >&6; }
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: unknown" >&5
-$as_echo "unknown" >&6; }
-    fi
-
-# Check pam_fail_delay
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking pam_fail_delay in -lpam" >&5
-$as_echo_n "checking pam_fail_delay in -lpam... " >&6; }
-    if ${ac_cv_pam_fail_delay+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_save_LDFLAGS="$LDFLAGS"
-      LDFLAGS="-lpam"
-      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* 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
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_pam_fail_delay=yes
-else
-  ac_pam_fail_delay=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-      ac_cv_pam_fail_delay=$ac_pam_fail_delay,
-      LDFLAGS=$ac_save_LDFLAGS
-fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_search" >&5
+$as_echo "$ac_cv_lib_resolv_res_search" >&6; }
+if test "x$ac_cv_lib_resolv_res_search" = xyes; then :
+  PASSWD_LIBS="${PASSWD_LIBS} -lresolv"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&5
+$as_echo "$as_me: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&2;}
 
-      if test "$ac_pam_fail_delay" = yes ; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-        $as_echo "#define HAVE_PAM_FAIL_DELAY 1" >>confdefs.h
+fi
 
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-      fi
+fi
 
   fi
 fi
 
 ###############################################################################
 #
-#       Check for Kerberos.
+#       Check for the nine billion variants of shadow passwords...
 #
 ###############################################################################
 
-have_kerberos=no
-have_kerberos5=no
-with_kerberos_req=unspecified
+need_setuid=no
 
+have_shadow=no
+with_shadow_req=unspecified
 
-# Check whether --with-kerberos was given.
-if test "${with_kerberos+set}" = set; then :
-  withval=$with_kerberos; with_kerberos="$withval"; with_kerberos_req="$withval"
+
+# Check whether --with-shadow was given.
+if test "${with_shadow+set}" = set; then :
+  withval=$with_shadow; with_shadow="$withval"; with_shadow_req="$withval"
 else
-  with_kerberos=yes
+  with_shadow=yes
 fi
 
 
 
-   case "$with_kerberos" in
+   case "$with_shadow" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos headers" >&5
-$as_echo_n "checking for Kerberos headers... " >&6; }
-     d=$with_kerberos/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password headers" >&5
+$as_echo_n "checking for shadow password headers... " >&6; }
+     d=$with_shadow/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -10377,9 +11099,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos libs" >&5
-$as_echo_n "checking for Kerberos libs... " >&6; }
-     d=$with_kerberos/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password libs" >&5
+$as_echo_n "checking for shadow password libs... " >&6; }
+     d=$with_shadow/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -10390,13 +11112,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_kerberos_req="yes"
-     with_kerberos=$with_kerberos_req
+     with_shadow_req="yes"
+     with_shadow=$with_shadow_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-kerberos must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-shadow 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
@@ -10404,43 +11126,22 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$enable_locking" = yes -a "$with_kerberos" = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 4" >&5
-$as_echo_n "checking for Kerberos 4... " >&6; }
-if ${ac_cv_kerberos+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+if test "$enable_locking" = no ; then
+  with_shadow_req=no
+  with_shadow=no
+fi
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <krb.h>
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_kerberos=yes
-else
-  ac_cv_kerberos=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos" >&5
-$as_echo "$ac_cv_kerberos" >&6; }
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Kerberos 5" >&5
-$as_echo_n "checking for Kerberos 5... " >&6; }
-if ${ac_cv_kerberos5+:} false; then :
+###############################################################################
+#
+#       Check for Sun "adjunct" passwords.
+#
+###############################################################################
+
+if test "$with_shadow" = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sun-style shadow passwords" >&5
+$as_echo_n "checking for Sun-style shadow passwords... " >&6; }
+if ${ac_cv_sun_adjunct+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <kerberosIV/krb.h>
+#include <stdlib.h>
+                                    #include <unistd.h>
+                                    #include <sys/types.h>
+                                    #include <sys/label.h>
+                                    #include <sys/audit.h>
+                                    #include <pwdadj.h>
 int
 main ()
 {
-
+struct passwd_adjunct *p = getpwanam("nobody");
+                       const char *pw = p->pwa_passwd;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_kerberos5=yes
+  ac_cv_sun_adjunct=yes
 else
-  ac_cv_kerberos5=no
+  ac_cv_sun_adjunct=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_kerberos5" >&5
-$as_echo "$ac_cv_kerberos5" >&6; }
-
-  if test "$ac_cv_kerberos" = yes ; then
-    have_kerberos=yes
-    $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sun_adjunct" >&5
+$as_echo "$ac_cv_sun_adjunct" >&6; }
+  if test "$ac_cv_sun_adjunct" = yes; then
+    have_shadow_adjunct=yes
+    have_shadow=yes
+    need_setuid=yes
   fi
+fi
 
-  if test "$ac_cv_kerberos5" = yes ; then
 
-    # Andrew Snare <ajs@pigpond.com> wrote:
-    #
-    # You were assuming that if kerberosV (krb5) was found, then kerberosIV
-    # (krb4) was also available.  This turns out not to be the case with
-    # mit-krb-1.2.7; apparently backwards-compatibility with KerberosIV
-    # is optional.
-    #
-    # So, disable kerberosV support if libkrb4 can't be found.
-    # This is not the best solution, but it makes the compile not fail.
-    #
+###############################################################################
+#
+#       Check for DEC and SCO so-called "enhanced" security.
+#
+###############################################################################
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-#  ac_save_LIBS="$LIBS"
+if test "$with_shadow" = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEC-style shadow passwords" >&5
+$as_echo_n "checking for DEC-style shadow passwords... " >&6; }
+if ${ac_cv_enhanced_passwd+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
 
+  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"
-
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_tf_realm in -lkrb4" >&5
-$as_echo_n "checking for krb_get_tf_realm in -lkrb4... " >&6; }
-if ${ac_cv_lib_krb4_krb_get_tf_realm+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lkrb4  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char krb_get_tf_realm ();
+#include <stdlib.h>
+                                    #include <unistd.h>
+                                    #include <sys/types.h>
+                                    #include <pwd.h>
+                                    #include <sys/security.h>
+                                    #include <prot.h>
 int
 main ()
 {
-return krb_get_tf_realm ();
+struct pr_passwd *p;
+                       const char *pw;
+                       set_auth_parameters(0, 0);
+                       check_auth_parameters();
+                       p = getprpwnam("nobody");
+                       pw = p->ufld.fd_encrypt;
   ;
   return 0;
 }
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_krb4_krb_get_tf_realm=yes
-else
-  ac_cv_lib_krb4_krb_get_tf_realm=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_tf_realm" >&5
-$as_echo "$ac_cv_lib_krb4_krb_get_tf_realm" >&6; }
-if test "x$ac_cv_lib_krb4_krb_get_tf_realm" = xyes; then :
-  have_kerberos=yes
-else
-  have_kerberos=no
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-    if test "$have_kerberos" = yes ; then
-      have_kerberos5=yes
-      $as_echo "#define HAVE_KERBEROS 1" >>confdefs.h
-
-      $as_echo "#define HAVE_KERBEROS5 1" >>confdefs.h
-
-    else
-      have_kerberos5=no
-      { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&5
-$as_echo "$as_me: WARNING: Cannot find compat lib (libkrb4) needed to use Kerberos 5" >&2;}
-    fi
-
-  fi
-
-  if test "$have_kerberos5" = yes ; then
-    # from Matt Knopp <mhat@infocalypse.netlag.com>
-    # (who got it from amu@mit.edu)
-
-    PASSWD_LIBS="$PASSWD_LIBS -lkrb4 -ldes425 -lkrb5 -lk5crypto -lcom_err"
-
-    # jwz: MacOS X uses -lkrb5, but not -lcrypt
-
-  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"
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_enhanced_passwd=yes
+else
+  ac_cv_enhanced_passwd=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enhanced_passwd" >&5
+$as_echo "$ac_cv_enhanced_passwd" >&6; }
+  if test $ac_cv_enhanced_passwd = yes; then
+    have_shadow_enhanced=yes
+    have_shadow=yes
+    need_setuid=yes
 
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
-$as_echo_n "checking for crypt in -lcrypt... " >&6; }
-if ${ac_cv_lib_crypt_crypt+:} false; then :
+    # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
+    # (I'm told it needs -lcurses too, but I don't understand why.)
+    # But on DEC, it's in -lsecurity.
+    #
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lprot" >&5
+$as_echo_n "checking for getprpwnam in -lprot... " >&6; }
+if ${ac_cv_lib_prot_getprpwnam+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypt  $LIBS"
+LIBS="-lprot -lx $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10611,52 +11261,36 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char crypt ();
+char getprpwnam ();
 int
 main ()
 {
-return crypt ();
+return getprpwnam ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_crypt_crypt=yes
+  ac_cv_lib_prot_getprpwnam=yes
 else
-  ac_cv_lib_crypt_crypt=no
+  ac_cv_lib_prot_getprpwnam=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5
-$as_echo "$ac_cv_lib_crypt_crypt" >&6; }
-if test "x$ac_cv_lib_crypt_crypt" = xyes; then :
-  PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-
-  elif test "$have_kerberos" = yes ; then
-    # from Tim Showalter <tjs@psaux.com> for FreeBSD 4.2
-    PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lcom_err"
-  fi
-
-  if test "$have_kerberos" = yes ; then
-    ac_fn_c_check_func "$LINENO" "res_search" "ac_cv_func_res_search"
-if test "x$ac_cv_func_res_search" = xyes; then :
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prot_getprpwnam" >&5
+$as_echo "$ac_cv_lib_prot_getprpwnam" >&6; }
+if test "x$ac_cv_lib_prot_getprpwnam" = xyes; then :
+  PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_search in -lresolv" >&5
-$as_echo_n "checking for res_search in -lresolv... " >&6; }
-if ${ac_cv_lib_resolv_res_search+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lsecurity" >&5
+$as_echo_n "checking for getprpwnam in -lsecurity... " >&6; }
+if ${ac_cv_lib_security_getprpwnam+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lresolv  $LIBS"
+LIBS="-lsecurity  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10666,32 +11300,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char res_search ();
+char getprpwnam ();
 int
 main ()
 {
-return res_search ();
+return getprpwnam ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_resolv_res_search=yes
+  ac_cv_lib_security_getprpwnam=yes
 else
-  ac_cv_lib_resolv_res_search=no
+  ac_cv_lib_security_getprpwnam=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_search" >&5
-$as_echo "$ac_cv_lib_resolv_res_search" >&6; }
-if test "x$ac_cv_lib_resolv_res_search" = xyes; then :
-  PASSWD_LIBS="${PASSWD_LIBS} -lresolv"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&5
-$as_echo "$as_me: WARNING: Can't find DNS resolver libraries needed for Kerberos" >&2;}
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_security_getprpwnam" >&5
+$as_echo "$ac_cv_lib_security_getprpwnam" >&6; }
+if test "x$ac_cv_lib_security_getprpwnam" = xyes; then :
+  PASSWD_LIBS="$PASSWD_LIBS -lsecurity"
 fi
 
 fi
   fi
 fi
 
-
-###############################################################################
-#
-#       Check for the nine billion variants of shadow passwords...
-#
-###############################################################################
-
-need_setuid=no
-
-have_shadow=no
-with_shadow_req=unspecified
-
-
-# Check whether --with-shadow was given.
-if test "${with_shadow+set}" = set; then :
-  withval=$with_shadow; with_shadow="$withval"; with_shadow_req="$withval"
-else
-  with_shadow=yes
-fi
-
-
-
-   case "$with_shadow" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password headers" >&5
-$as_echo_n "checking for shadow password headers... " >&6; }
-     d=$with_shadow/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shadow password libs" >&5
-$as_echo_n "checking for shadow password libs... " >&6; }
-     d=$with_shadow/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     # replace the directory string with "yes".
-     with_shadow_req="yes"
-     with_shadow=$with_shadow_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-shadow 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 "$enable_locking" = no ; then
-  with_shadow_req=no
-  with_shadow=no
-fi
-
-
 ###############################################################################
 #
-#       Check for Sun "adjunct" passwords.
+#       Check for HP's entry in the "Not Invented Here" Sweepstakes.
 #
 ###############################################################################
 
 if test "$with_shadow" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sun-style shadow passwords" >&5
-$as_echo_n "checking for Sun-style shadow passwords... " >&6; }
-if ${ac_cv_sun_adjunct+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP-style shadow passwords" >&5
+$as_echo_n "checking for HP-style shadow passwords... " >&6; }
+if ${ac_cv_hpux_passwd+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10795,31 +11353,105 @@ else
 #include <stdlib.h>
                                     #include <unistd.h>
                                     #include <sys/types.h>
-                                    #include <sys/label.h>
-                                    #include <sys/audit.h>
-                                    #include <pwdadj.h>
+                                    #include <pwd.h>
+                                    #include <hpsecurity.h>
+                                    #include <prot.h>
 int
 main ()
 {
-struct passwd_adjunct *p = getpwanam("nobody");
-                       const char *pw = p->pwa_passwd;
+struct s_passwd *p = getspwnam("nobody");
+                       const char *pw = p->pw_passwd;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_sun_adjunct=yes
+  ac_cv_hpux_passwd=yes
+else
+  ac_cv_hpux_passwd=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_hpux_passwd" >&5
+$as_echo "$ac_cv_hpux_passwd" >&6; }
+  if test "$ac_cv_hpux_passwd" = yes; then
+    have_shadow_hpux=yes
+    have_shadow=yes
+    need_setuid=yes
+
+    # on HPUX, bigcrypt is in -lsec
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bigcrypt in -lsec" >&5
+$as_echo_n "checking for bigcrypt in -lsec... " >&6; }
+if ${ac_cv_lib_sec_bigcrypt+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsec  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char bigcrypt ();
+int
+main ()
+{
+return bigcrypt ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_sec_bigcrypt=yes
+else
+  ac_cv_lib_sec_bigcrypt=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_bigcrypt" >&5
+$as_echo "$ac_cv_lib_sec_bigcrypt" >&6; }
+if test "x$ac_cv_lib_sec_bigcrypt" = xyes; then :
+  PASSWD_LIBS="$PASSWD_LIBS -lsec"
+fi
+
+  fi
+fi
+
+
+###############################################################################
+#
+#       Check for FreeBSD-style shadow passwords.
+#
+#       On FreeBSD, getpwnam() and friends work just like on non-shadow-
+#       password systems -- except you only get stuff in the pw_passwd field
+#       if the running program is setuid.  So, guess that we've got this
+#       lossage to contend with if /etc/master.passwd exists, and default to
+#       a setuid installation.
+#
+###############################################################################
+
+if test "$with_shadow" = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD-style shadow passwords" >&5
+$as_echo_n "checking for FreeBSD-style shadow passwords... " >&6; }
+if ${ac_cv_master_passwd+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  ac_cv_sun_adjunct=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test -f /etc/master.passwd ; then
+                    ac_cv_master_passwd=yes
+                  else
+                    ac_cv_master_passwd=no
+                  fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sun_adjunct" >&5
-$as_echo "$ac_cv_sun_adjunct" >&6; }
-  if test "$ac_cv_sun_adjunct" = yes; then
-    have_shadow_adjunct=yes
-    have_shadow=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_master_passwd" >&5
+$as_echo "$ac_cv_master_passwd" >&6; }
+  if test "$ac_cv_master_passwd" = yes; then
     need_setuid=yes
   fi
 fi
 
 ###############################################################################
 #
-#       Check for DEC and SCO so-called "enhanced" security.
+#       Check for traditional (ha!) shadow passwords.
 #
 ###############################################################################
 
 if test "$with_shadow" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DEC-style shadow passwords" >&5
-$as_echo_n "checking for DEC-style shadow passwords... " >&6; }
-if ${ac_cv_enhanced_passwd+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for generic shadow passwords" >&5
+$as_echo_n "checking for generic shadow passwords... " >&6; }
+if ${ac_cv_shadow+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
@@ -10850,47 +11482,39 @@ else
                                     #include <unistd.h>
                                     #include <sys/types.h>
                                     #include <pwd.h>
-                                    #include <sys/security.h>
-                                    #include <prot.h>
+                                    #include <shadow.h>
 int
 main ()
 {
-struct pr_passwd *p;
-                       const char *pw;
-                       set_auth_parameters(0, 0);
-                       check_auth_parameters();
-                       p = getprpwnam("nobody");
-                       pw = p->ufld.fd_encrypt;
+struct spwd *p = getspnam("nobody");
+                       const char *pw = p->sp_pwdp;
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_enhanced_passwd=yes
+  ac_cv_shadow=yes
 else
-  ac_cv_enhanced_passwd=no
+  ac_cv_shadow=no
 fi
 rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_enhanced_passwd" >&5
-$as_echo "$ac_cv_enhanced_passwd" >&6; }
-  if test $ac_cv_enhanced_passwd = yes; then
-    have_shadow_enhanced=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_shadow" >&5
+$as_echo "$ac_cv_shadow" >&6; }
+  if test "$ac_cv_shadow" = yes; then
     have_shadow=yes
     need_setuid=yes
 
-    # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
-    # (I'm told it needs -lcurses too, but I don't understand why.)
-    # But on DEC, it's in -lsecurity.
-    #
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lprot" >&5
-$as_echo_n "checking for getprpwnam in -lprot... " >&6; }
-if ${ac_cv_lib_prot_getprpwnam+:} false; then :
+    # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
+    have_getspnam=no
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lc" >&5
+$as_echo_n "checking for getspnam in -lc... " >&6; }
+if ${ac_cv_lib_c_getspnam+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lprot -lx $LIBS"
+LIBS="-l $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10900,36 +11524,38 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char getprpwnam ();
+char getspnam ();
 int
 main ()
 {
-return getprpwnam ();
+return getspnam ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_prot_getprpwnam=yes
+  ac_cv_lib_c_getspnam=yes
 else
-  ac_cv_lib_prot_getprpwnam=no
+  ac_cv_lib_c_getspnam=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_prot_getprpwnam" >&5
-$as_echo "$ac_cv_lib_prot_getprpwnam" >&6; }
-if test "x$ac_cv_lib_prot_getprpwnam" = xyes; then :
-  PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getprpwnam in -lsecurity" >&5
-$as_echo_n "checking for getprpwnam in -lsecurity... " >&6; }
-if ${ac_cv_lib_security_getprpwnam+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getspnam" >&5
+$as_echo "$ac_cv_lib_c_getspnam" >&6; }
+if test "x$ac_cv_lib_c_getspnam" = xyes; then :
+  have_getspnam=yes
+fi
+
+    if test "$have_getspnam" = no ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5
+$as_echo_n "checking for getspnam in -lgen... " >&6; }
+if ${ac_cv_lib_gen_getspnam+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsecurity  $LIBS"
+LIBS="-lgen  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -10939,94 +11565,93 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char getprpwnam ();
+char getspnam ();
 int
 main ()
 {
-return getprpwnam ();
+return getspnam ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_security_getprpwnam=yes
+  ac_cv_lib_gen_getspnam=yes
 else
-  ac_cv_lib_security_getprpwnam=no
+  ac_cv_lib_gen_getspnam=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_security_getprpwnam" >&5
-$as_echo "$ac_cv_lib_security_getprpwnam" >&6; }
-if test "x$ac_cv_lib_security_getprpwnam" = xyes; then :
-  PASSWD_LIBS="$PASSWD_LIBS -lsecurity"
-fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_getspnam" >&5
+$as_echo "$ac_cv_lib_gen_getspnam" >&6; }
+if test "x$ac_cv_lib_gen_getspnam" = xyes; then :
+  have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"
 fi
 
+    fi
   fi
 fi
 
+
 ###############################################################################
 #
-#       Check for HP's entry in the "Not Invented Here" Sweepstakes.
+#       Check for other libraries needed for non-shadow passwords.
 #
 ###############################################################################
 
-if test "$with_shadow" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for HP-style shadow passwords" >&5
-$as_echo_n "checking for HP-style shadow passwords... " >&6; }
-if ${ac_cv_hpux_passwd+:} false; then :
+if test "$enable_locking" = yes ; then
+
+  # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
+  have_crypt=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5
+$as_echo_n "checking for crypt in -lc... " >&6; }
+if ${ac_cv_lib_c_crypt+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdlib.h>
-                                    #include <unistd.h>
-                                    #include <sys/types.h>
-                                    #include <pwd.h>
-                                    #include <hpsecurity.h>
-                                    #include <prot.h>
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char crypt ();
 int
 main ()
 {
-struct s_passwd *p = getspwnam("nobody");
-                       const char *pw = p->pw_passwd;
+return crypt ();
   ;
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_hpux_passwd=yes
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_c_crypt=yes
 else
-  ac_cv_hpux_passwd=no
+  ac_cv_lib_c_crypt=no
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5
+$as_echo "$ac_cv_lib_c_crypt" >&6; }
+if test "x$ac_cv_lib_c_crypt" = xyes; then :
+  have_crypt=yes
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_hpux_passwd" >&5
-$as_echo "$ac_cv_hpux_passwd" >&6; }
-  if test "$ac_cv_hpux_passwd" = yes; then
-    have_shadow_hpux=yes
-    have_shadow=yes
-    need_setuid=yes
 
-    # on HPUX, bigcrypt is in -lsec
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for bigcrypt in -lsec" >&5
-$as_echo_n "checking for bigcrypt in -lsec... " >&6; }
-if ${ac_cv_lib_sec_bigcrypt+:} false; then :
+  if test "$have_crypt" = no ; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
+$as_echo_n "checking for crypt in -lcrypt... " >&6; }
+if ${ac_cv_lib_crypt_crypt+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lsec  $LIBS"
+LIBS="-lcrypt  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -11036,472 +11661,718 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char bigcrypt ();
+char crypt ();
 int
 main ()
 {
-return bigcrypt ();
+return crypt ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_sec_bigcrypt=yes
+  ac_cv_lib_crypt_crypt=yes
 else
-  ac_cv_lib_sec_bigcrypt=no
+  ac_cv_lib_crypt_crypt=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_sec_bigcrypt" >&5
-$as_echo "$ac_cv_lib_sec_bigcrypt" >&6; }
-if test "x$ac_cv_lib_sec_bigcrypt" = xyes; then :
-  PASSWD_LIBS="$PASSWD_LIBS -lsec"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5
+$as_echo "$ac_cv_lib_crypt_crypt" >&6; }
+if test "x$ac_cv_lib_crypt_crypt" = xyes; then :
+  have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
+fi
+
+  fi
+fi
+
+
+# Most of the above shadow mechanisms will have set need_setuid to yes,
+# if they were found.  But, on some systems, we need setuid even when
+# using plain old vanilla passwords.
+#
+if test "$enable_locking" = yes ; then
+  case "$host" in
+    *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
+      need_setuid=yes
+    ;;
+  esac
+fi
+
+
+if test "$have_shadow_adjunct" = yes ; then
+  $as_echo "#define HAVE_ADJUNCT_PASSWD 1" >>confdefs.h
+
+elif test "$have_shadow_enhanced" = yes ; then
+  $as_echo "#define HAVE_ENHANCED_PASSWD 1" >>confdefs.h
+
+elif test "$have_shadow_hpux" = yes ; then
+  $as_echo "#define HAVE_HPUX_PASSWD 1" >>confdefs.h
+
+elif test "$have_shadow" = yes ; then
+  $as_echo "#define HAVE_SHADOW_PASSWD 1" >>confdefs.h
+
+fi
+
+
+###############################################################################
+#
+#       Check for external password helper
+#      On SuSE, instead of having xscreensaver be a setuid program, they
+#      fork an external program that takes the password on stdin, and
+#      returns true if that password is a valid one.  Then only that
+#      smaller program needs to be setuid.
+#
+#       (Note that this external program is not a GUI: the GUI is still
+#      all in xscreensaver itself; the external program just does auth.)
+#
+###############################################################################
+
+have_passwd_helper=no
+with_passwd_helper_req=unspecified
+
+
+# Check whether --with-passwd-helper was given.
+if test "${with_passwd_helper+set}" = set; then :
+  withval=$with_passwd_helper; with_passwd_helper="$withval"; with_passwd_helper_req="$withval"
+else
+  with_passwd_helper=no
 fi
 
-  fi
+# no HANDLE_X_PATH_ARG for this one
+
+if test "$enable_locking" = no ; then
+  with_passwd_helper_req=no
+  with_passwd_helper=no
 fi
 
+case "$with_passwd_helper" in
+  ""|no) : ;;
+  /*)
+    cat >>confdefs.h <<_ACEOF
+#define PASSWD_HELPER_PROGRAM "$with_passwd_helper"
+_ACEOF
+
+    have_passwd_helper=yes;;
+  *)
+    echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2
+    exit 1
+esac
+
 
 ###############################################################################
 #
-#       Check for FreeBSD-style shadow passwords.
-#
-#       On FreeBSD, getpwnam() and friends work just like on non-shadow-
-#       password systems -- except you only get stuff in the pw_passwd field
-#       if the running program is setuid.  So, guess that we've got this
-#       lossage to contend with if /etc/master.passwd exists, and default to
-#       a setuid installation.
+#       Check for a login manager for a "New Login" button on the lock dialog.
+#      Usually this will be "/usr/bin/gdmflexiserver".
 #
 ###############################################################################
 
-if test "$with_shadow" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FreeBSD-style shadow passwords" >&5
-$as_echo_n "checking for FreeBSD-style shadow passwords... " >&6; }
-if ${ac_cv_master_passwd+:} false; then :
-  $as_echo_n "(cached) " >&6
+with_login_manager_req=unspecified
+default_login_manager_1='gdmflexiserver -ls'
+default_login_manager_2='kdmctl reserve'
+default_login_manager_3='lxdm -c USER_SWITCH'
+default_login_manager_4='dm-tool switch-to-greeter'
+
+
+# Check whether --with-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
-  if test -f /etc/master.passwd ; then
-                    ac_cv_master_passwd=yes
-                  else
-                    ac_cv_master_passwd=no
-                  fi
+  with_login_manager=yes
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_master_passwd" >&5
-$as_echo "$ac_cv_master_passwd" >&6; }
-  if test "$ac_cv_master_passwd" = yes; then
-    need_setuid=yes
-  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_login_manager_req" in
+  no)
+    with_login_manager=""
+  ;;
 
-###############################################################################
-#
-#       Check for traditional (ha!) shadow passwords.
-#
-###############################################################################
+  yes|unspecified)
+    # Try various defaults, use the first one that exists.
 
-if test "$with_shadow" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for generic shadow passwords" >&5
-$as_echo_n "checking for generic shadow passwords... " >&6; }
-if ${ac_cv_shadow+:} false; then :
+    with_login_manager=""
+
+    if test -z "$with_login_manager" ; then
+      set dummy $default_login_manager_1 ; login_manager_tmp=$2
+      unset ac_cv_path_login_manager_tmp  # don't cache
+      # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_login_manager_tmp+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <stdlib.h>
-                                    #include <unistd.h>
-                                    #include <sys/types.h>
-                                    #include <pwd.h>
-                                    #include <shadow.h>
-int
-main ()
-{
-struct spwd *p = getspnam("nobody");
-                       const char *pw = p->sp_pwdp;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_shadow=yes
-else
-  ac_cv_shadow=no
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-  CPPFLAGS="$ac_save_CPPFLAGS"
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+if test -n "$login_manager_tmp"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
+$as_echo "$login_manager_tmp" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_shadow" >&5
-$as_echo "$ac_cv_shadow" >&6; }
-  if test "$ac_cv_shadow" = yes; then
-    have_shadow=yes
-    need_setuid=yes
 
-    # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
-    have_getspnam=no
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lc" >&5
-$as_echo_n "checking for getspnam in -lc... " >&6; }
-if ${ac_cv_lib_c_getspnam+:} false; then :
+
+      if test ! -z "$login_manager_tmp" ; then
+        with_login_manager="$default_login_manager_1"
+      fi
+    fi
+
+    if test -z "$with_login_manager" ; then
+      set dummy $default_login_manager_2 ; login_manager_tmp=$2
+      unset ac_cv_path_login_manager_tmp  # don't cache
+      # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_login_manager_tmp+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getspnam ();
-int
-main ()
-{
-return getspnam ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_getspnam=yes
+  ;;
+esac
+fi
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+if test -n "$login_manager_tmp"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
+$as_echo "$login_manager_tmp" >&6; }
 else
-  ac_cv_lib_c_getspnam=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+
+      if test ! -z "$login_manager_tmp" ; then
+        with_login_manager="$default_login_manager_2"
+      fi
+    fi
+
+    if test -z "$with_login_manager" ; then
+      set dummy $default_login_manager_3 ; login_manager_tmp=$2
+      unset ac_cv_path_login_manager_tmp  # don't cache
+      # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_login_manager_tmp+:} false; then :
+  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_getspnam" >&5
-$as_echo "$ac_cv_lib_c_getspnam" >&6; }
-if test "x$ac_cv_lib_c_getspnam" = xyes; then :
-  have_getspnam=yes
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+if test -n "$login_manager_tmp"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
+$as_echo "$login_manager_tmp" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-    if test "$have_getspnam" = no ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getspnam in -lgen" >&5
-$as_echo_n "checking for getspnam in -lgen... " >&6; }
-if ${ac_cv_lib_gen_getspnam+:} false; then :
+
+      if test ! -z "$login_manager_tmp" ; then
+        with_login_manager="$default_login_manager_3"
+      fi
+    fi
+
+    if test -z "$with_login_manager" ; then
+      set dummy $default_login_manager_4 ; login_manager_tmp=$2
+      unset ac_cv_path_login_manager_tmp  # don't cache
+      # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_login_manager_tmp+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgen  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char getspnam ();
-int
-main ()
-{
-return getspnam ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gen_getspnam=yes
+  ;;
+esac
+fi
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+if test -n "$login_manager_tmp"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
+$as_echo "$login_manager_tmp" >&6; }
 else
-  ac_cv_lib_gen_getspnam=no
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+
+
+      if test ! -z "$login_manager_tmp" ; then
+        with_login_manager="$default_login_manager_4"
+      fi
+    fi
+
+  ;;
+
+  /*)
+    # absolute path specified on cmd line
+    set dummy $with_login_manager_req ; login_manager_tmp=$2
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $login_manager_tmp" >&5
+$as_echo_n "checking for $login_manager_tmp... " >&6; }
+    if test -x "$login_manager_tmp" ; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      with_login_manager=""
+    fi
+  ;;
+
+  *)
+    # relative path specified on cmd line
+    set dummy $with_login_manager_req ; login_manager_tmp=$2
+    unset ac_cv_path_login_manager_tmp    # don't cache
+    # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_login_manager_tmp+:} false; then :
+  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  ;;
+esac
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_getspnam" >&5
-$as_echo "$ac_cv_lib_gen_getspnam" >&6; }
-if test "x$ac_cv_lib_gen_getspnam" = xyes; then :
-  have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"
+login_manager_tmp=$ac_cv_path_login_manager_tmp
+if test -n "$login_manager_tmp"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
+$as_echo "$login_manager_tmp" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
+
+    if test -z "$login_manager_tmp" ; then
+      with_login_manager=""
+    else
+      with_login_manager="$login_manager_tmp"
     fi
-  fi
+  ;;
+esac
+ac_cv_login_manager_program="$with_login_manager"
+
+NEW_LOGIN_COMMAND_P=''
+NEW_LOGIN_COMMAND="$ac_cv_login_manager_program"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for login manager" >&5
+$as_echo_n "checking for login manager... " >&6; }
+if test -z "$NEW_LOGIN_COMMAND" ; then
+  NEW_LOGIN_COMMAND="$default_login_manager_1"
+  NEW_LOGIN_COMMAND_P='! '
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND (disabled)" >&5
+$as_echo "$NEW_LOGIN_COMMAND (disabled)" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND" >&5
+$as_echo "$NEW_LOGIN_COMMAND" >&6; }
 fi
 
 
 ###############################################################################
 #
-#       Check for other libraries needed for non-shadow passwords.
+#       Check for -lgtk (and Gnome stuff)
 #
 ###############################################################################
 
-if test "$enable_locking" = yes ; then
-
-  # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
-  have_crypt=no
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lc" >&5
-$as_echo_n "checking for crypt in -lc... " >&6; }
-if ${ac_cv_lib_c_crypt+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+have_gtk=no
+with_gtk_req=unspecified
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char crypt ();
-int
-main ()
-{
-return crypt ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_crypt=yes
+# Check whether --with-gtk was given.
+if test "${with_gtk+set}" = set; then :
+  withval=$with_gtk; with_gtk="$withval"; with_gtk_req="$withval"
 else
-  ac_cv_lib_c_crypt=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_crypt" >&5
-$as_echo "$ac_cv_lib_c_crypt" >&6; }
-if test "x$ac_cv_lib_c_crypt" = xyes; then :
-  have_crypt=yes
+  with_gtk=yes
 fi
 
-  if test "$have_crypt" = no ; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for crypt in -lcrypt" >&5
-$as_echo_n "checking for crypt in -lcrypt... " >&6; }
-if ${ac_cv_lib_crypt_crypt+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypt  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char crypt ();
-int
-main ()
-{
-return crypt ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_crypt_crypt=yes
-else
-  ac_cv_lib_crypt_crypt=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypt_crypt" >&5
-$as_echo "$ac_cv_lib_crypt_crypt" >&6; }
-if test "x$ac_cv_lib_crypt_crypt" = xyes; then :
-  have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
-fi
 
-  fi
-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
 
 
-# Most of the above shadow mechanisms will have set need_setuid to yes,
-# if they were found.  But, on some systems, we need setuid even when
-# using plain old vanilla passwords.
-#
-if test "$enable_locking" = yes ; then
-  case "$host" in
-    *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
-      need_setuid=yes
-    ;;
-  esac
-fi
+   case "$with_gtk" in
+    yes) ;;
+    no)  ;;
 
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk headers" >&5
+$as_echo_n "checking for Gtk headers... " >&6; }
+     d=$with_gtk/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
 
-if test "$have_shadow_adjunct" = yes ; then
-  $as_echo "#define HAVE_ADJUNCT_PASSWD 1" >>confdefs.h
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk libs" >&5
+$as_echo_n "checking for Gtk libs... " >&6; }
+     d=$with_gtk/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
 
-elif test "$have_shadow_enhanced" = yes ; then
-  $as_echo "#define HAVE_ENHANCED_PASSWD 1" >>confdefs.h
+     # replace the directory string with "yes".
+     with_gtk_req="yes"
+     with_gtk=$with_gtk_req
+     ;;
 
-elif test "$have_shadow_hpux" = yes ; then
-  $as_echo "#define HAVE_HPUX_PASSWD 1" >>confdefs.h
+    *)
+     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
 
-elif test "$have_shadow" = yes ; then
-  $as_echo "#define HAVE_SHADOW_PASSWD 1" >>confdefs.h
 
+if test "$with_gtk" != yes -a "$with_gtk" != no ; then
+  echo "error: must be yes or no: --with-gtk=$with_gtk"
+  exit 1
 fi
 
 
-###############################################################################
-#
-#       Check for external password helper
-#      On SuSE, instead of having xscreensaver be a setuid program, they
-#      fork an external program that takes the password on stdin, and
-#      returns true if that password is a valid one.  Then only that
-#      smaller program needs to be setuid.
-#
-#       (Note that this external program is not a GUI: the GUI is still
-#      all in xscreensaver itself; the external program just does auth.)
-#
-###############################################################################
+parse_gtk_version_string() {
+  # M4 sucks!!
 
-have_passwd_helper=no
-with_passwd_helper_req=unspecified
+  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
+}
 
-# Check whether --with-passwd-helper was given.
-if test "${with_passwd_helper+set}" = set; then :
-  withval=$with_passwd_helper; with_passwd_helper="$withval"; with_passwd_helper_req="$withval"
-else
-  with_passwd_helper=no
+# 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
 
-# no HANDLE_X_PATH_ARG for this one
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_path_pkg_config+:} false; then :
+  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
 
-if test "$enable_locking" = no ; then
-  with_passwd_helper_req=no
-  with_passwd_helper=no
+  ;;
+esac
+fi
+pkg_config=$ac_cv_path_pkg_config
+if test -n "$pkg_config"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config" >&5
+$as_echo "$pkg_config" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 
-case "$with_passwd_helper" in
-  ""|no) : ;;
-  /*)
-    cat >>confdefs.h <<_ACEOF
-#define PASSWD_HELPER_PROGRAM "$with_passwd_helper"
-_ACEOF
 
-    have_passwd_helper=yes;;
-  *)
-    echo "error: --with-passwd-helper needs full pathname of helper (not '$with_passwd_helper')." >&2
-    exit 1
-esac
+  test -n "$pkg_config" && break
+done
 
 
-###############################################################################
-#
-#       Check for a login manager for a "New Login" button on the lock dialog.
-#      Usually this will be "/usr/bin/gdmflexiserver".
+if test -z "$pkg_config" ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found!" >&5
+$as_echo "$as_me: WARNING: pkg-config not found!" >&2;}
+  pkg_config="false"
+fi
+
+
+# Utility function for running pkg-config-based tests...
 #
-###############################################################################
+pkgs=''
+pkg_check_version() {
+  if test "$ok" = yes ; then
+    req="$1"
+    min="$2"
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $req" >&5
+$as_echo_n "checking for $req... " >&6; }
+    if $pkg_config --exists "$req" ; then
+      vers=`$pkg_config --modversion "$req"`
+      if $pkg_config --exists "$req >= $min" ; then
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers" >&5
+$as_echo "$vers" >&6; }
+        pkgs="$pkgs $req"
+        return 1
+      else
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers (wanted >= $min)" >&5
+$as_echo "$vers (wanted >= $min)" >&6; }
+        ok=no
+        return 0
+      fi
+    else
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+      ok=no
+      return 0
+    fi
+  fi
+}
 
-with_login_manager_req=unspecified
-default_login_manager_1='gdmflexiserver -ls'
-default_login_manager_2='kdmctl reserve'
 
+jurassic_gtk=no
+gtk_halfassed=no
+have_gtk_2_22_or_higher=no
+COMMENT_DEMO_GLADE2_GTK_2_22_HEAD=""
+COMMENT_DEMO_GLADE2_GTK_2_22_TAIL=""
+
+if test "$with_gtk" = yes; then
+  have_gtk=no
 
-# Check whether --with-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"
+  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
+    parse_gtk_version_string
+    jurassic_gtk=no
+  fi
+
+  if test "$have_gtk" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk includes" >&5
+$as_echo_n "checking for Gtk includes... " >&6; }
+if ${ac_cv_gtk_config_cflags+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  with_login_manager=yes
+  ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_cflags" >&5
+$as_echo "$ac_cv_gtk_config_cflags" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk libs" >&5
+$as_echo_n "checking for Gtk libs... " >&6; }
+if ${ac_cv_gtk_config_libs+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_libs" >&5
+$as_echo "$ac_cv_gtk_config_libs" >&6; }
+  fi
 
-# no HANDLE_X_PATH_ARG for this one
+  ac_gtk_config_cflags=$ac_cv_gtk_config_cflags
+  ac_gtk_config_libs=$ac_cv_gtk_config_libs
+
+  GTK_EXTRA_OBJS=""
+  GTK_DATADIR=""
+  if test "$have_gtk" = yes; then
+    GTK_DATADIR=`$pkg_config --variable=prefix gtk+-2.0`
+    GTK_DATADIR="$GTK_DATADIR/share"
+  fi
 
-if test "$enable_locking" = no ; then
-  with_login_manager_req=no
-  with_login_manager=no
-fi
+  if test "$have_gtk" = yes; then
+    INCLUDES="$INCLUDES $ac_gtk_config_cflags"
+    GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs"
+    $as_echo "#define HAVE_GTK 1" >>confdefs.h
 
-case "$with_login_manager_req" in
-  no)
-    with_login_manager=""
-  ;;
+    $as_echo "#define HAVE_GTK2 1" >>confdefs.h
 
-  yes|unspecified)
-    # Try both defaults, use the one that exists.
+    $as_echo "#define HAVE_XML 1" >>confdefs.h
 
-    set dummy $default_login_manager_1 ; login_manager_tmp=$2
-    unset ac_cv_path_login_manager_tmp  # don't cache
-    # 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_login_manager_tmp+:} false; then :
-  $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
   fi
-done
-  done
-IFS=$as_save_IFS
 
-  ;;
-esac
-fi
-login_manager_tmp=$ac_cv_path_login_manager_tmp
-if test -n "$login_manager_tmp"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
-$as_echo "$login_manager_tmp" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  if test "$have_gtk" = yes; then
+    ok="yes"
+    pkg_check_version gtk+-2.0 2.22
+    have_gtk_2_22_or_higher="$ok"
+    if test "$have_gtk_2_22_or_higher" = yes; then
+      COMMENT_DEMO_GLADE2_GTK_2_22_HEAD="<!-- comment>"
+      COMMENT_DEMO_GLADE2_GTK_2_22_TAIL="</comment -->"
+    fi
+  fi
 fi
 
 
-    if test ! -z "$login_manager_tmp" ; then
-      with_login_manager="$default_login_manager_1"
-    else
-      set dummy $default_login_manager_2 ; login_manager_tmp=$2
-      unset ac_cv_path_login_manager_tmp  # don't cache
-      # 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
+# Check for the various Gnome help and URL loading programs.
+#
+WITH_BROWSER=gnome-open
+if test "$have_gtk" = yes; then
+  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
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_login_manager_tmp+:} false; then :
+if ${ac_cv_prog_gnome_open_program+:} false; then :
   $as_echo_n "(cached) " >&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
+  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
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_prog_gnome_open_program="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -11509,66 +12380,41 @@ done
   done
 IFS=$as_save_IFS
 
-  ;;
-esac
 fi
-login_manager_tmp=$ac_cv_path_login_manager_tmp
-if test -n "$login_manager_tmp"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
-$as_echo "$login_manager_tmp" >&6; }
+fi
+gnome_open_program=$ac_cv_prog_gnome_open_program
+if test -n "$gnome_open_program"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_open_program" >&5
+$as_echo "$gnome_open_program" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
-      if test ! -z "$login_manager_tmp" ; then
-        with_login_manager="$default_login_manager_2"
-      else
-        with_login_manager=""
-      fi
-    fi
-  ;;
-
-  /*)
-    # absolute path specified on cmd line
-    set dummy $with_login_manager_req ; login_manager_tmp=$2
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $login_manager_tmp" >&5
-$as_echo_n "checking for $login_manager_tmp... " >&6; }
-    if test -x "$login_manager_tmp" ; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-      with_login_manager=""
-    fi
-  ;;
+  test -n "$gnome_open_program" && break
+done
 
-  *)
-    # relative path specified on cmd line
-    set dummy $with_login_manager_req ; login_manager_tmp=$2
-    unset ac_cv_path_login_manager_tmp    # don't cache
-    # 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
+  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
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
 $as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_login_manager_tmp+:} false; then :
+if ${ac_cv_prog_gnome_url_show_program+:} false; then :
   $as_echo_n "(cached) " >&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
+  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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_login_manager_tmp="$as_dir/$ac_word$ac_exec_ext"
+    ac_cv_prog_gnome_url_show_program="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
@@ -11576,81 +12422,50 @@ done
   done
 IFS=$as_save_IFS
 
-  ;;
-esac
 fi
-login_manager_tmp=$ac_cv_path_login_manager_tmp
-if test -n "$login_manager_tmp"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $login_manager_tmp" >&5
-$as_echo "$login_manager_tmp" >&6; }
+fi
+gnome_url_show_program=$ac_cv_prog_gnome_url_show_program
+if test -n "$gnome_url_show_program"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_url_show_program" >&5
+$as_echo "$gnome_url_show_program" >&6; }
 else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "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"
-
-NEW_LOGIN_COMMAND_P=''
-NEW_LOGIN_COMMAND="$ac_cv_login_manager_program"
+  test -n "$gnome_url_show_program" && break
+done
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for login manager" >&5
-$as_echo_n "checking for login manager... " >&6; }
-if test -z "$NEW_LOGIN_COMMAND" ; then
-  NEW_LOGIN_COMMAND="$default_login_manager_1"
-  NEW_LOGIN_COMMAND_P='! '
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND (disabled)" >&5
-$as_echo "$NEW_LOGIN_COMMAND (disabled)" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEW_LOGIN_COMMAND" >&5
-$as_echo "$NEW_LOGIN_COMMAND" >&6; }
 fi
 
 
 ###############################################################################
 #
-#       Check for -lgtk (and Gnome stuff)
+#       Check for -lXm.
 #
 ###############################################################################
 
-have_gtk=no
-with_gtk_req=unspecified
+have_motif=no
+with_motif_req=unspecified
 
-# Check whether --with-gtk was given.
-if test "${with_gtk+set}" = set; then :
-  withval=$with_gtk; with_gtk="$withval"; with_gtk_req="$withval"
+# Check whether --with-motif was given.
+if test "${with_motif+set}" = set; then :
+  withval=$with_motif; with_motif="$withval"; with_motif_req="$withval"
 else
-  with_gtk=yes
+  with_motif=no
 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
+   case "$with_motif" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk headers" >&5
-$as_echo_n "checking for Gtk headers... " >&6; }
-     d=$with_gtk/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif headers" >&5
+$as_echo_n "checking for Motif headers... " >&6; }
+     d=$with_motif/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -11660,9 +12475,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk libs" >&5
-$as_echo_n "checking for Gtk libs... " >&6; }
-     d=$with_gtk/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif libs" >&5
+$as_echo_n "checking for Motif libs... " >&6; }
+     d=$with_motif/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -11672,324 +12487,450 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     # replace the directory string with "yes".
-     with_gtk_req="yes"
-     with_gtk=$with_gtk_req
-     ;;
+     # replace the directory string with "yes".
+     with_motif_req="yes"
+     with_motif=$with_motif_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+
+
+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_motif" = yes; then
+  have_motif=no
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "Xm/Xm.h" "ac_cv_header_Xm_Xm_h" "#include <stdlib.h>
+                     #include <stdio.h>
+                     #include <X11/Intrinsic.h>
+"
+if test "x$ac_cv_header_Xm_Xm_h" = xyes; then :
+  have_motif=yes
+                     $as_echo "#define HAVE_MOTIF 1" >>confdefs.h
+
+                     MOTIF_LIBS="$MOTIF_LIBS -lXm"
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+
 
-    *)
-     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 "$have_motif" = yes; then
 
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "Xm/ComboBox.h" "ac_cv_header_Xm_ComboBox_h" "#include <stdlib.h>
+                     #include <stdio.h>
+                     #include <X11/Intrinsic.h>
+"
+if test "x$ac_cv_header_Xm_ComboBox_h" = xyes; then :
+  $as_echo "#define HAVE_XMCOMBOBOX 1" >>confdefs.h
 
-if test "$with_gtk" != yes -a "$with_gtk" != no ; then
-  echo "error: must be yes or no: --with-gtk=$with_gtk"
-  exit 1
 fi
 
 
-parse_gtk_version_string() {
-  # M4 sucks!!
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
 
-  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
+###############################################################################
+#
+#       Checking whether Motif is really Lesstif.
+#
+###############################################################################
+
+have_lesstif=no
+if test "$have_motif" = yes ; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Motif is really LessTif" >&5
+$as_echo_n "checking whether Motif is really LessTif... " >&6; }
+if ${ac_cv_have_lesstif+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <Xm/Xm.h>
+int
+main ()
+{
+long vers = LesstifVersion;
+  ;
+  return 0;
 }
-
-# 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"
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  ac_cv_have_lesstif=yes
+else
+  ac_cv_have_lesstif=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_lesstif" >&5
+$as_echo "$ac_cv_have_lesstif" >&6; }
+  have_lesstif=$ac_cv_have_lesstif
 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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_pkg_config+:} false; then :
+
+lesstif_version=unknown
+lesstif_version_string=unknown
+
+if test "$have_lesstif" = yes ; then
+  ltv=unknown
+  echo unknown > conftest-lt
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking LessTif version number" >&5
+$as_echo_n "checking LessTif version number... " >&6; }
+if ${ac_cv_lesstif_version_string+:} false; then :
   $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_path_pkg_config="$as_dir/$ac_word$ac_exec_ext"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-done
-  done
-IFS=$as_save_IFS
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  if test "$cross_compiling" = yes; then :
+  ac_cv_lesstif_version=unknown
+                     ac_cv_lesstif_version_string=unknown
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+                     #include <Xm/Xm.h>
+                     int main() {
+                       FILE *f = fopen("conftest-lt", "w");
+                       if (!f) exit(1);
+                       fprintf(f, "%d %d.%d\n", LesstifVersion,
+                          LESSTIF_VERSION, LESSTIF_REVISION);
+                       fclose(f);
+                       exit(0);
+                     }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  ltv=`cat conftest-lt`
+                     ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
+                     ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`
+else
+  ac_cv_lesstif_version=unknown
+                     ac_cv_lesstif_version_string=unknown
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
 
-  ;;
-esac
+  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
-pkg_config=$ac_cv_path_pkg_config
-if test -n "$pkg_config"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pkg_config" >&5
-$as_echo "$pkg_config" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lesstif_version_string" >&5
+$as_echo "$ac_cv_lesstif_version_string" >&6; }
+  rm -rf conftest-lt
+  lesstif_version=$ac_cv_lesstif_version
+  lesstif_version_string=$ac_cv_lesstif_version_string
+
+fi
+
+
+if test "$have_motif" = yes ; then
+  mtv=unknown
+  echo unknown > conftest-mt
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Motif version number" >&5
+$as_echo_n "checking Motif version number... " >&6; }
+if ${ac_cv_motif_version_string+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  if test "$cross_compiling" = yes; then :
+  ac_cv_motif_version=unknown
+                     ac_cv_motif_version_string=unknown
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+#include <stdio.h>
+                     #include <Xm/Xm.h>
+                     int main() {
+                       FILE *f = fopen("conftest-mt", "w");
+                       if (!f) exit(1);
+                       fprintf(f, "%d %d.%d\n", XmVersion,
+                          XmVERSION, XmREVISION);
+                       fclose(f);
+                       exit(0);
+                     }
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+  mtv=`cat conftest-mt`
+                     ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
+                     ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`
+else
+  ac_cv_motif_version=unknown
+                     ac_cv_motif_version_string=unknown
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+  conftest.$ac_objext conftest.beam conftest.$ac_ext
 fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_motif_version_string" >&5
+$as_echo "$ac_cv_motif_version_string" >&6; }
+  rm -rf conftest-mt
+  motif_version=$ac_cv_motif_version
+  motif_version_string=$ac_cv_motif_version_string
 
-  test -n "$pkg_config" && break
-done
+fi
 
 
-if test -z "$pkg_config" ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: pkg-config not found!" >&5
-$as_echo "$as_me: WARNING: pkg-config not found!" >&2;}
-  pkg_config="false"
+###############################################################################
+#
+#       Checking whether Motif requires -lXpm.
+#
+#       If this is Motif 2.x, and we have XPM, then link against XPM as well.
+#       The deal is, Motif 2.x requires XPM -- but it's a compilation option
+#       of the library whether to build the XPM code into libXm, or whether
+#       to rely on an external libXm.  So the only way to tell whether XPM is
+#       a link-time requirement is to examine libXm.a, which is very
+#       difficult to do in an autoconf script.  So... if it's Motif 2.x, we
+#       always link against XPM if the XPM lib exists (and this will be a
+#       no-op if libXm happens to already have the XPM code in it.)
+#
+###############################################################################
+
+motif_requires_xpm=no
+if test "$have_motif" = yes ; then
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Motif requires XPM" >&5
+$as_echo_n "checking whether Motif requires XPM... " >&6; }
+   if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000
+   then
+     motif_requires_xpm=yes
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: maybe" >&5
+$as_echo "maybe" >&6; }
+   else
+     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+   fi
 fi
 
 
-# Utility function for running pkg-config-based tests...
+###############################################################################
 #
-pkgs=''
-pkg_check_version() {
-  if test "$ok" = yes ; then
-    req="$1"
-    min="$2"
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $req" >&5
-$as_echo_n "checking for $req... " >&6; }
-    if $pkg_config --exists "$req" ; then
-      vers=`$pkg_config --modversion "$req"`
-      if $pkg_config --exists "$req >= $min" ; then
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers" >&5
-$as_echo "$vers" >&6; }
-        pkgs="$pkgs $req"
-        return 1
-      else
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $vers (wanted >= $min)" >&5
-$as_echo "$vers (wanted >= $min)" >&6; }
-        ok=no
-        return 0
-      fi
-    else
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-      ok=no
-      return 0
-    fi
-  fi
-}
-
-
-jurassic_gtk=no
-gtk_halfassed=no
+#       Checking whether Motif requires -lXp.
+#
+#       Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
+#       Extension".   Why this extension isn't in -lXext with all the others,
+#       I have no idea.
+#
+###############################################################################
 
-if test "$with_gtk" = yes; then
-  have_gtk=no
+have_xp_ext=no
+if test "$have_motif" = yes ; then
+   have_xp_ext=no
 
-  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"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
 
-  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
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
-  if test "$have_gtk" = yes; then
-    parse_gtk_version_string
-    jurassic_gtk=no
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
   fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
 
-  if test "$have_gtk" = yes; then
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk includes" >&5
-$as_echo_n "checking for Gtk includes... " >&6; }
-if ${ac_cv_gtk_config_cflags+:} false; then :
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpQueryExtension in -lXp" >&5
+$as_echo_n "checking for XpQueryExtension in -lXp... " >&6; }
+if ${ac_cv_lib_Xp_XpQueryExtension+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-  ac_cv_gtk_config_cflags=`$pkg_config --cflags $pkgs`
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXp -lX11 -lXext -lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XpQueryExtension ();
+int
+main ()
+{
+return XpQueryExtension ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xp_XpQueryExtension=yes
+else
+  ac_cv_lib_Xp_XpQueryExtension=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_cflags" >&5
-$as_echo "$ac_cv_gtk_config_cflags" >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Gtk libs" >&5
-$as_echo_n "checking for Gtk libs... " >&6; }
-if ${ac_cv_gtk_config_libs+:} false; then :
-  $as_echo_n "(cached) " >&6
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xp_XpQueryExtension" >&5
+$as_echo "$ac_cv_lib_Xp_XpQueryExtension" >&6; }
+if test "x$ac_cv_lib_Xp_XpQueryExtension" = xyes; then :
+  have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"
 else
-  ac_cv_gtk_config_libs=`$pkg_config --libs $pkgs`
+  true
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gtk_config_libs" >&5
-$as_echo "$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
-
-  GTK_EXTRA_OBJS=""
-  GTK_DATADIR=""
-  if test "$have_gtk" = yes; then
-    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"
-    $as_echo "#define HAVE_GTK 1" >>confdefs.h
-
-    $as_echo "#define HAVE_GTK2 1" >>confdefs.h
 
-    $as_echo "#define HAVE_XML 1" >>confdefs.h
-
-  fi
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
 fi
 
 
-# Check for the various Gnome help and URL loading programs.
+###############################################################################
 #
-WITH_BROWSER=gnome-open
-if test "$have_gtk" = yes; then
-  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_gnome_open_program+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  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
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-    for ac_exec_ext in '' $ac_executable_extensions; do
-  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_gnome_open_program="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+#       Checking whether Motif requires -lXintl (for _Xsetlocale.)
+#
+###############################################################################
 
-fi
-fi
-gnome_open_program=$ac_cv_prog_gnome_open_program
-if test -n "$gnome_open_program"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_open_program" >&5
-$as_echo "$gnome_open_program" >&6; }
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
+have_xintl=no
+if test "$have_motif" = yes ; then
 
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
 
-  test -n "$gnome_open_program" && break
-done
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
-  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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_gnome_url_show_program+:} false; then :
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Xsetlocale in -lXintl" >&5
+$as_echo_n "checking for _Xsetlocale in -lXintl... " >&6; }
+if ${ac_cv_lib_Xintl__Xsetlocale+:} false; then :
   $as_echo_n "(cached) " >&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_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_gnome_url_show_program="$ac_prog"
-    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-  done
-IFS=$as_save_IFS
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXintl -lX11 -lXext -lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
 
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _Xsetlocale ();
+int
+main ()
+{
+return _Xsetlocale ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_Xintl__Xsetlocale=yes
+else
+  ac_cv_lib_Xintl__Xsetlocale=no
 fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-gnome_url_show_program=$ac_cv_prog_gnome_url_show_program
-if test -n "$gnome_url_show_program"; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gnome_url_show_program" >&5
-$as_echo "$gnome_url_show_program" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xintl__Xsetlocale" >&5
+$as_echo "$ac_cv_lib_Xintl__Xsetlocale" >&6; }
+if test "x$ac_cv_lib_Xintl__Xsetlocale" = xyes; then :
+  have_xintl=yes
 else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+  have_xintl=no
 fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-  test -n "$gnome_url_show_program" && break
-done
-
+  if test "$have_xintl" = yes; then
+    MOTIF_LIBS="$MOTIF_LIBS -lXintl"
+  fi
 fi
 
 
 ###############################################################################
 #
-#       Check for -lXm.
+#       Check for -lGL or -lMesaGL.
 #
 ###############################################################################
 
-have_motif=no
-with_motif_req=unspecified
+have_gl=no
+ac_have_mesa_gl=no
+with_gl_req=unspecified
+gl_halfassed=no
 
-# Check whether --with-motif was given.
-if test "${with_motif+set}" = set; then :
-  withval=$with_motif; with_motif="$withval"; with_motif_req="$withval"
+# Check whether --with-gl was given.
+if test "${with_gl+set}" = set; then :
+  withval=$with_gl; with_gl="$withval"; with_gl_req="$withval"
 else
-  with_motif=no
+  with_gl=yes
 fi
 
 
 
-   case "$with_motif" in
+   case "$with_gl" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif headers" >&5
-$as_echo_n "checking for Motif headers... " >&6; }
-     d=$with_motif/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL headers" >&5
+$as_echo_n "checking for GL headers... " >&6; }
+     d=$with_gl/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -11999,9 +12940,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Motif libs" >&5
-$as_echo_n "checking for Motif libs... " >&6; }
-     d=$with_motif/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL libs" >&5
+$as_echo_n "checking for GL libs... " >&6; }
+     d=$with_gl/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -12012,13 +12953,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_motif_req="yes"
-     with_motif=$with_motif_req
+     with_gl_req="yes"
+     with_gl=$with_gl_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-motif must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-gl 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
@@ -12026,13 +12967,10 @@ $as_echo "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"
-  exit 1
-fi
+ac_mesagl_version=unknown
+ac_mesagl_version_string=unknown
 
-if test "$with_motif" = yes; then
-  have_motif=no
+if test "$with_gl" = yes; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -12040,23 +12978,16 @@ if test "$with_motif" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "Xm/Xm.h" "ac_cv_header_Xm_Xm_h" "#include <stdlib.h>
-                     #include <stdio.h>
-                     #include <X11/Intrinsic.h>
-"
-if test "x$ac_cv_header_Xm_Xm_h" = xyes; then :
-  have_motif=yes
-                     $as_echo "#define HAVE_MOTIF 1" >>confdefs.h
-
-                     MOTIF_LIBS="$MOTIF_LIBS -lXm"
+  ac_fn_c_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default"
+if test "x$ac_cv_header_GL_gl_h" = xyes; then :
+  have_gl=yes
+else
+  have_gl=no
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-
-
-if test "$have_motif" = yes; then
+  if test "$have_gl" = yes ; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -12064,33 +12995,34 @@ if test "$have_motif" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "Xm/ComboBox.h" "ac_cv_header_Xm_ComboBox_h" "#include <stdlib.h>
-                     #include <stdio.h>
-                     #include <X11/Intrinsic.h>
+  ac_fn_c_check_header_compile "$LINENO" "GL/glx.h" "ac_cv_header_GL_glx_h" "#include <GL/gl.h>
 "
-if test "x$ac_cv_header_Xm_ComboBox_h" = xyes; then :
-  $as_echo "#define HAVE_XMCOMBOBOX 1" >>confdefs.h
-
+if test "x$ac_cv_header_GL_glx_h" = xyes; then :
+  have_gl=yes
+else
+  have_gl=no
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-fi
-
+  fi
 
-###############################################################################
-#
-#       Checking whether Motif is really Lesstif.
-#
-###############################################################################
+  # If we have the headers, try and figure out which vendor it's from.
+  #
+  if test "$have_gl" = yes ; then
 
-have_lesstif=no
-if test "$have_motif" = yes ; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Motif is really LessTif" >&5
-$as_echo_n "checking whether Motif is really LessTif... " >&6; }
-if ${ac_cv_have_lesstif+:} false; then :
+    # We need to know whether it's MesaGL so that we know which libraries
+    # to link against.
+    #
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GL is really MesaGL" >&5
+$as_echo_n "checking whether GL is really MesaGL... " >&6; }
+if ${ac_cv_have_mesa_gl+:} false; then :
   $as_echo_n "(cached) " >&6
 else
+  ac_cv_have_mesa_gl=no
+       if test "$ac_macosx" = no; then
+         # WTF! MacOS 10.5.0 ships the Mesa GL headers!
+         # It's not really Mesa, is it?
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <Xm/Xm.h>
-int
-main ()
-{
-long vers = LesstifVersion;
-  ;
-  return 0;
-}
+#include <GL/glx.h>
+
 _ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  ac_cv_have_lesstif=yes
-else
-  ac_cv_have_lesstif=no
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "Mesa|MESA" >/dev/null 2>&1; then :
+  ac_cv_have_mesa_gl=yes
 fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+rm -rf conftest*
+
   CPPFLAGS="$ac_save_CPPFLAGS"
+       fi
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_lesstif" >&5
-$as_echo "$ac_cv_have_lesstif" >&6; }
-  have_lesstif=$ac_cv_have_lesstif
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_mesa_gl" >&5
+$as_echo "$ac_cv_have_mesa_gl" >&6; }
+    ac_have_mesa_gl=$ac_cv_have_mesa_gl
 
+    gl_lib_1=""
+    GL_LIBS=""
 
-lesstif_version=unknown
-lesstif_version_string=unknown
+    if test "$ac_macosx" = yes; then
 
-if test "$have_lesstif" = yes ; then
-  ltv=unknown
-  echo unknown > conftest-lt
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking LessTif version number" >&5
-$as_echo_n "checking LessTif version number... " >&6; }
-if ${ac_cv_lesstif_version_string+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+      # Without these, every link against libGL gets a bunch of useless
+      # warnings.
+      #
+      osx_crud="-bind_at_load -multiply_defined suppress"
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5
+$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; }
+      GL_LIBS="$GL_LIBS $osx_crud"
+      unset osx_crud
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  if test "$cross_compiling" = yes; then :
-  ac_cv_lesstif_version=unknown
-                     ac_cv_lesstif_version_string=unknown
+      # New lossage in 10.5.0: without this, we get:
+      #   ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib
+      #
+      osx_crud="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
+      osx_crud="-Wl,-dylib_file,${osx_crud}:${osx_crud}"
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5
+$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; }
+      GL_LIBS="$GL_LIBS $osx_crud"
+      unset osx_crud
+
+      # New lossage in 10.6.8: we can't allow -L/opt/local/lib to be in the
+      # link line, or at runtime XQueryExtension gets a segv due to some kind
+      # of library version skew.  Libs must come from /usr/X11/lib even if
+      # $prefix and/or $exec_prefix are set to /opt/local/.
+      #
+      { $as_echo "$as_me:${as_lineno-$LINENO}: result: omitting \"$libdir\" from LDFLAGS" >&5
+$as_echo "omitting \"$libdir\" from LDFLAGS" >&6; }
+      libdir=''
+
+    fi
+
+
+    # Some versions of MesaGL are compiled to require -lpthread.
+    # So if the Mesa headers exist, and -lpthread exists, then always
+    # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
+    #
+    # Oftentimes, AX_PTHREAD will bring in -lpthread as well; but that ends
+    # up before -l(Mesa)GL, instead of after where it would belong.
+    #
+    if test "$ac_have_mesa_gl" = yes; then
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if ${ac_cv_lib_pthread_pthread_create+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread  $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-                     #include <Xm/Xm.h>
-                     int main() {
-                       FILE *f = fopen("conftest-lt", "w");
-                       if (!f) exit(1);
-                       fprintf(f, "%d %d.%d\n", LesstifVersion,
-                          LESSTIF_VERSION, LESSTIF_REVISION);
-                       fclose(f);
-                       exit(0);
-                     }
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  ltv=`cat conftest-lt`
-                     ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
-                     ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_create ();
+int
+main ()
+{
+return pthread_create ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_pthread_pthread_create=yes
 else
-  ac_cv_lesstif_version=unknown
-                     ac_cv_lesstif_version_string=unknown
+  ac_cv_lib_pthread_pthread_create=no
 fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
+  GL_LIBS="-lpthread"
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lesstif_version_string" >&5
-$as_echo "$ac_cv_lesstif_version_string" >&6; }
-  rm -rf conftest-lt
-  lesstif_version=$ac_cv_lesstif_version
-  lesstif_version_string=$ac_cv_lesstif_version_string
 
-fi
+    fi
 
 
-if test "$have_motif" = yes ; then
-  mtv=unknown
-  echo unknown > conftest-mt
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking Motif version number" >&5
-$as_echo_n "checking Motif version number... " >&6; }
-if ${ac_cv_motif_version_string+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+    # If we have Mesa headers, check to see if we can link against -lMesaGL.
+    # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL.
+    # Else, warn that GL is busted.  (We have the headers, but no libs.)
+    #
+
+    if test "$ac_have_mesa_gl" = 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"
+
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  if test "$cross_compiling" = yes; then :
-  ac_cv_motif_version=unknown
-                     ac_cv_motif_version_string=unknown
+  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lMesaGL" >&5
+$as_echo_n "checking for glXCreateContext in -lMesaGL... " >&6; }
+if ${ac_cv_lib_MesaGL_glXCreateContext+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
-#include <stdio.h>
-                     #include <Xm/Xm.h>
-                     int main() {
-                       FILE *f = fopen("conftest-mt", "w");
-                       if (!f) exit(1);
-                       fprintf(f, "%d %d.%d\n", XmVersion,
-                          XmVERSION, XmREVISION);
-                       fclose(f);
-                       exit(0);
-                     }
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char glXCreateContext ();
+int
+main ()
+{
+return glXCreateContext ();
+  ;
+  return 0;
+}
 _ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-  mtv=`cat conftest-mt`
-                     ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
-                     ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`
+if ac_fn_c_try_link "$LINENO"; then :
+  ac_cv_lib_MesaGL_glXCreateContext=yes
 else
-  ac_cv_motif_version=unknown
-                     ac_cv_motif_version_string=unknown
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
-  conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
+  ac_cv_lib_MesaGL_glXCreateContext=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_motif_version_string" >&5
-$as_echo "$ac_cv_motif_version_string" >&6; }
-  rm -rf conftest-mt
-  motif_version=$ac_cv_motif_version
-  motif_version_string=$ac_cv_motif_version_string
-
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
 fi
-
-
-###############################################################################
-#
-#       Checking whether Motif requires -lXpm.
-#
-#       If this is Motif 2.x, and we have XPM, then link against XPM as well.
-#       The deal is, Motif 2.x requires XPM -- but it's a compilation option
-#       of the library whether to build the XPM code into libXm, or whether
-#       to rely on an external libXm.  So the only way to tell whether XPM is
-#       a link-time requirement is to examine libXm.a, which is very
-#       difficult to do in an autoconf script.  So... if it's Motif 2.x, we
-#       always link against XPM if the XPM lib exists (and this will be a
-#       no-op if libXm happens to already have the XPM code in it.)
-#
-###############################################################################
-
-motif_requires_xpm=no
-if test "$have_motif" = yes ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Motif requires XPM" >&5
-$as_echo_n "checking whether Motif requires XPM... " >&6; }
-   if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000
-   then
-     motif_requires_xpm=yes
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: maybe" >&5
-$as_echo "maybe" >&6; }
-   else
-     { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-   fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_MesaGL_glXCreateContext" >&5
+$as_echo "$ac_cv_lib_MesaGL_glXCreateContext" >&6; }
+if test "x$ac_cv_lib_MesaGL_glXCreateContext" = xyes; then :
+  gl_lib_1="MesaGL"
+                      GL_LIBS="-lMesaGL -lMesaGLU $VIDMODE_LIBS $GL_LIBS"
 fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-###############################################################################
-#
-#       Checking whether Motif requires -lXp.
-#
-#       Some versions of Motif (2.1.0, at least) require -lXp, the "X Printing
-#       Extension".   Why this extension isn't in -lXext with all the others,
-#       I have no idea.
-#
-###############################################################################
+    fi
 
-have_xp_ext=no
-if test "$have_motif" = yes ; then
-   have_xp_ext=no
+    if test "$gl_lib_1" = "" ; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -12299,13 +13228,13 @@ if test "$have_motif" = yes ; then
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XpQueryExtension in -lXp" >&5
-$as_echo_n "checking for XpQueryExtension in -lXp... " >&6; }
-if ${ac_cv_lib_Xp_XpQueryExtension+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lGL" >&5
+$as_echo_n "checking for glXCreateContext in -lGL... " >&6; }
+if ${ac_cv_lib_GL_glXCreateContext+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXp -lX11 -lXext -lm $LIBS"
+LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12315,47 +13244,148 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char XpQueryExtension ();
+char glXCreateContext ();
 int
 main ()
 {
-return XpQueryExtension ();
+return glXCreateContext ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xp_XpQueryExtension=yes
+  ac_cv_lib_GL_glXCreateContext=yes
 else
-  ac_cv_lib_Xp_XpQueryExtension=no
+  ac_cv_lib_GL_glXCreateContext=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xp_XpQueryExtension" >&5
-$as_echo "$ac_cv_lib_Xp_XpQueryExtension" >&6; }
-if test "x$ac_cv_lib_Xp_XpQueryExtension" = xyes; then :
-  have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"
-else
-  true
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glXCreateContext" >&5
+$as_echo "$ac_cv_lib_GL_glXCreateContext" >&6; }
+if test "x$ac_cv_lib_GL_glXCreateContext" = xyes; then :
+  gl_lib_1="GL"
+                      GL_LIBS="-lGL -lGLU $VIDMODE_LIBS $GL_LIBS"
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+
+    fi
+
+    if test "$gl_lib_1" = "" ; then
+      # we have headers, but no libs -- bail.
+      have_gl=no
+      ac_have_mesa_gl=no
+      gl_halfassed=yes
+    else
+      # linking works -- we can build the GL hacks.
+      $as_echo "#define HAVE_GL 1" >>confdefs.h
+
+      if test "$ac_have_mesa_gl" = yes ; then
+        $as_echo "#define HAVE_MESA_GL 1" >>confdefs.h
+
+      fi
+    fi
+  fi
+
+
+  # Now that we know we have GL headers and libs, do some more GL testing.
+  #
+
+  if test "$have_gl" = yes ; then
+    # If it's MesaGL, we'd like to issue a warning if the version number
+    # is less than or equal to 2.6, because that version had a security bug.
+    #
+    if test "$ac_have_mesa_gl" = yes; then
+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking MesaGL version number" >&5
+$as_echo_n "checking MesaGL version number... " >&6; }
+if ${ac_cv_mesagl_version_string+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 13314 "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+#ifndef MESA_MAJOR_VERSION
+# include <GL/xmesa.h>
+# ifdef XMESA_MAJOR_VERSION
+   /* Around Mesa 3.2, they took out the Mesa version number, so instead,
+      we have to check the XMesa version number (the number of the X protocol
+      support, which seems to be the same as the Mesa version number.)
+    */
+#  define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION
+#  define MESA_MINOR_VERSION XMESA_MINOR_VERSION
+# else
+   /* Oh great.  Some time after 3.4, they took out the xmesa.h header file,
+      so we have no way of telling what version of Mesa this is at all.
+      So, we'll guess that the osmesa version (the "offscreen protocol")
+      is less than or equal to the real mesa version number.  Except that
+      if OSmesa is 3.3, assume at least Mesa 3.4, since OSmesa was 3.3 in
+      Mesa 3.4.  And Mesa 3.3 had xmesa.h.  What a complete load of shit!
+    */
+# include <GL/osmesa.h>
+#  define MESA_MAJOR_VERSION OSMESA_MAJOR_VERSION
+#  define MESA_MINOR_VERSION OSMESA_MINOR_VERSION or newer, probably?
+#  if OSMESA_MAJOR_VERSION == 3 && OSMESA_MINOR_VERSION == 3
+#   undef MESA_MINOR_VERSION
+#   define MESA_MINOR_VERSION 4 or newer, probably?
+#  endif
+# endif
+#endif
+configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
+EOF
+
+         ac_save_CPPFLAGS="$CPPFLAGS"
+         if test \! -z "$includedir" ; then
+           CPPFLAGS="$CPPFLAGS -I$includedir"
+         fi
+         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
 
-fi
+         mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | grep configure:`
 
+         # M4 sucks!!
 
-###############################################################################
-#
-#       Checking whether Motif requires -lXintl (for _Xsetlocale.)
-#
-###############################################################################
+          mglv=`echo "$mglv" | sed -n \
+             's/^configure: *\([0-9][0-9]*\)  *\([0-9].*\)$/\1.\2/p'`
 
-have_xintl=no
-if test "$have_motif" = yes ; then
+
+         rm -rf conftest.$ac_ext
+
+         CPPFLAGS="$ac_save_CPPFLAGS"
+
+         if test "$mglv" = ""; then
+           ac_mesagl_version=unknown
+           ac_mesagl_version_string=unknown
+         else
+           ac_mesagl_version_string="$mglv"
+           # M4 sucks!!
+
+           maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'`
+           min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'`
+
+           ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
+           if test -z "$ac_mesagl_version"; then
+             ac_mesagl_version=unknown
+             ac_mesagl_version_string=unknown
+           fi
+         fi
+         ac_cv_mesagl_version=$ac_mesagl_version
+         ac_cv_mesagl_version_string=$ac_mesagl_version_string
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mesagl_version_string" >&5
+$as_echo "$ac_cv_mesagl_version_string" >&6; }
+      ac_mesagl_version=$ac_cv_mesagl_version
+      ac_mesagl_version_string=$ac_cv_mesagl_version_string
+    fi
+
+
+    # Check for OpenGL 1.1 features.
+    #
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -12375,13 +13405,14 @@ if test "$have_motif" = yes ; then
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Xsetlocale in -lXintl" >&5
-$as_echo_n "checking for _Xsetlocale in -lXintl... " >&6; }
-if ${ac_cv_lib_Xintl__Xsetlocale+:} false; then :
+  as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBindTexture" | $as_tr_sh`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBindTexture in -l$gl_lib_1" >&5
+$as_echo_n "checking for glBindTexture in -l$gl_lib_1... " >&6; }
+if eval \${$as_ac_Lib+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lXintl -lX11 -lXext -lm $LIBS"
+LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12391,70 +13422,73 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char _Xsetlocale ();
+char glBindTexture ();
 int
 main ()
 {
-return _Xsetlocale ();
+return glBindTexture ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_Xintl__Xsetlocale=yes
+  eval "$as_ac_Lib=yes"
 else
-  ac_cv_lib_Xintl__Xsetlocale=no
+  eval "$as_ac_Lib=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_Xintl__Xsetlocale" >&5
-$as_echo "$ac_cv_lib_Xintl__Xsetlocale" >&6; }
-if test "x$ac_cv_lib_Xintl__Xsetlocale" = xyes; then :
-  have_xintl=yes
+eval ac_res=\$$as_ac_Lib
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
+  $as_echo "#define HAVE_GLBINDTEXTURE 1" >>confdefs.h
+
 else
-  have_xintl=no
+  true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-  if test "$have_xintl" = yes; then
-    MOTIF_LIBS="$MOTIF_LIBS -lXintl"
   fi
+
+elif test "$with_gl" != no; then
+  echo "error: must be yes or no: --with-gl=$with_gl"
+  exit 1
 fi
 
 
 ###############################################################################
 #
-#       Check for -lGL or -lMesaGL.
+#       Check for -lgle.
 #
 ###############################################################################
 
-have_gl=no
-ac_have_mesa_gl=no
-with_gl_req=unspecified
-gl_halfassed=no
+have_gle=no
+with_gle_req=unspecified
+gle_halfassed=no
 
-# Check whether --with-gl was given.
-if test "${with_gl+set}" = set; then :
-  withval=$with_gl; with_gl="$withval"; with_gl_req="$withval"
+# Check whether --with-gle was given.
+if test "${with_gle+set}" = set; then :
+  withval=$with_gle; with_gle="$withval"; with_gle_req="$withval"
 else
-  with_gl=yes
+  with_gle=yes
 fi
 
 
 
-   case "$with_gl" in
+   case "$with_gle" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL headers" >&5
-$as_echo_n "checking for GL headers... " >&6; }
-     d=$with_gl/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE headers" >&5
+$as_echo_n "checking for GLE headers... " >&6; }
+     d=$with_gle/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -12464,9 +13498,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GL libs" >&5
-$as_echo_n "checking for GL libs... " >&6; }
-     d=$with_gl/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE libs" >&5
+$as_echo_n "checking for GLE libs... " >&6; }
+     d=$with_gle/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -12477,13 +13511,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_gl_req="yes"
-     with_gl=$with_gl_req
+     with_gle_req="yes"
+     with_gle=$with_gle_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-gl must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-gle 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
@@ -12491,27 +13525,12 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-ac_mesagl_version=unknown
-ac_mesagl_version_string=unknown
-
-if test "$with_gl" = yes; then
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_mongrel "$LINENO" "GL/gl.h" "ac_cv_header_GL_gl_h" "$ac_includes_default"
-if test "x$ac_cv_header_GL_gl_h" = xyes; then :
-  have_gl=yes
-else
-  have_gl=no
-fi
+GLE_LIBS=""
 
+if test "$have_gl" = no ; then
+ true
+elif test "$with_gle" = yes; then
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  if test "$have_gl" = yes ; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "GL/glx.h" "ac_cv_header_GL_glx_h" "#include <GL/gl.h>
+  ac_fn_c_check_header_compile "$LINENO" "GL/gle.h" "ac_cv_header_GL_gle_h" "#include <GL/gl.h>
 "
-if test "x$ac_cv_header_GL_glx_h" = xyes; then :
-  have_gl=yes
-else
-  have_gl=no
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  fi
-
-  # If we have the headers, try and figure out which vendor it's from.
-  #
-  if test "$have_gl" = yes ; then
-
-    # We need to know whether it's MesaGL so that we know which libraries
-    # to link against.
-    #
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether GL is really MesaGL" >&5
-$as_echo_n "checking whether GL is really MesaGL... " >&6; }
-if ${ac_cv_have_mesa_gl+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_have_mesa_gl=no
-       if test "$ac_macosx" = no; then
-         # WTF! MacOS 10.5.0 ships the Mesa GL headers!
-         # It's not really Mesa, is it?
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-#include <GL/glx.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "Mesa|MESA" >/dev/null 2>&1; then :
-  ac_cv_have_mesa_gl=yes
-fi
-rm -rf conftest*
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-       fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_have_mesa_gl" >&5
-$as_echo "$ac_cv_have_mesa_gl" >&6; }
-    ac_have_mesa_gl=$ac_cv_have_mesa_gl
-
-    gl_lib_1=""
-    GL_LIBS=""
-
-    if test "$ac_macosx" = yes; then
-
-      # Without these, every link against libGL gets a bunch of useless
-      # warnings.
-      #
-      osx_crud="-bind_at_load -multiply_defined suppress"
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5
-$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; }
-      GL_LIBS="$GL_LIBS $osx_crud"
-      unset osx_crud
-
-      # New lossage in 10.5.0: without this, we get:
-      #   ld: cycle in dylib re-exports with /usr/X11/lib/libGL.dylib
-      #
-      osx_crud="/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib"
-      osx_crud="-Wl,-dylib_file,${osx_crud}:${osx_crud}"
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: adding \"$osx_crud\" to GL_LIBS" >&5
-$as_echo "adding \"$osx_crud\" to GL_LIBS" >&6; }
-      GL_LIBS="$GL_LIBS $osx_crud"
-      unset osx_crud
-
-      # New lossage in 10.6.8: we can't allow -L/opt/local/lib to be in the
-      # link line, or at runtime XQueryExtension gets a segv due to some kind
-      # of library version skew.  Libs must come from /usr/X11/lib even if
-      # $prefix and/or $exec_prefix are set to /opt/local/.
-      #
-      { $as_echo "$as_me:${as_lineno-$LINENO}: result: omitting \"$libdir\" from LDFLAGS" >&5
-$as_echo "omitting \"$libdir\" from LDFLAGS" >&6; }
-      libdir=''
-
-    fi
-
-
-    # Some versions of MesaGL are compiled to require -lpthread.
-    # So if the Mesa headers exist, and -lpthread exists, then always
-    # link -lpthread after the Mesa libs (be they named -lGL or -lMesaGL.)
-    #
-    # Oftentimes, AX_PTHREAD will bring in -lpthread as well; but that ends
-    # up before -l(Mesa)GL, instead of after where it would belong.
-    #
-    if test "$ac_have_mesa_gl" = yes; then
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
-  $as_echo_n "(cached) " >&6
+if test "x$ac_cv_header_GL_gle_h" = xyes; then :
+  have_gle3=yes
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  have_gle3=no
+fi
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_create ();
-int
-main ()
-{
-return pthread_create ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_pthread_pthread_create=yes
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test "$have_gle3" = yes ; then
+    have_gle=yes;
+  else
+
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "GL/gutil.h" "ac_cv_header_GL_gutil_h" "#include <GL/gl.h>
+"
+if test "x$ac_cv_header_GL_gutil_h" = xyes; then :
+  have_gle=yes
 else
-  ac_cv_lib_pthread_pthread_create=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
-  GL_LIBS="-lpthread"
+  have_gle=no
 fi
 
-    fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+    if test "$have_gle" = yes ; then
 
-    # If we have Mesa headers, check to see if we can link against -lMesaGL.
-    # If we don't have Mesa headers, or we don't have -lMesaGL, try -lGL.
-    # Else, warn that GL is busted.  (We have the headers, but no libs.)
-    #
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "GL/tube.h" "ac_cv_header_GL_tube_h" "#include <GL/gl.h>
+"
+if test "x$ac_cv_header_GL_tube_h" = xyes; then :
+  have_gle=yes
+else
+  have_gle=no
+fi
 
-    if test "$ac_have_mesa_gl" = yes ; then
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+    fi
+  fi
+
+  if test "$have_gle" = yes ; then
+    have_gle=no
+    gle_halfassed=yes
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lMesaGL" >&5
-$as_echo_n "checking for glXCreateContext in -lMesaGL... " >&6; }
-if ${ac_cv_lib_MesaGL_glXCreateContext+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gleCreateGC in -lgle" >&5
+$as_echo_n "checking for gleCreateGC in -lgle... " >&6; }
+if ${ac_cv_lib_gle_gleCreateGC+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS"
+LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12701,38 +13627,52 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char glXCreateContext ();
+char gleCreateGC ();
 int
 main ()
 {
-return glXCreateContext ();
+return gleCreateGC ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_MesaGL_glXCreateContext=yes
+  ac_cv_lib_gle_gleCreateGC=yes
 else
-  ac_cv_lib_MesaGL_glXCreateContext=no
+  ac_cv_lib_gle_gleCreateGC=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_MesaGL_glXCreateContext" >&5
-$as_echo "$ac_cv_lib_MesaGL_glXCreateContext" >&6; }
-if test "x$ac_cv_lib_MesaGL_glXCreateContext" = xyes; then :
-  gl_lib_1="MesaGL"
-                      GL_LIBS="-lMesaGL -lMesaGLU $VIDMODE_LIBS $GL_LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_gleCreateGC" >&5
+$as_echo "$ac_cv_lib_gle_gleCreateGC" >&6; }
+if test "x$ac_cv_lib_gle_gleCreateGC" = xyes; then :
+  have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
+  fi
+  if test "$have_gle" = yes ; then
+    have_gle=no
+    gle_halfassed=yes
 
-    if test "$gl_lib_1" = "" ; then
+    # sometimes the libmatrix stuff is included in libgle.  look there first.
+#
+# I don't get it.  For some reason, this test passes on SGI, as if
+# uview_direction_d() was in libgle -- but it's not, it's in libmatrix.
+# Yet the link is succeeding.  Why???
+#
+#    AC_CHECK_X_LIB(gle, uview_direction_d,
+#                   [have_gle=yes; gle_halfassed=no],
+#                   [], $GL_LIBS -lX11 -lXext -lm)
+
+    # As of GLE 3 this is in libgle, and has changed name to uview_direction!
+    # *sigh*
+    if test "$have_gle3" = yes ; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for glXCreateContext in -lGL" >&5
-$as_echo_n "checking for glXCreateContext in -lGL... " >&6; }
-if ${ac_cv_lib_GL_glXCreateContext+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction in -lgle" >&5
+$as_echo_n "checking for uview_direction in -lgle... " >&6; }
+if ${ac_cv_lib_gle_uview_direction+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext $VIDMODE_LIBS -lm $LIBS"
+LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12768,148 +13708,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char glXCreateContext ();
+char uview_direction ();
 int
 main ()
 {
-return glXCreateContext ();
+return uview_direction ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_GL_glXCreateContext=yes
+  ac_cv_lib_gle_uview_direction=yes
 else
-  ac_cv_lib_GL_glXCreateContext=no
+  ac_cv_lib_gle_uview_direction=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_GL_glXCreateContext" >&5
-$as_echo "$ac_cv_lib_GL_glXCreateContext" >&6; }
-if test "x$ac_cv_lib_GL_glXCreateContext" = xyes; then :
-  gl_lib_1="GL"
-                      GL_LIBS="-lGL -lGLU $VIDMODE_LIBS $GL_LIBS"
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-#  LIBS="$ac_save_LIBS"
-
-    fi
-
-    if test "$gl_lib_1" = "" ; then
-      # we have headers, but no libs -- bail.
-      have_gl=no
-      ac_have_mesa_gl=no
-      gl_halfassed=yes
-    else
-      # linking works -- we can build the GL hacks.
-      $as_echo "#define HAVE_GL 1" >>confdefs.h
-
-      if test "$ac_have_mesa_gl" = yes ; then
-        $as_echo "#define HAVE_MESA_GL 1" >>confdefs.h
-
-      fi
-    fi
-  fi
-
-
-  # Now that we know we have GL headers and libs, do some more GL testing.
-  #
-
-  if test "$have_gl" = yes ; then
-    # If it's MesaGL, we'd like to issue a warning if the version number
-    # is less than or equal to 2.6, because that version had a security bug.
-    #
-    if test "$ac_have_mesa_gl" = yes; then
-
-      { $as_echo "$as_me:${as_lineno-$LINENO}: checking MesaGL version number" >&5
-$as_echo_n "checking MesaGL version number... " >&6; }
-if ${ac_cv_mesagl_version_string+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 12838 "configure"
-#include "confdefs.h"
-#include <GL/gl.h>
-#ifndef MESA_MAJOR_VERSION
-# include <GL/xmesa.h>
-# ifdef XMESA_MAJOR_VERSION
-   /* Around Mesa 3.2, they took out the Mesa version number, so instead,
-      we have to check the XMesa version number (the number of the X protocol
-      support, which seems to be the same as the Mesa version number.)
-    */
-#  define MESA_MAJOR_VERSION XMESA_MAJOR_VERSION
-#  define MESA_MINOR_VERSION XMESA_MINOR_VERSION
-# else
-   /* Oh great.  Some time after 3.4, they took out the xmesa.h header file,
-      so we have no way of telling what version of Mesa this is at all.
-      So, we'll guess that the osmesa version (the "offscreen protocol")
-      is less than or equal to the real mesa version number.  Except that
-      if OSmesa is 3.3, assume at least Mesa 3.4, since OSmesa was 3.3 in
-      Mesa 3.4.  And Mesa 3.3 had xmesa.h.  What a complete load of shit!
-    */
-# include <GL/osmesa.h>
-#  define MESA_MAJOR_VERSION OSMESA_MAJOR_VERSION
-#  define MESA_MINOR_VERSION OSMESA_MINOR_VERSION or newer, probably?
-#  if OSMESA_MAJOR_VERSION == 3 && OSMESA_MINOR_VERSION == 3
-#   undef MESA_MINOR_VERSION
-#   define MESA_MINOR_VERSION 4 or newer, probably?
-#  endif
-# endif
-#endif
-configure: MESA_MAJOR_VERSION MESA_MINOR_VERSION
-EOF
-
-         ac_save_CPPFLAGS="$CPPFLAGS"
-         if test \! -z "$includedir" ; then
-           CPPFLAGS="$CPPFLAGS -I$includedir"
-         fi
-         CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-
-         mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | grep configure:`
-
-         # M4 sucks!!
-
-          mglv=`echo "$mglv" | sed -n \
-             's/^configure: *\([0-9][0-9]*\)  *\([0-9].*\)$/\1.\2/p'`
-
-
-         rm -rf conftest.$ac_ext
-
-         CPPFLAGS="$ac_save_CPPFLAGS"
-
-         if test "$mglv" = ""; then
-           ac_mesagl_version=unknown
-           ac_mesagl_version_string=unknown
-         else
-           ac_mesagl_version_string="$mglv"
-           # M4 sucks!!
-
-           maj=`echo "$mglv" | sed -n 's/^\([0-9][0-9]*\)\..*$/\1/p'`
-           min=`echo "$mglv" | sed -n 's/^.*\.\([0-9][0-9]*\).*$/\1/p'`
-
-           ac_mesagl_version=`echo "$maj * 1000 + $min" | bc`
-           if test -z "$ac_mesagl_version"; then
-             ac_mesagl_version=unknown
-             ac_mesagl_version_string=unknown
-           fi
-         fi
-         ac_cv_mesagl_version=$ac_mesagl_version
-         ac_cv_mesagl_version_string=$ac_mesagl_version_string
-
+    conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_uview_direction" >&5
+$as_echo "$ac_cv_lib_gle_uview_direction" >&6; }
+if test "x$ac_cv_lib_gle_uview_direction" = xyes; then :
+  have_gle=yes; gle_halfassed=no
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_mesagl_version_string" >&5
-$as_echo "$ac_cv_mesagl_version_string" >&6; }
-      ac_mesagl_version=$ac_cv_mesagl_version
-      ac_mesagl_version_string=$ac_cv_mesagl_version_string
-    fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
 
-    # Check for OpenGL 1.1 features.
-    #
+    fi
+    # if it wasn't in libgle, then look in libmatrix.
+    if test "$have_gle" = no ; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -12929,14 +13758,13 @@ $as_echo "$ac_cv_mesagl_version_string" >&6; }
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  as_ac_Lib=`$as_echo "ac_cv_lib_$gl_lib_1''_glBindTexture" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for glBindTexture in -l$gl_lib_1" >&5
-$as_echo_n "checking for glBindTexture in -l$gl_lib_1... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction_d in -lmatrix" >&5
+$as_echo_n "checking for uview_direction_d in -lmatrix... " >&6; }
+if ${ac_cv_lib_matrix_uview_direction_d+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS"
+LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -12946,73 +13774,79 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char glBindTexture ();
+char uview_direction_d ();
 int
 main ()
 {
-return glBindTexture ();
+return uview_direction_d ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
+  ac_cv_lib_matrix_uview_direction_d=yes
 else
-  eval "$as_ac_Lib=no"
+  ac_cv_lib_matrix_uview_direction_d=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-eval ac_res=\$$as_ac_Lib
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  $as_echo "#define HAVE_GLBINDTEXTURE 1" >>confdefs.h
-
-else
-  true
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_matrix_uview_direction_d" >&5
+$as_echo "$ac_cv_lib_matrix_uview_direction_d" >&6; }
+if test "x$ac_cv_lib_matrix_uview_direction_d" = xyes; then :
+  have_gle=yes; gle_halfassed=no;
+                      GLE_LIBS="$GLE_LIBS -lmatrix"
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
+    fi
   fi
 
-elif test "$with_gl" != no; then
-  echo "error: must be yes or no: --with-gl=$with_gl"
+  if test "$have_gle" = yes ; then
+    $as_echo "#define HAVE_GLE 1" >>confdefs.h
+
+    if test "$have_gle3" = yes ; then
+      $as_echo "#define HAVE_GLE3 1" >>confdefs.h
+
+    fi
+  fi
+
+elif test "$with_gle" != no; then
+  echo "error: must be yes or no: --with-gle=$with_gle"
   exit 1
+
 fi
 
 
 ###############################################################################
 #
-#       Check for -lgle.
+#       Handle --with-gles
 #
 ###############################################################################
 
-have_gle=no
-with_gle_req=unspecified
-gle_halfassed=no
+with_gles_req=unspecified
 
-# Check whether --with-gle was given.
-if test "${with_gle+set}" = set; then :
-  withval=$with_gle; with_gle="$withval"; with_gle_req="$withval"
+# Check whether --with-gles was given.
+if test "${with_gles+set}" = set; then :
+  withval=$with_gles; with_gles="$withval"; with_gles_req="$withval"
 else
-  with_gle=yes
+  with_gles=no
 fi
 
 
 
-   case "$with_gle" in
+   case "$with_gles" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE headers" >&5
-$as_echo_n "checking for GLE headers... " >&6; }
-     d=$with_gle/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES headers" >&5
+$as_echo_n "checking for JWZGLES headers... " >&6; }
+     d=$with_gles/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13022,9 +13856,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLE libs" >&5
-$as_echo_n "checking for GLE libs... " >&6; }
-     d=$with_gle/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES libs" >&5
+$as_echo_n "checking for JWZGLES libs... " >&6; }
+     d=$with_gles/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13035,13 +13869,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_gle_req="yes"
-     with_gle=$with_gle_req
+     with_gles_req="yes"
+     with_gles=$with_gles_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-gle must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-gles 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
@@ -13049,12 +13883,145 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-GLE_LIBS=""
+if test "$with_gles" = yes; then
+  have_gles=yes
+  $as_echo "#define HAVE_JWZGLES 1" >>confdefs.h
 
-if test "$have_gl" = no ; then
- true
-elif test "$with_gle" = yes; then
+  JWZGLES_OBJS="jwzgles.o"
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using OpenGL ES compatiblity shim" >&5
+$as_echo "using OpenGL ES compatiblity shim" >&6; }
+elif test "$with_gles" != no; then
+  echo "error: must be yes or no: --with-gles=$with_xpm"
+  exit 1
+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.)
+#
+###############################################################################
+
+have_gdk_pixbuf=no
+with_gdk_pixbuf_req=unspecified
+
+# Check whether --with-pixbuf was given.
+if test "${with_pixbuf+set}" = set; then :
+  withval=$with_pixbuf; with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"
+else
+  with_gdk_pixbuf=yes
+fi
+
+
+# if --with-pixbuf=/directory/ was specified, remember that directory so that
+# we can also look for the `gdk-pixbuf-config' program in that directory.
+case "$with_gdk_pixbuf" in
+  /*)
+    gdk_pixbuf_dir="$with_gdk_pixbuf"
+    ;;
+  *)
+    gdk_pixbuf_dir=""
+    ;;
+esac
+
+
+   case "$with_gdk_pixbuf" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF headers" >&5
+$as_echo_n "checking for GDK_PIXBUF headers... " >&6; }
+     d=$with_gdk_pixbuf/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF libs" >&5
+$as_echo_n "checking for GDK_PIXBUF libs... " >&6; }
+     d=$with_gdk_pixbuf/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     # replace the directory string with "yes".
+     with_gdk_pixbuf_req="yes"
+     with_gdk_pixbuf=$with_gdk_pixbuf_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-pixbuf 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_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then
+  echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf"
+  exit 1
+fi
+
+if test "$with_gdk_pixbuf" = yes; then
+  have_gdk_pixbuf=no
+
+  pkgs=''
+  ok="yes"
+
+  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
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf includes" >&5
+$as_echo_n "checking for gdk-pixbuf includes... " >&6; }
+if ${ac_cv_gdk_pixbuf_config_cflags+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_cflags" >&5
+$as_echo "$ac_cv_gdk_pixbuf_config_cflags" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf libs" >&5
+$as_echo_n "checking for gdk-pixbuf libs... " >&6; }
+if ${ac_cv_gdk_pixbuf_config_libs+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_libs" >&5
+$as_echo "$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
+
+
+  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
 
+    # check for header A...
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -13062,19 +14029,18 @@ elif test "$with_gle" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "GL/gle.h" "ac_cv_header_GL_gle_h" "#include <GL/gl.h>
-"
-if test "x$ac_cv_header_GL_gle_h" = xyes; then :
-  have_gle3=yes
-else
-  have_gle3=no
+  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" "$ac_includes_default"
+if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" = xyes; then :
+  have_gdk_pixbuf=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-  if test "$have_gle3" = yes ; then
-    have_gle=yes;
-  else
+
+    # if that worked, check for header B...
+    if test "$have_gdk_pixbuf" = yes; then
+      have_gdk_pixbuf=no
+      gdk_pixbuf_halfassed=yes
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "GL/gutil.h" "ac_cv_header_GL_gutil_h" "#include <GL/gl.h>
-"
-if test "x$ac_cv_header_GL_gutil_h" = xyes; then :
-  have_gle=yes
-else
-  have_gle=no
+  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" = xyes; then :
+  have_gdk_pixbuf=yes
+                         gdk_pixbuf_halfassed=no
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-    if test "$have_gle" = yes ; then
+
+      # yay, it has a new name in Gtk 2.x...
+      if test "$have_gdk_pixbuf" = no; then
+        have_gdk_pixbuf=no
+        gdk_pixbuf_halfassed=yes
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "GL/tube.h" "ac_cv_header_GL_tube_h" "#include <GL/gl.h>
-"
-if test "x$ac_cv_header_GL_tube_h" = xyes; then :
-  have_gle=yes
-else
-  have_gle=no
+  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf-xlib/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" = xyes; then :
+  have_gdk_pixbuf=yes
+                           gdk_pixbuf_halfassed=no
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
+      fi
     fi
+    CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
   fi
 
-  if test "$have_gle" = yes ; then
-    have_gle=no
-    gle_halfassed=yes
+  if test "$have_gdk_pixbuf" = yes; then
+    # we have the headers, now check for the libraries
+    have_gdk_pixbuf=no
+    gdk_pixbuf_halfassed=yes
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability..." >&5
+$as_echo "checking for gdk_pixbuf usability..." >&6; }
+
+    # library A...
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gleCreateGC in -lgle" >&5
-$as_echo_n "checking for gleCreateGC in -lgle... " >&6; }
-if ${ac_cv_lib_gle_gleCreateGC+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_new_from_file in -lc" >&5
+$as_echo_n "checking for gdk_pixbuf_new_from_file in -lc... " >&6; }
+if ${ac_cv_lib_c_gdk_pixbuf_new_from_file+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS"
+LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13151,52 +14125,37 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char gleCreateGC ();
+char gdk_pixbuf_new_from_file ();
 int
 main ()
 {
-return gleCreateGC ();
+return gdk_pixbuf_new_from_file ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gle_gleCreateGC=yes
+  ac_cv_lib_c_gdk_pixbuf_new_from_file=yes
 else
-  ac_cv_lib_gle_gleCreateGC=no
+  ac_cv_lib_c_gdk_pixbuf_new_from_file=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_gleCreateGC" >&5
-$as_echo "$ac_cv_lib_gle_gleCreateGC" >&6; }
-if test "x$ac_cv_lib_gle_gleCreateGC" = xyes; then :
-  have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5
+$as_echo "$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6; }
+if test "x$ac_cv_lib_c_gdk_pixbuf_new_from_file" = xyes; then :
+  have_gdk_pixbuf=yes
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-  fi
-  if test "$have_gle" = yes ; then
-    have_gle=no
-    gle_halfassed=yes
-
-    # sometimes the libmatrix stuff is included in libgle.  look there first.
-#
-# I don't get it.  For some reason, this test passes on SGI, as if
-# uview_direction_d() was in libgle -- but it's not, it's in libmatrix.
-# Yet the link is succeeding.  Why???
-#
-#    AC_CHECK_X_LIB(gle, uview_direction_d,
-#                   [have_gle=yes; gle_halfassed=no],
-#                   [], $GL_LIBS -lX11 -lXext -lm)
-
-    # As of GLE 3 this is in libgle, and has changed name to uview_direction!
-    # *sigh*
-    if test "$have_gle3" = yes ; then
+    # library B...
+    if test "$have_gdk_pixbuf" = yes; then
+      have_gdk_pixbuf=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction in -lgle" >&5
-$as_echo_n "checking for uview_direction in -lgle... " >&6; }
-if ${ac_cv_lib_gle_uview_direction+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_xlib_init in -lc" >&5
+$as_echo_n "checking for gdk_pixbuf_xlib_init in -lc... " >&6; }
+if ${ac_cv_lib_c_gdk_pixbuf_xlib_init+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS"
+LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13232,28 +14191,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char uview_direction ();
+char gdk_pixbuf_xlib_init ();
 int
 main ()
 {
-return uview_direction ();
+return gdk_pixbuf_xlib_init ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_gle_uview_direction=yes
+  ac_cv_lib_c_gdk_pixbuf_xlib_init=yes
 else
-  ac_cv_lib_gle_uview_direction=no
+  ac_cv_lib_c_gdk_pixbuf_xlib_init=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gle_uview_direction" >&5
-$as_echo "$ac_cv_lib_gle_uview_direction" >&6; }
-if test "x$ac_cv_lib_gle_uview_direction" = xyes; then :
-  have_gle=yes; gle_halfassed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5
+$as_echo "$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6; }
+if test "x$ac_cv_lib_c_gdk_pixbuf_xlib_init" = xyes; then :
+  have_gdk_pixbuf=yes
+                      gdk_pixbuf_halfassed=no
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 #  LIBS="$ac_save_LIBS"
 
     fi
-    # if it wasn't in libgle, then look in libmatrix.
-    if test "$have_gle" = no ; then
+  fi
+
+  if test "$have_gdk_pixbuf" = yes; then
+    INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
+    XPM_LIBS="$ac_gdk_pixbuf_config_libs"
+    $as_echo "#define HAVE_GDK_PIXBUF 1" >>confdefs.h
+
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability... no" >&5
+$as_echo "checking for gdk_pixbuf usability... no" >&6; }
+  fi
+
+  if test "$have_gdk_pixbuf" = yes; then
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uview_direction_d in -lmatrix" >&5
-$as_echo_n "checking for uview_direction_d in -lmatrix... " >&6; }
-if ${ac_cv_lib_matrix_uview_direction_d+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_apply_embedded_orientation in -lc" >&5
+$as_echo_n "checking for gdk_pixbuf_apply_embedded_orientation in -lc... " >&6; }
+if ${ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS"
+LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13298,79 +14269,65 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char uview_direction_d ();
+char gdk_pixbuf_apply_embedded_orientation ();
 int
 main ()
 {
-return uview_direction_d ();
+return gdk_pixbuf_apply_embedded_orientation ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_matrix_uview_direction_d=yes
+  ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=yes
 else
-  ac_cv_lib_matrix_uview_direction_d=no
+  ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_matrix_uview_direction_d" >&5
-$as_echo "$ac_cv_lib_matrix_uview_direction_d" >&6; }
-if test "x$ac_cv_lib_matrix_uview_direction_d" = xyes; then :
-  have_gle=yes; gle_halfassed=no;
-                      GLE_LIBS="$GLE_LIBS -lmatrix"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&5
+$as_echo "$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&6; }
+if test "x$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" = xyes; then :
+  $as_echo "#define HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION 1" >>confdefs.h
+
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
-  fi
-
-  if test "$have_gle" = yes ; then
-    $as_echo "#define HAVE_GLE 1" >>confdefs.h
-
-    if test "$have_gle3" = yes ; then
-      $as_echo "#define HAVE_GLE3 1" >>confdefs.h
-
-    fi
   fi
-
-elif test "$with_gle" != no; then
-  echo "error: must be yes or no: --with-gle=$with_gle"
-  exit 1
-
 fi
 
 
 ###############################################################################
 #
-#       Handle --with-gles
+#       Check for -lXpm.
 #
 ###############################################################################
 
-with_gles_req=unspecified
+have_xpm=no
+with_xpm_req=unspecified
 
-# Check whether --with-gles was given.
-if test "${with_gles+set}" = set; then :
-  withval=$with_gles; with_gles="$withval"; with_gles_req="$withval"
+# Check whether --with-xpm was given.
+if test "${with_xpm+set}" = set; then :
+  withval=$with_xpm; with_xpm="$withval"; with_xpm_req="$withval"
 else
-  with_gles=no
+  with_xpm=yes
 fi
 
 
 
-   case "$with_gles" in
+   case "$with_xpm" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES headers" >&5
-$as_echo_n "checking for JWZGLES headers... " >&6; }
-     d=$with_gles/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPM headers" >&5
+$as_echo_n "checking for XPM headers... " >&6; }
+     d=$with_xpm/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13380,9 +14337,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JWZGLES libs" >&5
-$as_echo_n "checking for JWZGLES libs... " >&6; }
-     d=$with_gles/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPM libs" >&5
+$as_echo_n "checking for XPM libs... " >&6; }
+     d=$with_xpm/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13393,13 +14350,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_gles_req="yes"
-     with_gles=$with_gles_req
+     with_xpm_req="yes"
+     with_xpm=$with_xpm_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-gles must be \"yes\", \"no\", or a directory."
+     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
@@ -13407,72 +14364,71 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_gles" = yes; then
-  have_gles=yes
-  $as_echo "#define HAVE_JWZGLES 1" >>confdefs.h
+if test "$with_xpm" = yes; then
 
-  JWZGLES_OBJS="jwzgles.o"
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using OpenGL ES compatiblity shim" >&5
-$as_echo "using OpenGL ES compatiblity shim" >&6; }
-elif test "$with_gles" != no; then
-  echo "error: must be yes or no: --with-gles=$with_xpm"
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
+  ac_fn_c_check_header_compile "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "#include <X11/Xlib.h>
+"
+if test "x$ac_cv_header_X11_xpm_h" = xyes; then :
+  have_xpm=yes
+                    $as_echo "#define HAVE_XPM 1" >>confdefs.h
+
+                    XPM_LIBS="-lXpm $XPM_LIBS"
+fi
+
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+elif test "$with_xpm" != no; then
+  echo "error: must be yes or no: --with-xpm=$with_xpm"
   exit 1
 fi
 
-# May want to phase out glBitmap even in a non-GLES world.
+# See comment near $motif_requires_xpm, above.
+# Need to do this here, after both Motif and XPM have been checked for.
 #
-if test "$have_gles" = yes; then
-  GLFPS_OBJS="fps-gl.o glxfonts.o texfont.o"
-  GLFONT_OBJS=""
-else
-  $as_echo "#define HAVE_GLBITMAP 1" >>confdefs.h
+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
 
-  GLFPS_OBJS="fps-gl.o glxfonts.o"
-  GLFONT_OBJS="texfont.o"
+if test "$XPM_LIBS" = "" ; then
+  XPM_LIBS=$(MINIXPM)
 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.)
+#       Check for -ljpeg
 #
 ###############################################################################
 
-have_gdk_pixbuf=no
-with_gdk_pixbuf_req=unspecified
+have_jpeg=no
+with_jpeg_req=unspecified
+jpeg_halfassed=no
 
-# Check whether --with-pixbuf was given.
-if test "${with_pixbuf+set}" = set; then :
-  withval=$with_pixbuf; with_gdk_pixbuf="$withval"; with_gdk_pixbuf_req="$withval"
+# Check whether --with-jpeg was given.
+if test "${with_jpeg+set}" = set; then :
+  withval=$with_jpeg; with_jpeg="$withval"; with_jpeg_req="$withval"
 else
-  with_gdk_pixbuf=yes
+  with_jpeg=yes
 fi
 
 
-# if --with-pixbuf=/directory/ was specified, remember that directory so that
-# we can also look for the `gdk-pixbuf-config' program in that directory.
-case "$with_gdk_pixbuf" in
-  /*)
-    gdk_pixbuf_dir="$with_gdk_pixbuf"
-    ;;
-  *)
-    gdk_pixbuf_dir=""
-    ;;
-esac
-
 
-   case "$with_gdk_pixbuf" in
+   case "$with_jpeg" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF headers" >&5
-$as_echo_n "checking for GDK_PIXBUF headers... " >&6; }
-     d=$with_gdk_pixbuf/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG headers" >&5
+$as_echo_n "checking for JPEG headers... " >&6; }
+     d=$with_jpeg/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13482,9 +14438,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GDK_PIXBUF libs" >&5
-$as_echo_n "checking for GDK_PIXBUF libs... " >&6; }
-     d=$with_gdk_pixbuf/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG libs" >&5
+$as_echo_n "checking for JPEG libs... " >&6; }
+     d=$with_jpeg/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13495,13 +14451,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_gdk_pixbuf_req="yes"
-     with_gdk_pixbuf=$with_gdk_pixbuf_req
+     with_jpeg_req="yes"
+     with_jpeg=$with_jpeg_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-pixbuf must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-jpeg 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
@@ -13509,95 +14465,14 @@ $as_echo "not found ($d: no such directory)" >&6; }
    esac
 
 
-if test "$with_gdk_pixbuf" != yes -a "$with_gdk_pixbuf" != no ; then
-  echo "error: must be yes or no: --with-pixbuf=$with_gdk_pixbuf"
+if test "$with_jpeg" != yes -a "$with_jpeg" != no ; then
+  echo "error: must be yes or no: --with-jpeg=$with_jpeg"
   exit 1
 fi
 
-if test "$with_gdk_pixbuf" = yes; then
-  have_gdk_pixbuf=no
-
-  pkgs=''
-  ok="yes"
-
-  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
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf includes" >&5
-$as_echo_n "checking for gdk-pixbuf includes... " >&6; }
-if ${ac_cv_gdk_pixbuf_config_cflags+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_gdk_pixbuf_config_cflags=`$pkg_config --cflags $pkgs`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_cflags" >&5
-$as_echo "$ac_cv_gdk_pixbuf_config_cflags" >&6; }
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk-pixbuf libs" >&5
-$as_echo_n "checking for gdk-pixbuf libs... " >&6; }
-if ${ac_cv_gdk_pixbuf_config_libs+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_cv_gdk_pixbuf_config_libs=`$pkg_config --libs $pkgs`
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_gdk_pixbuf_config_libs" >&5
-$as_echo "$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
-
-
-  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
-
-    # check for header A...
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" "$ac_includes_default"
-if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_h" = xyes; then :
-  have_gdk_pixbuf=yes
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-
-    # if that worked, check for header B...
-    if test "$have_gdk_pixbuf" = yes; then
-      have_gdk_pixbuf=no
-      gdk_pixbuf_halfassed=yes
-
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_gdk_pixbuf_gdk_pixbuf_xlib_h" = xyes; then :
-  have_gdk_pixbuf=yes
-                         gdk_pixbuf_halfassed=no
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
+if test "$with_jpeg" = yes; then
 
-      # yay, it has a new name in Gtk 2.x...
-      if test "$have_gdk_pixbuf" = no; then
-        have_gdk_pixbuf=no
-        gdk_pixbuf_halfassed=yes
+  have_jpeg=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_mongrel "$LINENO" "gdk-pixbuf-xlib/gdk-pixbuf-xlib.h" "ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" "$ac_includes_default"
-if test "x$ac_cv_header_gdk_pixbuf_xlib_gdk_pixbuf_xlib_h" = xyes; then :
-  have_gdk_pixbuf=yes
-                           gdk_pixbuf_halfassed=no
+  ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+  have_jpeg=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-      fi
-    fi
-    CPPFLAGS="$ac_save_gdk_pixbuf_CPPFLAGS"
-  fi
-
-  if test "$have_gdk_pixbuf" = yes; then
-    # we have the headers, now check for the libraries
-    have_gdk_pixbuf=no
-    gdk_pixbuf_halfassed=yes
-
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability..." >&5
-$as_echo "checking for gdk_pixbuf usability..." >&6; }
 
-    # library A...
+  if test "$have_jpeg" = yes; then
+    # we have the header, now check for the library
+    have_jpeg=no
+    jpeg_halfassed=yes
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -13646,13 +14511,13 @@ $as_echo "checking for gdk_pixbuf usability..." >&6; }
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_new_from_file in -lc" >&5
-$as_echo_n "checking for gdk_pixbuf_new_from_file in -lc... " >&6; }
-if ${ac_cv_lib_c_gdk_pixbuf_new_from_file+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg" >&5
+$as_echo_n "checking for jpeg_start_compress in -ljpeg... " >&6; }
+if ${ac_cv_lib_jpeg_jpeg_start_compress+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
+LIBS="-ljpeg  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13662,115 +14527,49 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char gdk_pixbuf_new_from_file ();
+char jpeg_start_compress ();
 int
 main ()
 {
-return gdk_pixbuf_new_from_file ();
+return jpeg_start_compress ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_gdk_pixbuf_new_from_file=yes
+  ac_cv_lib_jpeg_jpeg_start_compress=yes
 else
-  ac_cv_lib_c_gdk_pixbuf_new_from_file=no
+  ac_cv_lib_jpeg_jpeg_start_compress=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_new_from_file" >&5
-$as_echo "$ac_cv_lib_c_gdk_pixbuf_new_from_file" >&6; }
-if test "x$ac_cv_lib_c_gdk_pixbuf_new_from_file" = xyes; 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"
-
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_xlib_init in -lc" >&5
-$as_echo_n "checking for gdk_pixbuf_xlib_init in -lc... " >&6; }
-if ${ac_cv_lib_c_gdk_pixbuf_xlib_init+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5
+$as_echo "$ac_cv_lib_jpeg_jpeg_start_compress" >&6; }
+if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = xyes; then :
+  have_jpeg=yes
+                    jpeg_halfassed=no
+                    JPEG_LIBS="-ljpeg"
+                    $as_echo "#define HAVE_JPEGLIB 1" >>confdefs.h
 
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gdk_pixbuf_xlib_init ();
-int
-main ()
-{
-return gdk_pixbuf_xlib_init ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_gdk_pixbuf_xlib_init=yes
-else
-  ac_cv_lib_c_gdk_pixbuf_xlib_init=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_xlib_init" >&5
-$as_echo "$ac_cv_lib_c_gdk_pixbuf_xlib_init" >&6; }
-if test "x$ac_cv_lib_c_gdk_pixbuf_xlib_init" = xyes; then :
-  have_gdk_pixbuf=yes
-                      gdk_pixbuf_halfassed=no
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-    fi
   fi
+fi
 
-  if test "$have_gdk_pixbuf" = yes; then
-    INCLUDES="$INCLUDES $ac_gdk_pixbuf_config_cflags"
-    XPM_LIBS="$ac_gdk_pixbuf_config_libs"
-    $as_echo "#define HAVE_GDK_PIXBUF 1" >>confdefs.h
 
-  else
-    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for gdk_pixbuf usability... no" >&5
-$as_echo "checking for gdk_pixbuf usability... no" >&6; }
-  fi
+###############################################################################
+#
+#       Check for -lXft
+#
+###############################################################################
 
-  if test "$have_gdk_pixbuf" = yes; then
+have_xutf8drawstring=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
@@ -13790,13 +14589,13 @@ $as_echo "checking for gdk_pixbuf usability... no" >&6; }
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gdk_pixbuf_apply_embedded_orientation in -lc" >&5
-$as_echo_n "checking for gdk_pixbuf_apply_embedded_orientation in -lc... " >&6; }
-if ${ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xutf8DrawString in -lX11" >&5
+$as_echo_n "checking for Xutf8DrawString in -lX11... " >&6; }
+if ${ac_cv_lib_X11_Xutf8DrawString+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc $ac_gdk_pixbuf_config_libs -lX11 -lXext -lm $LIBS"
+LIBS="-lX11 -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -13806,65 +14605,63 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char gdk_pixbuf_apply_embedded_orientation ();
+char Xutf8DrawString ();
 int
 main ()
 {
-return gdk_pixbuf_apply_embedded_orientation ();
+return Xutf8DrawString ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=yes
+  ac_cv_lib_X11_Xutf8DrawString=yes
 else
-  ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation=no
+  ac_cv_lib_X11_Xutf8DrawString=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&5
-$as_echo "$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" >&6; }
-if test "x$ac_cv_lib_c_gdk_pixbuf_apply_embedded_orientation" = xyes; then :
-  $as_echo "#define HAVE_GDK_PIXBUF_APPLY_EMBEDDED_ORIENTATION 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_X11_Xutf8DrawString" >&5
+$as_echo "$ac_cv_lib_X11_Xutf8DrawString" >&6; }
+if test "x$ac_cv_lib_X11_Xutf8DrawString" = xyes; then :
+  have_xutf8drawstring=yes
+else
+  true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
 #  LIBS="$ac_save_LIBS"
 
-  fi
-fi
+if test "$have_xutf8drawstring" = yes ; then
+  $as_echo "#define HAVE_XUTF8DRAWSTRING 1" >>confdefs.h
 
+fi
 
-###############################################################################
-#
-#       Check for -lXpm.
-#
-###############################################################################
 
-have_xpm=no
-with_xpm_req=unspecified
+have_xft=no
+with_xft_req=unspecified
+xft_halfassed=no
 
-# Check whether --with-xpm was given.
-if test "${with_xpm+set}" = set; then :
-  withval=$with_xpm; with_xpm="$withval"; with_xpm_req="$withval"
+# Check whether --with-xft was given.
+if test "${with_xft+set}" = set; then :
+  withval=$with_xft; with_xft="$withval"; with_xft_req="$withval"
 else
-  with_xpm=yes
+  with_xft=yes
 fi
 
 
 
-   case "$with_xpm" in
+   case "$with_xft" in
     yes) ;;
     no)  ;;
 
     /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPM headers" >&5
-$as_echo_n "checking for XPM headers... " >&6; }
-     d=$with_xpm/include
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft headers" >&5
+$as_echo_n "checking for Xft headers... " >&6; }
+     d=$with_xft/include
      if test -d $d; then
        X_CFLAGS="-I$d $X_CFLAGS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13874,9 +14671,9 @@ $as_echo "$d" >&6; }
 $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPM libs" >&5
-$as_echo_n "checking for XPM libs... " >&6; }
-     d=$with_xpm/lib
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5
+$as_echo_n "checking for Xft libs... " >&6; }
+     d=$with_xft/lib
      if test -d $d; then
        X_LIBS="-L$d $X_LIBS"
        { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
@@ -13887,13 +14684,13 @@ $as_echo "not found ($d: no such directory)" >&6; }
      fi
 
      # replace the directory string with "yes".
-     with_xpm_req="yes"
-     with_xpm=$with_xpm_req
+     with_xft_req="yes"
+     with_xft=$with_xft_req
      ;;
 
     *)
      echo ""
-     echo "error: argument to --with-xpm must be \"yes\", \"no\", or a directory."
+     echo "error: argument to --with-xft 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
@@ -13901,115 +14698,50 @@ $as_echo "not found ($d: no such directory)" >&6; }
    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"
-  CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_compile "$LINENO" "X11/xpm.h" "ac_cv_header_X11_xpm_h" "#include <X11/Xlib.h>
-"
-if test "x$ac_cv_header_X11_xpm_h" = xyes; then :
-  have_xpm=yes
-                    $as_echo "#define HAVE_XPM 1" >>confdefs.h
-
-                    XPM_LIBS="-lXpm $XPM_LIBS"
-fi
-
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
-elif test "$with_xpm" != no; then
-  echo "error: must be yes or no: --with-xpm=$with_xpm"
+if test "$with_xft" != yes -a "$with_xft" != no ; then
+  echo "error: must be yes or no: --with-xft=$with_xft"
   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
-
-if test "$XPM_LIBS" = "" ; then
-  XPM_LIBS=$(MINIXPM)
-fi
-
-
-###############################################################################
-#
-#       Check for -ljpeg
-#
-###############################################################################
+if test "$with_xft" = yes; then
 
-have_jpeg=no
-with_jpeg_req=unspecified
-jpeg_halfassed=no
+  pkgs=''
+  ok="yes"
+  pkg_check_version xft 2.1.0
+  have_xft="$ok"
 
-# Check whether --with-jpeg was given.
-if test "${with_jpeg+set}" = set; then :
-  withval=$with_jpeg; with_jpeg="$withval"; with_jpeg_req="$withval"
+  if test "$have_xft" = yes; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft includes" >&5
+$as_echo_n "checking for Xft includes... " >&6; }
+if ${ac_cv_xft_config_cflags+:} false; then :
+  $as_echo_n "(cached) " >&6
 else
-  with_jpeg=yes
+  ac_cv_xft_config_cflags=`$pkg_config --cflags $pkgs`
 fi
-
-
-
-   case "$with_jpeg" in
-    yes) ;;
-    no)  ;;
-
-    /*)
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG headers" >&5
-$as_echo_n "checking for JPEG headers... " >&6; }
-     d=$with_jpeg/include
-     if test -d $d; then
-       X_CFLAGS="-I$d $X_CFLAGS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JPEG libs" >&5
-$as_echo_n "checking for JPEG libs... " >&6; }
-     d=$with_jpeg/lib
-     if test -d $d; then
-       X_LIBS="-L$d $X_LIBS"
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
-$as_echo "$d" >&6; }
-     else
-       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
-$as_echo "not found ($d: no such directory)" >&6; }
-     fi
-
-     # replace the directory string with "yes".
-     with_jpeg_req="yes"
-     with_jpeg=$with_jpeg_req
-     ;;
-
-    *)
-     echo ""
-     echo "error: argument to --with-jpeg 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_jpeg" != yes -a "$with_jpeg" != no ; then
-  echo "error: must be yes or no: --with-jpeg=$with_jpeg"
-  exit 1
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_cflags" >&5
+$as_echo "$ac_cv_xft_config_cflags" >&6; }
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Xft libs" >&5
+$as_echo_n "checking for Xft libs... " >&6; }
+if ${ac_cv_xft_config_libs+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  ac_cv_xft_config_libs=`$pkg_config --libs $pkgs`
 fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_xft_config_libs" >&5
+$as_echo "$ac_cv_xft_config_libs" >&6; }
+  fi
 
-if test "$with_jpeg" = yes; then
+  ac_xft_config_cflags=$ac_cv_xft_config_cflags
+  ac_xft_config_libs=$ac_cv_xft_config_libs
 
-  have_jpeg=no
+  if test "$have_xft" = yes; then
+    #
+    # we appear to have Xft; check for headers/libs to be sure.
+    #
+    ac_save_xft_CPPFLAGS="$CPPFLAGS"
+    CPPFLAGS="$CPPFLAGS $ac_xft_config_cflags"
+
+    have_xft=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then
@@ -14017,18 +14749,24 @@ if test "$with_jpeg" = yes; then
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
-  ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
-if test "x$ac_cv_header_jpeglib_h" = xyes; then :
-  have_jpeg=yes
+  ac_fn_c_check_header_mongrel "$LINENO" "X11/Xft/Xft.h" "ac_cv_header_X11_Xft_Xft_h" "$ac_includes_default"
+if test "x$ac_cv_header_X11_Xft_Xft_h" = xyes; then :
+  have_xft=yes
 fi
 
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  if test "$have_jpeg" = yes; then
-    # we have the header, now check for the library
-    have_jpeg=no
-    jpeg_halfassed=yes
+    CPPFLAGS="$ac_save_xft_CPPFLAGS"
+  fi
+
+  if test "$have_xft" = yes; then
+    # we have the headers, now check for the libraries
+    have_xft=no
+    xft_halfassed=yes
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability..." >&5
+$as_echo "checking for Xft usability..." >&6; }
 
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
 
   CPPFLAGS=`eval eval eval eval eval eval eval eval eval echo $CPPFLAGS`
   LDFLAGS=`eval eval eval eval eval eval eval eval eval echo $LDFLAGS`
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for jpeg_start_compress in -ljpeg" >&5
-$as_echo_n "checking for jpeg_start_compress in -ljpeg... " >&6; }
-if ${ac_cv_lib_jpeg_jpeg_start_compress+:} false; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XftDrawStringUtf8 in -lc" >&5
+$as_echo_n "checking for XftDrawStringUtf8 in -lc... " >&6; }
+if ${ac_cv_lib_c_XftDrawStringUtf8+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-ljpeg  $LIBS"
+LIBS="-lc $ac_xft_config_libs -lX11 -lXext -lm $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -14064,32 +14802,28 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char jpeg_start_compress ();
+char XftDrawStringUtf8 ();
 int
 main ()
 {
-return jpeg_start_compress ();
+return XftDrawStringUtf8 ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_jpeg_jpeg_start_compress=yes
+  ac_cv_lib_c_XftDrawStringUtf8=yes
 else
-  ac_cv_lib_jpeg_jpeg_start_compress=no
+  ac_cv_lib_c_XftDrawStringUtf8=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_jpeg_jpeg_start_compress" >&5
-$as_echo "$ac_cv_lib_jpeg_jpeg_start_compress" >&6; }
-if test "x$ac_cv_lib_jpeg_jpeg_start_compress" = xyes; then :
-  have_jpeg=yes
-                    jpeg_halfassed=no
-                    JPEG_LIBS="-ljpeg"
-                    $as_echo "#define HAVE_JPEGLIB 1" >>confdefs.h
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_XftDrawStringUtf8" >&5
+$as_echo "$ac_cv_lib_c_XftDrawStringUtf8" >&6; }
+if test "x$ac_cv_lib_c_XftDrawStringUtf8" = xyes; then :
+  have_xft=yes
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 #  LIBS="$ac_save_LIBS"
 
   fi
+
+  if test "$have_xft" = no; then
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: checking for Xft usability... no" >&5
+$as_echo "checking for Xft usability... no" >&6; }
+  fi
+fi
+
+if test "$have_xft" = yes; then
+  INCLUDES="$INCLUDES $ac_xft_config_cflags"
+  XFT_LIBS="$ac_xft_config_libs"
+  XFT_SRCS=''
+  XFT_OBJS=''
+  $as_echo "#define HAVE_XFT 1" >>confdefs.h
+
+else
+  XFT_LIBS=''
+  XFT_SRCS='$(UTILS_SRC)/xft.c'
+  XFT_OBJS='$(UTILS_BIN)/xft.o'
 fi
 
 
@@ -14918,6 +15670,88 @@ elif test "$setuid_hacks" != no; then
 fi
 
 
+###############################################################################
+#
+#       Check for --with-record-animation
+#
+###############################################################################
+
+record_anim_default=no
+record_anim="$record_anim_default"
+
+# Check whether --with-record-animation was given.
+if test "${with_record_animation+set}" = set; then :
+  withval=$with_record_animation; record_anim="$withval"
+else
+  record_anim="$record_anim_default"
+fi
+
+
+
+   case "$record_anim" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for record animation headers" >&5
+$as_echo_n "checking for record animation headers... " >&6; }
+     d=$record_anim/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     { $as_echo "$as_me:${as_lineno-$LINENO}: checking for record animation libs" >&5
+$as_echo_n "checking for record animation libs... " >&6; }
+     d=$record_anim/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $d" >&5
+$as_echo "$d" >&6; }
+     else
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found ($d: no such directory)" >&5
+$as_echo "not found ($d: no such directory)" >&6; }
+     fi
+
+     # replace the directory string with "yes".
+     record_anim_req="yes"
+     record_anim=$record_anim_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-record-animation 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 "$record_anim" = yes; then
+  true
+elif test "$record_anim" != no; then
+  echo "error: must be yes or no: --with-record-animation=$record_anim"
+  exit 1
+fi
+
+if test "$record_anim" = yes; then
+  if test "$have_gdk_pixbuf" != yes; then
+    as_fn_error $? "--with-record-animation requires GDK-Pixbuf" "$LINENO" 5
+  else
+    { $as_echo "$as_me:${as_lineno-$LINENO}: result: enabling --with-record-animation" >&5
+$as_echo "enabling --with-record-animation" >&6; }
+    $as_echo "#define HAVE_RECORD_ANIM 1" >>confdefs.h
+
+    ANIM_OBJS='$(ANIM_OBJS)'
+    ANIM_LIBS='$(ANIM_LIBS)'
+  fi
+fi
+
 ###############################################################################
 #
 #       Done testing.  Now, set up the various -I and -L variables,
@@ -15153,6 +15987,12 @@ INCLUDES=`echo "$INCLUDES" | sed 's@ -I${prefix}/include@@g;'`
 
 
 
+
+
+
+
+
+
 
 
 
@@ -15168,7 +16008,7 @@ APPDEFAULTS=$ac_x_app_defaults
 
 
 
-ac_config_files="$ac_config_files Makefile utils/Makefile driver/Makefile driver/xscreensaver.pam hacks/Makefile hacks/glx/Makefile po/Makefile.in driver/XScreenSaver.ad"
+ac_config_files="$ac_config_files Makefile utils/Makefile driver/Makefile driver/xscreensaver.pam driver/xscreensaver-demo.glade2 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
@@ -15280,6 +16120,10 @@ LTLIBOBJS=$ac_ltlibobjs
 
 
 
+  ac_config_commands="$ac_config_commands po/stamp-it"
+
+
+
 : "${CONFIG_STATUS=./config.status}"
 ac_write_fail=0
 ac_clean_files_save=$ac_clean_files
     "utils/Makefile") CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;;
     "driver/Makefile") CONFIG_FILES="$CONFIG_FILES driver/Makefile" ;;
     "driver/xscreensaver.pam") CONFIG_FILES="$CONFIG_FILES driver/xscreensaver.pam" ;;
+    "driver/xscreensaver-demo.glade2") CONFIG_FILES="$CONFIG_FILES driver/xscreensaver-demo.glade2" ;;
     "hacks/Makefile") CONFIG_FILES="$CONFIG_FILES hacks/Makefile" ;;
     "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" ;;
+    "po/stamp-it") CONFIG_COMMANDS="$CONFIG_COMMANDS po/stamp-it" ;;
 
   *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
   esac
@@ -16435,11 +17281,28 @@ $as_echo "$as_me: executing $ac_file commands" >&6;}
 
   case $ac_file$ac_mode in
     "default-1":C) case "$CONFIG_FILES" in *po/Makefile.in*)
-        rm -f po/stamp-it po/stamp-it.tmp
-        > po/stamp-it.tmp
         sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile
-        mv po/stamp-it.tmp po/stamp-it
       esac ;;
+    "po/stamp-it":C)
+    if  ! grep "^# INTLTOOL_MAKEFILE$" "po/Makefile.in" > /dev/null ; then
+       as_fn_error $? "po/Makefile.in.in was not created by intltoolize." "$LINENO" 5
+    fi
+    rm -f "po/stamp-it" "po/stamp-it.tmp" "po/POTFILES" "po/Makefile.tmp"
+    >"po/stamp-it.tmp"
+    sed '/^#/d
+        s/^[[].*] *//
+        /^[    ]*$/d
+       '"s|^|  $ac_top_srcdir/|" \
+      "$srcdir/po/POTFILES.in" | sed '$!s/$/ \\/' >"po/POTFILES"
+
+    sed '/^POTFILES =/,/[^\\]$/ {
+               /^POTFILES =/!d
+               r po/POTFILES
+         }
+        ' "po/Makefile.in" >"po/Makefile"
+    rm -f "po/Makefile.tmp"
+    mv "po/stamp-it.tmp" "po/stamp-it"
+   ;;
 
   esac
 done # for ac_tag
@@ -16769,6 +17632,28 @@ if test "$have_jpeg" = no ; then
 fi
 
 
+if test "$have_xft" = no ; then
+  if test "$with_xft_req" = yes ; then
+    warnL "Use of libXft was requested, but it was not found."
+  elif test "$with_xft_req" = no ; then
+    noteL 'The Xft library is not being used.'
+  else
+    noteL "The Xft library was not found."
+  fi
+
+  if test "$xft_halfassed" = yes ; then
+    echo ''
+    warn2 'More specifically, we found the headers, but not the'
+    warn2 'libraries; so either Xft is half-installed on this'
+    warn2 "system, or something else went wrong.  The \`config.log'"
+    warn2 'file might contain some clues.'
+    echo ''
+  fi
+
+  warn2 "This means that fonts won't be anti-aliased."
+fi
+
+
 if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then
   preferred_mesagl=3.4
   mgv="$ac_mesagl_version_string"
@@ -16811,10 +17696,7 @@ if test "$have_gl" = no ; then
   echo ''
   warn2 'Those demos which use 3D will not be built or installed.'
   warn2 'You might want to consider installing OpenGL and'
-  warn2 "re-running configure.  If your vendor doesn't ship"
-  warn2 'their own implementation of OpenGL, you can get a free'
-  warn2 'version at <http://www.mesa3d.org/>.  For general OpenGL'
-  warn2 'info, see <http://www.opengl.org/>.'
+  warn2 're-running configure.'
 
 fi
 
@@ -16834,7 +17716,7 @@ if test "$have_gl" = yes -a "$have_gle" = no ; then
     warn2 'library is not.'
   else
     noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)'
-    warn2 'was not.'
+    warn2 'library was not.'
   fi
 
   if test "$gle_halfassed" = yes ; then
@@ -16849,8 +17731,7 @@ if test "$have_gl" = yes -a "$have_gle" = no ; then
   warn2 'Some of the OpenGL (3D) demos (those that depend on GLE)'
   warn2 'will not be built or installed.  You might want to consider'
   warn2 'installing GLE and re-running configure.  You can find the'
-  warn2 'GLE library at <http://www.linas.org/gle/>.  For general'
-  warn2 'OpenGL info, see <http://www.opengl.org/>.'
+  warn2 'GLE library at <http://www.linas.org/gle/>'
 
  fi
 fi
@@ -16985,7 +17866,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 (190+ different executables) will"
+  echo "      The various graphics demos (200+ different executables) will"
   echo "      be installed in ${HACKDIR}/."
   echo ""
   echo "      If you would prefer the demos to be installed elsewhere,"