http://ftp.x.org/contrib/applications/xscreensaver-3.23.tar.gz
[xscreensaver] / configure
index c983155e048aee8e2fb74053475f607088465f3d..c6ce9ec195fb12dae9f699ca515c62fb042b0bec 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.12 
+# Generated automatically using autoconf version 2.13 
 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
 ac_help=
 ac_default_prefix=/usr/local
 # Any additions from configure.in:
+ac_help="$ac_help"
 ac_help="$ac_help
-
 Installation options:
 
   --enable-subdir=DIR     Put the demo programs in a subdirectory of \`bindir',
                           instead of putting them in bindir itself.  You can
                           specify the name of the subdirectory.  For example,
-                          --exec-prefix=/usr/local/bin --enable-subdir=demos
+                          \`--exec-prefix=/usr/local --enable-subdir=demos'
                           would put xscreensaver in /usr/local/bin/, and would
-                          put the demos in /usr/local/bin/demos/.  Note that if
-                          you do this, you must make sure that the directory
-                          is on your \$PATH before xscreensaver is started: the
-                          directory name is not hardcoded into the program.
-                          This merely sets the default installation location.
+                          put the demos in /usr/local/bin/demos/.  (If DIR
+                          begins with /, then bindir will not be prepended.)
 
   --disable-subdir        Just put the demos in \`bindir' (this is the default.)
 "
 ac_help="$ac_help
-  --with-x                use the X Window System"
-ac_help="$ac_help
+Except where noted, all of the --with options below can also take a
+directory argument: for example, \`--with-motif=/opt/Motif'.  That would
+cause /opt/Motif/include/ to be added to the -I list, and /opt/Motif/lib/
+to be added to the -L list, assuming those directories exist.  
 
-Server options:
+By default, support for each of these options will be built in, if the
+relevant library routines exist.  At run time, they will then be used
+only if the X server being used supports them.  Each --with option has
+a corresponding --without option, to override building support for them
+at all.
 
-  --with-sgi-ext          Include support for the SGI SCREEN_SAVER
-                          server extension, if possible (this is the default).
-  --without-sgi-ext       Do not compile in support for this extension."
+Screen blanking and idle-detection options:
+
+  --with-sgi-ext          Include support for the SGI SCREEN_SAVER extension."
+ac_help="$ac_help
+  --with-mit-ext          Include support for the MIT-SCREEN-SAVER extension."
+ac_help="$ac_help
+  --with-xidle-ext        Include support for the XIDLE extension."
+ac_help="$ac_help
+  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL extension."
+ac_help="$ac_help
+  --with-dpms-ext         Include support for the DPMS extension."
+ac_help="$ac_help
+  --with-xf86vmode-ext    Include support for XFree86 virtual screens."
 ac_help="$ac_help
-  --with-mit-ext          Include support for the MIT-SCREEN-SAVER
-                          server extension, if possible (this is the default).
-  --without-mit-ext       Do not compile in support for this extension."
+  --with-proc-interrupts  Include support for consulting the /proc/interrupts
+                          file to notice keyboard activity."
 ac_help="$ac_help
-  --with-xidle-ext        Include support for the XIDLE server extension,
-                          if possible (this is the default).
-  --without-xidle-ext     Do not compile in support for this extension."
+
+Screen locking options:
+
+  --enable-locking        Compile in support for locking the display.
+  --disable-locking       Do not allow locking at all.
+"
 ac_help="$ac_help
-  --with-xshm-ext         Include support for the XSHM (Shared Memory) server
-                          extension, if possible (this is the default).
-  --without-xshm-ext      Do not compile in support for this extension."
+  --with-pam              Include support for PAM (Pluggable Auth Modules.)"
 ac_help="$ac_help
-  --with-sgivc-ext        Include support for the SGI-VIDEO-CONTROL server
-                          extension, if possible (this is the default).
-  --without-sgivc-ext     Do not compile in support for this extension."
+  --with-kerberos         Include support for Kerberos authentication."
 ac_help="$ac_help
-  --with-dpms-ext         Include support for the DPMS server extension,
-                          if possible (this is the default).
-  --without-dpms-ext      Do not compile in support for this extension."
+  --with-shadow           Include support for shadow password authentication."
 ac_help="$ac_help
 
-Toolkit options:
+User interface options:
 
-  --with-motif            Use the Motif toolkit for the user interface,
-                          if possible (this is the default).
-  --without-motif         Do not use Motif."
+  --with-motif            Use the Motif toolkit for the user interface."
 ac_help="$ac_help
-  --with-athena           Use the Athena toolkit for the user interface, if
-                          possible (this is the default if Motif isn't used.)
-  --without-athena        Do not use Athena."
+  --with-gtk              Use the Gtk toolkit for the user interface."
 ac_help="$ac_help
 
-Demo options:
+Graphics options:
 
-  --with-xpm              Include support for XPM files in some demos,
-                          if possible (this is the default).
-  --without-xpm           Do not compile in support for XPM files."
+  --with-gl               Build those demos which depend on OpenGL."
+ac_help="$ac_help
+  --with-gle              Build those demos which depend on GLE
+                          (the OpenGL "extrusion" library.)"
 ac_help="$ac_help
-  --with-gl               Build those demos which depend on OpenGL,
-                          if possible (this is the default).
-  --without-gl            Do not build the OpenGL demos."
+  --with-xpm              Include support for XPM files in some demos."
 ac_help="$ac_help
-  --with-readdisplay      Include support for the XReadDisplay server
-                          extension if possible (this is the default).
-  --without-readdisplay   Do not compile in support for this extension."
+  --with-xshm-ext         Include support for the XSHM extension."
 ac_help="$ac_help
-  --with-sgivideo         Include support for SGI's Iris Video Library
-                          if possible (this is the default).
-  --without-sgivideo       Do not compile in support for this library."
+  --with-xdbe-ext         Include support for the DOUBLE-BUFFER extension."
 ac_help="$ac_help
+  --with-readdisplay      Include support for the XReadDisplay extension."
+ac_help="$ac_help
+  --with-sgivideo         Include support for SGI's Iris Video Library."
+ac_help="$ac_help
+
   --with-zippy=PROGRAM    Some demos are able to run an external program and
                           display its text; this names the program to use by
                           default (though it can be overridden with X
                           resources.)  If you don't specify this, the default
                           is to use \"yow\" from the Emacs distribution (if you
-                          have it) or else to use \"fortune\"."
-ac_help="$ac_help
-
-Locking options:
-
-  --enable-locking        Compile in support for locking the display
-                          (this is the default.)
-  --disable-locking       Do not allow locking at all."
-ac_help="$ac_help
-
-  --with-kerberos         Include support for Kerberos authentication,
-                          if possible (this is the default.)
-  --without-kerberos      Do not compile in support for Kerberos."
-ac_help="$ac_help
-  --with-shadow           Include support for shadow password authentication,
-                          if possible (this is the default, if no Kerberos.)
-  --without-shadow        Do not compile in support for shadow passwords.
+                          have it) or else to use \"fortune\".
 "
 
 # Initialize some variables set by options.
@@ -149,6 +138,7 @@ mandir='${prefix}/man'
 # Initialize some other variables.
 subdirs=
 MFLAGS= MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
 # Maximum number of lines to put in a shell here document.
 ac_max_here_lines=12
 
@@ -236,30 +226,26 @@ do
     cat << EOF
 Usage: configure [options] [host]
 Options: [defaults in brackets after descriptions]
+
 Configuration:
+
   --cache-file=FILE       cache test results in FILE
   --help                  print this message
   --no-create             do not create output files
   --quiet, --silent       do not print \`checking...' messages
   --version               print the version of autoconf that created configure
+
 Directory and file names:
+
   --prefix=PREFIX         install architecture-independent files in PREFIX
                           [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                           [same as prefix]
   --bindir=DIR            user executables in DIR [EPREFIX/bin]
-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data in DIR
-                          [PREFIX/share]
-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-                          [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
   --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
   --includedir=DIR        C header files in DIR [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --x-includes=DIR        X include files are in DIR
+  --x-libraries=DIR       X library files are in DIR
   --mandir=DIR            man documentation in DIR [PREFIX/man]
   --srcdir=DIR            find the sources in DIR [configure dir or ..]
   --program-prefix=PREFIX prepend PREFIX to installed program names
@@ -268,20 +254,15 @@ Directory and file names:
                           run sed PROGRAM on installed program names
 EOF
     cat << EOF
+
 Host type:
+
   --build=BUILD           configure for building on BUILD [BUILD=HOST]
   --host=HOST             configure for HOST [guessed]
   --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
 EOF
     if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
+      echo "$ac_help"
     fi
     exit 0 ;;
 
@@ -432,7 +413,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.12"
+    echo "configure generated by autoconf version 2.13"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -602,9 +583,11 @@ ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
+ac_exeext=
+ac_objext=o
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
   if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
@@ -619,6 +602,165 @@ fi
 
 
 
+
+echo "current directory: `pwd`"
+echo "command line was: $0 $@"
+
+
+# After checking to see that --srcdir is correct (which AC_INIT does)
+# check for some random other files that come later in the tar file,
+# to make sure everything is here.
+#
+for d in driver utils hacks hacks/glx ; do
+  f=$srcdir/$d/Makefile.in
+  if test \! -r $f ; then
+    echo ""
+    echo "ERROR: The package is incomplete: $f does not exist."
+    echo "       This probably means that your download was truncated."
+    echo ""
+    exit 1
+  fi
+done
+
+
+###############################################################################
+#
+#       Function to figure out how to run the compiler.
+#
+###############################################################################
+
+
+
+
+###############################################################################
+#
+#       Function to figure out how to create directory trees.
+#
+###############################################################################
+
+
+
+
+###############################################################################
+#
+#       Function to check whether gettimeofday() exists, and how to call it.
+#      This may define HAVE_GETTIMEOFDAY and GETTIMEOFDAY_TWO_ARGS.
+#
+###############################################################################
+
+
+
+
+###############################################################################
+#
+#       Function to find perl5 (defines PERL and PERL_VERSION.)
+#
+###############################################################################
+
+# M4 sucks!!  perl sucks too!!
+
+perl_version_cmd='print $]'
+
+
+
+
+
+###############################################################################
+#
+#       Functions to check how to do ICMP PING requests.
+#
+###############################################################################
+
+
+
+
+
+
+###############################################################################
+#
+#       Functions to check for various X11 crap.
+#
+###############################################################################
+
+# Try and find the app-defaults directory.
+# It sucks that autoconf doesn't do this already...
+#
+
+
+
+
+
+
+
+
+
+
+# Random special-cases for X on certain pathological OSes.
+# You know who you are.
+#
+
+
+
+
+###############################################################################
+#
+#       Some utility functions to make checking for X things easier.
+#
+###############################################################################
+
+# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
+#
+
+
+# Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
+#
+
+
+# Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
+#
+
+
+
+# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
+# Use this sparingly; it probably doesn't work very well on X programs.
+#
+
+
+# Like AC_TRY_RUN, but it uses the already-computed -I directories.
+# (But not the -L directories!)
+#
+
+
+
+
+# Usage: HANDLE_X_PATH_ARG([variable_name],
+#                          [--command-line-option],
+#                          [descriptive string])
+#
+# All of the --with options take three forms:
+#
+#   --with-foo (or --with-foo=yes)
+#   --without-foo (or --with-foo=no)
+#   --with-foo=/DIR
+#
+# This function, HANDLE_X_PATH_ARG, deals with the /DIR case.  When it sees
+# a directory (string beginning with a slash) it checks to see whether
+# /DIR/include and /DIR/lib exist, and adds them to $X_CFLAGS and $X_LIBS
+# as appropriate.
+#
+
+
+
+
+###############################################################################
+###############################################################################
+#
+#       End of function definitions.  Now start actually executing stuff.
+#
+###############################################################################
+###############################################################################
+
+# random compiler setup
 ac_aux_dir=
 for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
   if test -f $ac_dir/install-sh; then
@@ -640,44 +782,44 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
 
 
 # Make sure we can run config.sub.
-if $ac_config_sub sun4 >/dev/null 2>&1; then :
+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
 else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:649: checking host system type" >&5
+echo "configure:802: checking host system type" >&5
 
 host_alias=$host
 case "$host_alias" in
 NONE)
   case $nonopt in
   NONE)
-    if host_alias=`$ac_config_guess`; then :
+    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
     else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
     fi ;;
   *) host_alias=$nonopt ;;
   esac ;;
 esac
 
-host=`$ac_config_sub $host_alias`
+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
 host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
-
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:673: checking for $ac_word" >&5
+echo "configure:825: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_CC="gcc"
@@ -698,16 +840,17 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:702: checking for $ac_word" >&5
+echo "configure:855: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
   ac_prog_rejected=no
-  for ac_dir in $PATH; do
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
@@ -742,25 +885,61 @@ else
   echo "$ac_t""no" 1>&6
 fi
 
+  if test -z "$CC"; then
+    case "`uname -s`" in
+    *win32* | *WIN32*)
+      # Extract the first word of "cl", so it can be a program name with args.
+set dummy cl; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:906: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_CC="cl"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+fi
+fi
+CC="$ac_cv_prog_CC"
+if test -n "$CC"; then
+  echo "$ac_t""$CC" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+ ;;
+    esac
+  fi
   test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:750: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:938: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
 cross_compiling=$ac_cv_prog_cc_cross
 
-cat > conftest.$ac_ext <<EOF
-#line 760 "configure"
+cat > conftest.$ac_ext << EOF
+
+#line 949 "configure"
 #include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -774,18 +953,24 @@ else
   ac_cv_prog_cc_works=no
 fi
 rm -fr conftest*
+ac_ext=c
+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
+cross_compiling=$ac_cv_prog_cc_cross
 
 echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
 if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:784: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:980: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:789: checking whether we are using GNU C" >&5
+echo "configure:985: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -794,7 +979,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:798: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:994: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -805,11 +990,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
-  ac_test_CFLAGS="${CFLAGS+set}"
-  ac_save_CFLAGS="$CFLAGS"
-  CFLAGS=
-  echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:813: checking whether ${CC-cc} accepts -g" >&5
+else
+  GCC=
+fi
+
+ac_test_CFLAGS="${CFLAGS+set}"
+ac_save_CFLAGS="$CFLAGS"
+CFLAGS=
+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
+echo "configure:1013: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -824,53 +1013,58 @@ rm -f conftest*
 fi
 
 echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-  if test "$ac_test_CFLAGS" = set; then
-    CFLAGS="$ac_save_CFLAGS"
-  elif test $ac_cv_prog_cc_g = yes; then
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS="$ac_save_CFLAGS"
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
     CFLAGS="-g -O2"
   else
-    CFLAGS="-O2"
+    CFLAGS="-g"
   fi
 else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
 fi
 
 
-if test -z "$GCC"; then
-  echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6
-echo "configure:843: checking how to request ANSI compilation" >&5
-  case "$host" in
-    *-hpux*)
-      echo "$ac_t""HPUX: adding -Ae" 1>&6
-      CC="$CC -Ae"
-    ;;
-    *-aix*)
-      echo "$ac_t""AIX: adding -qlanglvl=ansi -qhalt=e" 1>&6
-      CC="$CC -qlanglvl=ansi -qhalt=e"
-    ;;
-
-# NOTE:   for Digital, need to add -std1 to get ANSI, but I'm not sure
-#         yet what $host pattern we should be testing for...
+  if test -z "$GCC"; then
+    echo $ac_n "checking how to request ANSI compilation""... $ac_c" 1>&6
+echo "configure:1047: checking how to request ANSI compilation" >&5
+    case "$host" in
+      *-hpux* )
+        echo "$ac_t""HPUX: adding -Ae" 1>&6
+        CC="$CC -Ae"
+      ;;
+      *-aix* )
+        echo "$ac_t""AIX: adding -qlanglvl=ansi -qhalt=e" 1>&6
+        CC="$CC -qlanglvl=ansi -qhalt=e"
+      ;;
 
-    *)
-      echo "$ac_t""no idea" 1>&6
-    ;;
-  esac
-fi
+      *-dec-* )
+        echo "$ac_t""DEC: adding -std1" 1>&6
+        CC="$CC -std1"
+      ;;
 
+      *)
+        echo "$ac_t""no idea" 1>&6
+      ;;
+    esac
+  fi
 
-echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6
-echo "configure:865: checking whether the compiler works on ANSI C" >&5
-if test "$cross_compiling" = yes; then
+  echo $ac_n "checking whether the compiler works on ANSI C""... $ac_c" 1>&6
+echo "configure:1070: checking whether the compiler works on ANSI C" >&5
+  if test "$cross_compiling" = yes; then
   { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 870 "configure"
+#line 1075 "configure"
 #include "confdefs.h"
  main(int ac, char **av) { return 0; } 
 EOF
-if { (eval echo configure:874: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1079: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   echo "$ac_t""yes" 1>&6
 else
@@ -878,28 +1072,34 @@ else
   cat conftest.$ac_ext >&5
   rm -fr conftest*
   echo "$ac_t""no" 1>&6
-   { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; }
+     { echo "configure: error: Couldn't build even a trivial ANSI C program: check CC." 1>&2; exit 1; }
 fi
 rm -fr conftest*
 fi
 
 
-case "$host" in
-  *-irix*)
   if test -n "$GCC"; then
     echo "$ac_t""Turning on gcc compiler warnings." 1>&6
     CC="$CC -Wall -Wstrict-prototypes -Wnested-externs -Wno-format"
+    echo "$ac_t""Disabling C++ comments in ANSI C code." 1>&6
+    CC="$CC -Wp,-lang-c89"
   else
-    # not gcc
-    echo "$ac_t""Turning on SGI compiler warnings." 1>&6
-    CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
+    case "$host" in
+      *-irix5* |*-irix6.0-3* )
+        echo "$ac_t""Turning on SGI compiler warnings." 1>&6
+        CC="$CC -fullwarn -use_readonly_const -rdata_shared -g3"
+      ;;
+#     *-dec-osf* )
+#       if test -z "$GCC"; then
+#         AC_MSG_RESULT(Turning on DEC C compiler warnings.)
+#         CC="$CC -migrate -w0 -verbose -warnprotos"
+#       fi
+#     ;;
+    esac
   fi
-  ;;
-esac
-
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:903: checking how to run the C preprocessor" >&5
+echo "configure:1114: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -914,14 +1114,14 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 918 "configure"
+#line 1129 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -931,14 +1131,31 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 935 "configure"
+#line 1146 "configure"
+#include "confdefs.h"
+#include <assert.h>
+Syntax Error
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1152: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  :
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  CPP="${CC-cc} -nologo -E"
+  cat > conftest.$ac_ext <<EOF
+#line 1163 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:941: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1169: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   :
 else
@@ -950,6 +1167,8 @@ else
 fi
 rm -f conftest*
 fi
+rm -f conftest*
+fi
 rm -f conftest*
   ac_cv_prog_CPP="$CPP"
 fi
@@ -959,101 +1178,13 @@ else
 fi
 echo "$ac_t""$CPP" 1>&6
 
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:974: checking for a BSD compatible install" >&5
-if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
-    # Account for people who put trailing slashes in PATH elements.
-    case "$ac_dir/" in
-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-    *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      for ac_prog in ginstall installbsd scoinst install; do
-        if test -f $ac_dir/$ac_prog; then
-         if test $ac_prog = install &&
-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           # OSF/1 installbsd also uses dspmsg, but is usable.
-           :
-         else
-           ac_cv_path_install="$ac_dir/$ac_prog -c"
-           break 2
-         fi
-       fi
-      done
-      ;;
-    esac
-  done
-  IFS="$ac_save_IFS"
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL="$ac_cv_path_install"
-  else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
-    INSTALL="$ac_install_sh"
-  fi
-fi
-echo "$ac_t""$INSTALL" 1>&6
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1024: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftestmake <<\EOF
-all:
-       @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
-  eval ac_cv_prog_make_${ac_make}_set=yes
-else
-  eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  SET_MAKE=
-else
-  echo "$ac_t""no" 1>&6
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1052: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
+echo $ac_n "checking for working const""... $ac_c" 1>&6
+echo "configure:1194: checking for working const" >&5
+if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1057 "configure"
+#line 1199 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1102,7 +1233,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:1106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1248: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -1123,21 +1254,21 @@ EOF
 fi
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1127: checking for inline" >&5
+echo "configure:1269: checking for inline" >&5
 if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 1134 "configure"
+#line 1276 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:1141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -1163,13 +1294,160 @@ EOF
 esac
 
 
+# stuff for Makefiles
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
+echo "configure:1322: checking for a BSD compatible install" >&5
+if test -z "$INSTALL"; then
+if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+    IFS="${IFS=        }"; ac_save_IFS="$IFS"; IFS=":"
+  for ac_dir in $PATH; do
+    # Account for people who put trailing slashes in PATH elements.
+    case "$ac_dir/" in
+    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
+    *)
+      # OSF1 and SCO ODT 3.0 have their own names for install.
+      # Don't use installbsd from OSF since it installs stuff as root
+      # by default.
+      for ac_prog in ginstall scoinst install; do
+        if test -f $ac_dir/$ac_prog; then
+         if test $ac_prog = install &&
+            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         else
+           ac_cv_path_install="$ac_dir/$ac_prog -c"
+           break 2
+         fi
+       fi
+      done
+      ;;
+    esac
+  done
+  IFS="$ac_save_IFS"
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
+fi
+echo "$ac_t""$INSTALL" 1>&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo $ac_n "checking whether \"\${INSTALL} -d\" creates intermediate directories""... $ac_c" 1>&6
+echo "configure:1375: checking whether \"\${INSTALL} -d\" creates intermediate directories" >&5
+if eval "test \"`echo '$''{'ac_cv_install_d_creates_dirs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_install_d_creates_dirs=no
+     rm -rf conftestdir
+     if mkdir conftestdir; then
+       cd conftestdir >&-
+       ${INSTALL} -d `pwd`/dir1/dir2 >&- 2>&-
+       if test -d dir1/dir2/. ; then
+         ac_cv_install_d_creates_dirs=yes
+       fi
+       cd .. >&-
+       rm -rf conftestdir
+     fi
+    
+fi
+
+echo "$ac_t""$ac_cv_install_d_creates_dirs" 1>&6
+
+  if test "$ac_cv_install_d_creates_dirs" = no ; then
+    echo $ac_n "checking whether \"mkdir -p\" creates intermediate directories""... $ac_c" 1>&6
+echo "configure:1397: checking whether \"mkdir -p\" creates intermediate directories" >&5
+if eval "test \"`echo '$''{'ac_cv_mkdir_p_creates_dirs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_mkdir_p_creates_dirs=no
+       rm -rf conftestdir
+       if mkdir conftestdir; then
+         cd conftestdir >&-
+         mkdir -p dir1/dir2 >&- 2>&-
+         if test -d dir1/dir2/. ; then
+           ac_cv_mkdir_p_creates_dirs=yes
+         fi
+         cd .. >&-
+         rm -rf conftestdir
+       fi
+      
+fi
+
+echo "$ac_t""$ac_cv_mkdir_p_creates_dirs" 1>&6
+  fi
+
+  if test "$ac_cv_install_d_creates_dirs" = yes ; then
+    INSTALL_DIRS='${INSTALL} -d'
+  elif test "$ac_cv_mkdir_p_creates_dirs" = yes ; then
+    INSTALL_DIRS='mkdir -p'
+  else
+    # any other ideas?
+    INSTALL_DIRS='${INSTALL} -d'
+  fi
+
+echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
+echo "configure:1428: checking whether ${MAKE-make} sets \${MAKE}" >&5
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftestmake <<\EOF
+all:
+       @echo 'ac_maketemp="${MAKE}"'
+EOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftestmake
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  SET_MAKE=
+else
+  echo "$ac_t""no" 1>&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+
+# random libc stuff
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1168: checking for ANSI C header files" >&5
+echo "configure:1457: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1173 "configure"
+#line 1462 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -1177,8 +1455,8 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1181: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:1470: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   ac_cv_header_stdc=yes
@@ -1194,7 +1472,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1198 "configure"
+#line 1487 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -1212,7 +1490,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 1216 "configure"
+#line 1505 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -1233,7 +1511,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 1237 "configure"
+#line 1526 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1244,7 +1522,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:1248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -1267,282 +1545,119 @@ EOF
 
 fi
 
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1272: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
+for ac_hdr in unistd.h
+do
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
+echo "configure:1564: checking for $ac_hdr" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1277 "configure"
+#line 1569 "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#include <sys/time.h>
-#include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
+#include <$ac_hdr>
 EOF
-if { (eval echo configure:1286: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:1574: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  ac_cv_header_time=yes
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_header_time=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
 fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
-if test $ac_cv_header_time = yes; then
-  cat >> confdefs.h <<\EOF
-#define TIME_WITH_SYS_TIME 1
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_hdr 1
 EOF
-
+else
+  echo "$ac_t""no" 1>&6
 fi
+done
 
-echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:1307: checking for sys/wait.h that is POSIX.1 compatible" >&5
-if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+echo $ac_n "checking for mode_t""... $ac_c" 1>&6
+echo "configure:1601: checking for mode_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1312 "configure"
+#line 1606 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
-#include <sys/wait.h>
-#ifndef WEXITSTATUS
-#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
-#endif
-#ifndef WIFEXITED
-#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
 #endif
-int main() {
-int s;
-wait (&s);
-s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
-; return 0; }
 EOF
-if { (eval echo configure:1328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  ac_cv_header_sys_wait_h=yes
+  ac_cv_type_mode_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_header_sys_wait_h=no
+  ac_cv_type_mode_t=no
 fi
 rm -f conftest*
-fi
 
-echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
-if test $ac_cv_header_sys_wait_h = yes; then
+fi
+echo "$ac_t""$ac_cv_type_mode_t" 1>&6
+if test $ac_cv_type_mode_t = no; then
   cat >> confdefs.h <<\EOF
-#define HAVE_SYS_WAIT_H 1
+#define mode_t int
 EOF
 
 fi
 
-ac_header_dirent=no
-for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:1353: checking for $ac_hdr that defines DIR" >&5
-if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
+echo $ac_n "checking for pid_t""... $ac_c" 1>&6
+echo "configure:1634: checking for pid_t" >&5
+if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1358 "configure"
+#line 1639 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
-#include <$ac_hdr>
-int main() {
-DIR *dirp = 0;
-; return 0; }
+#if STDC_HEADERS
+#include <stdlib.h>
+#include <stddef.h>
+#endif
 EOF
-if { (eval echo configure:1366: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_header_dirent_$ac_safe=yes"
+  ac_cv_type_pid_t=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_dirent_$ac_safe=no"
+  ac_cv_type_pid_t=no
 fi
 rm -f conftest*
+
 fi
-if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
- ac_header_dirent=$ac_hdr; break
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
-if test $ac_header_dirent = dirent.h; then
-echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:1391: checking for opendir in -ldir" >&5
-ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-ldir  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1399 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:1410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  LIBS="$LIBS -ldir"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-else
-echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:1432: checking for opendir in -lx" >&5
-ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lx  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1440 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char opendir();
-
-int main() {
-opendir()
-; return 0; }
-EOF
-if { (eval echo configure:1451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  LIBS="$LIBS -lx"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-fi
-
-
-echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:1475: checking for mode_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1480 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_mode_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_mode_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_mode_t" 1>&6
-if test $ac_cv_type_mode_t = no; then
-  cat >> confdefs.h <<\EOF
-#define mode_t int
-EOF
-
-fi
-
-echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:1508: checking for pid_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1513 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_pid_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_pid_t=no
-fi
-rm -f conftest*
-
-fi
-echo "$ac_t""$ac_cv_type_pid_t" 1>&6
-if test $ac_cv_type_pid_t = no; then
-  cat >> confdefs.h <<\EOF
-#define pid_t int
+echo "$ac_t""$ac_cv_type_pid_t" 1>&6
+if test $ac_cv_type_pid_t = no; then
+  cat >> confdefs.h <<\EOF
+#define pid_t int
 EOF
 
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1541: checking for size_t" >&5
+echo "configure:1667: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1546 "configure"
+#line 1672 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -1551,7 +1666,7 @@ else
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_size_t=yes
 else
@@ -1570,12 +1685,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1574: checking return type of signal handlers" >&5
+echo "configure:1700: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1579 "configure"
+#line 1705 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -1592,7 +1707,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:1596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -1610,140 +1725,285 @@ cat >> confdefs.h <<EOF
 EOF
 
 
-
-echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6
-echo "configure:1616: checking how to call gettimeofday" >&5
-if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then
+echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
+echo "configure:1741: checking whether time.h and sys/time.h may both be included" >&5
+if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1621 "configure"
+#line 1746 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-                 #include <sys/time.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
 int main() {
-struct timeval tv; struct timezone tzp;
-                 gettimeofday(&tv, &tzp);
+struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:1630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_gettimeofday_args=2
+  ac_cv_header_time=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
+  ac_cv_header_time=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_header_time" 1>&6
+if test $ac_cv_header_time = yes; then
+  cat >> confdefs.h <<\EOF
+#define TIME_WITH_SYS_TIME 1
+EOF
+
+fi
+
+echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
+echo "configure:1776: checking for sys/wait.h that is POSIX.1 compatible" >&5
+if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
+#line 1781 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-                                 #include <sys/time.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+#define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
 int main() {
-struct timeval tv; gettimeofday(&tv);
+int s;
+wait (&s);
+s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:1646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1797: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_gettimeofday_args=1
+  ac_cv_header_sys_wait_h=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_gettimeofday_args=0
-fi
-rm -f conftest*
+  ac_cv_header_sys_wait_h=no
 fi
 rm -f conftest*
-  ac_cv_gettimeofday_args=$ac_gettimeofday_args
 fi
 
-ac_gettimeofday_args=$ac_cv_gettimeofday_args
-if test $ac_gettimeofday_args = 1 ; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_GETTIMEOFDAY 1
-EOF
-
-  echo "$ac_t""one argument" 1>&6
-elif test $ac_gettimeofday_args = 2 ; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_GETTIMEOFDAY 1
-EOF
-
+echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6
+if test $ac_cv_header_sys_wait_h = yes; then
   cat >> confdefs.h <<\EOF
-#define GETTIMEOFDAY_TWO_ARGS 1
+#define HAVE_SYS_WAIT_H 1
 EOF
 
-  echo "$ac_t""two arguments" 1>&6
-else
-  echo "$ac_t""unknown" 1>&6
 fi
 
-
-for ac_func in select fcntl uname nice setpriority getcwd getwd putenv
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1686: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
+echo "configure:1822: checking for $ac_hdr that defines DIR" >&5
+if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1691 "configure"
+#line 1827 "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
-#include <assert.h>
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
+#include <sys/types.h>
+#include <$ac_hdr>
 int main() {
-
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-choke me
-#else
-$ac_func();
-#endif
-
+DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:1714: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1835: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
+  eval "ac_cv_header_dirent_$ac_safe=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
+  eval "ac_cv_header_dirent_$ac_safe=no"
 fi
 rm -f conftest*
 fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
   cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
+#define $ac_tr_hdr 1
 EOF
+ ac_header_dirent=$ac_hdr; break
 else
   echo "$ac_t""no" 1>&6
 fi
 done
-
-for ac_func in sigaction
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1741: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
+echo "configure:1860: checking for opendir in -ldir" >&5
+ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1746 "configure"
-#include "confdefs.h"
+  ac_save_LIBS="$LIBS"
+LIBS="-ldir  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1868 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -ldir"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+else
+echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
+echo "configure:1901: checking for opendir in -lx" >&5
+ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lx  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 1909 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char opendir();
+
+int main() {
+opendir()
+; return 0; }
+EOF
+if { (eval echo configure:1920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  LIBS="$LIBS -lx"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
+echo $ac_n "checking how to call gettimeofday""... $ac_c" 1>&6
+echo "configure:1943: checking how to call gettimeofday" >&5
+  if eval "test \"`echo '$''{'ac_cv_gettimeofday_args'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 1948 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+                    #include <sys/time.h>
+int main() {
+struct timeval tv; struct timezone tzp;
+                    gettimeofday(&tv, &tzp);
+; return 0; }
+EOF
+if { (eval echo configure:1957: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_gettimeofday_args=2
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cat > conftest.$ac_ext <<EOF
+#line 1965 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+                                    #include <sys/time.h>
+int main() {
+struct timeval tv; gettimeofday(&tv);
+; return 0; }
+EOF
+if { (eval echo configure:1973: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_gettimeofday_args=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_gettimeofday_args=0
+fi
+rm -f conftest*
+fi
+rm -f conftest*
+    ac_cv_gettimeofday_args=$ac_gettimeofday_args
+fi
+
+  ac_gettimeofday_args=$ac_cv_gettimeofday_args
+  if test "$ac_gettimeofday_args" = 1 ; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_GETTIMEOFDAY 1
+EOF
+
+    echo "$ac_t""one argument" 1>&6
+  elif test "$ac_gettimeofday_args" = 2 ; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_GETTIMEOFDAY 1
+EOF
+
+    cat >> confdefs.h <<\EOF
+#define GETTIMEOFDAY_TWO_ARGS 1
+EOF
+
+    echo "$ac_t""two arguments" 1>&6
+  else
+    echo "$ac_t""unknown" 1>&6
+  fi
+
+for ac_func in select fcntl uname nice setpriority getcwd getwd putenv
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2012: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2017 "configure"
+#include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
 #include <assert.h>
@@ -1765,7 +2025,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
 done
 
 
-for ac_hdr in unistd.h
+for ac_func in sigaction syslog realpath
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:2068: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2073 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:2096: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+echo $ac_n "checking for struct icmp""... $ac_c" 1>&6
+echo "configure:2121: checking for struct icmp" >&5
+if eval "test \"`echo '$''{'ac_cv_have_icmp'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2126 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+                   #include <stdio.h>
+                   #include <math.h>
+                   #include <unistd.h>
+                   #include <limits.h>
+                   #include <signal.h>
+                   #include <fcntl.h>
+                   #include <sys/types.h>
+                   #include <sys/time.h>
+                   #include <sys/ipc.h>
+                   #include <sys/shm.h>
+                   #include <sys/socket.h>
+                   #include <netinet/in_systm.h>
+                   #include <netinet/in.h>
+                   #include <netinet/ip.h>
+                   #include <netinet/ip_icmp.h>
+                   #include <netinet/udp.h>
+                   #include <arpa/inet.h>
+                   #include <netdb.h>
+int main() {
+struct icmp i;
+                   struct sockaddr s;
+                   struct sockaddr_in si;
+                   struct ip ip;
+                   i.icmp_type = ICMP_ECHO;
+                   i.icmp_code = 0;
+                   i.icmp_cksum = 0;
+                   i.icmp_id = 0;
+                   i.icmp_seq = 0;
+                   si.sin_family = AF_INET;
+                   ip.ip_hl = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2161: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_have_icmp=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_have_icmp=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_have_icmp" 1>&6
+ if test "$ac_cv_have_icmp" = yes ; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_ICMP 1
+EOF
+
+ fi
+echo $ac_n "checking for struct icmphdr""... $ac_c" 1>&6
+echo "configure:2181: checking for struct icmphdr" >&5
+if eval "test \"`echo '$''{'ac_cv_have_icmphdr'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 2186 "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+                   #include <stdio.h>
+                   #include <math.h>
+                   #include <unistd.h>
+                   #include <limits.h>
+                   #include <signal.h>
+                   #include <fcntl.h>
+                   #include <sys/types.h>
+                   #include <sys/time.h>
+                   #include <sys/ipc.h>
+                   #include <sys/shm.h>
+                   #include <sys/socket.h>
+                   #include <netinet/in_systm.h>
+                   #include <netinet/in.h>
+                   #include <netinet/ip.h>
+                   #include <netinet/ip_icmp.h>
+                   #include <netinet/udp.h>
+                   #include <arpa/inet.h>
+                   #include <netdb.h>
+int main() {
+struct icmphdr i;
+                   struct sockaddr s;
+                   struct sockaddr_in si;
+                   struct ip ip;
+                   i.type = ICMP_ECHO;
+                   i.code = 0;
+                   i.cksum = 0;
+                   i.un.echo.id = 0;
+                   i.un.echo.sequence = 0;
+                   si.sin_family = AF_INET;
+                   ip.ip_hl = 0;
+; return 0; }
+EOF
+if { (eval echo configure:2221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_have_icmphdr=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_have_icmphdr=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_have_icmphdr" 1>&6
+ if test "$ac_cv_have_icmphdr" = yes ; then
+   cat >> confdefs.h <<\EOF
+#define HAVE_ICMPHDR 1
+EOF
+
+ fi
+for ac_hdr in crypt.h sys/select.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1798: checking for $ac_hdr" >&5
+echo "configure:2244: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1803 "configure"
+#line 2249 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:2254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -1830,40 +2265,73 @@ else
 fi
 done
 
+for ac_prog in perl5 perl
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2285: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PERL" in
+  /*)
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_PERL="$PERL" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PERL="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PERL="$ac_cv_path_PERL"
+if test -n "$PERL"; then
+  echo "$ac_t""$PERL" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
 
+test -n "$PERL" && break
+done
 
-
-# Check whether --enable-subdir or --disable-subdir was given.
-if test "${enable_subdir+set}" = set; then
-  enableval="$enable_subdir"
-  enable_subdir="$enableval"
+  if test -z "$PERL" ; then
+    PERL_VERSION=0
+  else
+    echo $ac_n "checking perl version""... $ac_c" 1>&6
+echo "configure:2324: checking perl version" >&5
+if eval "test \"`echo '$''{'ac_cv_perl_version'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  enable_subdir=no
+  ac_cv_perl_version=`$PERL -e "$perl_version_cmd"`
 fi
 
-if test x"$enable_subdir" = xno; then
-  HACKDIR='${bindir}'
-elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
-  echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
-  exit 1
-else
-  # there must be a better way than this...
-  if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
-    # absolute path
-    HACKDIR=$enable_subdir
-  else
-    # relative path
-    HACKDIR='${bindir}/'$enable_subdir
+echo "$ac_t""$ac_cv_perl_version" 1>&6
+    PERL_VERSION=$ac_cv_perl_version
   fi
-fi
 
+if test -z "$PERL" ; then
+  # don't let it be blank...
+  PERL=/usr/local/bin/perl5
+fi
 
 # If we find X, set shell vars x_includes and x_libraries to the
 # paths, otherwise set no_x=yes.
 # Uses ac_ vars as temps to allow command line to override cache and checks.
 # --without-x overrides everything else, but does not touch the cache.
 echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1867: checking for X" >&5
+echo "configure:2346: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -1925,13 +2393,13 @@ if test "$ac_x_includes" = NO; then
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 1929 "configure"
+#line 2408 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:2413: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   # We can compile using X headers with no special include directory.
@@ -1999,14 +2467,14 @@ if test "$ac_x_libraries" = NO; then
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2003 "configure"
+#line 2482 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:2010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -2112,17 +2580,17 @@ else
     case "`(uname -sr) 2>/dev/null`" in
     "SunOS 5"*)
       echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:2116: checking whether -R must be followed by a space" >&5
+echo "configure:2595: checking whether -R must be followed by a space" >&5
       ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
       cat > conftest.$ac_ext <<EOF
-#line 2119 "configure"
+#line 2598 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -2138,14 +2606,14 @@ rm -f conftest*
       else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
        cat > conftest.$ac_ext <<EOF
-#line 2142 "configure"
+#line 2621 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -2177,7 +2645,7 @@ rm -f conftest*
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:2181: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:2660: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2185,7 +2653,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2189 "configure"
+#line 2668 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2196,7 +2664,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2200: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2218,7 +2686,7 @@ fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
       echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:2222: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:2701: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2226,7 +2694,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2230 "configure"
+#line 2709 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2237,7 +2705,7 @@ int main() {
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:2241: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2266,12 +2734,12 @@ fi
     # The nsl library prevents programs from opening the X display
     # on Irix 5.2, according to dickey@clark.net.
     echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:2270: checking for gethostbyname" >&5
+echo "configure:2749: checking for gethostbyname" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2275 "configure"
+#line 2754 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -2294,7 +2762,7 @@ gethostbyname();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2777: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -2315,7 +2783,7 @@ fi
 
     if test $ac_cv_func_gethostbyname = no; then
       echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:2319: checking for gethostbyname in -lnsl" >&5
+echo "configure:2798: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2323,7 +2791,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2327 "configure"
+#line 2806 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2334,7 +2802,7 @@ int main() {
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:2338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2817: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2364,12 +2832,12 @@ fi
     # -lsocket must be given before -lnsl if both are needed.
     # We assume that if connect needs -lnsl, so does gethostbyname.
     echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:2368: checking for connect" >&5
+echo "configure:2847: checking for connect" >&5
 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2373 "configure"
+#line 2852 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -2392,7 +2860,7 @@ connect();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -2413,7 +2881,7 @@ fi
 
     if test $ac_cv_func_connect = no; then
       echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:2417: checking for connect in -lsocket" >&5
+echo "configure:2896: checking for connect in -lsocket" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2421,7 +2889,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2425 "configure"
+#line 2904 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2432,7 +2900,7 @@ int main() {
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:2436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2456,12 +2924,12 @@ fi
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:2460: checking for remove" >&5
+echo "configure:2939: checking for remove" >&5
 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2465 "configure"
+#line 2944 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -2484,7 +2952,7 @@ remove();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2488: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -2505,7 +2973,7 @@ fi
 
     if test $ac_cv_func_remove = no; then
       echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:2509: checking for remove in -lposix" >&5
+echo "configure:2988: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2513,7 +2981,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2517 "configure"
+#line 2996 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2524,7 +2992,7 @@ int main() {
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:2528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2548,12 +3016,12 @@ fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:2552: checking for shmat" >&5
+echo "configure:3031: checking for shmat" >&5
 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2557 "configure"
+#line 3036 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -2576,7 +3044,7 @@ shmat();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3059: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -2597,7 +3065,7 @@ fi
 
     if test $ac_cv_func_shmat = no; then
       echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:2601: checking for shmat in -lipc" >&5
+echo "configure:3080: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2605,7 +3073,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lipc  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2609 "configure"
+#line 3088 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2616,7 +3084,7 @@ int main() {
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:2620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2649,15 +3117,15 @@ fi
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:2653: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:3132: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lICE  $LIBS"
+LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2661 "configure"
+#line 3140 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2668,7 +3136,7 @@ int main() {
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:2672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2693,26 +3161,20 @@ fi
 fi
 
 
-# Try and find the app-defaults directory.
-# It sucks that autoconf doesn't do this already...
-#
-
-
-
-
-
-
+if test "$have_x" != yes; then
+  { echo "configure: error: Couldn't find X11 headers/libs.  Try \`$0 --help'." 1>&2; exit 1; }
+fi
 
 
     echo $ac_n "checking for X app-defaults directory""... $ac_c" 1>&6
-echo "configure:2709: checking for X app-defaults directory" >&5
+echo "configure:3182: checking for X app-defaults directory" >&5
 if eval "test \"`echo '$''{'ac_cv_x_app_defaults'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
   rm -fr conftestdir
   if mkdir conftestdir; then
-    cd conftestdir
+    cd conftestdir >&-
     # Make sure to not put "make" in the Imakefile rules, since we grep it out.
     cat > Imakefile <<'EOF'
 acfindx:
@@ -2722,58 +3184,60 @@ EOF
       # GNU make sometimes prints "make[1]: Entering...", which'd confuse us.
       eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
     fi
-    cd ..
+    cd .. >&-
     rm -fr conftestdir
   fi
-        # Look for the directory under a standard set of common directories.
+      if test x"$ac_x_app_defaults" = x; then
+        
+  # 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                                        \
-    /usr/X11/lib/app-defaults                  \
-    /usr/X11R6/lib/app-defaults                        \
-    /usr/X11R6/lib/X11/app-defaults            \
-    /usr/X11R5/lib/app-defaults                        \
-    /usr/X11R5/lib/X11/app-defaults            \
-    /usr/X11R4/lib/app-defaults                        \
-    /usr/X11R4/lib/X11/app-defaults            \
-                                               \
-    /usr/lib/X11/app-defaults                  \
-    /usr/lib/X11R6/app-defaults                        \
-    /usr/lib/X11R5/app-defaults                        \
-    /usr/lib/X11R4/app-defaults                        \
-                                               \
-    /usr/local/X11/lib/app-defaults            \
-    /usr/local/X11R6/lib/app-defaults          \
-    /usr/local/X11R5/lib/app-defaults          \
-    /usr/local/X11R4/lib/app-defaults          \
-                                               \
-    /usr/local/lib/X11/app-defaults            \
-    /usr/local/lib/X11R6/app-defaults          \
-    /usr/local/lib/X11R6/X11/app-defaults      \
-    /usr/local/lib/X11R5/app-defaults          \
-    /usr/local/lib/X11R5/X11/app-defaults      \
-    /usr/local/lib/X11R4/app-defaults          \
-    /usr/local/lib/X11R4/X11/app-defaults      \
-                                               \
-    /usr/X386/lib/X11/app-defaults             \
-    /usr/x386/lib/X11/app-defaults             \
-    /usr/XFree86/lib/X11/app-defaults          \
-                                               \
-    /usr/lib/X11/app-defaults                  \
-    /usr/local/lib/X11/app-defaults            \
-    /usr/unsupported/lib/X11/app-defaults      \
-    /usr/athena/lib/X11/app-defaults           \
-    /usr/local/x11r5/lib/X11/app-defaults      \
-    /usr/lpp/Xamples/lib/X11/app-defaults      \
-    /lib/usr/lib/X11/app-defaults              \
-                                               \
-    /usr/openwin/lib/app-defaults              \
-    /usr/openwin/lib/X11/app-defaults          \
-    /usr/openwin/share/lib/app-defaults                \
-    /usr/openwin/share/lib/X11/app-defaults    \
-                                               \
-    /X11R6/lib/app-defaults                    \
-    /X11R5/lib/app-defaults                    \
-    /X11R4/lib/app-defaults                    \
+  for ac_dir in                                 \
+    /usr/X11/lib/app-defaults                   \
+    /usr/X11R6/lib/app-defaults                 \
+    /usr/X11R6/lib/X11/app-defaults             \
+    /usr/X11R5/lib/app-defaults                 \
+    /usr/X11R5/lib/X11/app-defaults             \
+    /usr/X11R4/lib/app-defaults                 \
+    /usr/X11R4/lib/X11/app-defaults             \
+                                                \
+    /usr/lib/X11/app-defaults                   \
+    /usr/lib/X11R6/app-defaults                 \
+    /usr/lib/X11R5/app-defaults                 \
+    /usr/lib/X11R4/app-defaults                 \
+                                                \
+    /usr/local/X11/lib/app-defaults             \
+    /usr/local/X11R6/lib/app-defaults           \
+    /usr/local/X11R5/lib/app-defaults           \
+    /usr/local/X11R4/lib/app-defaults           \
+                                                \
+    /usr/local/lib/X11/app-defaults             \
+    /usr/local/lib/X11R6/app-defaults           \
+    /usr/local/lib/X11R6/X11/app-defaults       \
+    /usr/local/lib/X11R5/app-defaults           \
+    /usr/local/lib/X11R5/X11/app-defaults       \
+    /usr/local/lib/X11R4/app-defaults           \
+    /usr/local/lib/X11R4/X11/app-defaults       \
+                                                \
+    /usr/X386/lib/X11/app-defaults              \
+    /usr/x386/lib/X11/app-defaults              \
+    /usr/XFree86/lib/X11/app-defaults           \
+                                                \
+    /usr/lib/X11/app-defaults                   \
+    /usr/local/lib/X11/app-defaults             \
+    /usr/unsupported/lib/X11/app-defaults       \
+    /usr/athena/lib/X11/app-defaults            \
+    /usr/local/x11r5/lib/X11/app-defaults       \
+    /usr/lpp/Xamples/lib/X11/app-defaults       \
+    /lib/usr/lib/X11/app-defaults               \
+                                                \
+    /usr/openwin/lib/app-defaults               \
+    /usr/openwin/lib/X11/app-defaults           \
+    /usr/openwin/share/lib/app-defaults         \
+    /usr/openwin/share/lib/X11/app-defaults     \
+                                                \
+    /X11R6/lib/app-defaults                     \
+    /X11R5/lib/app-defaults                     \
+    /X11R4/lib/app-defaults                     \
     ; \
   do
     if test -d "$ac_dir"; then
@@ -2782,6 +3246,7 @@ EOF
     fi
   done
 
+      fi
       if test x"$ac_x_app_defaults" = x; then
         ac_cv_x_app_defaults="/usr/lib/X11/app-defaults"
       else
 
 echo "$ac_t""$ac_cv_x_app_defaults" 1>&6
     eval ac_x_app_defaults="$ac_cv_x_app_defaults"
+case "$host" in
+    *-hpux*)
 
-APPDEFAULTS=$ac_x_app_defaults
-
-
-# Like AC_CHECK_HEADER, but it uses the already-computed -I directories.
-#
-
-
-# Like AC_EGREP_HEADER, but it uses the already-computed -I directories.
-#
-
-
-# Like AC_TRY_COMPILE, but it uses the already-computed -I directories.
-#
-
-
-
-# Like AC_CHECK_LIB, but it uses the already-computed -I and -L directories.
-# Use this sparingly; it probably doesn't work very well on X programs.
-#
-
-
-# Like AC_TRY_RUN, but it uses the already-computed -I directories.
-# (But not the -L directories!)
-#
+      # The following arcana was gleaned from conversations with
+      # Eric Schwartz <erics@col.hp.com>:
+      #
+      # On HPUX 10.x, the parts of X that HP considers "standard" live in
+      # /usr/{include,lib}/X11R6/.  The parts that HP doesn't consider
+      # "standard", notably, Xaw and Xmu, live in /usr/contrib/X11R6/.
+      # Yet /usr/contrib/X11R6/ comes preinstalled on all HPUX systems.
+      # Also, there are symlinks from /usr/include/ and /usr/lib/ into
+      # /usr/{include,lib}/X11R6/, so that (if you don't use Xmu at all)
+      # you don't need any -I or -L arguments.
+      #
+      # On HPUX 9.x, /usr/{include,lib}/X11R5/ and /usr/contrib/X11R5/
+      # are the same division as 10.x.  However, there are no symlinks to
+      # the X stuff from /usr/include/ and /usr/lib/, so -I and -L
+      # arguments are always necessary.
+      #
+      # However, X11R6 was available on HPUX 9.x as a patch: if that
+      # patch was installed, then all of X11R6 went in to
+      # /usr/contrib/X11R6/ (there was no /usr/{include,lib}/X11R6/.)
+      #
+      # HPUX 8.x was the same as 9.x, but was X11R4 instead (I don't know
+      # whether R5 was available as a patch; R6 undoubtedly was not.)
+      #
+      # So.  We try and use the highest numbered pair of
+      # /usr/{include,lib}/X11R?/ and /usr/contrib/X11R?/{include,lib}/
+      # that are available.  We do not mix and match different versions
+      # of X.
+      #
+      # Question I still don't know the answer to: (do you?)
+      #
+      #   * On HPUX 9.x, where /usr/include/X11R5/ was standard, and
+      #     /usr/contrib/X11R6/ could be installed as a patch, what was in
+      #     that contrib directory?  Did it contain so-called "standard"
+      #     X11R6, or did it include Xaw and Xmu as well?  If the former,
+      #     where did one find Xaw and Xmu on 9.x R6 systems?  Would this
+      #     be a situation where one had to reach into the R5 headers and
+      #     libs to find Xmu?  That is, must both R6 and R5 directories
+      #     be on the -I and -L lists in that case?
+      #
+      for version in X11R6 X11R5 X11R4 ; do
+        # if either pair of directories exists...
+        if test -d /usr/lib/$version || test -d /usr/contrib/$version/lib
+        then
+           # if contrib exists, use it...
+           if test -d /usr/contrib/$version/lib ; then
+             X_CFLAGS="$X_CFLAGS -I/usr/contrib/$version/include"
+             X_LIBS="$X_LIBS -L/usr/contrib/$version/lib"
+           fi
+           # if the "standard" one exists, use it.
+           if test -d /usr/lib/$version ; then
+             X_CFLAGS="$X_CFLAGS -I/usr/include/$version"
+             X_LIBS="$X_LIBS -L/usr/lib/$version"
+           fi
+           # since at least one of the pair exists, go no farther.
+           break
+        fi
+      done
 
+      # Now find Motif.  Thanks for not making xmkmf find this by
+      # default, you losers.
+      #
+      if test -d /usr/lib/Motif1.2 ; then
+        X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.2"
+        X_LIBS="$X_LIBS -L/usr/lib/Motif1.2"
+      elif test -d /usr/lib/Motif1.1 ; then
+        X_CFLAGS="$X_CFLAGS -I/usr/include/Motif1.1"
+        X_LIBS="$X_LIBS -L/usr/lib/Motif1.1"
+      fi
 
+      # Now let's check for the pseudo-standard locations for OpenGL and XPM.
+      #
+      if test -d /opt/Mesa/lib ; then
+        X_CFLAGS="-I/opt/Mesa/include $X_CFLAGS"
+        X_LIBS="-L/opt/Mesa/lib $X_LIBS"
+      fi
 
+      if test -d /opt/xpm/lib/X11 ; then
+        X_CFLAGS="-I/opt/xpm/include $X_CFLAGS"
+        X_LIBS="-L/opt/xpm/lib/X11 $X_LIBS"
+      fi
 
+      # On HPUX, default to installing in /opt/xscreensaver/ instead of
+      # in /usr/local/, unless there is already an xscreensaver in
+      # /usr/local/bin/.  This can be overridden with the --prefix arg
+      # to configure.  I'm not sure this is the right thing to do, but
+      # Richard Lloyd says so...
+      #
+      if test \! -x /usr/local/bin/xscreensaver ; then
+        ac_default_prefix=/opt/xscreensaver
+      fi
 
+    ;;
+    *-solaris*)
 
-# check for the HP XHPDisableReset server extension headers.
-#
+      # Thanks for not making xmkmf find this by default, pinheads.
+      # And thanks for moving things around again, too.  Is this
+      # really the standard location now?  What happened to the
+      # joke that this kind of thing went in /opt?
+      # cthomp says "answer: CDE (Common Disorganized Environment)"
+      #
+      if test -f /usr/dt/include/Xm/Xm.h ; then
+        X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
+        X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  cat > conftest.$ac_ext <<EOF
-#line 2836 "configure"
+        # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
+        echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6
+echo "configure:3381: checking for regcmp in -lgen" >&5
+ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lgen  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3389 "configure"
 #include "confdefs.h"
-#include <X11/XHPlib.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char regcmp();
+
+int main() {
+regcmp()
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "XHPDisableReset" >/dev/null 2>&1; then
+if { (eval echo configure:3400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  cat >> confdefs.h <<\EOF
-#define HAVE_XHPDISABLERESET 1
-EOF
-
-                  SAVER_LIBS="-lXhp11 $SAVER_LIBS"
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  X_LIBS="$X_LIBS -lgen"
+else
+  echo "$ac_t""no" 1>&6
+fi
 
-# Check for the availability of the XPointer typedef, and define it otherwise.
-#
+      fi
+    ;;
+  esac
 echo $ac_n "checking for XPointer""... $ac_c" 1>&6
-echo "configure:2857: checking for XPointer" >&5
+echo "configure:3424: checking for XPointer" >&5
 if eval "test \"`echo '$''{'ac_cv_xpointer'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2864,14 +3420,14 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 2868 "configure"
+#line 3435 "configure"
 #include "confdefs.h"
 #include <X11/Xlib.h>
 int main() {
 XPointer foo = (XPointer) 0;
 ; return 0; }
 EOF
-if { (eval echo configure:2875: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3442: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_xpointer=yes
 else
@@ -2885,98 +3441,21 @@ rm -f conftest*
 fi
 
 echo "$ac_t""$ac_cv_xpointer" 1>&6
-if test $ac_cv_xpointer != yes; then
-  cat >> confdefs.h <<\EOF
+  if test "$ac_cv_xpointer" != yes; then
+   cat >> confdefs.h <<\EOF
 #define XPointer char*
 EOF
 
-fi
-
-
-case "$host" in
-  *-hpux*)
-    # Thanks for not making xmkmf find this by default, you losers.
-    if test -d /usr/lib/Motif1.2 ; then
-      X_CFLAGS="-I/usr/include/Motif1.2 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.2 $X_LIBS"
-    elif test -d /usr/lib/Motif1.1 ; then
-      X_CFLAGS="-I/usr/include/Motif1.1 $X_CFLAGS"
-      X_LIBS="-L/usr/lib/Motif1.1 $X_LIBS"
-    fi
-
-    # This too.  You losers.
-    if test -d /usr/contrib/X11R6/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R6/lib $X_LIBS"
-    elif test -d /usr/X11R6/include ; then
-      X_CFLAGS="-I/usr/X11R6/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R6/lib $X_LIBS"
-    elif test -d /usr/contrib/X11R5/include ; then
-      X_CFLAGS="-I/usr/contrib/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/contrib/X11R5/lib $X_LIBS"
-    elif test -d /usr/X11R5/include ; then
-      X_CFLAGS="-I/usr/X11R5/include $X_CFLAGS"
-      X_LIBS="-L/usr/X11R5/lib $X_LIBS"
-    fi
-
-  ;;
-  *-solaris*)
-    # Same to you, pinheads.  (Is this really the standard location now?
-    # What happened to the joke that this kind of thing went in /opt?)
-    # cthomp says "answer: CDE (Common Disorganized Environment)"
-    if test -f /usr/dt/include/Xm/Xm.h ; then
-      X_CFLAGS="$X_CFLAGS -I/usr/dt/include"
-      X_LIBS="$X_LIBS -L/usr/dt/lib -R:/usr/dt/lib"
-
-      # Some versions of Slowlaris Motif require -lgen.  But not all.  Why?
-      echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6
-echo "configure:2934: checking for regcmp in -lgen" >&5
-ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lgen  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2942 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char regcmp();
-
-int main() {
-regcmp()
-; return 0; }
-EOF
-if { (eval echo configure:2953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  X_LIBS="$X_LIBS -lgen"
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-    fi
-  ;;
-esac
+  fi
 
 
 
-# Check for Xmu (some fucked up vendors don't ship it...)
+###############################################################################
+#
+#       Check for -lXmu (some fucked up vendors don't ship it...)
 #
+###############################################################################
+
 have_xmu=no
 
   ac_save_CPPFLAGS="$CPPFLAGS"
@@ -2986,18 +3465,18 @@ have_xmu=no
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/Xmu/Error.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Xmu/Error.h""... $ac_c" 1>&6
-echo "configure:2990: checking for X11/Xmu/Error.h" >&5
+echo "configure:3480: checking for X11/Xmu/Error.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2995 "configure"
+#line 3485 "configure"
 #include "confdefs.h"
 #include <X11/Xmu/Error.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3490: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3018,7 +3497,7 @@ else
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-if test $have_xmu = no ; then
+if test "$have_xmu" = no ; then
   XMU_SRCS='$(UTILS_SRC)/xmu.c'
   XMU_OBJS='$(UTILS_BIN)/xmu.o'
 else
@@ -3026,6 +3505,8 @@ else
   XMU_OBJS=''
   SAVER_LIBS="-lXmu $SAVER_LIBS"
   HACK_LIBS="-lXmu $HACK_LIBS"
+  MOTIF_LIBS="-lXmu $MOTIF_LIBS"
+  GTK_LIBS="-lXmu $GTK_LIBS"
   cat >> confdefs.h <<\EOF
 #define HAVE_XMU 1
 EOF
@@ -3033,34 +3514,39 @@ EOF
 fi
 
 
-# See comp.windows.x FAQ question 124 about _get_wmShellWidgetClass on 4.1.x.
-# The right fix is to get OpenWindows 3.0 patches 100512-02 and 100573-03.
+###############################################################################
+#
+#       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
+###############################################################################
+
+if test "$have_xmu" = yes ; then
   case "$host" in
     *-sunos4*)
     echo $ac_n "checking for the SunOS 4.1.x _get_wmShellWidgetClass bug""... $ac_c" 1>&6
-echo "configure:3044: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
+echo "configure:3541: checking for the SunOS 4.1.x _get_wmShellWidgetClass bug" >&5
 if eval "test \"`echo '$''{'ac_cv_sunos_xmu_bug'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&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 > conftest.$ac_ext <<EOF
-#line 3057 "configure"
+                    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 > conftest.$ac_ext <<EOF
+#line 3554 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_sunos_xmu_bug=no
 else
@@ -3070,27 +3556,27 @@ else
   ac_cv_sunos_xmu_bug=yes
 fi
 rm -f conftest*
-                   LDFLAGS="$ac_save_LDFLAGS"
+                    LDFLAGS="$ac_save_LDFLAGS"
 fi
 
 echo "$ac_t""$ac_cv_sunos_xmu_bug" 1>&6
-    if test $ac_cv_sunos_xmu_bug = yes ; then
+    if test "$ac_cv_sunos_xmu_bug" = yes ; then
       echo $ac_n "checking whether the compiler understands -static""... $ac_c" 1>&6
-echo "configure:3080: checking whether the compiler understands -static" >&5
+echo "configure:3577: checking whether the compiler understands -static" >&5
 if eval "test \"`echo '$''{'ac_cv_ld_static'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LDFLAGS="$LDFLAGS"
-                     LDFLAGS="$LDFLAGS -static"
-                     cat > conftest.$ac_ext <<EOF
-#line 3087 "configure"
+                      LDFLAGS="$LDFLAGS -static"
+                      cat > conftest.$ac_ext <<EOF
+#line 3584 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:3094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3591: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_ld_static=yes
 else
@@ -3100,14 +3586,14 @@ else
   ac_cv_ld_static=no
 fi
 rm -f conftest*
-                   LDFLAGS="$ac_save_LDFLAGS"
+                    LDFLAGS="$ac_save_LDFLAGS"
 fi
 
 echo "$ac_t""$ac_cv_ld_static" 1>&6
-      if test $ac_cv_ld_static = yes ; then
+      if test "$ac_cv_ld_static" = yes ; then
         LDFLAGS="$LDFLAGS -static"
       else
-       LDFLAGS="$LDFLAGS -Bstatic"
+        LDFLAGS="$LDFLAGS -Bstatic"
       fi
     fi
     ;;
@@ -3115,8 +3601,46 @@ echo "$ac_t""$ac_cv_ld_static" 1>&6
 fi
 
 
-# Check for the SGI SCREEN_SAVER server extension header.
+###############################################################################
+#
+#       Handle the --enable-subdir option
+#
+###############################################################################
+
+# Check whether --enable-subdir or --disable-subdir was given.
+if test "${enable_subdir+set}" = set; then
+  enableval="$enable_subdir"
+  enable_subdir="$enableval"
+else
+  enable_subdir=no
+fi
+
+if test x"$enable_subdir" = xno; then
+  HACKDIR='${bindir}'
+elif test x"$enable_subdir" = xyes -o x"$enable_subdir" = x ; then
+  echo "error: must be a subdirectory name: --enable-subdir=$enable_subdir"
+  exit 1
+else
+  # there must be a better way than this...
+  if test -z "`echo $enable_subdir | sed 's@^/.*@@'`" ; then
+    # absolute path
+    HACKDIR=$enable_subdir
+  else
+    # relative path
+    HACKDIR='${bindir}/'$enable_subdir
+  fi
+fi
+
+# canonicalize slashes.
+HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
+
+
+###############################################################################
 #
+#       Check for the SGI SCREEN_SAVER server extension.
+#
+###############################################################################
+
 have_sgi=no
 with_sgi_req=unspecified
 # Check whether --with-sgi-ext or --without-sgi-ext was given.
@@ -3127,7 +3651,49 @@ else
   with_sgi=yes
 fi
 
-if test $with_sgi = yes; then
+
+
+   case "$with_sgi" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for SGI SCREEN_SAVER headers""... $ac_c" 1>&6
+echo "configure:3674: checking for SGI SCREEN_SAVER headers" >&5
+     d=$with_sgi/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for SGI SCREEN_SAVER libs""... $ac_c" 1>&6
+echo "configure:3684: checking for SGI SCREEN_SAVER libs" >&5
+     d=$with_sgi/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgi_req="yes"
+     with_sgi=$with_sgi_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgi-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_sgi" = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
@@ -3136,18 +3702,18 @@ if test $with_sgi = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/XScreenSaver.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/XScreenSaver.h""... $ac_c" 1>&6
-echo "configure:3140: checking for X11/extensions/XScreenSaver.h" >&5
+echo "configure:3717: checking for X11/extensions/XScreenSaver.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3145 "configure"
+#line 3722 "configure"
 #include "confdefs.h"
 #include <X11/extensions/XScreenSaver.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3150: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3727: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3163,7 +3729,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   have_sgi=yes
-                    cat >> confdefs.h <<\EOF
+                     cat >> confdefs.h <<\EOF
 #define HAVE_SGI_SAVER_EXTENSION 1
 EOF
 
@@ -3173,14 +3739,18 @@ fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-elif test $with_sgi != no; then
+elif test "$with_sgi" != no; then
   echo "error: must be yes or no: --with-sgi-ext=$with_sgi"
   exit 1
 fi
 
-# Check for the MIT-SCREEN-SAVER server extension header,
-# unless the SGI extension has already been found.
+
+###############################################################################
+#
+#       Check for the MIT-SCREEN-SAVER server extension.
 #
+###############################################################################
+
 have_mit=no
 with_mit_req=unspecified
 # Check whether --with-mit-ext or --without-mit-ext was given.
@@ -3191,9 +3761,50 @@ else
   with_mit=yes
 fi
 
-if test $have_sgi != yes; then
-  if test $with_mit = yes; then
-    
+
+
+   case "$with_mit" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for MIT-SCREEN-SAVER headers""... $ac_c" 1>&6
+echo "configure:3784: checking for MIT-SCREEN-SAVER headers" >&5
+     d=$with_mit/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for MIT-SCREEN-SAVER libs""... $ac_c" 1>&6
+echo "configure:3794: checking for MIT-SCREEN-SAVER libs" >&5
+     d=$with_mit/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_mit_req="yes"
+     with_mit=$with_mit_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-mit-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_mit" = yes; then
+  
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
@@ -3201,18 +3812,18 @@ if test $have_sgi != yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/scrnsaver.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/scrnsaver.h""... $ac_c" 1>&6
-echo "configure:3205: checking for X11/extensions/scrnsaver.h" >&5
+echo "configure:3827: checking for X11/extensions/scrnsaver.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3210 "configure"
+#line 3832 "configure"
 #include "confdefs.h"
 #include <X11/extensions/scrnsaver.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3215: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3837: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3234,28 +3845,29 @@ fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-    # Now check to see if it's really in the library; XF86Free-3.3 ships
-    # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
-    #
-    if test $have_mit = yes; then
-      
+  # Now check to see if it's really in the library; XF86Free-3.3 ships
+  # scrnsaver.h, but doesn't include the code in libXext.a, the idiots!
+  #
+  if test "$have_mit" = yes; then
+    
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  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
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
   echo $ac_n "checking for XScreenSaverRegister in -lXext""... $ac_c" 1>&6
-echo "configure:3259: checking for XScreenSaverRegister in -lXext" >&5
+echo "configure:3882: checking for XScreenSaverRegister in -lXext" >&5
 ac_lib_var=`echo Xext'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3263,7 +3875,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3267 "configure"
+#line 3890 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3274,7 +3886,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3289,14 +3901,7 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo Xext | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
-
-  LIBS="-lXext $LIBS"
-
+  true
 else
   echo "$ac_t""no" 1>&6
 have_mit=no
@@ -3304,28 +3909,31 @@ fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
 
-      if test $have_mit = no; then
-       # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
-       # of in Xext.  Thank you master, may I have another.
-        
+    if test "$have_mit" = no; then
+      # Fuck!  Looks like XF86Free-3.3 actually puts it in XExExt instead
+      # of in Xext.  Thank you master, may I have another.
+      
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  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
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
   echo $ac_n "checking for XScreenSaverRegister in -lXExExt""... $ac_c" 1>&6
-echo "configure:3329: checking for XScreenSaverRegister in -lXExExt" >&5
+echo "configure:3948: checking for XScreenSaverRegister in -lXExExt" >&5
 ac_lib_var=`echo XExExt'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3333,7 +3941,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXExExt -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3337 "configure"
+#line 3956 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3344,7 +3952,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3348: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3362,35 +3970,39 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXExExt"
 else
   echo "$ac_t""no" 1>&6
+true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
-      fi
+#  LIBS="$ac_save_LIBS"
+  
+    fi
 
-      if test $have_mit = no; then
-       # Double fuck!  Looks like some versions of XFree86 (whichever version
-       # it is that comes with RedHat Linux 2.0 -- I can't find a version 
-       # number) put this garbage in Xss instead of Xext.  Thank you master,
-       #  may I have another.
-        
+    if test "$have_mit" = no; then
+      # Double fuck!  Looks like some versions of XFree86 (whichever version
+      # it is that comes with RedHat Linux 2.0 -- I can't find a version 
+      # number) put this garbage in Xss instead of Xext.  Thank you master,
+      #  may I have another.
+      
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  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
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
   echo $ac_n "checking for XScreenSaverRegister in -lXss""... $ac_c" 1>&6
-echo "configure:3394: checking for XScreenSaverRegister in -lXss" >&5
+echo "configure:4017: checking for XScreenSaverRegister in -lXss" >&5
 ac_lib_var=`echo Xss'_'XScreenSaverRegister | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3398,7 +4010,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lXss -lX11 -lXext -lm $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3402 "configure"
+#line 4025 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3409,7 +4021,7 @@ int main() {
 XScreenSaverRegister()
 ; return 0; }
 EOF
-if { (eval echo configure:3413: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4036: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3427,30 +4039,36 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   have_mit=yes; SAVER_LIBS="$SAVER_LIBS -lXss"
 else
   echo "$ac_t""no" 1>&6
+true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
-      fi
+#  LIBS="$ac_save_LIBS"
+  
+    fi
 
-    if test $have_mit = yes; then
-      cat >> confdefs.h <<\EOF
+  if test "$have_mit" = yes; then
+    cat >> confdefs.h <<\EOF
 #define HAVE_MIT_SAVER_EXTENSION 1
 EOF
 
-    fi
-
-    fi
+  fi
 
-  elif test $with_mit != no; then
-    echo "error: must be yes or no: --with-mit-ext=$with_mit"
-    exit 1
   fi
+
+elif test "$with_mit" != no; then
+  echo "error: must be yes or no: --with-mit-ext=$with_mit"
+  exit 1
 fi
 
 
-# Check for the XIDLE server extension header.
+###############################################################################
 #
+#       Check for the XIDLE server extension.
+#
+###############################################################################
+
 have_xidle=no
 with_xidle_req=unspecified
 # Check whether --with-xidle-ext or --without-xidle-ext was given.
@@ -3461,7 +4079,49 @@ else
   with_xidle=yes
 fi
 
-if test $with_xidle = yes; then
+
+
+   case "$with_xidle" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XIDLE headers""... $ac_c" 1>&6
+echo "configure:4102: checking for XIDLE headers" >&5
+     d=$with_xidle/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XIDLE libs""... $ac_c" 1>&6
+echo "configure:4112: checking for XIDLE libs" >&5
+     d=$with_xidle/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xidle_req="yes"
+     with_xidle=$with_xidle_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xidle-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+  
+
+if test "$with_xidle" = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
@@ -3470,18 +4130,18 @@ if test $with_xidle = yes; then
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   ac_safe=`echo "X11/extensions/xidle.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/extensions/xidle.h""... $ac_c" 1>&6
-echo "configure:3474: checking for X11/extensions/xidle.h" >&5
+echo "configure:4145: checking for X11/extensions/xidle.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3479 "configure"
+#line 4150 "configure"
 #include "confdefs.h"
 #include <X11/extensions/xidle.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3484: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:4155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3497,7 +4157,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   have_xidle=yes
-                    cat >> confdefs.h <<\EOF
+                     cat >> confdefs.h <<\EOF
 #define HAVE_XIDLE_EXTENSION 1
 EOF
 
@@ -3506,47 +4166,93 @@ else
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-elif test $with_xidle != no; then
+elif test "$with_xidle" != no; then
   echo "error: must be yes or no: --with-xidle-ext=$with_xidle"
   exit 1
 fi
 
 
-# Check for the XSHM server extension header.
+###############################################################################
 #
-have_xshm=no
-with_xshm_req=unspecified
-# Check whether --with-xshm-ext or --without-xshm-ext was given.
-if test "${with_xshm_ext+set}" = set; then
-  withval="$with_xshm_ext"
-  with_xshm="$withval"; with_xshm_req="$withval"
+#       Check for the SGI-VIDEO-CONTROL server extension.
+#
+###############################################################################
+
+have_sgivc=no
+with_sgivc_req=unspecified
+# Check whether --with-sgivc-ext or --without-sgivc-ext was given.
+if test "${with_sgivc_ext+set}" = set; then
+  withval="$with_sgivc_ext"
+  with_sgivc="$withval"; with_sgivc_req="$withval"
 else
-  with_xshm=yes
+  with_sgivc=yes
 fi
 
-if test $with_xshm = yes; then
 
-  # first check for Xshm.h.
+
+   case "$with_sgivc" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for SGI-VIDEO-CONTROL headers""... $ac_c" 1>&6
+echo "configure:4211: checking for SGI-VIDEO-CONTROL headers" >&5
+     d=$with_sgivc/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for SGI-VIDEO-CONTROL libs""... $ac_c" 1>&6
+echo "configure:4221: checking for SGI-VIDEO-CONTROL libs" >&5
+     d=$with_sgivc/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgivc_req="yes"
+     with_sgivc=$with_sgivc_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgivc-ext must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+  
+
+if test "$with_sgivc" = yes; then
+
+  # first check for XSGIvc.h
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6
-echo "configure:3539: checking for X11/extensions/XShm.h" >&5
+  ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6
+echo "configure:4256: checking for X11/extensions/XSGIvc.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3544 "configure"
+#line 4261 "configure"
 #include "confdefs.h"
-#include <X11/extensions/XShm.h>
+#include <X11/extensions/XSGIvc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3549: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:4266: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3561,81 +4267,175 @@ rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_xshm=yes
+  have_sgivc=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for sys/ipc.h.
-  if test $have_xshm = yes; then
-    have_xshm=no
+  # if that succeeded, then check for the -lXsgivc
+  if test "$have_sgivc" = yes; then
+    have_sgivc=no
     
   ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
+  # note: $X_CFLAGS includes $x_includes
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6
-echo "configure:3583: checking for sys/ipc.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6
+echo "configure:4310: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
+ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3588 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lXsgivc -lXext -lX11 $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 4318 "configure"
 #include "confdefs.h"
-#include <sys/ipc.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char XSGIvcQueryGammaMap();
+
+int main() {
+XSGIvcQueryGammaMap()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:4329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_xshm=yes
+  have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"
 else
   echo "$ac_t""no" 1>&6
+true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
   fi
 
-  # if that succeeded, then check for sys/shm.h.
-  if test $have_xshm = yes; then
-    have_xshm=no
-    
+  # if that succeeded, then we've really got it.
+  if test "$have_sgivc" = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_SGI_VC_EXTENSION 1
+EOF
+
+  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 or --without-dpms-ext was given.
+if test "${with_dpms_ext+set}" = set; then
+  withval="$with_dpms_ext"
+  with_dpms="$withval"; with_dpms_req="$withval"
+else
+  with_dpms=yes
+fi
+
+
+
+   case "$with_dpms" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for DPMS headers""... $ac_c" 1>&6
+echo "configure:4394: checking for DPMS headers" >&5
+     d=$with_dpms/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for DPMS libs""... $ac_c" 1>&6
+echo "configure:4404: checking for DPMS libs" >&5
+     d=$with_dpms/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&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"
-  ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6
-echo "configure:3628: checking for sys/shm.h" >&5
+  ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6
+echo "configure:4439: checking for X11/extensions/dpms.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3633 "configure"
+#line 4444 "configure"
 #include "confdefs.h"
-#include <sys/shm.h>
+#include <X11/extensions/dpms.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3638: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:4449: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3650,59 +4450,54 @@ rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_xshm=yes
+  have_dpms=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
-  fi
 
-  # AIX is pathological, as usual: apparently it's normal for the Xshm headers
-  # to exist, but the library code to not exist.  And even better, the library
-  # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
-  # lib doesn't exist, give up.
-  #
-  case "$host" in
-    *-aix*)
-      have_xshm=no
-      
+  # if that succeeded, then check for the -lXdpms
+  if test "$have_dpms" = yes; then
+    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
-  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
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
-  echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6
-echo "configure:3687: checking for XShmQueryExtension in -lXextSam" >&5
-ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'`
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6
+echo "configure:4493: checking for DPMSInfo in -lXdpms" >&5
+ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lXextSam -lX11 -lXext -lm $LIBS"
+LIBS="-lXdpms -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3695 "configure"
+#line 4501 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char XShmQueryExtension();
+char DPMSInfo();
 
 int main() {
-XShmQueryExtension()
+DPMSInfo()
 ; return 0; }
 EOF
-if { (eval echo configure:3706: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3717,65 +4512,113 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_xshm=yes; SAVER_LIBS="$SAVER_LIBS -lXextSam"
+  have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"
 else
   echo "$ac_t""no" 1>&6
+true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
-    ;;
-  esac
+#  LIBS="$ac_save_LIBS"
+  
+  fi
 
   # if that succeeded, then we've really got it.
-  if test $have_xshm = yes; then
+  if test "$have_dpms" = yes; then
     cat >> confdefs.h <<\EOF
-#define HAVE_XSHM_EXTENSION 1
+#define HAVE_DPMS_EXTENSION 1
 EOF
 
   fi
 
-elif test $with_xshm != no; then
-  echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
+elif test "$with_dpms" != no; then
+  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
   exit 1
 fi
 
 
-# Check for the SGI-VIDEO-CONTROL server extension header.
+###############################################################################
 #
-have_sgivc=no
-with_sgivc_req=unspecified
-# Check whether --with-sgivc-ext or --without-sgivc-ext was given.
-if test "${with_sgivc_ext+set}" = set; then
-  withval="$with_sgivc_ext"
-  with_sgivc="$withval"; with_sgivc_req="$withval"
+#       Check for the XF86VMODE server extension.
+#
+###############################################################################
+
+have_xf86vmode=no
+with_xf86vmode_req=unspecified
+# Check whether --with-xf86vmode-ext or --without-xf86vmode-ext was given.
+if test "${with_xf86vmode_ext+set}" = set; then
+  withval="$with_xf86vmode_ext"
+  with_xf86vmode="$withval"; with_xf86vmode_req="$withval"
 else
-  with_sgivc=yes
+  with_xf86vmode=yes
 fi
 
-if test $with_sgivc = yes; then
 
-  # first check for XSGIvc.h
+
+   case "$with_xf86vmode" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for xf86vmode headers""... $ac_c" 1>&6
+echo "configure:4577: checking for xf86vmode headers" >&5
+     d=$with_xf86vmode/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for xf86vmode libs""... $ac_c" 1>&6
+echo "configure:4587: checking for xf86vmode libs" >&5
+     d=$with_xf86vmode/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&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
+  
+
+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"
-  ac_safe=`echo "X11/extensions/XSGIvc.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/extensions/XSGIvc.h""... $ac_c" 1>&6
-echo "configure:3768: checking for X11/extensions/XSGIvc.h" >&5
+  ac_safe=`echo "X11/extensions/xf86vmode.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/xf86vmode.h""... $ac_c" 1>&6
+echo "configure:4622: checking for X11/extensions/xf86vmode.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3773 "configure"
+#line 4627 "configure"
 #include "confdefs.h"
-#include <X11/extensions/XSGIvc.h>
+#include <X11/extensions/xf86vmode.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:4632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
   eval "ac_cv_header_$ac_safe=yes"
@@ -3790,53 +4633,54 @@ rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_sgivc=yes
+  have_xf86vmode=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for the -lXsgivc
-  if test $have_sgivc = yes; then
-    have_sgivc=no
+  # if that succeeded, then check for the -lXxf86vm
+  if test "$have_xf86vmode" = yes; then
+    have_xf86vmode=no
     
   ac_save_CPPFLAGS="$CPPFLAGS"
   ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-  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
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
-  echo $ac_n "checking for XSGIvcQueryGammaMap in -lXsgivc""... $ac_c" 1>&6
-echo "configure:3821: checking for XSGIvcQueryGammaMap in -lXsgivc" >&5
-ac_lib_var=`echo Xsgivc'_'XSGIvcQueryGammaMap | sed 'y%./+-%__p_%'`
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for XF86VidModeGetViewPort in -lXxf86vm""... $ac_c" 1>&6
+echo "configure:4676: checking for XF86VidModeGetViewPort in -lXxf86vm" >&5
+ac_lib_var=`echo Xxf86vm'_'XF86VidModeGetViewPort | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lXsgivc -lXext -lX11 $LIBS"
+LIBS="-lXxf86vm -lXext -lX11 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3829 "configure"
+#line 4684 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char XSGIvcQueryGammaMap();
+char XF86VidModeGetViewPort();
 
 int main() {
-XSGIvcQueryGammaMap()
+XF86VidModeGetViewPort()
 ; return 0; }
 EOF
-if { (eval echo configure:3840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4695: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3851,342 +4695,315 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_sgivc=yes; SAVER_LIBS="$SAVER_LIBS -lXsgivc"
+  have_xf86vmode=yes; SAVER_LIBS="$SAVER_LIBS -lXxf86vm"
 else
   echo "$ac_t""no" 1>&6
+true
 fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
   LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
   fi
 
   # if that succeeded, then we've really got it.
-  if test $have_sgivc = yes; then
+  if test "$have_xf86vmode" = yes; then
     cat >> confdefs.h <<\EOF
-#define HAVE_SGI_VC_EXTENSION 1
+#define HAVE_XF86VMODE 1
 EOF
 
   fi
 
-elif test $with_sgivc != no; then
-  echo "error: must be yes or no: --with-sgivc-ext=$with_sgivc"
+elif test "$with_xf86vmode" != no; then
+  echo "error: must be yes or no: --with-xf86vmode-ext=$with_xf86vmode"
   exit 1
 fi
 
 
-# Check for the DPMS server extension header.
+###############################################################################
 #
-have_dpms=no
-with_dpms_req=unspecified
-# Check whether --with-dpms-ext or --without-dpms-ext was given.
-if test "${with_dpms_ext+set}" = set; then
-  withval="$with_dpms_ext"
-  with_dpms="$withval"; with_dpms_req="$withval"
-else
-  with_dpms=yes
-fi
+#       Check for HP XHPDisableReset and XHPEnableReset.
+#
+###############################################################################
 
-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"
-  ac_safe=`echo "X11/extensions/dpms.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/extensions/dpms.h""... $ac_c" 1>&6
-echo "configure:3901: checking for X11/extensions/dpms.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
   cat > conftest.$ac_ext <<EOF
-#line 3906 "configure"
+#line 4749 "configure"
 #include "confdefs.h"
-#include <X11/extensions/dpms.h>
+#include <X11/XHPlib.h>
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3911: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "XHPDisableReset" >/dev/null 2>&1; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  cat >> confdefs.h <<\EOF
+#define HAVE_XHPDISABLERESET 1
+EOF
+
+                   SAVER_LIBS="-lXhp11 $SAVER_LIBS"
 fi
 rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_dpms=yes
-else
-  echo "$ac_t""no" 1>&6
-fi
 
   CPPFLAGS="$ac_save_CPPFLAGS"
 
-  # if that succeeded, then check for the -lXdpms
-  if test $have_dpms = yes; then
-    have_dpms=no
-    
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
-  echo $ac_n "checking for DPMSInfo in -lXdpms""... $ac_c" 1>&6
-echo "configure:3954: checking for DPMSInfo in -lXdpms" >&5
-ac_lib_var=`echo Xdpms'_'DPMSInfo | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lXdpms -lXext -lX11 $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3962 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char DPMSInfo();
 
-int main() {
-DPMSInfo()
-; return 0; }
-EOF
-if { (eval echo configure:3973: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+###############################################################################
+#
+#       Check for /proc/interrupts.
+#
+###############################################################################
+
+have_proc_interrupts=no
+with_proc_interrupts_req=unspecified
+# Check whether --with-proc-interrupts or --without-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
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  with_proc_interrupts=yes
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_dpms=yes; SAVER_LIBS="$SAVER_LIBS -lXdpms"
+
+if test "$with_proc_interrupts" = yes; then
+
+   echo $ac_n "checking whether /proc/interrupts contains keyboard data""... $ac_c" 1>&6
+echo "configure:4787: checking whether /proc/interrupts contains keyboard data" >&5
+if eval "test \"`echo '$''{'ac_cv_have_proc_interrupts'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  echo "$ac_t""no" 1>&6
+  ac_cv_have_proc_interrupts=no
+     if grep keyboard /proc/interrupts >/dev/null 2>&1 ; then
+       ac_cv_have_proc_interrupts=yes
+     fi
+    
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-  fi
+echo "$ac_t""$ac_cv_have_proc_interrupts" 1>&6
+   have_proc_interrupts=$ac_cv_have_proc_interrupts
 
-  # if that succeeded, then we've really got it.
-  if test $have_dpms = yes; then
+  if test "$have_proc_interrupts" = yes; then
     cat >> confdefs.h <<\EOF
-#define HAVE_DPMS_EXTENSION 1
+#define HAVE_PROC_INTERRUPTS 1
 EOF
 
   fi
 
-elif test $with_dpms != no; then
-  echo "error: must be yes or no: --with-dpms-ext=$with_dpms"
+elif test "$with_proc_interrupts" != no; then
+  echo "error: must be yes or no: --with-proc-interrupts=$with_proc_interrupts"
   exit 1
 fi
 
 
-
-# Check for Motif and Athena --with and --without arguments.
+###############################################################################
 #
-have_motif=no
-have_athena=no
-have_athena3d=no
-with_motif_req=unspecified
-with_athena_req=unspecified
+#       The --enable-locking option
+#
+###############################################################################
 
-# Check whether --with-motif or --without-motif was given.
-if test "${with_motif+set}" = set; then
-  withval="$with_motif"
-  with_motif="$withval"; with_motif_req="$withval"
+# Check whether --enable-locking or --disable-locking was given.
+if test "${enable_locking+set}" = set; then
+  enableval="$enable_locking"
+  enable_locking="$enableval"
 else
-  with_motif=no
+  enable_locking=yes
 fi
 
+if test "$enable_locking" = yes; then
+  true
+elif test "$enable_locking" = no; then
+  cat >> confdefs.h <<\EOF
+#define NO_LOCKING 1
+EOF
 
-# Check whether --with-athena or --without-athena was given.
-if test "${with_athena+set}" = set; then
-  withval="$with_athena"
-  with_athena="$withval"; with_athena_req="$withval"
 else
-  with_athena=no
+  echo "error: must be yes or no: --enable-locking=$enable_locking"
+  exit 1
 fi
 
 
-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_athena != yes -a $with_athena != no ; then
-  echo "error: must be yes or no: --with-athena=$with_athena"
-  exit 1
-fi
+###############################################################################
+#
+#       The --enable-vt-locking option
+#
+###############################################################################
+
+#ac_vt_lockswitch=no
+#AC_ARG_ENABLE(vt-locking,[
+#  --enable-vt-locking     Compile in support for locking Virtual Terminals.
+#                          This is the default if the system supports it, and
+#                          if locking support is included (--enable-locking.)
+#  --disable-vt-locking    Do not allow locking of VTs, even if locking is
+#                          enabled.],
+#  [enable_vt_locking="$enableval"],[enable_vt_locking=yes])
+#if test "$enable_vt_locking" = yes; then
+#
+#  AC_CACHE_CHECK([for the VT_LOCKSWITCH ioctl], ac_cv_vt_lockswitch,
+#   [AC_TRY_COMPILE([#include <fcntl.h>
+#                   #include <sys/ioctl.h>
+#                   #include <sys/vt.h>],
+#                  [int x = VT_LOCKSWITCH; int y = VT_UNLOCKSWITCH;],
+#                  [ac_cv_vt_lockswitch=yes],
+#                  [ac_cv_vt_lockswitch=no])])
+#  ac_vt_lockswitch=$ac_cv_vt_lockswitch
+#
+#elif test "$enable_vt_locking" = no; then
+#  true
+#else
+#  echo "error: must be yes or no: --enable-vt-locking=$enable_vt_locking"
+#  exit 1
+#fi
+#
+#if test "$ac_vt_lockswitch" = yes; then
+#  AC_DEFINE(HAVE_VT_LOCKSWITCH)
+#  # the VT_LOCKSWITCH ioctl can only be used when running as root.
+#  # #### but it doesn't work yet, so don't worry about that for now.
+##  need_setuid=yes
+#fi
 
 
-# Saying --without-motif is the same as saying --with-athena.
-if test $with_motif_req = no ; then
-  with_athena_req=yes
-  with_athena=yes
-fi
 
-# Saying --without-athena is the same as saying --with-motif.
-if test $with_athena_req = no ; then
-  with_motif_req=yes
-  with_motif=yes
-fi
+###############################################################################
+#
+#       Check for PAM.
+#
+###############################################################################
 
-# Check for Motif and Athena headers.
+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
 
-check_motif() {
-  
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
-echo "configure:4072: checking for Xm/Xm.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4077 "configure"
-#include "confdefs.h"
-#include <Xm/Xm.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_motif=yes
-                    cat >> confdefs.h <<\EOF
-#define HAVE_MOTIF 1
-EOF
+have_pam=no
+with_pam_req=unspecified
 
-                    SAVER_LIBS="-lXm $SAVER_LIBS"
+# Check whether --with-pam or --without-pam was given.
+if test "${with_pam+set}" = set; then
+  withval="$with_pam"
+  with_pam="$withval"; with_pam_req="$withval"
 else
-  echo "$ac_t""no" 1>&6
+  with_pam=$with_pam_default
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-}
 
-check_athena() {
-  have_athena=no
-  have_athena3d=no
+
+   case "$with_pam" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for PAM headers""... $ac_c" 1>&6
+echo "configure:4920: checking for PAM headers" >&5
+     d=$with_pam/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for PAM libs""... $ac_c" 1>&6
+echo "configure:4930: checking for PAM libs" >&5
+     d=$with_pam/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_pam_req="yes"
+     with_pam=$with_pam_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+  
+
+if test "$enable_locking" = yes -a "$with_pam" = yes; then
+  echo $ac_n "checking for PAM""... $ac_c" 1>&6
+echo "configure:4956: checking for PAM" >&5
+if eval "test \"`echo '$''{'ac_cv_pam'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "X11/Xaw/Dialog.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/Xaw/Dialog.h""... $ac_c" 1>&6
-echo "configure:4122: checking for X11/Xaw/Dialog.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
   cat > conftest.$ac_ext <<EOF
-#line 4127 "configure"
+#line 4967 "configure"
 #include "confdefs.h"
-#include <X11/Xaw/Dialog.h>
+#include <security/pam_appl.h>
+int main() {
+
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4132: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:4974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  ac_cv_pam=yes
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_cv_pam=no
 fi
 rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_athena=yes
-else
-  echo "$ac_t""no" 1>&6
+  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
-  echo $ac_n "checking for Xaw3dComputeTopShadowRGB in -lXaw3d""... $ac_c" 1>&6
-echo "configure:4171: checking for Xaw3dComputeTopShadowRGB in -lXaw3d" >&5
-ac_lib_var=`echo Xaw3d'_'Xaw3dComputeTopShadowRGB | sed 'y%./+-%__p_%'`
+echo "$ac_t""$ac_cv_pam" 1>&6
+  if test "$ac_cv_pam" = yes ; then
+    have_pam=yes
+    cat >> confdefs.h <<\EOF
+#define HAVE_PAM 1
+EOF
+
+    PASSWD_LIBS="${PASSWD_LIBS} -lpam"
+
+    # libpam typically requires dlopen and dlsym.  On FreeBSD,
+    # those are in libc.  On Linux and Solaris, they're in libdl.
+    echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
+echo "configure:4999: checking for dlopen in -ldl" >&5
+ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lXaw3d -lXt -lXmu -lXext -lX11 $LIBS"
+LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4179 "configure"
+#line 5007 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char Xaw3dComputeTopShadowRGB();
+char dlopen();
 
 int main() {
-Xaw3dComputeTopShadowRGB()
+dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4201,110 +5018,140 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_athena=yes; have_athena3d=yes
+  PASSWD_LIBS="${PASSWD_LIBS} -ldl"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
-
-  if test $have_athena3d = yes; then
-    SAVER_LIBS="-lXaw3d $SAVER_LIBS"
-  elif test $have_athena = yes; then
-    SAVER_LIBS="-lXaw $SAVER_LIBS"
-  fi
-}
-
-
-# If they asked for both motif and athena, check motif then athena.
-# If they asked for only motif, check motif then athena.
-# If they asked for only athena, check athena then motif.
-# If they asked for neither, check motif then athena.
-
-proselytize_motif=yes
-if test $with_motif = yes; then
-  # asked for both, or for motif only
-  check_motif
-  if test $have_motif = yes; then
-    with_athena=no
-    with_athena_req=no
-  else
-    check_athena
-  fi
-
-elif test $with_athena = yes; then
-  # asked for athena only
-  check_athena
-  if test $have_athena = yes; then
-    with_motif=no
-    proselytize_motif=no
-  else
-    check_motif
-  fi
-
-else
-  # asked for neither
-  check_motif
-  if test $have_motif = yes; then
-    with_athena=no
-  else
-    check_athena
-  fi
-
-fi
-
-if test $have_motif = yes; then
-  proselytize_motif=no
-fi
 
-# If we have Athena, check whether it's a version that includes
-# XawViewportSetCoordinates in Viewport.h (R3 (or R4?) don't.)
-if test $have_athena = yes ; then
-  echo $ac_n "checking for XawViewportSetCoordinates in Viewport.h""... $ac_c" 1>&6
-echo "configure:4266: checking for XawViewportSetCoordinates in Viewport.h" >&5
-if eval "test \"`echo '$''{'ac_cv_have_XawViewportSetCoordinates'+set}'`\" = set"; then
+    echo $ac_n "checking how to call pam_strerror""... $ac_c" 1>&6
+echo "configure:5040: checking how to call pam_strerror" >&5
+    if eval "test \"`echo '$''{'ac_cv_pam_strerror_args'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_cv_have_XawViewportSetCoordinates=no
-                 
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4278 "configure"
+#line 5045 "configure"
 #include "confdefs.h"
-#include <X11/Xaw/Viewport.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; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "XawViewportSetCoordinates" >/dev/null 2>&1; then
+if { (eval echo configure:5055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_pam_strerror_args=2
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  cat > conftest.$ac_ext <<EOF
+#line 5063 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+                                      #include <stdlib.h>
+                                      #include <security/pam_appl.h>
+int main() {
+char *s =
+                                       pam_strerror(PAM_SUCCESS);
+; return 0; }
+EOF
+if { (eval echo configure:5073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_pam_strerror_args=1
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_have_XawViewportSetCoordinates=yes
+  ac_pam_strerror_args=0
 fi
 rm -f conftest*
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+rm -f conftest*
+      ac_cv_pam_strerror_args=$ac_pam_strerror_args
 fi
 
-echo "$ac_t""$ac_cv_have_XawViewportSetCoordinates" 1>&6
-  if test $ac_cv_have_XawViewportSetCoordinates = yes ; then
-    cat >> confdefs.h <<\EOF
-#define HAVE_XawViewportSetCoordinates 1
+    ac_pam_strerror_args=$ac_cv_pam_strerror_args
+    if test "$ac_pam_strerror_args" = 1 ; then
+      echo "$ac_t""one argument" 1>&6
+    elif test "$ac_pam_strerror_args" = 2 ; then
+      cat >> confdefs.h <<\EOF
+#define PAM_STRERROR_TWO_ARGS 1
 EOF
 
+      echo "$ac_t""two arguments" 1>&6
+    else
+      echo "$ac_t""unknown" 1>&6
+    fi
   fi
 fi
 
 
-# If we have Motif, check whether it's really LessTif.
+###############################################################################
 #
-have_lesstif=no
-if test $have_motif = yes ; then
-  echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6
-echo "configure:4307: checking whether Motif is really LessTif" >&5
-if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then
+#       Check for Kerberos.
+#
+###############################################################################
+
+have_kerberos=no
+with_kerberos_req=unspecified
+
+# Check whether --with-kerberos or --without-kerberos was given.
+if test "${with_kerberos+set}" = set; then
+  withval="$with_kerberos"
+  with_kerberos="$withval"; with_kerberos_req="$withval"
+else
+  with_kerberos=yes
+fi
+
+
+
+   case "$with_kerberos" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Kerberos headers""... $ac_c" 1>&6
+echo "configure:5129: checking for Kerberos headers" >&5
+     d=$with_kerberos/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Kerberos libs""... $ac_c" 1>&6
+echo "configure:5139: checking for Kerberos libs" >&5
+     d=$with_kerberos/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_kerberos_req="yes"
+     with_kerberos=$with_kerberos_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+  
+
+if test "$enable_locking" = yes -a "$with_kerberos" = yes; then
+  echo $ac_n "checking for Kerberos""... $ac_c" 1>&6
+echo "configure:5165: checking for Kerberos" >&5
+if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
@@ -4314,122 +5161,103 @@ else
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4318 "configure"
+#line 5176 "configure"
 #include "confdefs.h"
-#include <Xm/Xm.h>
+#include <krb.h>
 int main() {
-long vers = LesstifVersion;
+
 ; return 0; }
 EOF
-if { (eval echo configure:4325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5183: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  ac_cv_have_lesstif=yes
+  ac_cv_kerberos=yes
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_have_lesstif=no
+  ac_cv_kerberos=no
 fi
 rm -f conftest*
   CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-echo "$ac_t""$ac_cv_have_lesstif" 1>&6
-  have_lesstif=$ac_cv_have_lesstif
-fi
+echo "$ac_t""$ac_cv_kerberos" 1>&6
+  if test "$ac_cv_kerberos" = yes ; then
+    have_kerberos=yes
+    cat >> confdefs.h <<\EOF
+#define HAVE_KERBEROS 1
+EOF
 
-# don't cache this
-unset ac_cv_good_lesstif
 
-good_lesstif=no
-if test $have_lesstif = yes ; then
-  # It must be at least "GNU Lesstif 0.82".
-  # #### If you change this, also sync the warning message lower down.
-  echo $ac_n "checking whether LessTif is of a recent enough vintage""... $ac_c" 1>&6
-echo "configure:4350: checking whether LessTif is of a recent enough vintage" >&5
-if eval "test \"`echo '$''{'ac_cv_good_lesstif'+set}'`\" = set"; then
+    # from Tim Showalter <tjs+@andrew.cmu.edu>
+    PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes"
+    echo $ac_n "checking for res_search""... $ac_c" 1>&6
+echo "configure:5207: checking for res_search" >&5
+if eval "test \"`echo '$''{'ac_cv_func_res_search'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test "$cross_compiling" = yes; then
-  # cross compiling?  Make an ass out of umption.
-                              ac_cv_good_lesstif=yes
-else
   cat > conftest.$ac_ext <<EOF
-#line 4365 "configure"
+#line 5212 "configure"
 #include "confdefs.h"
-#include <Xm/Xm.h>
-                               int main() { exit(LesstifVersion < 82); }
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char res_search(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char res_search();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_res_search) || defined (__stub___res_search)
+choke me
+#else
+res_search();
+#endif
+
+; return 0; }
 EOF
-if { (eval echo configure:4370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_good_lesstif=yes
+if { (eval echo configure:5235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_func_res_search=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_good_lesstif=no
-fi
-rm -fr conftest*
-fi
-
-  CPPFLAGS="$ac_save_CPPFLAGS"
+  rm -rf conftest*
+  eval "ac_cv_func_res_search=no"
 fi
-
-echo "$ac_t""$ac_cv_good_lesstif" 1>&6
-  good_lesstif=$ac_cv_good_lesstif
+rm -f conftest*
 fi
 
-
-# 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.
-#
-have_xp_ext=no
-if test $have_motif = yes ; then
-   have_xp_ext=no
-   
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  ac_save_LDFLAGS="$LDFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  if test \! -z "$libdir" ; then
-    LDFLAGS="$LDFLAGS -L$libdir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  if test \! -z "$x_libraries" ; then
-    LDFLAGS="$LDFLAGS -L$x_libraries"
-  fi
-  echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6
-echo "configure:4414: checking for XpQueryExtension in -lXp" >&5
-ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$ac_cv_func_'res_search`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  :
+else
+  echo "$ac_t""no" 1>&6
+echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
+echo "configure:5253: checking for res_search in -lresolv" >&5
+ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lXp -lX11 -lXext -lm $LIBS"
+LIBS="-lresolv  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4422 "configure"
+#line 5261 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char XpQueryExtension();
+char res_search();
 
 int main() {
-XpQueryExtension()
+res_search()
 ; return 0; }
 EOF
-if { (eval echo configure:4433: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4444,360 +5272,524 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_xp_ext=yes; SAVER_LIBS="$SAVER_LIBS -lXp"
+  PASSWD_LIBS="${PASSWD_LIBS} -lresolv"
 else
   echo "$ac_t""no" 1>&6
+echo "configure: warning: Can't find DNS resolver libraries needed for Kerberos" 1>&2
+      
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  LDFLAGS="$ac_save_LDFLAGS"
 fi
 
 
-# check for XPM header.
+  fi
+fi
+
+
+###############################################################################
 #
-have_xpm=no
-with_xpm_req=unspecified
-# Check whether --with-xpm or --without-xpm was given.
-if test "${with_xpm+set}" = set; then
-  withval="$with_xpm"
-  with_xpm="$withval"; with_xpm_req="$withval"
+#       Check for the nine billion variants of shadow passwords...
+#
+###############################################################################
+
+need_setuid=no
+
+have_shadow=no
+with_shadow_req=unspecified
+
+# Check whether --with-shadow or --without-shadow was given.
+if test "${with_shadow+set}" = set; then
+  withval="$with_shadow"
+  with_shadow="$withval"; with_shadow_req="$withval"
 else
-  with_xpm=yes
+  with_shadow=yes
+fi
+
+
+
+   case "$with_shadow" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for shadow password headers""... $ac_c" 1>&6
+echo "configure:5328: checking for shadow password headers" >&5
+     d=$with_shadow/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for shadow password libs""... $ac_c" 1>&6
+echo "configure:5338: checking for shadow password libs" >&5
+     d=$with_shadow/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&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
 
-if test $with_xpm = yes; then
+
+###############################################################################
+#
+#       Check for Sun "adjunct" passwords.
+#
+###############################################################################
+
+if test "$with_shadow" = yes ; then
+  echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6
+echo "configure:5376: checking for Sun-style shadow passwords" >&5
+if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6
-echo "configure:4479: checking for X11/xpm.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
   cat > conftest.$ac_ext <<EOF
-#line 4484 "configure"
+#line 5387 "configure"
 #include "confdefs.h"
-#include <X11/xpm.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; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4489: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:5400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  ac_cv_sun_adjunct=yes
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_cv_sun_adjunct=no
 fi
 rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_xpm=yes
-                   cat >> confdefs.h <<\EOF
-#define HAVE_XPM 1
-EOF
-
-                   XPM_LIBS="-lXpm"
-else
-  echo "$ac_t""no" 1>&6
+  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-elif test $with_xpm != no; then
-  echo "error: must be yes or no: --with-xpm=$with_xpm"
-  exit 1
+echo "$ac_t""$ac_cv_sun_adjunct" 1>&6
+  if test "$ac_cv_sun_adjunct" = yes; then
+    have_shadow_adjunct=yes
+    have_shadow=yes
+    need_setuid=yes
+  fi
 fi
 
 
-# check for the GL header
+###############################################################################
 #
-have_gl=no
-with_gl_req=unspecified
-# Check whether --with-gl or --without-gl was given.
-if test "${with_gl+set}" = set; then
-  withval="$with_gl"
-  with_gl="$withval"; with_gl_req="$withval"
-else
-  with_gl=yes
-fi
-
+#       Check for DEC and SCO so-called "enhanced" security.
+#
+###############################################################################
 
-if test $with_gl = yes; then
+if test "$with_shadow" = yes ; then
+  echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6
+echo "configure:5430: checking for DEC-style shadow passwords" >&5
+if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6
-echo "configure:4544: checking for GL/gl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
   cat > conftest.$ac_ext <<EOF
-#line 4549 "configure"
+#line 5441 "configure"
 #include "confdefs.h"
-#include <GL/gl.h>
+#include <stdlib.h>
+                                    #include <unistd.h>
+                                    #include <sys/types.h>
+                                    #include <pwd.h>
+                                    #include <sys/security.h>
+                                    #include <prot.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;
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:5458: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  ac_cv_enhanced_passwd=yes
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_cv_enhanced_passwd=no
 fi
 rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_gl=yes
-else
-  echo "$ac_t""no" 1>&6
+  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  if test $have_gl = yes ; then
-    
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6
-echo "configure:4585: checking for GL/glx.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "$ac_t""$ac_cv_enhanced_passwd" 1>&6
+  if test $ac_cv_enhanced_passwd = yes; then
+    have_shadow_enhanced=yes
+    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.
+    #
+    echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6
+echo "configure:5482: checking for getprpwnam in -lprot" >&5
+ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4590 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lprot -lx $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5490 "configure"
 #include "confdefs.h"
-#include <GL/glx.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getprpwnam();
+
+int main() {
+getprpwnam()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4595: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:5501: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_gl=yes
+  PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"
 else
   echo "$ac_t""no" 1>&6
+echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6
+echo "configure:5520: checking for getprpwnam in -lsecurity" >&5
+ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lsecurity  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5528 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getprpwnam();
+
+int main() {
+getprpwnam()
+; return 0; }
+EOF
+if { (eval echo configure:5539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  fi
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  PASSWD_LIBS="$PASSWD_LIBS -lsecurity"
+else
+  echo "$ac_t""no" 1>&6
+fi
 
-  # If we have the headers, try and figure out which vendor it's from.
-  #
-  if test $have_gl = yes ; then
+fi
 
-    cat >> confdefs.h <<\EOF
-#define HAVE_GL 1
-EOF
+  fi
+fi
 
-    have_mesa_gl=no
-    
+###############################################################################
+#
+#       Check for HP's entry in the "Not Invented Here" Sweepstakes.
+#
+###############################################################################
+
+if test "$with_shadow" = yes ; then
+  echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6
+echo "configure:5572: checking for HP-style shadow passwords" >&5
+if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
   cat > conftest.$ac_ext <<EOF
-#line 4635 "configure"
+#line 5583 "configure"
 #include "confdefs.h"
-#include <GL/glx.h>
+#include <stdlib.h>
+                                    #include <unistd.h>
+                                    #include <sys/types.h>
+                                    #include <pwd.h>
+                                    #include <hpsecurity.h>
+                                    #include <prot.h>
+int main() {
+struct s_passwd *p = getspwnam("nobody");
+                       const char *pw = p->pw_passwd;
+; return 0; }
 EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "Mesa" >/dev/null 2>&1; then
+if { (eval echo configure:5596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_hpux_passwd=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
   rm -rf conftest*
-  have_mesa_gl=yes
+  ac_cv_hpux_passwd=no
 fi
 rm -f conftest*
-
   CPPFLAGS="$ac_save_CPPFLAGS"
-    if test $have_mesa_gl = no ; then
-      GL_LIBS="-lGL -lGLU"
-    else
-      cat >> confdefs.h <<\EOF
-#define HAVE_MESA_GL 1
-EOF
-
-      GL_LIBS="-lMesaGL -lMesaGLU"
-    fi
-  fi
-
-elif test $with_gl != no; then
-  echo "error: must be yes or no: --with-gl=$with_gl"
-  exit 1
-fi
-
-
-# check for SGI XReadDisplay server extension header.
-#
-have_readdisplay=no
-with_readdisplay_req=unspecified
-# Check whether --with-readdisplay or --without-readdisplay was given.
-if test "${with_readdisplay+set}" = set; then
-  withval="$with_readdisplay"
-  with_readdisplay="$withval"; with_readdisplay_req="$withval"
-else
-  with_readdisplay=yes
 fi
 
-if test $with_readdisplay = yes; then
-  
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6
-echo "configure:4685: checking for X11/extensions/readdisplay.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+echo "$ac_t""$ac_cv_hpux_passwd" 1>&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
+    echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6
+echo "configure:5617: checking for bigcrypt in -lsec" >&5
+ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4690 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lsec  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5625 "configure"
 #include "confdefs.h"
-#include <X11/extensions/readdisplay.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char bigcrypt();
+
+int main() {
+bigcrypt()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:5636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_READ_DISPLAY_EXTENSION 1
-EOF
-
+  PASSWD_LIBS="$PASSWD_LIBS -lsec"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-elif test $with_readdisplay != no; then
-  echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
-  exit 1
+  fi
 fi
 
 
-# check for SGI's Iris Video Library header.
+###############################################################################
 #
-have_sgivideo=no
-with_sgivideo_req=unspecified
-# Check whether --with-sgivideo or --without-sgivideo was given.
-if test "${with_sgivideo+set}" = set; then
-  withval="$with_sgivideo"
-  with_sgivideo="$withval"; with_sgivideo_req="$withval"
+#       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
+  echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6
+echo "configure:5674: checking for FreeBSD-style shadow passwords" >&5
+if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  with_sgivideo=yes
+  if test -f /etc/master.passwd ; then
+                    ac_cv_master_passwd=yes
+                  else
+                    ac_cv_master_passwd=no
+                  fi
+fi
+
+echo "$ac_t""$ac_cv_master_passwd" 1>&6
+  if test "$ac_cv_master_passwd" = yes; then
+    need_setuid=yes
+  fi
 fi
 
-if test $with_sgivideo = yes; then
+
+###############################################################################
+#
+#       Check for traditional (ha!) shadow passwords.
+#
+###############################################################################
+
+if test "$with_shadow" = yes ; then
+  echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6
+echo "configure:5700: checking for generic shadow passwords" >&5
+if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  ac_safe=`echo "dmedia/vl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for dmedia/vl.h""... $ac_c" 1>&6
-echo "configure:4747: checking for dmedia/vl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  cat > conftest.$ac_ext <<EOF
+#line 5711 "configure"
+#include "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; }
+EOF
+if { (eval echo configure:5723: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_shadow=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_shadow=no
+fi
+rm -f conftest*
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+
+echo "$ac_t""$ac_cv_shadow" 1>&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
+    echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6
+echo "configure:5744: checking for getspnam in -lc" >&5
+ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4752 "configure"
+  ac_save_LIBS="$LIBS"
+LIBS="-lc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5752 "configure"
 #include "confdefs.h"
-#include <dmedia/vl.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char getspnam();
+
+int main() {
+getspnam()
+; return 0; }
 EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
+if { (eval echo configure:5763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
-  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
+LIBS="$ac_save_LIBS"
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_sgivideo=yes
+  have_getspnam=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  CPPFLAGS="$ac_save_CPPFLAGS"
-  if test $have_sgivideo = yes; then
-    have_sgivideo=no
-    echo $ac_n "checking for vlOpenVideo in -lvl""... $ac_c" 1>&6
-echo "configure:4782: checking for vlOpenVideo in -lvl" >&5
-ac_lib_var=`echo vl'_'vlOpenVideo | sed 'y%./+-%__p_%'`
+    if test "$have_getspnam" = no ; then
+      echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6
+echo "configure:5785: checking for getspnam in -lgen" >&5
+ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lvl  $LIBS"
+LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4790 "configure"
+#line 5793 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char vlOpenVideo();
+char getspnam();
 
 int main() {
-vlOpenVideo()
+getspnam()
 ; return 0; }
 EOF
-if { (eval echo configure:4801: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5804: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4812,303 +5804,459 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  have_sgivideo=yes
+  have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-    if test $have_sgivideo = yes; then
-      SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
-      SGI_VIDEO_LIBS="-lvl"
-      cat >> confdefs.h <<\EOF
-#define HAVE_SGI_VIDEO 1
-EOF
-
     fi
   fi
-elif test $with_sgivideo != no; then
-  echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
-  exit 1
 fi
 
 
-
-# Try to find a program to generate random text.
-#
-# Zippy is funnier than the idiocy generally spat out by `fortune',
-# so try to find that, by invoking Emacs and asking it where its 
-# libexec directory is ("yow" lives in there.)
+###############################################################################
 #
-# If that doesn't work, see if fortune, zippy, or yow are on $PATH,
-# and if so, use them.
+#       Check for other libraries needed for non-shadow passwords.
 #
-# If that doesn't work, look in /usr/games, and if it's there, use
-# the full pathname.
-#
-with_zippy_req=""
-# Check whether --with-zippy or --without-zippy was given.
-if test "${with_zippy+set}" = set; then
-  withval="$with_zippy"
-   with_zippy_req="$withval"; with_zippy="$withval" 
-else
-   with_zippy_req="$withval"; with_zippy="$withval" 
-fi
-
+###############################################################################
 
-if test "$with_zippy" = no || test "$with_zippy" = yes ; then
-  with_zippy=""
-  with_zippy_req=""
-fi
+if test "$enable_locking" = yes ; then
 
-if test -n "$with_zippy_req" ; then
-  ac_cv_zippy_program=""
-  case "$with_zippy_req" in
-    /*)
-      echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6
-echo "configure:4869: checking for $with_zippy_req" >&5
-      if test -x "$with_zippy_req" ; then
-        echo "$ac_t""yes" 1>&6
-      else
-        echo "$ac_t""no" 1>&6
-        with_zippy=""
-      fi
-    ;;
-    *)
-      # don't cache
-      unset ac_cv_path_zip2
-      # Extract the first word of "$with_zippy_req", so it can be a program name with args.
-set dummy $with_zippy_req; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4883: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then
+  # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
+  have_crypt=no
+  echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6
+echo "configure:5840: checking for crypt in -lc" >&5
+ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  case "$zip2" in
-  /*)
-  ac_cv_path_zip2="$zip2" # 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
-      ac_cv_path_zip2="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-  ;;
-esac
+  ac_save_LIBS="$LIBS"
+LIBS="-lc  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5848 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char crypt();
+
+int main() {
+crypt()
+; return 0; }
+EOF
+if { (eval echo configure:5859: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
-zip2="$ac_cv_path_zip2"
-if test -n "$zip2"; then
-  echo "$ac_t""$zip2" 1>&6
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_crypt=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
-      if test "$zip2" = ""; then
-        with_zippy=""
-      fi
+  if test "$have_crypt" = no ; then
+    echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
+echo "configure:5881: checking for crypt in -lcrypt" >&5
+ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lcrypt  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5889 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char crypt();
+
+int main() {
+crypt()
+; return 0; }
+EOF
+if { (eval echo configure:5900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
+else
+  echo "$ac_t""no" 1>&6
+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
-  ac_cv_zippy_program="$with_zippy"
+fi
+
+
+if test "$have_shadow_adjunct" = yes ; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ADJUNCT_PASSWD 1
+EOF
+
+elif test "$have_shadow_enhanced" = yes ; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_ENHANCED_PASSWD 1
+EOF
+
+elif test "$have_shadow_hpux" = yes ; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_HPUX_PASSWD 1
+EOF
+
+elif test "$have_shadow" = yes ; then
+  cat >> confdefs.h <<\EOF
+#define HAVE_SHADOW_PASSWD 1
+EOF
 
-elif test -n "$ac_cv_zippy_program"; then
-  echo "$ac_t""checking for zippy... (cached) $ac_cv_zippy_program" 1>&6
 fi
 
-if test ! -n "$ac_cv_zippy_program"; then
 
-  for ac_prog in emacs
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4929: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then
+###############################################################################
+#
+#       Check for -lXm.
+#
+###############################################################################
+
+have_motif=no
+with_motif_req=unspecified
+# Check whether --with-motif or --without-motif was given.
+if test "${with_motif+set}" = set; then
+  withval="$with_motif"
+  with_motif="$withval"; with_motif_req="$withval"
+else
+  with_motif=yes
+fi
+
+
+
+   case "$with_motif" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Motif headers""... $ac_c" 1>&6
+echo "configure:5984: checking for Motif headers" >&5
+     d=$with_motif/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Motif libs""... $ac_c" 1>&6
+echo "configure:5994: checking for Motif libs" >&5
+     d=$with_motif/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # 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"
+  ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
+echo "configure:6033: checking for Xm/Xm.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$emacs_exe"; then
-  ac_cv_prog_emacs_exe="$emacs_exe" # Let the user override the test.
+  cat > conftest.$ac_ext <<EOF
+#line 6038 "configure"
+#include "confdefs.h"
+#include <Xm/Xm.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6043: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
 else
-  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
-      ac_cv_prog_emacs_exe="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
+rm -f conftest*
 fi
-emacs_exe="$ac_cv_prog_emacs_exe"
-if test -n "$emacs_exe"; then
-  echo "$ac_t""$emacs_exe" 1>&6
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_motif=yes
+                     cat >> confdefs.h <<\EOF
+#define HAVE_MOTIF 1
+EOF
+
+                     MOTIF_LIBS="$MOTIF_LIBS -lXm"
 else
   echo "$ac_t""no" 1>&6
 fi
 
-test -n "$emacs_exe" && break
-done
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
 
-  for ac_prog in xemacs
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:4962: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then
+
+if test "$have_motif" = yes; then
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "Xm/ComboBox.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for Xm/ComboBox.h""... $ac_c" 1>&6
+echo "configure:6082: checking for Xm/ComboBox.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$xemacs_exe"; then
-  ac_cv_prog_xemacs_exe="$xemacs_exe" # Let the user override the test.
+  cat > conftest.$ac_ext <<EOF
+#line 6087 "configure"
+#include "confdefs.h"
+#include <Xm/ComboBox.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6092: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
 else
-  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
-      ac_cv_prog_xemacs_exe="$ac_prog"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
+rm -f conftest*
 fi
-xemacs_exe="$ac_cv_prog_xemacs_exe"
-if test -n "$xemacs_exe"; then
-  echo "$ac_t""$xemacs_exe" 1>&6
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_XMCOMBOBOX 1
+EOF
+
 else
   echo "$ac_t""no" 1>&6
 fi
 
-test -n "$xemacs_exe" && break
-done
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
 
 
-  ac_cv_zippy_program=""
-  eargs='-batch -q -nw --eval'
+###############################################################################
+#
+#       Check for -lgtk.
+#
+###############################################################################
 
-  if test -n "$emacs_exe" ; then
-    echo $ac_n "checking for emacs yow""... $ac_c" 1>&6
-echo "configure:4996: checking for emacs yow" >&5
-    #
-    # get emacs to tell us where the libexec directory is.
-    #
-    dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
-        2>/dev/null | tail -1`
-    dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
-    #
-    # try running libexec/yow and see if it exits without error.
-    #
-    if test x"$dir" != x -a -x $dir/yow ; then
-      if $dir/yow >&- 2>&- ; then
-       ac_cv_zippy_program="$dir/yow"
-       echo "$ac_t""$ac_cv_zippy_program" 1>&6
-      else
-       echo "$ac_t""no" 1>&6
-      fi
-    fi
-  fi
+have_gtk=no
+with_gtk_req=unspecified
+# Check whether --with-gtk or --without-gtk was given.
+if test "${with_gtk+set}" = set; then
+  withval="$with_gtk"
+  with_gtk="$withval"; with_gtk_req="$withval"
+else
+  with_gtk=yes
+fi
 
-  if test -z "$ac_cv_zippy_program" ; then
-    echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6
-echo "configure:5018: checking for xemacs yow" >&5
-    if test -n "$xemacs_exe" ; then
-      #
-      # get xemacs to tell us where the libexec directory is.
-      #
-      dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
-          2>/dev/null | tail -1`
-      dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
-      #
-      # try running libexec/yow and see if it exits without error.
-      #
-      if test x"$dir" != x -a -x $dir/yow ; then
-        if $dir/yow >&- 2>&- ; then
-         ac_cv_zippy_program="$dir/yow"
-         echo "$ac_t""$ac_cv_zippy_program" 1>&6
-       else
-         #
-         # in some xemacs installations, the pathname of the yow.lines file
-         # isn't hardcoded into the yow executable, and must be passed on 
-         # the command line.  See if it's in libexec/../etc/.
-
-         # M4 sucks!!
-         
-         dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
-         
-
-          yow="yow -f $dir_up/etc/yow.lines"
-         if $dir/$yow >&- 2>&- ; then
-           ac_cv_zippy_program="$dir/$yow"
-           echo "$ac_t""$ac_cv_zippy_program" 1>&6
-         else
-           echo "$ac_t""no" 1>&6
-         fi
-        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
+
+
+   case "$with_gtk" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Gtk headers""... $ac_c" 1>&6
+echo "configure:6155: checking for Gtk headers" >&5
+     d=$with_gtk/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Gtk libs""... $ac_c" 1>&6
+echo "configure:6165: checking for Gtk libs" >&5
+     d=$with_gtk/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_gtk_req="yes"
+     with_gtk=$with_gtk_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-gtk must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+  
+
+if test "$with_gtk" != yes -a "$with_gtk" != no ; then
+  echo "error: must be yes or no: --with-gtk=$with_gtk"
+  exit 1
+fi
+
+jurassic_gtk=no
+if test "$with_gtk" = yes; then
+  have_gtk=no
+  
+  # if the user specified --with-gtk=/foo/ then look in /foo/bin/
+  # for glib-config and gtk-config.
+  #
+  gtk_path="$PATH"
+
+  if test ! -z "$gtk_dir"; then
+    # canonicalize slashes.
+    gtk_dir=`echo "${gtk_dir}/bin" | sed 's@//*@/@g'`
+    gtk_path="$gtk_dir:$gtk_dir:$gtk_path"
   fi
 
-  # if that didn't work, try for some other programs...
-  if test -z "$ac_cv_zippy_program" ; then
-    fortune=''
-    for ac_prog in fortune zippy yow
+  for ac_prog in glib-config
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5064: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then
+echo "configure:6214: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_glib_config'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  if test -n "$fortune"; then
-  ac_cv_prog_fortune="$fortune" # Let the user override the test.
-else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  case "$glib_config" in
+  /*)
+  ac_cv_path_glib_config="$glib_config" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_glib_config="$glib_config" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$gtk_path"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_fortune="$ac_prog"
+      ac_cv_path_glib_config="$ac_dir/$ac_word"
       break
     fi
   done
   IFS="$ac_save_ifs"
+  ;;
+esac
 fi
-fi
-fortune="$ac_cv_prog_fortune"
-if test -n "$fortune"; then
-  echo "$ac_t""$fortune" 1>&6
+glib_config="$ac_cv_path_glib_config"
+if test -n "$glib_config"; then
+  echo "$ac_t""$glib_config" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-test -n "$fortune" && break
+test -n "$glib_config" && break
 done
 
-    # if that didn't work, try for those programs in /usr/games...
-    if test -z "$fortune" ; then
-      for ac_prog in fortune zippy yow
+  for ac_prog in gtk-config
 do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5099: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then
+echo "configure:6254: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_gtk_config'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  case "$fortune" in
+  case "$gtk_config" in
   /*)
-  ac_cv_path_fortune="$fortune" # Let the user override the test with a path.
+  ac_cv_path_gtk_config="$gtk_config" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_gtk_config="$gtk_config" # Let the user override the test with a dos path.
   ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in /usr/games:/usr/local/games$ac_dummy; do
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$gtk_path"
+  for ac_dir in $ac_dummy; do 
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
-      ac_cv_path_fortune="$ac_dir/$ac_word"
+      ac_cv_path_gtk_config="$ac_dir/$ac_word"
       break
     fi
   done
@@ -5116,395 +6264,2034 @@ else
   ;;
 esac
 fi
-fortune="$ac_cv_path_fortune"
-if test -n "$fortune"; then
-  echo "$ac_t""$fortune" 1>&6
+gtk_config="$ac_cv_path_gtk_config"
+if test -n "$gtk_config"; then
+  echo "$ac_t""$gtk_config" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+test -n "$gtk_config" && break
+done
+
+
+  if test -n "$glib_config" -a  -n "gtk_config" ; then
+    have_gtk=yes
+  fi
+  if test "$have_gtk" = yes; then
+    echo $ac_n "checking Gtk version number""... $ac_c" 1>&6
+echo "configure:6295: checking Gtk version number" >&5
+if eval "test \"`echo '$''{'ac_cv_gtk_version_string'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_gtk_version_string=`$glib_config --version`
+fi
+
+echo "$ac_t""$ac_cv_gtk_version_string" 1>&6
+    ac_gtk_version_string=$ac_cv_gtk_version_string
+    # M4 sucks!!
+    
+    maj=`echo $ac_gtk_version_string | sed -n 's/\..*//p'`
+    min=`echo $ac_gtk_version_string | sed -n 's/[^.]*\.\([^.]*\).*/\1/p'`
+    
+    ac_gtk_version=`echo "$maj * 1000 + $min" | bc`
+    if test -z "$ac_gtk_version"; then
+      ac_gtk_version=unknown
+      ac_gtk_version_string=unknown
+    fi
+    if test "$ac_gtk_version" = "unknown" || test "$ac_gtk_version" -lt 1002
+    then
+      have_gtk=no
+      jurassic_gtk=yes
+    fi
+  fi
+  if test "$have_gtk" = yes; then
+    echo $ac_n "checking for Gtk includes""... $ac_c" 1>&6
+echo "configure:6322: checking for Gtk includes" >&5
+if eval "test \"`echo '$''{'ac_cv_gtk_config_cflags'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_gtk_config_cflags=`$gtk_config --cflags`
+fi
+
+echo "$ac_t""$ac_cv_gtk_config_cflags" 1>&6
+    echo $ac_n "checking for Gtk libs""... $ac_c" 1>&6
+echo "configure:6331: checking for Gtk libs" >&5
+if eval "test \"`echo '$''{'ac_cv_gtk_config_libs'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_gtk_config_libs=`$gtk_config --libs`
+fi
+
+echo "$ac_t""$ac_cv_gtk_config_libs" 1>&6
+    INCLUDES="$INCLUDES $ac_cv_gtk_config_cflags"
+    GTK_LIBS="$GTK_LIBS $ac_cv_gtk_config_libs"
+    cat >> confdefs.h <<\EOF
+#define HAVE_GTK 1
+EOF
+
+  fi
+fi
+
+
+###############################################################################
+#
+#       Checking whether Motif is really Lesstif.
+#
+###############################################################################
+
+have_lesstif=no
+if test "$have_motif" = yes ; then
+  echo $ac_n "checking whether Motif is really LessTif""... $ac_c" 1>&6
+echo "configure:6358: checking whether Motif is really LessTif" >&5
+if eval "test \"`echo '$''{'ac_cv_have_lesstif'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  cat > conftest.$ac_ext <<EOF
+#line 6369 "configure"
+#include "confdefs.h"
+#include <Xm/Xm.h>
+int main() {
+long vers = LesstifVersion;
+; return 0; }
+EOF
+if { (eval echo configure:6376: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+  rm -rf conftest*
+  ac_cv_have_lesstif=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ac_cv_have_lesstif=no
+fi
+rm -f conftest*
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+
+echo "$ac_t""$ac_cv_have_lesstif" 1>&6
+  have_lesstif=$ac_cv_have_lesstif
+fi
+
+
+lesstif_version=unknown
+lesstif_version_string=unknown
+
+if test "$have_lesstif" = yes ; then
+  ltv=unknown
+  echo unknown > conftest-lt
+  echo $ac_n "checking LessTif version number""... $ac_c" 1>&6
+echo "configure:6401: checking LessTif version number" >&5
+if eval "test \"`echo '$''{'ac_cv_lesstif_version_string'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  if test "$cross_compiling" = yes; then
+  ac_cv_lesstif_version=unknown
+                     ac_cv_lesstif_version_string=unknown
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6416 "configure"
+#include "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);
+                     }
+EOF
+if { (eval echo configure:6429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  ltv=`cat conftest-lt`
+                     ac_cv_lesstif_version=`echo $ltv | sed 's/ .*//'`
+                     ac_cv_lesstif_version_string=`echo $ltv | sed 's/.* //'`
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_lesstif_version=unknown
+                     ac_cv_lesstif_version_string=unknown
+fi
+rm -fr conftest*
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+
+echo "$ac_t""$ac_cv_lesstif_version_string" 1>&6
+  rm -f 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
+  echo $ac_n "checking Motif version number""... $ac_c" 1>&6
+echo "configure:6459: checking Motif version number" >&5
+if eval "test \"`echo '$''{'ac_cv_motif_version_string'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  if test "$cross_compiling" = yes; then
+  ac_cv_motif_version=unknown
+                     ac_cv_motif_version_string=unknown
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6474 "configure"
+#include "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);
+                     }
+EOF
+if { (eval echo configure:6487: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+then
+  mtv=`cat conftest-mt`
+                     ac_cv_motif_version=`echo $mtv | sed 's/ .*//'`
+                     ac_cv_motif_version_string=`echo $mtv | sed 's/.* //'`
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -fr conftest*
+  ac_cv_motif_version=unknown
+                     ac_cv_motif_version_string=unknown
+fi
+rm -fr conftest*
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+
+echo "$ac_t""$ac_cv_motif_version_string" 1>&6
+  rm -f conftest-mt
+  motif_version=$ac_cv_motif_version
+  motif_version_string=$ac_cv_motif_version_string
+
+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
+   echo $ac_n "checking whether Motif requires XPM""... $ac_c" 1>&6
+echo "configure:6531: checking whether Motif requires XPM" >&5
+   if test "$motif_version" = "unknown" || test "$motif_version" -ge 2000
+   then
+     motif_requires_xpm=yes
+     echo "$ac_t""maybe" 1>&6
+   else
+     echo "$ac_t""no" 1>&6
+   fi
+fi
+
+
+###############################################################################
+#
+#       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.
+#
+###############################################################################
+
+have_xp_ext=no
+if test "$have_motif" = yes ; then
+   have_xp_ext=no
+   
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for XpQueryExtension in -lXp""... $ac_c" 1>&6
+echo "configure:6573: checking for XpQueryExtension in -lXp" >&5
+ac_lib_var=`echo Xp'_'XpQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXp -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6581 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char XpQueryExtension();
+
+int main() {
+XpQueryExtension()
+; return 0; }
+EOF
+if { (eval echo configure:6592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xp_ext=yes; MOTIF_LIBS="$MOTIF_LIBS -lXp"
+else
+  echo "$ac_t""no" 1>&6
+true
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
+fi
+
+
+###############################################################################
+#
+#       Checking whether Motif requires -lXintl (for _Xsetlocale.)
+#
+###############################################################################
+
+have_xintl=no
+if test "$have_motif" = yes ; then
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for _Xsetlocale in -lXintl""... $ac_c" 1>&6
+echo "configure:6646: checking for _Xsetlocale in -lXintl" >&5
+ac_lib_var=`echo Xintl'_'_Xsetlocale | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXintl -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6654 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char _Xsetlocale();
+
+int main() {
+_Xsetlocale()
+; return 0; }
+EOF
+if { (eval echo configure:6665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xintl=yes
+else
+  echo "$ac_t""no" 1>&6
+have_xintl=no
+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
+fi
+
+
+###############################################################################
+#
+#       Check for -lGL or -lMesaGL.
+#
+###############################################################################
+
+have_gl=no
+ac_have_mesa_gl=no
+with_gl_req=unspecified
+gl_halfassed=no
+# Check whether --with-gl or --without-gl was given.
+if test "${with_gl+set}" = set; then
+  withval="$with_gl"
+  with_gl="$withval"; with_gl_req="$withval"
+else
+  with_gl=yes
+fi
+
+
+
+   case "$with_gl" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for GL headers""... $ac_c" 1>&6
+echo "configure:6722: checking for GL headers" >&5
+     d=$with_gl/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for GL libs""... $ac_c" 1>&6
+echo "configure:6732: checking for GL libs" >&5
+     d=$with_gl/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_gl_req="yes"
+     with_gl=$with_gl_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   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"
+  ac_safe=`echo "GL/gl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for GL/gl.h""... $ac_c" 1>&6
+echo "configure:6768: checking for GL/gl.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6773 "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gl=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test "$have_gl" = yes ; then
+    
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "GL/glx.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for GL/glx.h""... $ac_c" 1>&6
+echo "configure:6809: checking for GL/glx.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 6814 "configure"
+#include "confdefs.h"
+#include <GL/glx.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:6819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gl=yes
+else
+  echo "$ac_t""no" 1>&6
+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.
+    #
+    echo $ac_n "checking whether GL is really MesaGL""... $ac_c" 1>&6
+echo "configure:6851: checking whether GL is really MesaGL" >&5
+if eval "test \"`echo '$''{'ac_cv_have_mesa_gl'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_cv_have_mesa_gl=no
+       
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  cat > conftest.$ac_ext <<EOF
+#line 6863 "configure"
+#include "confdefs.h"
+#include <GL/glx.h>
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "Mesa" >/dev/null 2>&1; then
+  rm -rf conftest*
+  ac_cv_have_mesa_gl=yes
+fi
+rm -f conftest*
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+      
+fi
+
+echo "$ac_t""$ac_cv_have_mesa_gl" 1>&6
+    ac_have_mesa_gl=$ac_cv_have_mesa_gl
+
+    gl_lib_1=""
+    GL_LIBS=""
+
+
+    # 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.)
+    #
+    if test "$ac_have_mesa_gl" = yes; then
+      echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
+echo "configure:6892: checking for pthread_create in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpthread  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6900 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
+EOF
+if { (eval echo configure:6911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  GL_LIBS="-lpthread"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+    fi
+
+
+    # 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"
+
+  echo $ac_n "checking for glXCreateContext in -lMesaGL""... $ac_c" 1>&6
+echo "configure:6958: checking for glXCreateContext in -lMesaGL" >&5
+ac_lib_var=`echo MesaGL'_'glXCreateContext | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lMesaGL -lMesaGLU $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 6966 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char glXCreateContext();
+
+int main() {
+glXCreateContext()
+; return 0; }
+EOF
+if { (eval echo configure:6977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gl_lib_1="MesaGL"
+                      GL_LIBS="-lMesaGL -lMesaGLU $GL_LIBS"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
+    fi
+
+    if test "$gl_lib_1" = "" ; then
+      
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for glXCreateContext in -lGL""... $ac_c" 1>&6
+echo "configure:7023: checking for glXCreateContext in -lGL" >&5
+ac_lib_var=`echo GL'_'glXCreateContext | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lGL -lGLU $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7031 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char glXCreateContext();
+
+int main() {
+glXCreateContext()
+; return 0; }
+EOF
+if { (eval echo configure:7042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  gl_lib_1="GL"
+                      GL_LIBS="-lGL -lGLU $GL_LIBS"
+else
+  echo "$ac_t""no" 1>&6
+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.
+      cat >> confdefs.h <<\EOF
+#define HAVE_GL 1
+EOF
+
+      if test "$ac_have_mesa_gl" = yes ; then
+        cat >> confdefs.h <<\EOF
+#define HAVE_MESA_GL 1
+EOF
+
+      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
+
+      echo $ac_n "checking MesaGL version number""... $ac_c" 1>&6
+echo "configure:7100: checking MesaGL version number" >&5
+if eval "test \"`echo '$''{'ac_cv_mesagl_version_string'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7105 "configure"
+#include "confdefs.h"
+#include <GL/gl.h>
+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"
+
+          # M4 sucks!!
+         
+         mglv=`(eval "$ac_cpp conftest.$ac_ext") 2>&5 | sed -n \
+              's/^configure:.*\([0-9][0-9]*\).*\([0-9][0-9]*\).*$/\1.\2/p'`
+         
+
+         rm -f 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
+           maj=`echo $mglv | sed -n 's/\..*//p'`
+           min=`echo $mglv | sed -n 's/.*\.//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
+
+echo "$ac_t""$ac_cv_mesagl_version_string" 1>&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"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for glBindTexture in -l$gl_lib_1""... $ac_c" 1>&6
+echo "configure:7171: checking for glBindTexture in -l$gl_lib_1" >&5
+ac_lib_var=`echo $gl_lib_1'_'glBindTexture | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-l$gl_lib_1 $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7179 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char glBindTexture();
+
+int main() {
+glBindTexture()
+; return 0; }
+EOF
+if { (eval echo configure:7190: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  cat >> confdefs.h <<\EOF
+#define HAVE_GLBINDTEXTURE 1
+EOF
+
+else
+  echo "$ac_t""no" 1>&6
+true
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
+
+
+    # Check whether the `xscreensaver' executable should link against GL.
+    # See comments in utils/visual-gl.c for why this is sometimes necessary.
+    #
+    echo $ac_n "checking whether drastic GL measures must be taken""... $ac_c" 1>&6
+echo "configure:7224: checking whether drastic GL measures must be taken" >&5
+    case "$host" in
+      *-sgi*)
+        echo "$ac_t""yes -- hello, SGI." 1>&6
+        cat >> confdefs.h <<\EOF
+#define DAEMON_USE_GL 1
+EOF
+
+        SAVER_GL_SRCS='$(UTILS_SRC)/visual-gl.c'
+        SAVER_GL_OBJS='$(UTILS_BIN)/visual-gl.o'
+        SAVER_GL_LIBS="$GL_LIBS"
+      ;;
+      *)
+        echo "$ac_t""no -- non-SGI." 1>&6
+        SAVER_GL_SRCS=''
+        SAVER_GL_OBJS=''
+        SAVER_GL_LIBS=''
+      ;;
+    esac
+
+  fi
+
+elif test "$with_gl" != no; then
+  echo "error: must be yes or no: --with-gl=$with_gl"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for -lgle.
+#
+###############################################################################
+
+have_gle=no
+with_gle_req=unspecified
+gle_halfassed=no
+# Check whether --with-gle or --without-gle was given.
+if test "${with_gle+set}" = set; then
+  withval="$with_gle"
+  with_gle="$withval"; with_gle_req="$withval"
+else
+  with_gle=yes
+fi
+
+
+
+   case "$with_gle" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for GLE headers""... $ac_c" 1>&6
+echo "configure:7277: checking for GLE headers" >&5
+     d=$with_gle/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for GLE libs""... $ac_c" 1>&6
+echo "configure:7287: checking for GLE libs" >&5
+     d=$with_gle/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_gle_req="yes"
+     with_gle=$with_gle_req
+     ;;
+
+    *)
+     echo ""
+     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
+     ;;
+   esac
+  
+
+GLE_LIBS=""
+
+if test "$with_gle" = yes; then
+
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "GL/gutil.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for GL/gutil.h""... $ac_c" 1>&6
+echo "configure:7323: checking for GL/gutil.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7328 "configure"
+#include "confdefs.h"
+#include <GL/gutil.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7333: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gle=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test "$have_gle" = yes ; then
+    
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "GL/tube.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for GL/tube.h""... $ac_c" 1>&6
+echo "configure:7364: checking for GL/tube.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7369 "configure"
+#include "confdefs.h"
+#include <GL/tube.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7374: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gle=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
+
+  if test "$have_gle" = yes ; then
+    have_gle=no
+    gle_halfassed=yes
+    
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  ac_save_LDFLAGS="$LDFLAGS"
+#  ac_save_LIBS="$LIBS"
+
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  # note: $X_CFLAGS includes $x_includes
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for gleCreateGC in -lgle""... $ac_c" 1>&6
+echo "configure:7419: checking for gleCreateGC in -lgle" >&5
+ac_lib_var=`echo gle'_'gleCreateGC | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lgle $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7427 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char gleCreateGC();
+
+int main() {
+gleCreateGC()
+; return 0; }
+EOF
+if { (eval echo configure:7438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gle=yes; gle_halfassed=no; GLE_LIBS="-lgle"
+else
+  echo "$ac_t""no" 1>&6
+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)
+
+    # if it wasn't in libgle, then look in libmatrix.
+    if test "$have_gle" = 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"
+
+  echo $ac_n "checking for uview_direction_d in -lmatrix""... $ac_c" 1>&6
+echo "configure:7497: checking for uview_direction_d in -lmatrix" >&5
+ac_lib_var=`echo matrix'_'uview_direction_d | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lmatrix $GL_LIBS -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7505 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char uview_direction_d();
+
+int main() {
+uview_direction_d()
+; return 0; }
+EOF
+if { (eval echo configure:7516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_gle=yes; gle_halfassed=no;
+                      GLE_LIBS="$GLE_LIBS -lmatrix"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
+    fi
+  fi
+
+  if test "$have_gle" = yes ; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_GLE 1
+EOF
+
+  fi
+
+elif test "$with_gle" != no; then
+  echo "error: must be yes or no: --with-gle=$with_gle"
+  exit 1
+
+fi
+
+
+
+###############################################################################
+#
+#       Check for -lXpm.
+#
+###############################################################################
+
+have_xpm=no
+with_xpm_req=unspecified
+# Check whether --with-xpm or --without-xpm was given.
+if test "${with_xpm+set}" = set; then
+  withval="$with_xpm"
+  with_xpm="$withval"; with_xpm_req="$withval"
+else
+  with_xpm=yes
+fi
+
+
+
+   case "$with_xpm" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XPM headers""... $ac_c" 1>&6
+echo "configure:7583: checking for XPM headers" >&5
+     d=$with_xpm/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XPM libs""... $ac_c" 1>&6
+echo "configure:7593: checking for XPM libs" >&5
+     d=$with_xpm/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xpm_req="yes"
+     with_xpm=$with_xpm_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xpm must be \"yes\", \"no\", or a directory."
+     echo "       If it is a directory, then \`DIR/include' will be added to"
+     echo "       the -I list, and \`DIR/lib' will be added to the -L list."
+     exit 1
+     ;;
+   esac
+  
+
+if test "$with_xpm" = yes; then
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "X11/xpm.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/xpm.h""... $ac_c" 1>&6
+echo "configure:7626: checking for X11/xpm.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7631 "configure"
+#include "confdefs.h"
+#include <X11/xpm.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xpm=yes
+                    cat >> confdefs.h <<\EOF
+#define HAVE_XPM 1
+EOF
+
+                    XPM_LIBS="-lXpm"
+else
+  echo "$ac_t""no" 1>&6
+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
+
+# See comment near $motif_requires_xpm, above.
+# Need to do this here, after both Motif and XPM have been checked for.
+#
+if test "$have_motif" = yes -a "$have_xpm" = yes ; then
+  if test "$motif_requires_xpm" = yes ; then
+    MOTIF_LIBS="$MOTIF_LIBS $XPM_LIBS"
+  fi
+fi
+
+
+###############################################################################
+#
+#       Check for the XSHM server extension.
+#
+###############################################################################
+
+have_xshm=no
+with_xshm_req=unspecified
+# Check whether --with-xshm-ext or --without-xshm-ext was given.
+if test "${with_xshm_ext+set}" = set; then
+  withval="$with_xshm_ext"
+  with_xshm="$withval"; with_xshm_req="$withval"
+else
+  with_xshm=yes
+fi
+
+
+
+   case "$with_xshm" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XSHM headers""... $ac_c" 1>&6
+echo "configure:7702: checking for XSHM headers" >&5
+     d=$with_xshm/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XSHM libs""... $ac_c" 1>&6
+echo "configure:7712: checking for XSHM libs" >&5
+     d=$with_xshm/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xshm_req="yes"
+     with_xshm=$with_xshm_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xshm-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_xshm" = yes; then
+
+  # first check for Xshm.h.
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "X11/extensions/XShm.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/XShm.h""... $ac_c" 1>&6
+echo "configure:7747: checking for X11/extensions/XShm.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7752 "configure"
+#include "confdefs.h"
+#include <X11/extensions/XShm.h>
+EOF
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7757: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
+else
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
+fi
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xshm=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
-test -n "$fortune" && break
-done
-test -n "$fortune" || fortune="fortune"
+  CPPFLAGS="$ac_save_CPPFLAGS"
 
-    fi
+  # if that succeeded, then check for sys/ipc.h.
+  if test "$have_xshm" = yes; then
+    have_xshm=no
+    
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
-fi
-
-if test -z "$ac_cv_zippy_program" ; then
-  ac_cv_zippy_program=fortune
-fi
-
-cat >> confdefs.h <<EOF
-#define ZIPPY_PROGRAM "$ac_cv_zippy_program"
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6
+echo "configure:7791: checking for sys/ipc.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 7796 "configure"
+#include "confdefs.h"
+#include <sys/ipc.h>
 EOF
-
-
-
-
-
-# Allow locking to be disabled at compile-time.
-#
-have_locking=yes
-have_kerberos=no
-with_kerberos_req=unspecified
-have_shadow=no
-with_shadow_req=unspecified
-need_setuid=no
-
-# Check whether --enable-locking or --disable-locking was given.
-if test "${enable_locking+set}" = set; then
-  enableval="$enable_locking"
-  enable_locking="$enableval"
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=yes"
 else
-  enable_locking=yes
+  echo "$ac_err" >&5
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_header_$ac_safe=no"
 fi
-
-if test $enable_locking = yes; then
-
-  # Check for Kerberos.
-  #
-  # Check whether --with-kerberos or --without-kerberos was given.
-if test "${with_kerberos+set}" = set; then
-  withval="$with_kerberos"
-  with_kerberos="$withval"; with_kerberos_req="$withval"
+rm -f conftest*
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xshm=yes
 else
-  with_kerberos=yes
+  echo "$ac_t""no" 1>&6
 fi
 
-  if test $with_kerberos = yes; then
-    echo $ac_n "checking for Kerberos""... $ac_c" 1>&6
-echo "configure:5178: checking for Kerberos" >&5
-if eval "test \"`echo '$''{'ac_cv_kerberos'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  fi
+
+  # if that succeeded, then check for sys/shm.h.
+  if test "$have_xshm" = yes; then
+    have_xshm=no
+    
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "sys/shm.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for sys/shm.h""... $ac_c" 1>&6
+echo "configure:7836: checking for sys/shm.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   cat > conftest.$ac_ext <<EOF
-#line 5189 "configure"
+#line 7841 "configure"
 #include "confdefs.h"
-#include <krb.h>
-int main() {
-
-; return 0; }
+#include <sys/shm.h>
 EOF
-if { (eval echo configure:5196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:7846: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  ac_cv_kerberos=yes
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_kerberos=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-  CPPFLAGS="$ac_save_CPPFLAGS"
 fi
-
-echo "$ac_t""$ac_cv_kerberos" 1>&6
-    if test $ac_cv_kerberos = yes ; then
-      have_kerberos=yes
-      cat >> confdefs.h <<\EOF
-#define HAVE_KERBEROS 1
-EOF
-
-      PASSWD_LIBS="$PASSWD_LIBS -lkrb -ldes -lnsl -lsocket"
-    fi
-  elif test $with_kerberos != no; then
-    echo "error: must be yes or no: --with-kerberos=$with_kerberos"
-    exit 1
-  fi
-
-  # Next, check for the nine billion variants of shadow passwords...
-
-  passwd_cruft_done=no
-  # Check whether --with-shadow or --without-shadow was given.
-if test "${with_shadow+set}" = set; then
-  withval="$with_shadow"
-  with_shadow="$withval"; with_shadow_req="$withval"
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xshm=yes
 else
-  with_shadow=yes
+  echo "$ac_t""no" 1>&6
 fi
 
-  if test $with_shadow = no; then
-    passwd_cruft_done=yes
-  elif test $with_shadow != yes; then
-    echo "error: must be yes or no: --with-shadow=$with_shadow"
-    exit 1
+  CPPFLAGS="$ac_save_CPPFLAGS"
   fi
 
-
-  # Sun's "adjunct" passwords.
+  # AIX is pathological, as usual: apparently it's normal for the Xshm headers
+  # to exist, but the library code to not exist.  And even better, the library
+  # code is in its own library: libXextSam.a.  So, if we're on AIX, and that
+  # lib doesn't exist, give up.  (This lib gets added to X_EXTRA_LIBS, and
+  # that's not quite right, but close enough.)
   #
-  if test $passwd_cruft_done = no ; then
-    echo $ac_n "checking for Sun-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5246: checking for Sun-style shadow passwords" >&5
-if eval "test \"`echo '$''{'ac_cv_sun_adjunct'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
+  case "$host" in
+    *-aix*)
+      if  `uname -v` -eq 3 ; then
+        have_xshm=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"
-  cat > conftest.$ac_ext <<EOF
-#line 5257 "configure"
+
+  if test \! -z "$libdir" ; then
+    LDFLAGS="$LDFLAGS -L$libdir"
+  fi
+  # note: $X_LIBS includes $x_libraries
+  LDFLAGS="$LDFLAGS $X_LIBS $X_EXTRA_LIBS"
+
+  echo $ac_n "checking for XShmQueryExtension in -lXextSam""... $ac_c" 1>&6
+echo "configure:7898: checking for XShmQueryExtension in -lXextSam" >&5
+ac_lib_var=`echo XextSam'_'XShmQueryExtension | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lXextSam -lX11 -lXext -lm $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 7906 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-                                     #include <unistd.h>
-                                     #include <sys/types.h>
-                                     #include <sys/label.h>
-                                     #include <sys/audit.h>
-                                     #include <pwdadj.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char XShmQueryExtension();
+
 int main() {
-struct passwd_adjunct *p = getpwanam("nobody");
-                        const char *pw = p->pwa_passwd;
+XShmQueryExtension()
 ; return 0; }
 EOF
-if { (eval echo configure:5270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
-  ac_cv_sun_adjunct=yes
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_sun_adjunct=no
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
-  CPPFLAGS="$ac_save_CPPFLAGS"
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xshm=yes; X_EXTRA_LIBS="$X_EXTRA_LIBS -lXextSam"
+else
+  echo "$ac_t""no" 1>&6
+true
 fi
 
-echo "$ac_t""$ac_cv_sun_adjunct" 1>&6
-    if test $ac_cv_sun_adjunct = yes; then
-      have_shadow=yes
-      need_setuid=yes
-      passwd_cruft_done=yes
-      cat >> confdefs.h <<\EOF
-#define HAVE_ADJUNCT_PASSWD 1
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  LDFLAGS="$ac_save_LDFLAGS"
+#  LIBS="$ac_save_LIBS"
+  
+      fi
+    ;;
+  esac
+
+  # if that succeeded, then we've really got it.
+  if test "$have_xshm" = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_XSHM_EXTENSION 1
 EOF
 
-    fi
   fi
 
-  # DEC and SCO so-called "enhanced" security.
-  #
-  if test $passwd_cruft_done = no ; then
-    echo $ac_n "checking for DEC-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5299: checking for DEC-style shadow passwords" >&5
-if eval "test \"`echo '$''{'ac_cv_enhanced_passwd'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+elif test "$with_xshm" != no; then
+  echo "error: must be yes or no: --with-xshm-ext=$with_xshm"
+  exit 1
+fi
+
+
+###############################################################################
+#
+#       Check for the DOUBLE-BUFFER server extension.
+#
+###############################################################################
+
+have_xdbe=no
+with_xdbe_req=unspecified
+# Check whether --with-xdbe-ext or --without-xdbe-ext was given.
+if test "${with_xdbe_ext+set}" = set; then
+  withval="$with_xdbe_ext"
+  with_xdbe="$withval"; with_xdbe_req="$withval"
 else
+  with_xdbe=yes
+fi
+
+
+
+   case "$with_xdbe" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for DOUBLE-BUFFER headers""... $ac_c" 1>&6
+echo "configure:7984: checking for DOUBLE-BUFFER headers" >&5
+     d=$with_xdbe/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for DOUBLE-BUFFER libs""... $ac_c" 1>&6
+echo "configure:7994: checking for DOUBLE-BUFFER libs" >&5
+     d=$with_xdbe/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_xdbe_req="yes"
+     with_xdbe=$with_xdbe_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-xdbe-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_xdbe" = yes; then
+
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "X11/extensions/Xdbe.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/Xdbe.h""... $ac_c" 1>&6
+echo "configure:8028: checking for X11/extensions/Xdbe.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   cat > conftest.$ac_ext <<EOF
-#line 5310 "configure"
+#line 8033 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-                                     #include <unistd.h>
-                                     #include <sys/types.h>
-                                     #include <pwd.h>
-                                     #include <sys/security.h>
-                                     #include <prot.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;
-; return 0; }
+#include <X11/extensions/Xdbe.h>
 EOF
-if { (eval echo configure:5327: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  ac_cv_enhanced_passwd=yes
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_enhanced_passwd=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_xdbe=yes
+else
+  echo "$ac_t""no" 1>&6
 fi
 
-echo "$ac_t""$ac_cv_enhanced_passwd" 1>&6
-    if test $ac_cv_enhanced_passwd = yes; then
-      have_shadow=yes
-      need_setuid=yes
-      passwd_cruft_done=yes
-      cat >> confdefs.h <<\EOF
-#define HAVE_ENHANCED_PASSWD 1
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test "$have_xdbe" = yes; then
+    cat >> confdefs.h <<\EOF
+#define HAVE_DOUBLE_BUFFER_EXTENSION 1
 EOF
+    
+  fi
 
+elif test "$with_xdbe" != no; then
+  echo "error: must be yes or no: --with-xdbe-ext=$with_xshm"
+  exit 1
+fi
 
-      # On SCO, getprpwnam() is in -lprot (which uses nap() from -lx)
-      # (I'm told it needs -lcurses too, but I don't understand why.)
-      echo $ac_n "checking for getprpwnam in -lprot""... $ac_c" 1>&6
-echo "configure:5353: checking for getprpwnam in -lprot" >&5
-ac_lib_var=`echo prot'_'getprpwnam | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lprot -lx $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5361 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char getprpwnam();
 
-int main() {
-getprpwnam()
-; return 0; }
-EOF
-if { (eval echo configure:5372: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+###############################################################################
+#
+#       Check for the SGI XReadDisplay server extension.
+#
+#       Note: this has to be down here, rather than up with the other server
+#       extension tests, so that the output of `configure --help' is in the
+#       right order.  Arrgh!
+#
+###############################################################################
+
+have_readdisplay=no
+with_readdisplay_req=unspecified
+# Check whether --with-readdisplay or --without-readdisplay was given.
+if test "${with_readdisplay+set}" = set; then
+  withval="$with_readdisplay"
+  with_readdisplay="$withval"; with_readdisplay_req="$withval"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  with_readdisplay=yes
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  PASSWD_LIBS="$PASSWD_LIBS -lprot -lcurses -lx"
-else
-  echo "$ac_t""no" 1>&6
-# On DEC, getprpwnam() is in -lsecurity
-                   echo $ac_n "checking for getprpwnam in -lsecurity""... $ac_c" 1>&6
-echo "configure:5392: checking for getprpwnam in -lsecurity" >&5
-ac_lib_var=`echo security'_'getprpwnam | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+
+
+   case "$with_readdisplay" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for XReadDisplay headers""... $ac_c" 1>&6
+echo "configure:8101: checking for XReadDisplay headers" >&5
+     d=$with_readdisplay/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for XReadDisplay libs""... $ac_c" 1>&6
+echo "configure:8111: checking for XReadDisplay libs" >&5
+     d=$with_readdisplay/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_readdisplay_req="yes"
+     with_readdisplay=$with_readdisplay_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-readdisplay 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_readdisplay" = yes; then
+  
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  if test \! -z "$includedir" ; then 
+    CPPFLAGS="$CPPFLAGS -I$includedir"
+  fi
+  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "X11/extensions/readdisplay.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for X11/extensions/readdisplay.h""... $ac_c" 1>&6
+echo "configure:8144: checking for X11/extensions/readdisplay.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lsecurity  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5400 "configure"
+  cat > conftest.$ac_ext <<EOF
+#line 8149 "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char getprpwnam();
-
-int main() {
-getprpwnam()
-; return 0; }
+#include <X11/extensions/readdisplay.h>
 EOF
-if { (eval echo configure:5411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8154: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  PASSWD_LIBS="$PASSWD_LIBS -lsecurity"
+  cat >> confdefs.h <<\EOF
+#define HAVE_READ_DISPLAY_EXTENSION 1
+EOF
+
 else
   echo "$ac_t""no" 1>&6
 fi
 
+  CPPFLAGS="$ac_save_CPPFLAGS"
+elif test "$with_readdisplay" != no; then
+  echo "error: must be yes or no: --with-readdisplay=$with_readdisplay"
+  exit 1
 fi
 
-    fi
-  fi
 
-  # HP's entry in the "Not Invented Here" Sweepstakes.
-  #
-  if test $passwd_cruft_done = no ; then
-    echo $ac_n "checking for HP-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5440: checking for HP-style shadow passwords" >&5
-if eval "test \"`echo '$''{'ac_cv_hpux_passwd'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+###############################################################################
+#
+#       Check for the SGI Iris Video Library.
+#
+###############################################################################
+
+have_sgivideo=no
+with_sgivideo_req=unspecified
+# Check whether --with-sgivideo or --without-sgivideo was given.
+if test "${with_sgivideo+set}" = set; then
+  withval="$with_sgivideo"
+  with_sgivideo="$withval"; with_sgivideo_req="$withval"
 else
+  with_sgivideo=yes
+fi
+
+
+
+   case "$with_sgivideo" in
+    yes) ;;
+    no)  ;;
+
+    /*)
+     echo $ac_n "checking for Iris Video headers""... $ac_c" 1>&6
+echo "configure:8209: checking for Iris Video headers" >&5
+     d=$with_sgivideo/include
+     if test -d $d; then
+       X_CFLAGS="-I$d $X_CFLAGS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     echo $ac_n "checking for Iris Video libs""... $ac_c" 1>&6
+echo "configure:8219: checking for Iris Video libs" >&5
+     d=$with_sgivideo/lib
+     if test -d $d; then
+       X_LIBS="-L$d $X_LIBS"
+       echo "$ac_t""$d" 1>&6
+     else
+       echo "$ac_t""not found ($d: no such directory)" 1>&6
+     fi
+
+     # replace the directory string with "yes".
+     with_sgivideo_req="yes"
+     with_sgivideo=$with_sgivideo_req
+     ;;
+
+    *)
+     echo ""
+     echo "error: argument to --with-sgivideo 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_sgivideo" = yes; then
   
   ac_save_CPPFLAGS="$CPPFLAGS"
   if test \! -z "$includedir" ; then 
     CPPFLAGS="$CPPFLAGS -I$includedir"
   fi
   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
+  ac_safe=`echo "dmedia/vl.h" | sed 'y%./+-%__p_%'`
+echo $ac_n "checking for dmedia/vl.h""... $ac_c" 1>&6
+echo "configure:8252: checking for dmedia/vl.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
   cat > conftest.$ac_ext <<EOF
-#line 5451 "configure"
+#line 8257 "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-                                     #include <unistd.h>
-                                     #include <sys/types.h>
-                                     #include <pwd.h>
-                                     #include <hpsecurity.h>
-                                     #include <prot.h>
-int main() {
-struct s_passwd *p = getspwnam("nobody");
-                        const char *pw = p->pw_passwd;
-; return 0; }
+#include <dmedia/vl.h>
 EOF
-if { (eval echo configure:5464: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
+{ (eval echo configure:8262: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
+if test -z "$ac_err"; then
   rm -rf conftest*
-  ac_cv_hpux_passwd=yes
+  eval "ac_cv_header_$ac_safe=yes"
 else
+  echo "$ac_err" >&5
   echo "configure: failed program was:" >&5
   cat conftest.$ac_ext >&5
   rm -rf conftest*
-  ac_cv_hpux_passwd=no
+  eval "ac_cv_header_$ac_safe=no"
 fi
 rm -f conftest*
-  CPPFLAGS="$ac_save_CPPFLAGS"
+fi
+if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  have_sgivideo=yes
+else
+  echo "$ac_t""no" 1>&6
 fi
 
-echo "$ac_t""$ac_cv_hpux_passwd" 1>&6
-    if test $ac_cv_hpux_passwd = yes; then
-      have_shadow=yes
-      need_setuid=yes
-      passwd_cruft_done=yes
-      cat >> confdefs.h <<\EOF
-#define HAVE_HPUX_PASSWD 1
-EOF
-
-
-      # on HPUX, bigcrypt is in -lsec
-      echo $ac_n "checking for bigcrypt in -lsec""... $ac_c" 1>&6
-echo "configure:5489: checking for bigcrypt in -lsec" >&5
-ac_lib_var=`echo sec'_'bigcrypt | sed 'y%./+-%__p_%'`
+  CPPFLAGS="$ac_save_CPPFLAGS"
+  if test "$have_sgivideo" = yes; then
+    have_sgivideo=no
+    echo $ac_n "checking for vlOpenVideo in -lvl""... $ac_c" 1>&6
+echo "configure:8287: checking for vlOpenVideo in -lvl" >&5
+ac_lib_var=`echo vl'_'vlOpenVideo | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lsec  $LIBS"
+LIBS="-lvl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5497 "configure"
+#line 8295 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char bigcrypt();
+char vlOpenVideo();
 
 int main() {
-bigcrypt()
+vlOpenVideo()
 ; return 0; }
 EOF
-if { (eval echo configure:5508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5519,342 +8306,417 @@ LIBS="$ac_save_LIBS"
 fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-  PASSWD_LIBS="$PASSWD_LIBS -lsec"
+  have_sgivideo=yes
 else
   echo "$ac_t""no" 1>&6
 fi
 
+    if test "$have_sgivideo" = yes; then
+      SGI_VIDEO_OBJS="$(UTILS_BIN)/sgivideo.o"
+      SGI_VIDEO_LIBS="-lvl"
+      cat >> confdefs.h <<\EOF
+#define HAVE_SGI_VIDEO 1
+EOF
+
     fi
   fi
+elif test "$with_sgivideo" != no; then
+  echo "error: must be yes or no: --with-sgivideo=$with_sgivideo"
+  exit 1
+fi
 
-  # Traditional (ha!) shadow passwords.
-  #
-  if test $passwd_cruft_done = no ; then
-    echo $ac_n "checking for generic shadow passwords""... $ac_c" 1>&6
-echo "configure:5535: checking for generic shadow passwords" >&5
-if eval "test \"`echo '$''{'ac_cv_shadow'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  
-  ac_save_CPPFLAGS="$CPPFLAGS"
-  if test \! -z "$includedir" ; then 
-    CPPFLAGS="$CPPFLAGS -I$includedir"
-  fi
-  CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-  cat > conftest.$ac_ext <<EOF
-#line 5546 "configure"
-#include "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; }
-EOF
-if { (eval echo configure:5558: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  ac_cv_shadow=yes
+
+###############################################################################
+#
+#       Check for a program to generate random text.
+#
+#       Zippy is funnier than the idiocy generally spat out by `fortune',
+#       so try to find that, by invoking Emacs and asking it where its 
+#       libexec directory is ("yow" lives in there.)
+#
+#       If that doesn't work, see if fortune, zippy, or yow are on $PATH,
+#       and if so, use them.
+#
+#       If that doesn't work, look in /usr/games, and if it's there, use
+#       the full pathname.
+#
+###############################################################################
+
+with_zippy_req=""
+# Check whether --with-zippy or --without-zippy was given.
+if test "${with_zippy+set}" = set; then
+  withval="$with_zippy"
+  with_zippy_req="$withval"; with_zippy="$withval"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_shadow=no
-fi
-rm -f conftest*
-  CPPFLAGS="$ac_save_CPPFLAGS"
+  with_zippy=yes
 fi
 
-echo "$ac_t""$ac_cv_shadow" 1>&6
-    if test $ac_cv_shadow = yes; then
-      have_shadow=yes
-      need_setuid=yes
-      passwd_cruft_done=yes
-      cat >> confdefs.h <<\EOF
-#define HAVE_SHADOW_PASSWD 1
-EOF
 
+if test "$with_zippy" = no || test "$with_zippy" = yes ; then
+  with_zippy=""
+  with_zippy_req=""
+fi
 
-      # On some systems (UnixWare 2.1), getspnam() is in -lgen instead of -lc.
-      have_getspnam=no
-      echo $ac_n "checking for getspnam in -lc""... $ac_c" 1>&6
-echo "configure:5584: checking for getspnam in -lc" >&5
-ac_lib_var=`echo c'_'getspnam | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+if test -n "$with_zippy_req" ; then
+  ac_cv_zippy_program=""
+  case "$with_zippy_req" in
+    /*)
+      echo $ac_n "checking for $with_zippy_req""... $ac_c" 1>&6
+echo "configure:8377: checking for $with_zippy_req" >&5
+      if test -x "$with_zippy_req" ; then
+        echo "$ac_t""yes" 1>&6
+      else
+        echo "$ac_t""no" 1>&6
+        with_zippy=""
+      fi
+    ;;
+    *)
+      # don't cache
+      unset ac_cv_path_zip2
+      # Extract the first word of "$with_zippy_req", so it can be a program name with args.
+set dummy $with_zippy_req; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8391: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_zip2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lc  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5592 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char getspnam();
-
-int main() {
-getspnam()
-; return 0; }
-EOF
-if { (eval echo configure:5603: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  case "$zip2" in
+  /*)
+  ac_cv_path_zip2="$zip2" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_zip2="$zip2" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_zip2="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+zip2="$ac_cv_path_zip2"
+if test -n "$zip2"; then
+  echo "$ac_t""$zip2" 1>&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  echo "$ac_t""no" 1>&6
+fi
+
+      if test "$zip2" = ""; then
+        with_zippy=""
+      fi
+    ;;
+  esac
+  ac_cv_zippy_program="$with_zippy"
+
+elif test -n "$ac_cv_zippy_program"; then
+  echo "$ac_t""checking for zippy... (cached) $ac_cv_zippy_program" 1>&6
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
+if test ! -n "$ac_cv_zippy_program"; then
+
+  for ac_prog in emacs
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8441: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_emacs_exe'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  if test -n "$emacs_exe"; then
+  ac_cv_prog_emacs_exe="$emacs_exe" # Let the user override the test.
+else
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_emacs_exe="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_getspnam=yes
+fi
+emacs_exe="$ac_cv_prog_emacs_exe"
+if test -n "$emacs_exe"; then
+  echo "$ac_t""$emacs_exe" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-      if test $have_getspnam = no ; then
-        echo $ac_n "checking for getspnam in -lgen""... $ac_c" 1>&6
-echo "configure:5625: checking for getspnam in -lgen" >&5
-ac_lib_var=`echo gen'_'getspnam | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+test -n "$emacs_exe" && break
+done
+
+  for ac_prog in xemacs
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8475: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_xemacs_exe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lgen  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5633 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char getspnam();
-
-int main() {
-getspnam()
-; return 0; }
-EOF
-if { (eval echo configure:5644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  if test -n "$xemacs_exe"; then
+  ac_cv_prog_xemacs_exe="$xemacs_exe" # Let the user override the test.
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_xemacs_exe="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_getspnam=yes; PASSWD_LIBS="$PASSWD_LIBS -lgen"
+xemacs_exe="$ac_cv_prog_xemacs_exe"
+if test -n "$xemacs_exe"; then
+  echo "$ac_t""$xemacs_exe" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
+test -n "$xemacs_exe" && break
+done
+
+
+  ac_cv_zippy_program=""
+  eargs='-batch -q -nw --eval'
+
+  if test -n "$emacs_exe" ; then
+    echo $ac_n "checking for emacs yow""... $ac_c" 1>&6
+echo "configure:8510: checking for emacs yow" >&5
+    #
+    # get emacs to tell us where the libexec directory is.
+    #
+    dir=`$emacs_exe $eargs '(princ (concat exec-directory "\n"))' \
+         2>/dev/null | tail -1`
+    dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
+    #
+    # try running libexec/yow and see if it exits without error.
+    #
+    if test x"$dir" != x -a -x "$dir/yow" ; then
+      if $dir/yow >&- 2>&- ; then
+        ac_cv_zippy_program="$dir/yow"
+        echo "$ac_t""$ac_cv_zippy_program" 1>&6
+      else
+        echo "$ac_t""no" 1>&6
       fi
     fi
   fi
 
-  # 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 $passwd_cruft_done = no ; then
-    echo $ac_n "checking for FreeBSD-style shadow passwords""... $ac_c" 1>&6
-echo "configure:5675: checking for FreeBSD-style shadow passwords" >&5
-if eval "test \"`echo '$''{'ac_cv_master_passwd'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test -f /etc/master.passwd ; then
-                     ac_cv_master_passwd=yes
-                   else
-                     ac_cv_master_passwd=no
-                   fi
-fi
-
-echo "$ac_t""$ac_cv_master_passwd" 1>&6
-    if test $ac_cv_master_passwd = yes; then
-      need_setuid=yes
-      passwd_cruft_done=yes
+  if test -z "$ac_cv_zippy_program" ; then
+    echo $ac_n "checking for xemacs yow""... $ac_c" 1>&6
+echo "configure:8532: checking for xemacs yow" >&5
+    if test -n "$xemacs_exe" ; then
+      #
+      # get xemacs to tell us where the libexec directory is.
+      #
+      dir=`$xemacs_exe $eargs '(princ (concat exec-directory "\n"))' \
+           2>/dev/null | tail -1`
+      dir=`echo "$dir" | sed 's@///*@/@g;s@/$@@'`
+      #
+      # try running libexec/yow and see if it exits without error.
+      #
+      if test x"$dir" != x -a -x "$dir/yow" ; then
+        if $dir/yow >&- 2>&- ; then
+          ac_cv_zippy_program="$dir/yow"
+          echo "$ac_t""$ac_cv_zippy_program" 1>&6
+        else
+          #
+          # in some xemacs installations, the pathname of the yow.lines file
+          # isn't hardcoded into the yow executable, and must be passed on 
+          # the command line.  See if it's in libexec/../etc/.
+
+          # M4 sucks!!
+          
+          dir_up=`echo "$dir" | sed 's@/[^/]*$@@'`
+          
+
+          yowlines="$dir_up/etc/yow.lines"
+          if $dir/yow -f $yowlines >&- 2>&- ; then
+            ac_cv_zippy_program="$dir/yow -f $yowlines"
+            echo "$ac_t""$ac_cv_zippy_program" 1>&6
+          else
+            #
+            # In newer XEmacs releases, yow.lines is in a different place,
+            # and the easiest way to get it is by calling the new function
+            # `locate-data-file'.
+            #
+            yowlines=`$xemacs_exe $eargs \
+              '(princ (concat (locate-data-file "yow.lines") "\n"))' \
+              2>/dev/null | tail -1`
+            if $dir/yow -f $yowlines >&- 2>&- ; then
+              ac_cv_zippy_program="$dir/yow -f $yowlines"
+              echo "$ac_t""$ac_cv_zippy_program" 1>&6
+            else
+              echo "$ac_t""no" 1>&6
+            fi
+          fi
+        fi
+      fi
     fi
   fi
 
-  # On some systems (UnixWare 2.1), crypt() is in -lcrypt instead of -lc.
-  have_crypt=no
-  echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6
-echo "configure:5696: checking for crypt in -lc" >&5
-ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  # if that didn't work, try for some other programs...
+  if test -z "$ac_cv_zippy_program" ; then
+    fortune=''
+    for ac_prog in fortune zippy yow
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8591: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_prog_fortune'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lc  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5704 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char crypt();
-
-int main() {
-crypt()
-; return 0; }
-EOF
-if { (eval echo configure:5715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  if test -n "$fortune"; then
+  ac_cv_prog_fortune="$fortune" # Let the user override the test.
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="$PATH"
+  for ac_dir in $ac_dummy; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_prog_fortune="$ac_prog"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_crypt=yes
+fortune="$ac_cv_prog_fortune"
+if test -n "$fortune"; then
+  echo "$ac_t""$fortune" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  if test $have_crypt = no ; then
-    echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:5737: checking for crypt in -lcrypt" >&5
-ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lcrypt  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 5745 "configure"
-#include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char crypt();
+test -n "$fortune" && break
+done
 
-int main() {
-crypt()
-; return 0; }
-EOF
-if { (eval echo configure:5756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+    # if that didn't work, try for those programs in /usr/games...
+    if test -z "$fortune" ; then
+      for ac_prog in fortune zippy yow
+do
+# Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:8627: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_fortune'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
+  case "$fortune" in
+  /*)
+  ac_cv_path_fortune="$fortune" # Let the user override the test with a path.
+  ;;
+  ?:/*)                         
+  ac_cv_path_fortune="$fortune" # Let the user override the test with a dos path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
+  ac_dummy="/usr/games:/usr/local/games:$PATH"
+  for ac_dir in $ac_dummy; do 
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_fortune="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_crypt=yes; PASSWD_LIBS="$PASSWD_LIBS -lcrypt"
+fortune="$ac_cv_path_fortune"
+if test -n "$fortune"; then
+  echo "$ac_t""$fortune" 1>&6
 else
   echo "$ac_t""no" 1>&6
 fi
 
-  fi
-
+test -n "$fortune" && break
+done
+test -n "$fortune" || fortune="fortune"
 
-  # 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 $need_setuid = no ; then
-    case "$host" in
-      *-hpux* | *-aix* | *-netbsd* | *-freebsd* | *-openbsd* )
-        need_setuid=yes
-      ;;
-    esac
+    fi
   fi
+fi
 
-elif test $enable_locking = no; then
-  cat >> confdefs.h <<\EOF
-#define NO_LOCKING 1
-EOF
-
-else
-  echo "error: must be yes or no: --enable-locking=$enable_locking"
-  exit 1
+if test -z "$ac_cv_zippy_program" ; then
+  ac_cv_zippy_program=fortune
 fi
 
+cat >> confdefs.h <<EOF
+#define ZIPPY_PROGRAM "$ac_cv_zippy_program"
+EOF
 
 
-if test \! -z "$includedir" ; then 
-  INCLUDES="-I$includedir"
-fi
-
-if test \! -z "$libdir" ; then
-  LDFLAGS="$LDFLAGS -L$libdir"
-fi
 
+###############################################################################
+#
+#       Done testing.  Now, set up the various -I and -L variables,
+#       and decide which GUI program to build by default.
+#
+###############################################################################
 
-##### should have options to override the DEPEND crap, I guess...
 DEPEND=makedepend
 DEPEND_FLAGS=
 DEPEND_DEFINES=
 
 
-# Autoconf doesn't seem to have an INSTALL_DIRS, so let's define our own...
-INSTALL_DIRS='$(INSTALL) -d'
+if test \! -z "$includedir" ; then 
+  INCLUDES="$INCLUDES -I$includedir"
+fi
 
-# Done testing things -- now substitute in some stuff for the Makefiles.
-#
-if test $have_motif = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_MOTIF 1
-EOF
+if test \! -z "$libdir" ; then
+  LDFLAGS="$LDFLAGS -L$libdir"
+fi
 
-  DIALOG_SRCS='$(MOTIF_SRCS)'
-  DIALOG_OBJS='$(MOTIF_OBJS)'
-elif test $have_athena = yes; then
-  cat >> confdefs.h <<\EOF
-#define HAVE_ATHENA 1
-EOF
 
-  DIALOG_SRCS='$(ATHENA_SRCS)'
-  DIALOG_OBJS='$(ATHENA_OBJS)'
-else
-  DIALOG_SRCS=''
-  DIALOG_OBJS=''
+PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm
+ALL_DEMO_PROGRAMS=
+if test "$have_motif" = yes; then
+  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm
+  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
+fi
+if test "$have_gtk" = yes; then
+  PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk
+  ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS"
 fi
 
-if test $have_kerberos = yes; then
-  PASSWD_SRCS='$(KERBEROS_SRCS)'
-  PASSWD_OBJS='$(KERBEROS_OBJS)'
-else
-  PASSWD_SRCS='$(PWENT_SRCS)'
-  PASSWD_OBJS='$(PWENT_OBJS)'
+
+if test "$have_kerberos" = yes; then
+  PASSWD_SRCS="$PASSWD_SRCS \$(KERBEROS_SRCS)"
+  PASSWD_OBJS="$PASSWD_OBJS \$(KERBEROS_OBJS)"
 fi
+if test "$have_pam" = yes; then
+  PASSWD_SRCS="$PASSWD_SRCS \$(PAM_SRCS)"
+  PASSWD_OBJS="$PASSWD_OBJS \$(PAM_OBJS)"
+  INSTALL_PAM="install-pam"
+fi
+  PASSWD_SRCS="$PASSWD_SRCS \$(PWENT_SRCS)"
+  PASSWD_OBJS="$PASSWD_OBJS \$(PWENT_OBJS)"
+
 
-if test $enable_locking = yes; then
+if test "$enable_locking" = yes; then
   LOCK_SRCS='$(LOCK_SRCS_1) $(PASSWD_SRCS)'
   LOCK_OBJS='$(LOCK_OBJS_1) $(PASSWD_OBJS)'
 else
-  LOCK_SRCS=''
-  LOCK_OBJS=''
+  LOCK_SRCS='$(NOLOCK_SRCS_1)'
+  LOCK_OBJS='$(NOLOCK_OBJS_1)'
 fi
 
-if test $need_setuid = yes; then
+if test "$need_setuid" = yes; then
   NEED_SETUID=yes
   INSTALL_SETUID='$(INSTALL) $(SUID_FLAGS)'
 else
@@ -5863,17 +8725,28 @@ else
 fi
 
 tab='  '
-if test $have_gl = yes; then
+if test "$have_gl" = yes; then
   GL_EXES='$(GL_EXES)'
-  GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'  \'
-  GL_KLUDGE_2=${tab}
+  GL_MEN='$(GL_MEN)'
+  GL_KLUDGE="${tab}  "
 else
-  GL_KLUDGE_1=${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}${tab}'\n'
-  GL_KLUDGE_2='!'${tab}
+  GL_KLUDGE="-${tab}  "
 fi
 
+if test "$have_gle" = yes; then
+  GLE_EXES='$(GLE_EXES)'
+  GLE_MEN='$(GLE_MEN)'
+  GLE_KLUDGE="${tab}   "
+else
+  GLE_KLUDGE="-${tab}   "
+fi
 
 
+###############################################################################
+#
+#       Perform substitutions and write Makefiles.
+#
+###############################################################################
 
 
 
 
 
 
-# Print some warnings before emitting the Makefiles.
-#
-warning=no
-warnsep='    #################################################################'
-warnpre() {
-  if test $warning = no ; then
-    echo '' ; echo "$warnsep" ; echo ''
-    warning=yes
-  fi
-}
-
-warn() {
-  warnpre
-  if test $warning = long ; then echo '' ; fi
-  warning=yes
-  echo "    Warning: $@"
-}
-
-warnL() {
-  was=$warning
-  warnpre
-  warning=yes
-  if test $was != no ; then echo '' ; fi
-  echo "    Warning: $@"
-}
-
-warn2() {
-  echo "             $@"
-  warning=long
-}
-
-if test $with_sgi_req = yes -a $have_sgi = no ; then
-  warn 'The SGI saver extension was requested, but was not found.'
-fi
-
-if test $with_mit_req = yes -a $have_mit = no ; then
-  warn 'The MIT saver extension was requested, but was not found.'
-fi
-
-if test $with_xidle_req = yes -a $have_xidle = no ; then
-  warn 'The XIdle extension was requested, but was not found.'
-fi
-
-if test $with_xshm_req = yes -a $have_xshm = no ; then
-  warn 'The XSHM extension was requested, but was not found.'
-fi
-
-if test $with_sgivc_req = yes -a $have_sgivc = no ; then
-  warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
-fi
-
-if test $with_dpms_req = yes -a $have_dpms = no ; then
-  warn 'The DPMS extension was requested, but was not found.'
-fi
 
-if test $have_motif = no -a $have_athena = no ; then
-  warnL "Neither Motif nor Athena widgets seem to be available;"
-  warn2 "one or the other is required."
-  proselytize_motif=no
 
-elif test $with_motif_req = yes -a $have_motif = no ; then
-  warnL "Use of Motif was requested, but it wasn't found;"
-  warn2 "Athena will be used instead."
 
-elif test $with_athena_req = yes -a $have_athena = no ; then
-  warnL "Use of Athena was requested, but it wasn't found;"
-  warn2 "Motif will be used instead."
-fi
 
-if test $have_motif = yes -a $have_lesstif = yes ; then
-  if test $good_lesstif != yes ; then
-    warnL "Motif is being used, but it appears to actually be"
-    warn2 "LessTif, and the version number is less than 0.82!"
-    warn2 "Such old versions of LessTif are too buggy to use"
-    warn2 "with XScreenSaver; it is strongly recommended that"
-    warn2 "you upgrade!  See <http://www.lesstif.org/>."
-  fi
-fi
 
-if test $proselytize_motif = yes ; then
-    warnL "Athena widgets are being used instead of Motif."
-    warn2 "XScreenSaver looks much better with Motif, and has"
-    warn2 "a few extra features as well.  Wouldn't you rather"
-    warn2 "be using Motif?  It is shipped by every commercial"
-    warn2 "Unix vendor; and there is a free implementation"
-    warn2 "available as well: see <http://www.lesstif.org/>."
-fi
 
-if test $with_xpm_req = yes -a $have_xpm = no ; then
-  warn 'Use of XPM was requested, but it was not found.'
-fi
 
-if test $with_gl_req = yes -a $have_gl = no ; then
-  warn 'Use of GL was requested, but it was not found.'
-fi
 
-if test $with_readdisplay_req = yes -a $have_readdisplay = no ; then
-  warn 'Use of XReadDisplay was requested, but it was not found.'
-fi
+APPDEFAULTS=$ac_x_app_defaults
 
-if test $with_sgivideo_req = yes -a $have_sgivideo = no ; then
-  warn 'Use of the Iris Video Library was requested, but it was not found.'
-fi
 
-if test $with_kerberos_req = yes -a $have_kerberos = no ; then
-  warn 'Use of Kerberos was requested, but it was not found.'
-fi
 
-if test $with_shadow_req = yes -a $have_shadow = no ; then
-  warn 'Use of shadow passwords was requested, but they were not found.'
-fi
 
-if test -n "$with_zippy_req"; then
-  if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
-    warnL "$with_zippy_req was requested as the Zippy program,"
-    warn2 "but was not found.  The default will be used instead."
-  fi
-fi
 
-if test $warning != no; then
-  echo '' ; echo "$warnsep" ; echo ''
-fi
 
 
 trap '' 1 2 15
@@ -6050,7 +8815,7 @@ EOF
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
 (set) 2>&1 |
-  case `(ac_space=' '; set) 2>&1` in
+  case `(ac_space=' '; set | grep ac_space) 2>&1` in
   *ac_space=\ *)
     # `set' does not quote correctly, so add quotes (double-quote substitution
     # turns \\\\ into \\, and sed turns \\ into \).
@@ -6117,7 +8882,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.12"
+    echo "$CONFIG_STATUS generated by autoconf version 2.13"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -6129,11 +8894,11 @@ ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
 trap 'rm -fr `echo "Makefile
-         utils/Makefile
-         driver/Makefile
-         hacks/Makefile
-         hacks/glx/Makefile
-         driver/XScreenSaver.ad config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+          utils/Makefile
+          driver/Makefile
+          hacks/Makefile
+          hacks/glx/Makefile
+          driver/XScreenSaver.ad config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -6142,9 +8907,11 @@ sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
  s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
 $ac_vpsub
 $extrasub
+s%@SHELL@%$SHELL%g
 s%@CFLAGS@%$CFLAGS%g
 s%@CPPFLAGS@%$CPPFLAGS%g
 s%@CXXFLAGS@%$CXXFLAGS%g
+s%@FFLAGS@%$FFLAGS%g
 s%@DEFS@%$DEFS%g
 s%@LDFLAGS@%$LDFLAGS%g
 s%@LIBS@%$LIBS%g
@@ -6171,38 +8938,52 @@ s%@host_os@%$host_os%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@SET_MAKE@%$SET_MAKE%g
+s%@PERL@%$PERL%g
 s%@X_CFLAGS@%$X_CFLAGS%g
 s%@X_PRE_LIBS@%$X_PRE_LIBS%g
 s%@X_LIBS@%$X_LIBS%g
 s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@glib_config@%$glib_config%g
+s%@gtk_config@%$gtk_config%g
 s%@zip2@%$zip2%g
 s%@emacs_exe@%$emacs_exe%g
 s%@xemacs_exe@%$xemacs_exe%g
 s%@fortune@%$fortune%g
 s%@INCLUDES@%$INCLUDES%g
+s%@PREFERRED_DEMO_PROGRAM@%$PREFERRED_DEMO_PROGRAM%g
+s%@ALL_DEMO_PROGRAMS@%$ALL_DEMO_PROGRAMS%g
 s%@SAVER_LIBS@%$SAVER_LIBS%g
+s%@MOTIF_LIBS@%$MOTIF_LIBS%g
+s%@GTK_LIBS@%$GTK_LIBS%g
 s%@HACK_LIBS@%$HACK_LIBS%g
 s%@XPM_LIBS@%$XPM_LIBS%g
 s%@GL_LIBS@%$GL_LIBS%g
+s%@GLE_LIBS@%$GLE_LIBS%g
 s%@PASSWD_LIBS@%$PASSWD_LIBS%g
 s%@INSTALL_SETUID@%$INSTALL_SETUID%g
 s%@INSTALL_DIRS@%$INSTALL_DIRS%g
 s%@NEED_SETUID@%$NEED_SETUID%g
+s%@INSTALL_PAM@%$INSTALL_PAM%g
 s%@SGI_VIDEO_OBJS@%$SGI_VIDEO_OBJS%g
 s%@SGI_VIDEO_LIBS@%$SGI_VIDEO_LIBS%g
-s%@DIALOG_SRCS@%$DIALOG_SRCS%g
-s%@DIALOG_OBJS@%$DIALOG_OBJS%g
 s%@PASSWD_SRCS@%$PASSWD_SRCS%g
 s%@PASSWD_OBJS@%$PASSWD_OBJS%g
 s%@XMU_SRCS@%$XMU_SRCS%g
 s%@XMU_OBJS@%$XMU_OBJS%g
+s%@SAVER_GL_SRCS@%$SAVER_GL_SRCS%g
+s%@SAVER_GL_OBJS@%$SAVER_GL_OBJS%g
+s%@SAVER_GL_LIBS@%$SAVER_GL_LIBS%g
 s%@LOCK_SRCS@%$LOCK_SRCS%g
 s%@LOCK_OBJS@%$LOCK_OBJS%g
 s%@GL_EXES@%$GL_EXES%g
-s%@GL_KLUDGE_1@%$GL_KLUDGE_1%g
-s%@GL_KLUDGE_2@%$GL_KLUDGE_2%g
+s%@GL_MEN@%$GL_MEN%g
+s%@GL_KLUDGE@%$GL_KLUDGE%g
+s%@GLE_EXES@%$GLE_EXES%g
+s%@GLE_MEN@%$GLE_MEN%g
+s%@GLE_KLUDGE@%$GLE_KLUDGE%g
 s%@HACKDIR@%$HACKDIR%g
 s%@APPDEFAULTS@%$APPDEFAULTS%g
 s%@DEPEND@%$DEPEND%g
@@ -6250,11 +9031,11 @@ EOF
 cat >> $CONFIG_STATUS <<EOF
 
 CONFIG_FILES=\${CONFIG_FILES-"Makefile
-         utils/Makefile
-         driver/Makefile
-         hacks/Makefile
-         hacks/glx/Makefile
-         driver/XScreenSaver.ad"}
+          utils/Makefile
+          driver/Makefile
+          hacks/Makefile
+          hacks/glx/Makefile
+          driver/XScreenSaver.ad"}
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
@@ -6433,6 +9214,268 @@ rm -fr confdefs* $ac_clean_files
 test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
 
 
+###############################################################################
+#
+#       Print some warnings at the end.
+#
+###############################################################################
+
+warn_prefix_1="    Warning:"
+warn_prefix_2="       Note:"
+warn_prefix="$warn_prefix_1"
+
+warning=no
+warnsep='    #################################################################'
+
+warnpre() {
+  if test "$warning" = no ; then
+    echo '' ; echo "$warnsep" ; echo ''
+    warning=yes
+  fi
+}
+
+warn() {
+  warnpre
+  if test "$warning" = long ; then echo '' ; fi
+  warning=yes
+  echo "$warn_prefix $@"
+}
+
+warnL() {
+  was=$warning
+  warnpre
+  warning=yes
+  if test "$was" != no ; then echo '' ; fi
+  echo "$warn_prefix $@"
+}
+
+warn2() {
+  echo "             $@"
+  warning=long
+}
+
+note() {
+  warn_prefix="$warn_prefix_2"
+  warn $@
+  warn_prefix="$warn_prefix_1"
+}
+
+noteL() {
+  warn_prefix="$warn_prefix_2"
+  warnL $@
+  warn_prefix="$warn_prefix_1"
+}
+
+
+if test "$with_sgi_req" = yes -a "$have_sgi" = no ; then
+  warn 'The SGI saver extension was requested, but was not found.'
+fi
+
+if test "$with_mit_req" = yes -a "$have_mit" = no ; then
+  warn 'The MIT saver extension was requested, but was not found.'
+fi
+
+if test "$with_xidle_req" = yes -a "$have_xidle" = no ; then
+  warn 'The XIdle extension was requested, but was not found.'
+fi
+
+if test "$with_xshm_req" = yes -a "$have_xshm" = no ; then
+  warn 'The XSHM extension was requested, but was not found.'
+fi
+
+if test "$with_xdbe_req" = yes -a "$have_xdbe" = no ; then
+  warn 'The DOUBLE-BUFFER extension was requested, but was not found.'
+fi
+
+if test "$with_sgivc_req" = yes -a "$have_sgivc" = no ; then
+  warn 'The SGI-VIDEO-CONTROL extension was requested, but was not found.'
+fi
+
+if test "$with_dpms_req" = yes -a "$have_dpms" = no ; then
+  warn 'The DPMS extension was requested, but was not found.'
+fi
+
+if test "$with_xf86vmode_req" = yes -a "$have_xf86vmode" = no ; then
+  warn 'The XF86VMODE extension was requested, but was not found.'
+fi
+
+if test "$with_proc_interrupts_req" = yes -a "$have_proc_interrupts" = no; then
+  warn "Checking of /proc/interrupts was requested, but it's bogus."
+fi
+
+
+if test "$have_motif" = no -a "$have_gtk" = no; then
+  warnL "Neither Motif nor Gtk seem to be available;"
+  warn2 "the \`xscreensaver-demo' program requires one of these."
+
+elif test "$with_motif_req" = yes -a "$have_motif" = no ; then
+  warnL "Use of Motif was requested, but it wasn't found;"
+  warn2 "Gtk will be used instead."
+
+elif test "$jurassic_gtk" = yes ; then
+
+  pref_gtk=1.2
+
+  v="$ac_gtk_version_string"
+  if test "$with_gtk_req" = yes -a "$ac_gtk_version" = "unknown" ; then
+    warnL "Use of Gtk was requested, but its version number is unknown;"
+  elif test "$with_gtk_req" = yes ; then
+    warnL "Use of Gtk was requested, but it is version $v;"
+  else
+    warnL "Gtk was found on this system, but it is version $v;"
+  fi
+
+  warn2 "Gtk $pref_gtk or newer is required.  Motif will be used instead."
+
+elif test "$with_gtk_req" = yes -a "$have_gtk" = no ; then
+  warnL "Use of Gtk was requested, but it wasn't found;"
+  warn2 "Motif will be used instead."
+
+fi
+
+
+if test "$have_motif" = yes -a "$have_lesstif" = yes ; then
+
+  preferred_lesstif=0.86
+
+  if test "$lesstif_version" = unknown; then
+    warnL "Unable to determine the LessTif version number!"
+    warn2 "Make sure you are using version $preferred_lesstif or newer."
+    warn2 "See <http://www.lesstif.org/>."
+
+  elif test \! $lesstif_version -gt 82; then
+    warnL "LessTif version $lesstif_version_string is being used."
+    warn2 "LessTif versions 0.82 and earlier are too buggy to"
+    warn2 "use with XScreenSaver; it is strongly recommended"
+    warn2 "that you upgrade to at least version $preferred_lesstif!"
+    warn2 "See <http://www.lesstif.org/>."
+  fi
+fi
+
+
+
+if test "$have_xpm" = no ; then
+  if test "$with_xpm_req" = yes ; then
+    warnL 'Use of XPM was requested, but it was not found.'
+  elif test "$with_xpm_req" = no ; then
+    noteL 'The XPM library is not being used.'
+  else
+    noteL 'The XPM library was not found.'
+  fi
+
+  echo ''
+  warn2 'Some of the demos will not be as colorful as they'
+  warn2 'could be.  You might want to consider installing XPM'
+  warn2 'and re-running configure.  (Remember to delete the'
+  warn2 'config.cache file first.)  You can find XPM at most'
+  warn2 'X11 archive sites, such as <http://sunsite.unc.edu/>.'
+fi
+
+
+if test "$have_gl" = yes -a "$ac_have_mesa_gl" = yes ; then
+  preferred_mesagl=3.0
+
+  if test "$ac_mesagl_version" = unknown; then
+    warnL "Unable to determine the MesaGL version number!"
+    warn2 "Make sure you are using version $preferred_mesagl or newer."
+
+  elif test \! "$ac_mesagl_version" -gt 2006; then
+    warnL "MesaGL version $ac_mesagl_version_string is being used."
+    warn2 "MesaGL versions 2.6 and earlier have a security bug."
+    warn2 "It is strongly recommended that you upgrade to at"
+    warn2 "least version $preferred_mesagl."
+  fi
+fi
+
+if test "$have_gl" = no ; then
+  if test "$with_gl_req" = yes ; then
+    warnL 'Use of GL was requested, but it was not found.'
+  elif test "$with_gl_req" = no ; then
+    noteL 'The OpenGL 3D library is not being used.'
+  else
+    noteL 'The OpenGL 3D library was not found.'
+  fi
+
+  if test "$gl_halfassed" = yes ; then
+    echo ''
+    warn2 'More specifically, we found the headers, but not the'
+    warn2 'libraries; so either GL is half-installed on this'
+    warn2 "system, or something else went wrong.  The \`config.log'"
+    warn2 'file might contain some clues.'
+  fi
+
+  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.  (Remember to delete the'
+  warn2 "config.cache file first.)  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/>.'
+
+fi
+
+
+if test "$have_gl" = yes -a "$have_gle" = no ; then
+  if test "$with_gle_req" = yes ; then
+    noteL 'Use of the GLE (GL Extrusion) library was requested, but'
+    warn2 'it was not found (though the OpenGL library was found, and'
+    warn2 'is being used.)'
+  elif test "$with_gle_req" = no ; then
+    noteL 'The OpenGL Library is being used, but the GLE (GL Extrusion)'
+    warn2 'library is not.'
+  else
+    noteL 'The OpenGL Library was found, but the GLE (GL Extrusion)'
+    warn2 'was not.'
+  fi
+
+  if test "$gle_halfassed" = yes ; then
+    echo ''
+    warn2 'More specifically, we found the headers, but not the'
+    warn2 'libraries; so either GLE is half-installed on this'
+    warn2 "system, or something else went wrong.  The \`config.log'"
+    warn2 'file might contain some clues.'
+  fi
+
+  echo ''
+  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.  (Remember to delete'
+  warn2 'the config.cache file first.)  You can find the GLE library'
+  warn2 'at <http://www.linas.org/gle/>.  For general OpenGL info,'
+  warn2 'see <http://www.opengl.org/>.'
+
+fi
+
+
+if test "$with_readdisplay_req" = yes -a "$have_readdisplay" = no ; then
+  warn 'Use of XReadDisplay was requested, but it was not found.'
+fi
+
+if test "$with_sgivideo_req" = yes -a "$have_sgivideo" = no ; then
+  warn 'Use of the Iris Video Library was requested, but it was not found.'
+fi
+
+if test -n "$with_zippy_req"; then
+  if test "$with_zippy_req" != "$ac_cv_zippy_program" ; then
+    warnL "$with_zippy_req was requested as the Zippy program,"
+    warn2 "but was not found.  The default will be used instead."
+  fi
+fi
+
+if test "$with_kerberos_req" = yes -a "$have_kerberos" = no ; then
+  warn 'Use of Kerberos was requested, but it was not found.'
+fi
+
+if test "$with_pam_req" = yes -a "$have_pam" = no ; then
+  warn 'Use of PAM was requested, but it was not found.'
+fi
+
+if test "$with_shadow_req" = yes -a "$have_shadow" = no ; then
+  warn 'Use of shadow passwords was requested, but they were not found.'
+fi
+
+
 # You are in a twisty maze of namespaces and syntaxes, all alike.
 # Fuck the skull of Unix.
 #
@@ -6449,20 +9492,94 @@ eval HACKDIR=${HACKDIR}
 eval HACKDIR=${HACKDIR}
 eval HACKDIR=${HACKDIR}
 
-echo ""
-echo "$warnsep"
-echo ""
-echo '      When you run "make install", the "xscreensaver" and'
-echo '      "xscreensaver-command" executables will be installed in'
-echo "      ${bindir}."
-echo ""
-echo "      The various graphics demos (60+ different executables) will"
-echo "      be installed in ${HACKDIR}."
-echo ""
-echo "      If you would prefer the demos to be installed elsewhere"
-echo "      (for example, in a dedicated directory) you should re-run"
-echo "      configure with the --enable-subdir=DIR option.  For more"
-echo "       information, run $0 --help."
-echo ""
-echo "$warnsep"
-echo ""
+# canonicalize slashes.
+bindir=`echo  "${bindir}"  | sed 's@/$@@;s@//*@/@g'`
+HACKDIR=`echo "${HACKDIR}" | sed 's@/$@@;s@//*@/@g'`
+
+
+# Sanity check the subdir
+for bad_choice in xscreensaver xscreensaver-demo xscreensaver-command ; do
+  if test "${HACKDIR}" = "${bindir}/${bad_choice}" ; then
+    echo ""
+    { echo "configure: error: \"--enable-subdir=${bindir}/${bad_choice}\" won't work.
+                   There will be an executable installed with that name, so
+                   that can't be the name of a directory as well.  Please
+                   re-configure with a different directory name." 1>&2; exit 1; }
+  fi
+done
+
+
+do_dir_warning=no
+
+# Now let's see if there's a previous RPM version already installed.  Blargh!
+
+# M4 sucks!!
+
+rpmv=`(rpm -qv xscreensaver) 2>&- | \
+      sed 's/^xscreensaver-\([0-9][0-9]*[.][0-9][0-9]*\)-[0-9][0-9]*$/\1/'`
+
+
+if test \! -z "$rpmv" ; then
+  rpmbdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/xscreensaver-demo$@\1@p'`
+  rpmhdir=`rpm -ql xscreensaver | sed -n 's@^\(.*\)/attraction$@\1@p'`
+
+  warning=no
+  warnL "There is already an installed RPM of xscreensaver $rpmv"
+  warn2 "on this system.  You might want to remove it (with"
+  warn2 '"rpm -ve xscreensaver") before running "make install"'
+  warn2 "from this directory."
+  echo ""
+  warn2 "Alternately, you could build this version of xscreensaver"
+  warn2 'as an RPM, and then install that.  An "xscreensaver.spec"'
+  warn2 "file is included.  See the RPM documentation for more info."
+  echo ""
+
+  if test "$rpmbdir" = "$rpmhdir" ; then
+    warn2 "The RPM version was installed in $rpmbdir."
+  else
+    warn2 "The RPM version was installed in $rpmbdir,"
+    warn2 "with demos in $rpmhdir."
+  fi
+
+  do_dir_warning=yes
+fi
+
+
+# Warn about egregious GNOME bogosity.
+#
+if (rpm -qv control-center) >&- 2>&- ; then
+  warning=no
+  warnL "The Gnome Control Center seems to be installed."
+  echo  ""
+  warn2 "Note that simply installing this version of xscreensaver"
+  warn2 "will not cause GNOME to know about the newly-added display"
+  warn2 "modes -- GNOME is just lame that way.  Instead of using the"
+  warn2 "Control Center, try using the \`xscreensaver-demo' command."
+fi
+
+
+if test "${bindir}" = "${HACKDIR}" ; then
+  do_dir_warning=yes
+fi
+
+if test "$do_dir_warning" = yes; then
+  echo ""
+  echo "$warnsep"
+  echo ""
+  echo '      When you run "make install", the "xscreensaver",'
+  echo '      "xscreensaver-demo", and "xscreensaver-command" executables'
+  echo "      will be installed in ${bindir}."
+  echo ""
+  echo "      The various graphics demos (100+ different executables) will"
+  echo "      also be installed in ${HACKDIR}."
+  echo ""
+  echo "      If you would prefer the demos to be installed elsewhere"
+  echo "      (for example, in a dedicated directory) you should re-run"
+  echo "      configure with the --enable-subdir=DIR option.  For more"
+  echo "      information, run $0 --help."
+  warning=yes
+fi
+
+if test "$warning" != no; then
+  echo '' ; echo "$warnsep" ; echo ''
+fi