changeset 420:41dbb7a9d5f2 r21-2-18

Import from CVS: tag r21-2-18
author cvs
date Mon, 13 Aug 2007 11:24:09 +0200
parents 66615b78f1a5
children fff06e11db74
files CHANGES-beta ChangeLog INSTALL Makefile.in.in README.packages config.guess configure configure.in configure.usage etc/NEWS etc/TUTORIAL.ru lib-src/ChangeLog lib-src/config.values.in lisp/ChangeLog lisp/cus-face.el lisp/help.el lisp/lib-complete.el lisp/list-mode.el lisp/menubar-items.el lisp/mule/mule-category.el lisp/mule/mule-misc.el lisp/packages.el lisp/simple.el lisp/subr.el lisp/wid-edit.el lisp/x-win-sun.el lwlib/ChangeLog lwlib/lwlib-Xm.c lwlib/lwlib.c lwlib/lwlib.h man/ChangeLog man/xemacs/packages.texi nt/ChangeLog src/ChangeLog src/alloc.c src/buffer.c src/bytecode.c src/chartab.c src/config.h.in src/console-tty.c src/console.c src/data.c src/database.c src/device.c src/dialog-x.c src/editfns.c src/eldap.c src/elhash.c src/emacs.c src/eval.c src/event-Xt.c src/event-msw.c src/event-stream.c src/events.c src/extents.c src/faces.c src/file-coding.c src/floatfns.c src/fns.c src/frame.c src/glyphs-msw.c src/glyphs-widget.c src/glyphs-x.c src/glyphs-x.h src/glyphs.c src/glyphs.h src/gui-x.c src/gui.c src/gui.h src/indent.c src/input-method-xlib.c src/keymap.c src/lisp.h src/lrecord.h src/lstream.c src/marker.c src/menubar-msw.c src/menubar-x.c src/mule-charset.c src/nt.c src/objects.c src/opaque.c src/paths.h.in src/process.c src/rangetab.c src/redisplay-x.c src/s/cygwin32.h src/s/linux.h src/sheap.c src/specifier.c src/symbols.c src/symeval.h src/symsinit.h src/syntax.c src/sysdep.c src/toolbar.c src/tooltalk.c src/window.c tests/ChangeLog tests/glyph-test.el version.sh
diffstat 101 files changed, 3700 insertions(+), 1563 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 11:23:14 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 11:24:09 2007 +0200
@@ -1,4 +1,17 @@
 							-*- indented-text -*-
+to 21.2.18 "Toshima"
+-- miscellaneous fixes from Steve Baur
+-- miscellaneous fixes from Didier Verna
+-- various bug fixes from Karl Hegbloom
+-- miscellaneous fixes from Bob Weiner
+-- fix for XIM server crashing and taking down XEmacs from Kazuyuki IENAGA
+-- valid-image-instantiator-format-p tightened up by Andy Piper.
+-- glyph widget support under X/Motif from Andy Piper
+-- Make docdir configurable, update package searching rules from Michael
+   Sperber
+-- Fix for Japanese word/character movements from MORIOKA Tomohiko
+-- lrecord struct header size fix from Olivier Galibert
+
 to 21.2.17 "Chiyoda"
 -- miscellaneous bug fixes from Steve Baur
 -- font menu fix from Robert Pluim
--- a/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,43 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
+1999-07-06  SL Baur  <steve@miho.m17n.org>
+
+	* config.guess (main): Synch with newer config.guess for HP
+	support.
+	From Marcus Thiessel <marcus@xemacs.org>
+
+1999-06-25  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* configure.in (with_prefix): Added --with-prefix, defaults to
+	yes, to control whether the value of --prefix is compiled into the 
+	binary.
+
+1999-07-03  Andy Piper  <andy@xemacs.org>
+
+	* configure.usage (--with-widgets): add.
+
+1999-07-02  Andy Piper  <andy@xemacs.org>
+
+	* configure.in: Make sure we get motif in lwlib if we have widgets
+ 	and motif.
+
+1999-06-25  SL Baur  <steve@miho.m17n.org>
+
+	* configure.in (version): Fix --with-infodock test.
+
+1999-06-15  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* configure.in: --prefix and --exec-prefix are now only compiled
+	into the binary if user-defined.
+
+1999-03-23  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* configure.in: Made docdir configurable.
+
+	* Makefile.in (docdir): Added variable for custom DOC directory.
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/INSTALL	Mon Aug 13 11:23:14 2007 +0200
+++ b/INSTALL	Mon Aug 13 11:24:09 2007 +0200
@@ -630,6 +630,10 @@
 	above), is `/usr/local/lib/xemacs-VERSION/CONFIGURATION-NAME'
 	(where VERSION and CONFIGURATION-NAME are as described above).
 
+`docdir' indicates where to put Lisp documentation strings that XEmacs
+        refers to as it runs.  It defaults the value of `archlibdir'
+        (see above).
+
 `moduledir' indicates where XEmacs installs and expects to find
 	any dynamic modules.  Its default value, based on
 	`archlibdir' (see above) is
--- a/Makefile.in.in	Mon Aug 13 11:23:14 2007 +0200
+++ b/Makefile.in.in	Mon Aug 13 11:24:09 2007 +0200
@@ -191,6 +191,9 @@
 ## currently being edited.
 lockdir=@lockdir@
 
+# Where to put the DOC file.
+docdir=@docdir@
+
 ## Where to put executables to be run by XEmacs rather than
 ## the user.  This path usually includes the XEmacs version
 ## and configuration name, so that multiple configurations
@@ -393,9 +396,8 @@
 	   if test -f ../Installation; then \
 		${INSTALL_DATA} ../Installation ${archlibdir}/Installation; \
 	   fi; \
-	   for f in DOC config.values; do \
-		${INSTALL_DATA} lib-src/$${f} ${archlibdir}/$${f}; \
-	   done ; \
+	   ${INSTALL_DATA} lib-src/config.values ${archlibdir}/config.values; \
+	   ${INSTALL_DATA} lib-src/DOC ${docdir}/DOC; \
 	   for subdir in `find ${archlibdir} -type d ! -name RCS ! -name SCCS ! -name CVS -print` ; \
 	     do (cd $${subdir} && $(RM) -r RCS CVS SCCS \#* *~) ; done ; \
 	else true; fi
@@ -471,7 +473,7 @@
 ## (e.g. /usr/local/lib/${PROGNAME}-20.5/sparc-sun-solaris2.6), we use
 ## make-path instead of mkdir.  Not all mkdirs have the `-p' flag.
 mkdir: FRC.mkdir
-	${MAKEPATH} ${COPYDESTS} ${lockdir} ${infodir} ${archlibdir} \
+	${MAKEPATH} ${COPYDESTS} ${lockdir} ${docdir} ${infodir} ${archlibdir} \
 	  ${mandir} ${bindir} ${datadir} ${libdir} ${pkgdir} \
 	  ${sitelispdir} ${moduledir} ${sitemoduledir}
 	-chmod 0777 ${lockdir}
--- a/README.packages	Mon Aug 13 11:23:14 2007 +0200
+++ b/README.packages	Mon Aug 13 11:24:09 2007 +0200
@@ -213,10 +213,9 @@
 ------------------------
 
 In addition to the system wide packages, each user can have his own
-packages installed in "~/.xemacs" (Note that this will most likely
-change to "~/.xemacs/packages" in the near future). If you want to
+packages installed in "~/.xemacs/xemacs-packages". If you want to
 install packages there using the interactive tools, you need to set
-'pui-package-install-dest-dir' to "~/xemacs"
+'pui-package-install-dest-dir' to "~/.xemacs/xemacs-packages"
 
 Site lisp/Site start
 --------------------
--- a/config.guess	Mon Aug 13 11:23:14 2007 +0200
+++ b/config.guess	Mon Aug 13 11:24:09 2007 +0200
@@ -368,7 +368,7 @@
 	case "${UNAME_MACHINE}" in
 	    9000/31? )            HP_ARCH=m68000 ;;
 	    9000/[34]?? )         HP_ARCH=m68k ;;
-	    9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 )
+	    9000/[678][0-9][0-9])
               sed 's/^              //' << EOF >dummy.c
               #include <stdlib.h>
               #include <unistd.h>
--- a/configure	Mon Aug 13 11:23:14 2007 +0200
+++ b/configure	Mon Aug 13 11:24:09 2007 +0200
@@ -2,7 +2,7 @@
 
 #### Configuration script for XEmacs.  Largely divergent from FSF.
 #### 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.
 #### Copyright (C) 1993-1995 Board of Trustees, University of Illinois.
 #### Copyright (C) 1996, 1997 Sun Microsystems, Inc.
@@ -199,6 +199,8 @@
 ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
 cross_compiling=no
 
+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
@@ -237,10 +239,13 @@
 etcdir='${datadir}/${PROGNAME}-${version}/etc'
 lockdir='${statedir}/${PROGNAME}/lock'
 archlibdir='${datadir}/${PROGNAME}-${version}/${configuration}'
+docdir='${archlibdir}'
+with_prefix='yes'
 with_site_lisp='no'
 with_site_modules='yes'
 with_menubars=''
 with_scrollbars=''
+with_widgets=''
 with_dialogs=''
 with_file_coding=''
 cpp='' cppflags='' libs='' ldflags=''
@@ -304,7 +309,8 @@
             case "$opt" in
 
       	with_site_lisp	| \
-    with_site_modules | \
+	with_prefix	| \
+	with_site_modules | \
 	with_x		| \
 	with_x11	| \
 	with_msw	| \
@@ -545,6 +551,14 @@
 	   eval "$opt=\"$val\""
 
                       	   case "$opt" in
+	     	     exec_prefix ) { test "$extra_verbose" = "yes" && cat << \EOF
+    Defining EXEC_PREFIX_USER_DEFINED
+EOF
+cat >> confdefs.h <<\EOF
+#define EXEC_PREFIX_USER_DEFINED 1
+EOF
+}
+ ;;
              lispdir ) { test "$extra_verbose" = "yes" && cat << \EOF
     Defining LISPDIR_USER_DEFINED
 EOF
@@ -642,6 +656,14 @@
 EOF
 }
  ;;
+	     docdir ) { test "$extra_verbose" = "yes" && cat << \EOF
+    Defining DOCDIR_USER_DEFINED
+EOF
+cat >> confdefs.h <<\EOF
+#define DOCDIR_USER_DEFINED 1
+EOF
+}
+ ;;
              exec_prefix | libdir | archlibdir ) { test "$extra_verbose" = "yes" && cat << \EOF
     Defining ARCHLIBDIR_USER_DEFINED
 EOF
@@ -659,7 +681,8 @@
 
 		"with_menubars"   | \
 	"with_scrollbars" | \
-	"with_dialogs" )
+	"with_dialogs" | \
+	"with_widgets" )
 	  case "$val" in
 	    l | lu | luc | luci | lucid )		val=lucid  ;;
 	    m | mo | mot | moti | motif )		val=motif  ;;
@@ -767,7 +790,7 @@
 fi
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:771: checking whether ln -s works" >&5
+echo "configure:794: checking whether ln -s works" >&5
 
 rm -f conftestdata
 if ln -s X conftestdata 2>/dev/null
@@ -892,7 +915,7 @@
 
 
 if test "$with_infodock" = "yes"; then
-  if test ! -f ../ID-INSTALL; then
+  if test ! -f ../../ID-INSTALL; then
     echo "Cannot build InfoDock without InfoDock sources"
     with_infodock=no
   fi
@@ -1012,7 +1035,7 @@
 
 
 echo $ac_n "checking "host system type"""... $ac_c" 1>&6
-echo "configure:1016: checking "host system type"" >&5
+echo "configure:1039: checking "host system type"" >&5
 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'`
 canonical=`${CONFIG_SHELL-/bin/sh} $srcdir/config.sub "$internal_configuration"`
 configuration=`echo "$configuration" | sed 's/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/'`
@@ -1504,13 +1527,14 @@
 # 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:1508: checking for $ac_word" >&5
+echo "configure:1531: checking for $ac_word" >&5
 
 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"
@@ -1530,14 +1554,15 @@
   # 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:1534: checking for $ac_word" >&5
+echo "configure:1558: checking for $ac_word" >&5
 
 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
@@ -1571,11 +1596,42 @@
   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:1606: checking for $ac_word" >&5
+
+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
+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:1579: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1635: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
@@ -1586,12 +1642,14 @@
 ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
 cross_compiling=no
 
-cat > conftest.$ac_ext <<EOF
-#line 1591 "configure"
-#include "confdefs.h"
+cat > conftest.$ac_ext << EOF
+
+#line 1648 "configure"
+#include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:1595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1653: \"$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
@@ -1605,25 +1663,33 @@
   ac_cv_prog_cc_works=no
 fi
 rm -fr conftest*
+ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
+cross_compiling=no
 
 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:1615: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1681: 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:1620: checking whether we are using GNU C" >&5
+echo "configure:1686: checking whether we are using GNU C" >&5
 
 cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1627: \"$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:1693: \"$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
@@ -1633,11 +1699,15 @@
 
 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:1641: 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:1711: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1649,16 +1719,20 @@
 
 
 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="-g"
+  fi
+else
+  if test "$GCC" = yes; then
     CFLAGS="-O2"
-  fi
-else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  else
+    CFLAGS=
+  fi
 fi
  
 if   test "$with_gcc" = "no"  -a "$GCC" = "yes"; then
@@ -1666,13 +1740,14 @@
   # 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:1670: checking for $ac_word" >&5
+echo "configure:1744: checking for $ac_word" >&5
 
 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"
@@ -1692,14 +1767,15 @@
   # 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:1696: checking for $ac_word" >&5
+echo "configure:1771: checking for $ac_word" >&5
 
 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
@@ -1733,11 +1809,42 @@
   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:1819: checking for $ac_word" >&5
+
+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
+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:1741: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1848: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
@@ -1748,12 +1855,14 @@
 ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
 cross_compiling=no
 
-cat > conftest.$ac_ext <<EOF
-#line 1753 "configure"
-#include "confdefs.h"
+cat > conftest.$ac_ext << EOF
+
+#line 1861 "configure"
+#include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:1757: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1866: \"$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
@@ -1767,25 +1876,33 @@
   ac_cv_prog_cc_works=no
 fi
 rm -fr conftest*
+ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
+cross_compiling=no
 
 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:1777: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1894: 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:1782: checking whether we are using GNU C" >&5
+echo "configure:1899: checking whether we are using GNU C" >&5
 
 cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1789: \"$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:1906: \"$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
@@ -1795,11 +1912,15 @@
 
 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:1803: 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:1924: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1811,16 +1932,20 @@
 
 
 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="-g"
+  fi
+else
+  if test "$GCC" = yes; then
     CFLAGS="-O2"
-  fi
-else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  else
+    CFLAGS=
+  fi
 fi
 
 elif test "$with_gcc" = "yes" -a "$GCC" != "yes" ; then
@@ -1828,13 +1953,14 @@
   # 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:1832: checking for $ac_word" >&5
+echo "configure:1957: checking for $ac_word" >&5
 
 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"
@@ -1854,14 +1980,15 @@
   # 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:1858: checking for $ac_word" >&5
+echo "configure:1984: checking for $ac_word" >&5
 
 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
@@ -1895,11 +2022,42 @@
   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:2032: checking for $ac_word" >&5
+
+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
+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:1903: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:2061: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
@@ -1910,12 +2068,14 @@
 ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
 cross_compiling=no
 
-cat > conftest.$ac_ext <<EOF
-#line 1915 "configure"
-#include "confdefs.h"
+cat > conftest.$ac_ext << EOF
+
+#line 2074 "configure"
+#include "confdefs.h"
+
 main(){return(0);}
 EOF
-if { (eval echo configure:1919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2079: \"$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
@@ -1929,25 +2089,33 @@
   ac_cv_prog_cc_works=no
 fi
 rm -fr conftest*
+ac_ext=c
+xe_cppflags='$CPPFLAGS $c_switch_site $c_switch_machine $c_switch_system $c_switch_x_site $X_CFLAGS'
+xe_ldflags='$LDFLAGS $ld_switch_site $ld_switch_machine $ld_switch_system $ld_switch_x_site $ld_switch_run'
+xe_libs='$ld_call_shared $xe_check_libs $X_EXTRA_LIBS $libs_x $X_PRE_LIBS $LIBS $libs_machine $libs_system $libs_standard'
+ac_cpp='$CPP '"$xe_cppflags"
+ac_compile='${CC-cc} -c $CFLAGS '"$xe_cppflags"' conftest.$ac_ext 1>&5'
+ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
+cross_compiling=no
 
 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:1939: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:2107: 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:1944: checking whether we are using GNU C" >&5
+echo "configure:2112: checking whether we are using GNU C" >&5
 
 cat > conftest.c <<EOF
 #ifdef __GNUC__
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1951: \"$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:2119: \"$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
@@ -1957,11 +2125,15 @@
 
 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:1965: 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:2137: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1973,16 +2145,20 @@
 
 
 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="-g"
+  fi
+else
+  if test "$GCC" = yes; then
     CFLAGS="-O2"
-  fi
-else
-  GCC=
-  test "${CFLAGS+set}" = set || CFLAGS="-g"
+  else
+    CFLAGS=
+  fi
 fi
 
 fi
@@ -1994,7 +2170,7 @@
 test -n "$NON_GNU_CPP" -a "$GCC" != "yes" -a -z "$CPP" && CPP="$NON_GNU_CPP"
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1998: checking how to run the C preprocessor" >&5
+echo "configure:2174: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2007,14 +2183,14 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 2011 "configure"
+#line 2187 "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:2017: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:2193: \"$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
@@ -2024,14 +2200,31 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 2028 "configure"
+#line 2204 "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:2034: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:2210: \"$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 2221 "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:2227: \"$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
@@ -2044,6 +2237,8 @@
 rm -f conftest*
 fi
 rm -f conftest*
+fi
+rm -f conftest*
   ac_cv_prog_CPP="$CPP"
   CPP="$ac_cv_prog_CPP"
 else
@@ -2053,9 +2248,9 @@
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:2057: checking for AIX" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2059 "configure"
+echo "configure:2252: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2254 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -2082,9 +2277,9 @@
 
 
 echo $ac_n "checking for GNU libc""... $ac_c" 1>&6
-echo "configure:2086: checking for GNU libc" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2088 "configure"
+echo "configure:2281: checking for GNU libc" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2283 "configure"
 #include "confdefs.h"
 #include <features.h>
 int main() {
@@ -2096,7 +2291,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2100: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   have_glibc=yes
 else
@@ -2118,7 +2313,7 @@
 
 
 cat > conftest.$ac_ext <<EOF
-#line 2122 "configure"
+#line 2317 "configure"
 #include "confdefs.h"
 int main () {
 #if defined __SUNPRO_C
@@ -2130,7 +2325,7 @@
 #endif
 }
 EOF
-if { (eval echo configure:2134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:2329: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   :
 else
@@ -2404,7 +2599,7 @@
  fi
 
 echo $ac_n "checking for dynodump""... $ac_c" 1>&6
-echo "configure:2408: checking for dynodump" >&5
+echo "configure:2603: checking for dynodump" >&5
 if test "$unexec" != "unexsol2.o"; then
   echo "$ac_t""no" 1>&6
 else
@@ -2442,12 +2637,12 @@
   done
   
 echo $ac_n "checking for terminateAndUnload in -lC""... $ac_c" 1>&6
-echo "configure:2446: checking for terminateAndUnload in -lC" >&5
+echo "configure:2641: checking for terminateAndUnload in -lC" >&5
 ac_lib_var=`echo C'_'terminateAndUnload | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lC "
 cat > conftest.$ac_ext <<EOF
-#line 2451 "configure"
+#line 2646 "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
@@ -2458,7 +2653,7 @@
 terminateAndUnload()
 ; return 0; }
 EOF
-if { (eval echo configure:2462: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2657: \"$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
@@ -2562,7 +2757,7 @@
 
 if test "$add_runtime_path" = "yes"; then
       echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6
-echo "configure:2566: checking "for runtime libraries flag"" >&5
+echo "configure:2761: checking "for runtime libraries flag"" >&5
   case "$opsys" in
     sol2 ) dash_r="-R" ;;
     decosf* | linux* | irix*) dash_r="-rpath " ;;
@@ -2584,14 +2779,14 @@
   done
 fi
         cat > conftest.$ac_ext <<EOF
-#line 2588 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 2783 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   dash_r="$try_dash_r"
 else
@@ -2693,10 +2888,10 @@
 fi
 after_morecore_hook_exists=yes
 echo $ac_n "checking for malloc_get_state""... $ac_c" 1>&6
-echo "configure:2697: checking for malloc_get_state" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2700 "configure"
+echo "configure:2892: checking for malloc_get_state" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2895 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char malloc_get_state(); below.  */
@@ -2719,7 +2914,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_malloc_get_state=yes"
 else
@@ -2739,10 +2934,10 @@
 fi
 
 echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6
-echo "configure:2743: checking for malloc_set_state" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2746 "configure"
+echo "configure:2938: checking for malloc_set_state" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2941 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char malloc_set_state(); below.  */
@@ -2765,7 +2960,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2769: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_malloc_set_state=yes"
 else
@@ -2785,16 +2980,16 @@
 fi
 
 echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6
-echo "configure:2789: checking whether __after_morecore_hook exists" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2791 "configure"
+echo "configure:2984: checking whether __after_morecore_hook exists" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2986 "configure"
 #include "confdefs.h"
 extern void (* __after_morecore_hook)();
 int main() {
 __after_morecore_hook = 0
 ; return 0; }
 EOF
-if { (eval echo configure:2798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -2853,13 +3048,14 @@
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2857: checking for $ac_word" >&5
+echo "configure:3052: checking for $ac_word" >&5
 
 if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # 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_RANLIB="ranlib"
@@ -2902,26 +3098,28 @@
 # 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:2910: checking for a BSD compatible install" >&5
+echo "configure:3107: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 
-  IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
+  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.
-      for ac_prog in ginstall installbsd scoinst install; do
+      # 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.
-	    # OSF/1 installbsd also uses dspmsg, but is usable.
 	    :
 	  else
 	    ac_cv_path_install="$ac_dir/$ac_prog -c"
@@ -2950,6 +3148,8 @@
 # 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'
 
 for ac_prog in 'bison -y' byacc
@@ -2957,13 +3157,14 @@
 # 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:2961: checking for $ac_word" >&5
+echo "configure:3161: checking for $ac_word" >&5
 
 if test -n "$YACC"; then
   ac_cv_prog_YACC="$YACC" # 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_YACC="$ac_prog"
@@ -2988,16 +3189,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2992: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2995 "configure"
+echo "configure:3193: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3196 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 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:3201: \"$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"
@@ -3029,16 +3230,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3033: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3036 "configure"
+echo "configure:3234: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3237 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3041: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3242: \"$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"
@@ -3070,16 +3271,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3074: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3077 "configure"
+echo "configure:3275: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3278 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3082: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3283: \"$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"
@@ -3108,10 +3309,10 @@
 done
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:3112: checking for sys/wait.h that is POSIX.1 compatible" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3115 "configure"
+echo "configure:3313: checking for sys/wait.h that is POSIX.1 compatible" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3316 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -3127,7 +3328,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:3131: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3332: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -3151,10 +3352,10 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:3155: checking for ANSI C header files" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3158 "configure"
+echo "configure:3356: checking for ANSI C header files" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3359 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -3162,8 +3363,8 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3166: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:3367: \"$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
@@ -3179,7 +3380,7 @@
 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 3183 "configure"
+#line 3384 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -3197,7 +3398,7 @@
 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 3201 "configure"
+#line 3402 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3215,7 +3416,7 @@
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
 cat > conftest.$ac_ext <<EOF
-#line 3219 "configure"
+#line 3420 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3226,7 +3427,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:3230: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:3431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   :
 else
@@ -3252,10 +3453,10 @@
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3256: checking whether time.h and sys/time.h may both be included" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3259 "configure"
+echo "configure:3457: checking whether time.h and sys/time.h may both be included" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3460 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3264,7 +3465,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3268: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3288,10 +3489,10 @@
 fi
 
 echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:3292: checking for sys_siglist declaration in signal.h or unistd.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3295 "configure"
+echo "configure:3493: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3496 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3303,7 +3504,7 @@
 char *msg = *(sys_siglist + 1);
 ; return 0; }
 EOF
-if { (eval echo configure:3307: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3508: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_decl_sys_siglist=yes
 else
@@ -3328,9 +3529,9 @@
 
 
 echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
-echo "configure:3332: checking for struct utimbuf" >&5
-cat > conftest.$ac_ext <<EOF
-#line 3334 "configure"
+echo "configure:3533: checking for struct utimbuf" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3535 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -3349,7 +3550,7 @@
 static struct utimbuf x; x.actime = x.modtime;
 ; return 0; }
 EOF
-if { (eval echo configure:3353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3554: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
    { test "$extra_verbose" = "yes" && cat << \EOF
@@ -3369,10 +3570,10 @@
 rm -f conftest*
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3373: checking return type of signal handlers" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3376 "configure"
+echo "configure:3574: checking return type of signal handlers" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3577 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3389,7 +3590,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3594: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3411,10 +3612,10 @@
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3415: checking for size_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3418 "configure"
+echo "configure:3616: checking for size_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3619 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3423,7 +3624,7 @@
 #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
@@ -3445,10 +3646,10 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3449: checking for pid_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3452 "configure"
+echo "configure:3650: checking for pid_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3653 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3457,7 +3658,7 @@
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_pid_t=yes
 else
@@ -3479,10 +3680,10 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3483: checking for uid_t in sys/types.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3486 "configure"
+echo "configure:3684: checking for uid_t in sys/types.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3687 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3518,10 +3719,10 @@
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3522: checking for mode_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3525 "configure"
+echo "configure:3723: checking for mode_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3726 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3530,7 +3731,7 @@
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_mode_t=yes
 else
@@ -3552,10 +3753,10 @@
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3556: checking for off_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3559 "configure"
+echo "configure:3757: checking for off_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3760 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3564,7 +3765,7 @@
 #endif
 EOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
+  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
   rm -rf conftest*
   ac_cv_type_off_t=yes
 else
@@ -3587,9 +3788,9 @@
 
 
 echo $ac_n "checking for struct timeval""... $ac_c" 1>&6
-echo "configure:3591: checking for struct timeval" >&5
-cat > conftest.$ac_ext <<EOF
-#line 3593 "configure"
+echo "configure:3792: checking for struct timeval" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3794 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -3605,7 +3806,7 @@
 static struct timeval x; x.tv_sec = x.tv_usec;
 ; return 0; }
 EOF
-if { (eval echo configure:3609: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3810: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
   HAVE_TIMEVAL=yes
@@ -3627,10 +3828,10 @@
 rm -f conftest*
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:3631: checking whether struct tm is in sys/time.h or time.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3634 "configure"
+echo "configure:3832: checking whether struct tm is in sys/time.h or time.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3835 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -3638,7 +3839,7 @@
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:3642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3843: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -3662,10 +3863,10 @@
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3666: checking for tm_zone in struct tm" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3669 "configure"
+echo "configure:3867: checking for tm_zone in struct tm" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3870 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -3673,7 +3874,7 @@
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:3677: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3878: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -3696,10 +3897,10 @@
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3700: checking for tzname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3703 "configure"
+echo "configure:3901: checking for tzname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3904 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -3709,7 +3910,7 @@
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:3713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -3735,10 +3936,10 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3739: checking for working const" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3742 "configure"
+echo "configure:3940: checking for working const" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3943 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3787,7 +3988,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3812,7 +4013,7 @@
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:3816: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:4017: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 
 cat > conftestmake <<\EOF
@@ -3837,12 +4038,12 @@
 
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3841: checking whether byte ordering is bigendian" >&5
+echo "configure:4042: checking whether byte ordering is bigendian" >&5
 
 ac_cv_c_bigendian=unknown
 # See if sys/param.h defines the BYTE_ORDER macro.
 cat > conftest.$ac_ext <<EOF
-#line 3846 "configure"
+#line 4047 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3853,11 +4054,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3857: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   # It does; now see whether it defined to BIG_ENDIAN or not.
 cat > conftest.$ac_ext <<EOF
-#line 3861 "configure"
+#line 4062 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3868,7 +4069,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4073: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3885,7 +4086,7 @@
 rm -f conftest*
 if test $ac_cv_c_bigendian = unknown; then
 cat > conftest.$ac_ext <<EOF
-#line 3889 "configure"
+#line 4090 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3898,7 +4099,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_c_bigendian=no
 else
@@ -3925,10 +4126,10 @@
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:3929: checking size of short" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3932 "configure"
+echo "configure:4130: checking size of short" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4133 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3939,7 +4140,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -3967,10 +4168,10 @@
   exit 1
 fi
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:3971: checking size of int" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3974 "configure"
+echo "configure:4172: checking size of int" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4175 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3981,7 +4182,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -4003,10 +4204,10 @@
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:4007: checking size of long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4010 "configure"
+echo "configure:4208: checking size of long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4211 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4017,7 +4218,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -4039,10 +4240,10 @@
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4043: checking size of long long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4046 "configure"
+echo "configure:4244: checking size of long long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4247 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4053,7 +4254,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_sizeof_long_long=`cat conftestval`
 else
@@ -4075,10 +4276,10 @@
 
 
 echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:4079: checking size of void *" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4082 "configure"
+echo "configure:4280: checking size of void *" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4283 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -4089,7 +4290,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:4093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:4294: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_sizeof_void_p=`cat conftestval`
 else
@@ -4112,7 +4313,7 @@
 
 
 echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:4116: checking for long file names" >&5
+echo "configure:4317: checking for long file names" >&5
 
 ac_cv_sys_long_file_names=yes
 # Test for long file names in all the places we know might matter:
@@ -4158,10 +4359,10 @@
 
 
 echo $ac_n "checking for sin""... $ac_c" 1>&6
-echo "configure:4162: checking for sin" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4165 "configure"
+echo "configure:4363: checking for sin" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4366 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char sin(); below.  */
@@ -4184,7 +4385,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4188: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_sin=yes"
 else
@@ -4202,12 +4403,12 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:4206: checking for sin in -lm" >&5
+echo "configure:4407: checking for sin in -lm" >&5
 ac_lib_var=`echo m'_'sin | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lm "
 cat > conftest.$ac_ext <<EOF
-#line 4211 "configure"
+#line 4412 "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
@@ -4218,7 +4419,7 @@
 sin()
 ; return 0; }
 EOF
-if { (eval echo configure:4222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4423: \"$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
@@ -4262,14 +4463,14 @@
 
 
 cat > conftest.$ac_ext <<EOF
-#line 4266 "configure"
+#line 4467 "configure"
 #include "confdefs.h"
 #include <math.h>
 int main() {
 return atanh(1.0) + asinh(1.0) + acosh(1.0); 
 ; return 0; }
 EOF
-if { (eval echo configure:4273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_INVERSE_HYPERBOLIC
@@ -4286,7 +4487,7 @@
 rm -f conftest*
 
 echo "checking type of mail spool file locking" 1>&6
-echo "configure:4290: checking type of mail spool file locking" >&5
+echo "configure:4491: checking type of mail spool file locking" >&5
 test -z "$mail_locking" -a "$mail_use_flock" = "yes" && mail_locking=flock
 test -z "$mail_locking" -a "$mail_use_lockf" = "yes" && mail_locking=lockf
 if   test "$mail_locking" = "lockf"; then { test "$extra_verbose" = "yes" && cat << \EOF
@@ -4311,12 +4512,12 @@
 case "$opsys" in decosf*)
   
 echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6
-echo "configure:4315: checking for cma_open in -lpthreads" >&5
+echo "configure:4516: checking for cma_open in -lpthreads" >&5
 ac_lib_var=`echo pthreads'_'cma_open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lpthreads "
 cat > conftest.$ac_ext <<EOF
-#line 4320 "configure"
+#line 4521 "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
@@ -4327,7 +4528,7 @@
 cma_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4532: \"$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
@@ -4363,7 +4564,7 @@
 esac
 
 echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6
-echo "configure:4367: checking whether the -xildoff compiler flag is required" >&5
+echo "configure:4568: checking whether the -xildoff compiler flag is required" >&5
 if   ${CC-cc} '-###' -xildon  no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ; then
   if ${CC-cc} '-###' -xildoff no_such_file.c 2>&1 | grep '^[^ ]*/ild ' > /dev/null ;
     then echo "$ac_t""no" 1>&6;
@@ -4374,7 +4575,7 @@
 
 if test "$opsys" = "sol2" && test "$OS_RELEASE" -ge 56; then
   echo $ac_n "checking for \"-z ignore\" linker flag""... $ac_c" 1>&6
-echo "configure:4378: checking for \"-z ignore\" linker flag" >&5
+echo "configure:4579: checking for \"-z ignore\" linker flag" >&5
   case "`ld -h 2>&1`" in
     *-z\ ignore\|record* ) echo "$ac_t""yes" 1>&6
       ld_switch_site="-z ignore $ld_switch_site" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-z ignore\" to \$ld_switch_site"; fi ;;
@@ -4384,7 +4585,7 @@
 
 
 echo "checking "for specified window system"" 1>&6
-echo "configure:4388: checking "for specified window system"" >&5
+echo "configure:4589: checking "for specified window system"" >&5
 
 if test "$with_x11" != "no"; then
     test "$x_includes $x_libraries" != "NONE NONE" && \
@@ -4417,7 +4618,7 @@
 # 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:4421: checking for X" >&5
+echo "configure:4622: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -4477,13 +4678,13 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 4481 "configure"
+#line 4682 "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:4486: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:4687: \"$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.
@@ -4551,14 +4752,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4555 "configure"
+#line 4756 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:4562: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4763: \"$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.
@@ -4667,17 +4868,17 @@
     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:4671: checking whether -R must be followed by a space" >&5
+echo "configure:4872: 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 4674 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4875 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -4693,14 +4894,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 4697 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4898 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4905: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -4736,12 +4937,12 @@
 else
 
 echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:4740: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:4941: checking for dnet_ntoa in -ldnet" >&5
 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldnet "
 cat > conftest.$ac_ext <<EOF
-#line 4745 "configure"
+#line 4946 "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
@@ -4752,7 +4953,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4957: \"$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
@@ -4776,12 +4977,12 @@
     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:4780: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:4981: checking for dnet_ntoa in -ldnet_stub" >&5
 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldnet_stub "
 cat > conftest.$ac_ext <<EOF
-#line 4785 "configure"
+#line 4986 "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
@@ -4792,7 +4993,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4997: \"$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
@@ -4821,10 +5022,10 @@
     # 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:4825: checking for gethostbyname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4828 "configure"
+echo "configure:5026: checking for gethostbyname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5029 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4847,7 +5048,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5052: \"$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
@@ -4868,12 +5069,12 @@
     if test $ac_cv_func_gethostbyname = no; then
       
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:4872: checking for gethostbyname in -lnsl" >&5
+echo "configure:5073: checking for gethostbyname in -lnsl" >&5
 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lnsl "
 cat > conftest.$ac_ext <<EOF
-#line 4877 "configure"
+#line 5078 "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
@@ -4884,7 +5085,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:4888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5089: \"$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
@@ -4914,10 +5115,10 @@
     # -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:4918: checking for connect" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4921 "configure"
+echo "configure:5119: checking for connect" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5122 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -4940,7 +5141,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5145: \"$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
@@ -4963,12 +5164,12 @@
 xe_msg_checking="for connect in -lsocket"
 test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:4967: checking "$xe_msg_checking"" >&5
+echo "configure:5168: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lsocket $X_EXTRA_LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4972 "configure"
+#line 5173 "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
@@ -4979,7 +5180,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:4983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5184: \"$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
@@ -5003,10 +5204,10 @@
 
     # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
     echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:5007: checking for remove" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5010 "configure"
+echo "configure:5208: checking for remove" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5211 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -5029,7 +5230,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5033: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5234: \"$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
@@ -5050,12 +5251,12 @@
     if test $ac_cv_func_remove = no; then
       
 echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:5054: checking for remove in -lposix" >&5
+echo "configure:5255: checking for remove in -lposix" >&5
 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lposix "
 cat > conftest.$ac_ext <<EOF
-#line 5059 "configure"
+#line 5260 "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
@@ -5066,7 +5267,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:5070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5271: \"$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
@@ -5090,10 +5291,10 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:5094: checking for shmat" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5097 "configure"
+echo "configure:5295: checking for shmat" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5298 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -5116,7 +5317,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:5120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5321: \"$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
@@ -5137,12 +5338,12 @@
     if test $ac_cv_func_shmat = no; then
       
 echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:5141: checking for shmat in -lipc" >&5
+echo "configure:5342: checking for shmat in -lipc" >&5
 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lipc "
 cat > conftest.$ac_ext <<EOF
-#line 5146 "configure"
+#line 5347 "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
@@ -5153,7 +5354,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:5157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5358: \"$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
@@ -5186,13 +5387,15 @@
   # 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:5191: checking for IceConnectionNumber in -lICE" >&5
+xe_msg_checking="for IceConnectionNumber in -lICE"
+test -n "$X_EXTRA_LIBS" && xe_msg_checking="$xe_msg_checking using extra libs $X_EXTRA_LIBS"
+echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
+echo "configure:5394: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 
-xe_check_libs=" -lICE "
-cat > conftest.$ac_ext <<EOF
-#line 5196 "configure"
+xe_check_libs=" -lICE $X_EXTRA_LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5399 "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
@@ -5203,7 +5406,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:5207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5410: \"$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
@@ -5372,7 +5575,7 @@
 
 
     echo "checking for X defines extracted by xmkmf" 1>&6
-echo "configure:5376: checking for X defines extracted by xmkmf" >&5
+echo "configure:5579: checking for X defines extracted by xmkmf" >&5
   rm -fr conftestdir
   if mkdir conftestdir; then
     cd conftestdir
@@ -5404,16 +5607,16 @@
 
     ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6
-echo "configure:5408: checking for X11/Intrinsic.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5411 "configure"
+echo "configure:5611: checking for X11/Intrinsic.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5614 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:5619: \"$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"
@@ -5436,12 +5639,12 @@
 
       
 echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:5440: checking for XOpenDisplay in -lX11" >&5
+echo "configure:5643: checking for XOpenDisplay in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lX11 "
 cat > conftest.$ac_ext <<EOF
-#line 5445 "configure"
+#line 5648 "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
@@ -5452,7 +5655,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:5456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5659: \"$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
@@ -5477,12 +5680,12 @@
 xe_msg_checking="for XGetFontProperty in -lX11"
 test -n "-b i486-linuxaout" && xe_msg_checking="$xe_msg_checking using extra libs -b i486-linuxaout"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:5481: checking "$xe_msg_checking"" >&5
+echo "configure:5684: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo X11'_'XGetFontProperty | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lX11 -b i486-linuxaout"
 cat > conftest.$ac_ext <<EOF
-#line 5486 "configure"
+#line 5689 "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
@@ -5493,7 +5696,7 @@
 XGetFontProperty()
 ; return 0; }
 EOF
-if { (eval echo configure:5497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5700: \"$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
@@ -5520,12 +5723,12 @@
 
     
 echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6
-echo "configure:5524: checking for XShapeSelectInput in -lXext" >&5
+echo "configure:5727: checking for XShapeSelectInput in -lXext" >&5
 ac_lib_var=`echo Xext'_'XShapeSelectInput | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXext "
 cat > conftest.$ac_ext <<EOF
-#line 5529 "configure"
+#line 5732 "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
@@ -5536,7 +5739,7 @@
 XShapeSelectInput()
 ; return 0; }
 EOF
-if { (eval echo configure:5540: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5743: \"$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
@@ -5559,12 +5762,12 @@
 
     
 echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6
-echo "configure:5563: checking for XtOpenDisplay in -lXt" >&5
+echo "configure:5766: checking for XtOpenDisplay in -lXt" >&5
 ac_lib_var=`echo Xt'_'XtOpenDisplay | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXt "
 cat > conftest.$ac_ext <<EOF
-#line 5568 "configure"
+#line 5771 "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
@@ -5575,7 +5778,7 @@
 XtOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:5579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5782: \"$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
@@ -5598,14 +5801,14 @@
 
 
   echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6
-echo "configure:5602: checking the version of X11 being used" >&5
+echo "configure:5805: checking the version of X11 being used" >&5
   cat > conftest.$ac_ext <<EOF
-#line 5604 "configure"
+#line 5807 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
     int main(int c, char *v[]) { return c>1 ? XlibSpecificationRelease : 0; }
 EOF
-if { (eval echo configure:5609: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ./conftest foobar; x11_release=$?
 else
@@ -5630,16 +5833,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5634: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5637 "configure"
+echo "configure:5837: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5840 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5642: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:5845: \"$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"
@@ -5669,7 +5872,7 @@
 
 
     echo $ac_n "checking for XFree86""... $ac_c" 1>&6
-echo "configure:5673: checking for XFree86" >&5
+echo "configure:5876: checking for XFree86" >&5
   if test -d "/usr/X386/include" -o \
           -f "/etc/XF86Config"    -o \
 	  -f "/etc/X11/XF86Config" -o \
@@ -5689,12 +5892,12 @@
 
     test -z "$with_xmu" && { 
 echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6
-echo "configure:5693: checking for XmuReadBitmapDataFromFile in -lXmu" >&5
+echo "configure:5896: checking for XmuReadBitmapDataFromFile in -lXmu" >&5
 ac_lib_var=`echo Xmu'_'XmuReadBitmapDataFromFile | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXmu "
 cat > conftest.$ac_ext <<EOF
-#line 5698 "configure"
+#line 5901 "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
@@ -5705,7 +5908,7 @@
 XmuReadBitmapDataFromFile()
 ; return 0; }
 EOF
-if { (eval echo configure:5709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5912: \"$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
@@ -5744,19 +5947,19 @@
 
       
 echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:5748: checking for main in -lXbsd" >&5
+echo "configure:5951: checking for main in -lXbsd" >&5
 ac_lib_var=`echo Xbsd'_'main | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXbsd "
 cat > conftest.$ac_ext <<EOF
-#line 5753 "configure"
+#line 5956 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5963: \"$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
@@ -5793,22 +5996,22 @@
 fi 
 if test "$with_msw" != "no"; then
   echo "checking for MS-Windows" 1>&6
-echo "configure:5797: checking for MS-Windows" >&5
+echo "configure:6000: checking for MS-Windows" >&5
   
 echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6
-echo "configure:5800: checking for main in -lgdi32" >&5
+echo "configure:6003: checking for main in -lgdi32" >&5
 ac_lib_var=`echo gdi32'_'main | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lgdi32 "
 cat > conftest.$ac_ext <<EOF
-#line 5805 "configure"
+#line 6008 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6015: \"$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
@@ -5873,12 +6076,12 @@
  fi
     fi
         cat > conftest.$ac_ext <<EOF
-#line 5877 "configure"
+#line 6080 "configure"
 #include "confdefs.h"
 #include <fcntl.h>
     int main() { return (open("/dev/windows", O_RDONLY, 0) > 0)? 0 : 1; }
 EOF
-if { (eval echo configure:5882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:6085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_MSG_SELECT
@@ -5954,7 +6157,7 @@
 esac
 
 echo "checking for WM_COMMAND option" 1>&6
-echo "configure:5958: checking for WM_COMMAND option" >&5;
+echo "configure:6161: checking for WM_COMMAND option" >&5;
 if test "$with_wmcommand" != "no"; then
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_WMCOMMAND
@@ -5969,16 +6172,16 @@
 test -z "$with_xauth" && test "$window_system" = "none" && with_xauth=no
 test -z "$with_xauth" && { ac_safe=`echo "X11/Xauth.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Xauth.h""... $ac_c" 1>&6
-echo "configure:5973: checking for X11/Xauth.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5976 "configure"
+echo "configure:6176: checking for X11/Xauth.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6179 "configure"
 #include "confdefs.h"
 #include <X11/Xauth.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5981: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6184: \"$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"
@@ -6000,12 +6203,12 @@
  }
 test -z "$with_xauth" && { 
 echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6
-echo "configure:6004: checking for XauGetAuthByAddr in -lXau" >&5
+echo "configure:6207: checking for XauGetAuthByAddr in -lXau" >&5
 ac_lib_var=`echo Xau'_'XauGetAuthByAddr | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXau "
 cat > conftest.$ac_ext <<EOF
-#line 6009 "configure"
+#line 6212 "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
@@ -6016,7 +6219,7 @@
 XauGetAuthByAddr()
 ; return 0; }
 EOF
-if { (eval echo configure:6020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6223: \"$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
@@ -6061,16 +6264,16 @@
       for dir in "" "Tt/" "desktop/" ; do
     ac_safe=`echo "${dir}tt_c.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ${dir}tt_c.h""... $ac_c" 1>&6
-echo "configure:6065: checking for ${dir}tt_c.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6068 "configure"
+echo "configure:6268: checking for ${dir}tt_c.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6271 "configure"
 #include "confdefs.h"
 #include <${dir}tt_c.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6276: \"$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"
@@ -6105,12 +6308,12 @@
 xe_msg_checking="for tt_message_create in -ltt"
 test -n "$extra_libs" && xe_msg_checking="$xe_msg_checking using extra libs $extra_libs"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:6109: checking "$xe_msg_checking"" >&5
+echo "configure:6312: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo tt'_'tt_message_create | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltt $extra_libs"
 cat > conftest.$ac_ext <<EOF
-#line 6114 "configure"
+#line 6317 "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
@@ -6121,7 +6324,7 @@
 tt_message_create()
 ; return 0; }
 EOF
-if { (eval echo configure:6125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6328: \"$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
@@ -6178,16 +6381,16 @@
 
 test -z "$with_cde" && { ac_safe=`echo "Dt/Dt.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Dt/Dt.h""... $ac_c" 1>&6
-echo "configure:6182: checking for Dt/Dt.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6185 "configure"
+echo "configure:6385: checking for Dt/Dt.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6388 "configure"
 #include "confdefs.h"
 #include <Dt/Dt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6393: \"$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"
@@ -6209,12 +6412,12 @@
  }
 test -z "$with_cde" && { 
 echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6
-echo "configure:6213: checking for DtDndDragStart in -lDtSvc" >&5
+echo "configure:6416: checking for DtDndDragStart in -lDtSvc" >&5
 ac_lib_var=`echo DtSvc'_'DtDndDragStart | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lDtSvc "
 cat > conftest.$ac_ext <<EOF
-#line 6218 "configure"
+#line 6421 "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
@@ -6225,7 +6428,7 @@
 DtDndDragStart()
 ; return 0; }
 EOF
-if { (eval echo configure:6229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6432: \"$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
@@ -6294,7 +6497,7 @@
 fi
 
 echo $ac_n "checking if drag and drop API is needed""... $ac_c" 1>&6
-echo "configure:6298: checking if drag and drop API is needed" >&5
+echo "configure:6501: checking if drag and drop API is needed" >&5
 if test "$with_dragndrop" != "no" ; then
   if test -n "$dragndrop_proto" ; then
     with_dragndrop=yes
@@ -6315,19 +6518,19 @@
 fi
 
 echo "checking for LDAP" 1>&6
-echo "configure:6319: checking for LDAP" >&5
+echo "configure:6522: checking for LDAP" >&5
 test -z "$with_ldap" && { ac_safe=`echo "ldap.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ldap.h""... $ac_c" 1>&6
-echo "configure:6322: checking for ldap.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6325 "configure"
+echo "configure:6525: checking for ldap.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6528 "configure"
 #include "confdefs.h"
 #include <ldap.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6330: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6533: \"$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"
@@ -6349,16 +6552,16 @@
  }
 test -z "$with_ldap" && { ac_safe=`echo "lber.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for lber.h""... $ac_c" 1>&6
-echo "configure:6353: checking for lber.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6356 "configure"
+echo "configure:6556: checking for lber.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6559 "configure"
 #include "confdefs.h"
 #include <lber.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6361: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6564: \"$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"
@@ -6381,12 +6584,12 @@
 if test "$with_ldap" != "no"; then
   
 echo $ac_n "checking for ldap_search in -lldap""... $ac_c" 1>&6
-echo "configure:6385: checking for ldap_search in -lldap" >&5
+echo "configure:6588: checking for ldap_search in -lldap" >&5
 ac_lib_var=`echo ldap'_'ldap_search | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lldap "
 cat > conftest.$ac_ext <<EOF
-#line 6390 "configure"
+#line 6593 "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
@@ -6397,7 +6600,7 @@
 ldap_search()
 ; return 0; }
 EOF
-if { (eval echo configure:6401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6604: \"$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
@@ -6422,12 +6625,12 @@
 xe_msg_checking="for ldap_open in -lldap"
 test -n "-llber" && xe_msg_checking="$xe_msg_checking using extra libs -llber"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:6426: checking "$xe_msg_checking"" >&5
+echo "configure:6629: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo ldap'_'ldap_open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lldap -llber"
 cat > conftest.$ac_ext <<EOF
-#line 6431 "configure"
+#line 6634 "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
@@ -6438,7 +6641,7 @@
 ldap_open()
 ; return 0; }
 EOF
-if { (eval echo configure:6442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6645: \"$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
@@ -6482,10 +6685,10 @@
   for ac_func in ldap_set_option ldap_get_lderrno ldap_result2error ldap_parse_result
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6486: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6489 "configure"
+echo "configure:6689: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6692 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6508,7 +6711,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6715: \"$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
@@ -6540,15 +6743,15 @@
 
 if test "$window_system" != "none"; then
   echo "checking for graphics libraries" 1>&6
-echo "configure:6544: checking for graphics libraries" >&5
+echo "configure:6747: checking for graphics libraries" >&5
 
     xpm_problem=""
   if test -z "$with_xpm"; then
     echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6
-echo "configure:6549: checking for Xpm - no older than 3.4f" >&5
+echo "configure:6752: checking for Xpm - no older than 3.4f" >&5
     xe_check_libs=-lXpm
     cat > conftest.$ac_ext <<EOF
-#line 6552 "configure"
+#line 6755 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
     int main(int c, char **v) {
@@ -6556,7 +6759,7 @@
       XpmIncludeVersion != XpmLibraryVersion() ? 1 :
       XpmIncludeVersion < 30406 ? 2 : 0 ;}
 EOF
-if { (eval echo configure:6560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:6763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ./conftest dummy_arg; xpm_status=$?;
       if test "$xpm_status" = "0"; then
@@ -6598,17 +6801,17 @@
 
     libs_x="-lXpm $libs_x" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lXpm\" to \$libs_x"; fi
     echo $ac_n "checking for \"FOR_MSW\" xpm""... $ac_c" 1>&6
-echo "configure:6602: checking for \"FOR_MSW\" xpm" >&5
+echo "configure:6805: checking for \"FOR_MSW\" xpm" >&5
     xe_check_libs=-lXpm
     cat > conftest.$ac_ext <<EOF
-#line 6605 "configure"
+#line 6808 "configure"
 #include "confdefs.h"
 
 int main() {
 XpmCreatePixmapFromData()
 ; return 0; }
 EOF
-if { (eval echo configure:6612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6815: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   xpm_for_msw=no
 else
@@ -6634,16 +6837,16 @@
 
     test -z "$with_xface" && { ac_safe=`echo "compface.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for compface.h""... $ac_c" 1>&6
-echo "configure:6638: checking for compface.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6641 "configure"
+echo "configure:6841: checking for compface.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6844 "configure"
 #include "confdefs.h"
 #include <compface.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:6849: \"$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"
@@ -6665,12 +6868,12 @@
  }
   test -z "$with_xface" && { 
 echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6
-echo "configure:6669: checking for UnGenFace in -lcompface" >&5
+echo "configure:6872: checking for UnGenFace in -lcompface" >&5
 ac_lib_var=`echo compface'_'UnGenFace | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lcompface "
 cat > conftest.$ac_ext <<EOF
-#line 6674 "configure"
+#line 6877 "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
@@ -6681,7 +6884,7 @@
 UnGenFace()
 ; return 0; }
 EOF
-if { (eval echo configure:6685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6888: \"$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
@@ -6733,12 +6936,12 @@
       if test "$with_png $with_tiff" != "no no"; then
     
 echo $ac_n "checking for inflate in -lc""... $ac_c" 1>&6
-echo "configure:6737: checking for inflate in -lc" >&5
+echo "configure:6940: checking for inflate in -lc" >&5
 ac_lib_var=`echo c'_'inflate | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lc "
 cat > conftest.$ac_ext <<EOF
-#line 6742 "configure"
+#line 6945 "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
@@ -6749,7 +6952,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6753: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6956: \"$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
@@ -6768,12 +6971,12 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6
-echo "configure:6772: checking for inflate in -lz" >&5
+echo "configure:6975: checking for inflate in -lz" >&5
 ac_lib_var=`echo z'_'inflate | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lz "
 cat > conftest.$ac_ext <<EOF
-#line 6777 "configure"
+#line 6980 "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
@@ -6784,7 +6987,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6991: \"$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
@@ -6803,12 +7006,12 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for inflate in -lgz""... $ac_c" 1>&6
-echo "configure:6807: checking for inflate in -lgz" >&5
+echo "configure:7010: checking for inflate in -lgz" >&5
 ac_lib_var=`echo gz'_'inflate | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lgz "
 cat > conftest.$ac_ext <<EOF
-#line 6812 "configure"
+#line 7015 "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
@@ -6819,7 +7022,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7026: \"$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
@@ -6849,16 +7052,16 @@
 
     test -z "$with_jpeg" && { ac_safe=`echo "jpeglib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for jpeglib.h""... $ac_c" 1>&6
-echo "configure:6853: checking for jpeglib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6856 "configure"
+echo "configure:7056: checking for jpeglib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7059 "configure"
 #include "confdefs.h"
 #include <jpeglib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6861: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:7064: \"$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"
@@ -6880,12 +7083,12 @@
  }
   test -z "$with_jpeg" && { 
 echo $ac_n "checking for jpeg_destroy_decompress in -ljpeg""... $ac_c" 1>&6
-echo "configure:6884: checking for jpeg_destroy_decompress in -ljpeg" >&5
+echo "configure:7087: checking for jpeg_destroy_decompress in -ljpeg" >&5
 ac_lib_var=`echo jpeg'_'jpeg_destroy_decompress | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ljpeg "
 cat > conftest.$ac_ext <<EOF
-#line 6889 "configure"
+#line 7092 "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
@@ -6896,7 +7099,7 @@
 jpeg_destroy_decompress()
 ; return 0; }
 EOF
-if { (eval echo configure:6900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7103: \"$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
@@ -6932,10 +7135,10 @@
 
     png_problem=""
   test -z "$with_png" && { echo $ac_n "checking for pow""... $ac_c" 1>&6
-echo "configure:6936: checking for pow" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6939 "configure"
+echo "configure:7139: checking for pow" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7142 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pow(); below.  */
@@ -6958,7 +7161,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_pow=yes"
 else
@@ -6979,16 +7182,16 @@
  }
   test -z "$with_png" && { ac_safe=`echo "png.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for png.h""... $ac_c" 1>&6
-echo "configure:6983: checking for png.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6986 "configure"
+echo "configure:7186: checking for png.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7189 "configure"
 #include "confdefs.h"
 #include <png.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6991: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:7194: \"$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"
@@ -7010,12 +7213,12 @@
  }
   test -z "$with_png" && { 
 echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6
-echo "configure:7014: checking for png_read_image in -lpng" >&5
+echo "configure:7217: checking for png_read_image in -lpng" >&5
 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lpng "
 cat > conftest.$ac_ext <<EOF
-#line 7019 "configure"
+#line 7222 "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
@@ -7026,7 +7229,7 @@
 png_read_image()
 ; return 0; }
 EOF
-if { (eval echo configure:7030: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7233: \"$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
@@ -7049,10 +7252,10 @@
  }
   if test -z "$with_png"; then
     echo $ac_n "checking for workable png version information""... $ac_c" 1>&6
-echo "configure:7053: checking for workable png version information" >&5
+echo "configure:7256: checking for workable png version information" >&5
     xe_check_libs="-lpng -lz"
     cat > conftest.$ac_ext <<EOF
-#line 7056 "configure"
+#line 7259 "configure"
 #include "confdefs.h"
 #include <png.h>
     int main(int c, char **v) {
@@ -7060,7 +7263,7 @@
     if (strcmp(png_libpng_ver, PNG_LIBPNG_VER_STRING) != 0) return 1;
     return (PNG_LIBPNG_VER < 10002) ? 2 : 0 ;}
 EOF
-if { (eval echo configure:7064: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:7267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ./conftest dummy_arg; png_status=$?;
       if test "$png_status" = "0"; then
@@ -7103,16 +7306,16 @@
 
     test -z "$with_tiff" && { ac_safe=`echo "tiffio.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for tiffio.h""... $ac_c" 1>&6
-echo "configure:7107: checking for tiffio.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7110 "configure"
+echo "configure:7310: checking for tiffio.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7313 "configure"
 #include "confdefs.h"
 #include <tiffio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7115: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:7318: \"$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"
@@ -7134,12 +7337,12 @@
  }
   test -z "$with_tiff" && { 
 echo $ac_n "checking for TIFFClientOpen in -ltiff""... $ac_c" 1>&6
-echo "configure:7138: checking for TIFFClientOpen in -ltiff" >&5
+echo "configure:7341: checking for TIFFClientOpen in -ltiff" >&5
 ac_lib_var=`echo tiff'_'TIFFClientOpen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltiff "
 cat > conftest.$ac_ext <<EOF
-#line 7143 "configure"
+#line 7346 "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
@@ -7150,7 +7353,7 @@
 TIFFClientOpen()
 ; return 0; }
 EOF
-if { (eval echo configure:7154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7357: \"$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
@@ -7189,16 +7392,16 @@
 if test "$with_x11" = "yes"; then
 
   echo "checking for X11 graphics libraries" 1>&6
-echo "configure:7193: checking for X11 graphics libraries" >&5
+echo "configure:7396: checking for X11 graphics libraries" >&5
 
     
 echo $ac_n "checking for XawScrollbarSetThumb in -lXaw""... $ac_c" 1>&6
-echo "configure:7197: checking for XawScrollbarSetThumb in -lXaw" >&5
+echo "configure:7400: checking for XawScrollbarSetThumb in -lXaw" >&5
 ac_lib_var=`echo Xaw'_'XawScrollbarSetThumb | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXaw "
 cat > conftest.$ac_ext <<EOF
-#line 7202 "configure"
+#line 7405 "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
@@ -7209,7 +7412,7 @@
 XawScrollbarSetThumb()
 ; return 0; }
 EOF
-if { (eval echo configure:7213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7416: \"$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
@@ -7233,16 +7436,16 @@
                     
     ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
-echo "configure:7237: checking for Xm/Xm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7240 "configure"
+echo "configure:7440: checking for Xm/Xm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7443 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7245: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:7448: \"$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"
@@ -7258,12 +7461,12 @@
   echo "$ac_t""yes" 1>&6
   
 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6
-echo "configure:7262: checking for XmStringFree in -lXm" >&5
+echo "configure:7465: checking for XmStringFree in -lXm" >&5
 ac_lib_var=`echo Xm'_'XmStringFree | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXm "
 cat > conftest.$ac_ext <<EOF
-#line 7267 "configure"
+#line 7470 "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
@@ -7274,7 +7477,7 @@
 XmStringFree()
 ; return 0; }
 EOF
-if { (eval echo configure:7278: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7481: \"$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
@@ -7303,9 +7506,9 @@
 
   if test "$have_motif" = "yes"; then
         echo $ac_n "checking for Lesstif""... $ac_c" 1>&6
-echo "configure:7307: checking for Lesstif" >&5
+echo "configure:7510: checking for Lesstif" >&5
     cat > conftest.$ac_ext <<EOF
-#line 7309 "configure"
+#line 7512 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 #ifdef LESSTIF_VERSION
@@ -7340,8 +7543,13 @@
 case "$with_scrollbars" in "" | "yes" )
   with_scrollbars="lucid" ;;
 esac
-
-all_widgets="$with_menubars $with_scrollbars $with_dialogs $with_toolbars"
+case "$with_widgets" in "" | "yes" )
+  if   test "$have_motif" = "yes"; then with_widgets="motif"
+  else with_widgets=no
+  fi ;;
+esac
+
+all_widgets="$with_menubars $with_scrollbars $with_dialogs $with_toolbars $with_widgets"
 
 case "$all_widgets" in *athena* )
   { test "$extra_verbose" = "yes" && cat << \EOF
@@ -7536,7 +7744,7 @@
   test "$with_toolbars"   != "no"      && extra_objs="$extra_objs toolbar-x.o" &&  if test "$extra_verbose" = "yes"; then
    echo "    xemacs will be linked with \"toolbar-x.o\""
  fi
-  test "$all_widgets" != "no no no no" && extra_objs="$extra_objs gui-x.o" &&  if test "$extra_verbose" = "yes"; then
+  test "$all_widgets" != "no no no no no" && extra_objs="$extra_objs gui-x.o" &&  if test "$extra_verbose" = "yes"; then
    echo "    xemacs will be linked with \"gui-x.o\""
  fi
 else
@@ -7568,7 +7776,7 @@
 
 if test "$with_mule" = "yes" ; then
   echo "checking for Mule-related features" 1>&6
-echo "configure:7572: checking for Mule-related features" >&5
+echo "configure:7780: checking for Mule-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining MULE
 EOF
@@ -7593,16 +7801,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7597: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7600 "configure"
+echo "configure:7805: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7808 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:7813: \"$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"
@@ -7632,12 +7840,12 @@
 
   
 echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6
-echo "configure:7636: checking for strerror in -lintl" >&5
+echo "configure:7844: checking for strerror in -lintl" >&5
 ac_lib_var=`echo intl'_'strerror | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lintl "
 cat > conftest.$ac_ext <<EOF
-#line 7641 "configure"
+#line 7849 "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
@@ -7648,7 +7856,7 @@
 strerror()
 ; return 0; }
 EOF
-if { (eval echo configure:7652: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7860: \"$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
@@ -7681,18 +7889,18 @@
 
 
   echo "checking for Mule input methods" 1>&6
-echo "configure:7685: checking for Mule input methods" >&5
+echo "configure:7893: checking for Mule input methods" >&5
         case "$with_xim" in "" | "yes" )
     echo "checking for XIM" 1>&6
-echo "configure:7688: checking for XIM" >&5
+echo "configure:7896: checking for XIM" >&5
     
 echo $ac_n "checking for XOpenIM in -lX11""... $ac_c" 1>&6
-echo "configure:7691: checking for XOpenIM in -lX11" >&5
+echo "configure:7899: checking for XOpenIM in -lX11" >&5
 ac_lib_var=`echo X11'_'XOpenIM | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lX11 "
 cat > conftest.$ac_ext <<EOF
-#line 7696 "configure"
+#line 7904 "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
@@ -7703,7 +7911,7 @@
 XOpenIM()
 ; return 0; }
 EOF
-if { (eval echo configure:7707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7915: \"$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
@@ -7727,12 +7935,12 @@
         if test "$have_motif $have_lesstif" = "yes no"; then
       
 echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6
-echo "configure:7731: checking for XmImMbLookupString in -lXm" >&5
+echo "configure:7939: checking for XmImMbLookupString in -lXm" >&5
 ac_lib_var=`echo Xm'_'XmImMbLookupString | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lXm "
 cat > conftest.$ac_ext <<EOF
-#line 7736 "configure"
+#line 7944 "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
@@ -7743,7 +7951,7 @@
 XmImMbLookupString()
 ; return 0; }
 EOF
-if { (eval echo configure:7747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7955: \"$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
@@ -7808,15 +8016,15 @@
 
     if test "$with_xfs" = "yes" ; then
     echo "checking for XFontSet" 1>&6
-echo "configure:7812: checking for XFontSet" >&5
+echo "configure:8020: checking for XFontSet" >&5
     
 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6
-echo "configure:7815: checking for XmbDrawString in -lX11" >&5
+echo "configure:8023: checking for XmbDrawString in -lX11" >&5
 ac_lib_var=`echo X11'_'XmbDrawString | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lX11 "
 cat > conftest.$ac_ext <<EOF
-#line 7820 "configure"
+#line 8028 "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
@@ -7827,7 +8035,7 @@
 XmbDrawString()
 ; return 0; }
 EOF
-if { (eval echo configure:7831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8039: \"$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
@@ -7867,16 +8075,16 @@
     test "$with_wnn6" = "yes" && with_wnn=yes # wnn6 implies wnn support
   test -z "$with_wnn" && { ac_safe=`echo "wnn/jllib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for wnn/jllib.h""... $ac_c" 1>&6
-echo "configure:7871: checking for wnn/jllib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7874 "configure"
+echo "configure:8079: checking for wnn/jllib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8082 "configure"
 #include "confdefs.h"
 #include <wnn/jllib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7879: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:8087: \"$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"
@@ -7900,10 +8108,10 @@
     for ac_func in crypt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7904: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7907 "configure"
+echo "configure:8112: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8115 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7926,7 +8134,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8138: \"$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
@@ -7955,12 +8163,12 @@
 
     test "$ac_cv_func_crypt" != "yes" && { 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:7959: checking for crypt in -lcrypt" >&5
+echo "configure:8167: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lcrypt "
 cat > conftest.$ac_ext <<EOF
-#line 7964 "configure"
+#line 8172 "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
@@ -7971,7 +8179,7 @@
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:7975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8183: \"$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
@@ -8006,12 +8214,12 @@
     if test -z "$with_wnn" -o "$with_wnn" = "yes"; then
     
 echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6
-echo "configure:8010: checking for jl_dic_list_e in -lwnn" >&5
+echo "configure:8218: checking for jl_dic_list_e in -lwnn" >&5
 ac_lib_var=`echo wnn'_'jl_dic_list_e | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lwnn "
 cat > conftest.$ac_ext <<EOF
-#line 8015 "configure"
+#line 8223 "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
@@ -8022,7 +8230,7 @@
 jl_dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:8026: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8234: \"$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
@@ -8040,12 +8248,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for jl_dic_list_e in -lwnn4""... $ac_c" 1>&6
-echo "configure:8044: checking for jl_dic_list_e in -lwnn4" >&5
+echo "configure:8252: checking for jl_dic_list_e in -lwnn4" >&5
 ac_lib_var=`echo wnn4'_'jl_dic_list_e | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lwnn4 "
 cat > conftest.$ac_ext <<EOF
-#line 8049 "configure"
+#line 8257 "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
@@ -8056,7 +8264,7 @@
 jl_dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:8060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8268: \"$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
@@ -8074,12 +8282,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for jl_dic_list_e in -lwnn6""... $ac_c" 1>&6
-echo "configure:8078: checking for jl_dic_list_e in -lwnn6" >&5
+echo "configure:8286: checking for jl_dic_list_e in -lwnn6" >&5
 ac_lib_var=`echo wnn6'_'jl_dic_list_e | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lwnn6 "
 cat > conftest.$ac_ext <<EOF
-#line 8083 "configure"
+#line 8291 "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
@@ -8090,7 +8298,7 @@
 jl_dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:8094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8302: \"$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
@@ -8108,12 +8316,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for dic_list_e in -lwnn6_fromsrc""... $ac_c" 1>&6
-echo "configure:8112: checking for dic_list_e in -lwnn6_fromsrc" >&5
+echo "configure:8320: checking for dic_list_e in -lwnn6_fromsrc" >&5
 ac_lib_var=`echo wnn6_fromsrc'_'dic_list_e | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lwnn6_fromsrc "
 cat > conftest.$ac_ext <<EOF
-#line 8117 "configure"
+#line 8325 "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
@@ -8124,7 +8332,7 @@
 dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:8128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8336: \"$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
@@ -8172,12 +8380,12 @@
     if test "$with_wnn6" != "no"; then
       
 echo $ac_n "checking for jl_fi_dic_list in -l$libwnn""... $ac_c" 1>&6
-echo "configure:8176: checking for jl_fi_dic_list in -l$libwnn" >&5
+echo "configure:8384: checking for jl_fi_dic_list in -l$libwnn" >&5
 ac_lib_var=`echo $libwnn'_'jl_fi_dic_list | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -l$libwnn "
 cat > conftest.$ac_ext <<EOF
-#line 8181 "configure"
+#line 8389 "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
@@ -8188,7 +8396,7 @@
 jl_fi_dic_list()
 ; return 0; }
 EOF
-if { (eval echo configure:8192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8400: \"$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
@@ -8223,16 +8431,16 @@
   if test "$with_canna" != "no"; then
     ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6
-echo "configure:8227: checking for canna/jrkanji.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8230 "configure"
+echo "configure:8435: checking for canna/jrkanji.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8438 "configure"
 #include "confdefs.h"
 #include <canna/jrkanji.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8235: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:8443: \"$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"
@@ -8258,16 +8466,16 @@
     c_switch_site="$c_switch_site -I/usr/local/canna/include"
     ac_safe=`echo "canna/jrkanji.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for canna/jrkanji.h""... $ac_c" 1>&6
-echo "configure:8262: checking for canna/jrkanji.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8265 "configure"
+echo "configure:8470: checking for canna/jrkanji.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8473 "configure"
 #include "confdefs.h"
 #include <canna/jrkanji.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:8478: \"$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"
@@ -8294,16 +8502,16 @@
 
   test -z "$with_canna" && { ac_safe=`echo "canna/RK.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for canna/RK.h""... $ac_c" 1>&6
-echo "configure:8298: checking for canna/RK.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8301 "configure"
+echo "configure:8506: checking for canna/RK.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8509 "configure"
 #include "confdefs.h"
 #include <canna/RK.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8306: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:8514: \"$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"
@@ -8325,12 +8533,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6
-echo "configure:8329: checking for RkBgnBun in -lRKC" >&5
+echo "configure:8537: checking for RkBgnBun in -lRKC" >&5
 ac_lib_var=`echo RKC'_'RkBgnBun | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lRKC "
 cat > conftest.$ac_ext <<EOF
-#line 8334 "configure"
+#line 8542 "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
@@ -8341,7 +8549,7 @@
 RkBgnBun()
 ; return 0; }
 EOF
-if { (eval echo configure:8345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8553: \"$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
@@ -8364,12 +8572,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6
-echo "configure:8368: checking for jrKanjiControl in -lcanna" >&5
+echo "configure:8576: checking for jrKanjiControl in -lcanna" >&5
 ac_lib_var=`echo canna'_'jrKanjiControl | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lcanna "
 cat > conftest.$ac_ext <<EOF
-#line 8373 "configure"
+#line 8581 "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
@@ -8380,7 +8588,7 @@
 jrKanjiControl()
 ; return 0; }
 EOF
-if { (eval echo configure:8384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8592: \"$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
@@ -8429,12 +8637,12 @@
   libs_x="-lXm $libs_x" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-lXm\" to \$libs_x"; fi
     
 echo $ac_n "checking for layout_object_getvalue in -li18n""... $ac_c" 1>&6
-echo "configure:8433: checking for layout_object_getvalue in -li18n" >&5
+echo "configure:8641: checking for layout_object_getvalue in -li18n" >&5
 ac_lib_var=`echo i18n'_'layout_object_getvalue | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -li18n "
 cat > conftest.$ac_ext <<EOF
-#line 8438 "configure"
+#line 8646 "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
@@ -8445,7 +8653,7 @@
 layout_object_getvalue()
 ; return 0; }
 EOF
-if { (eval echo configure:8449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8657: \"$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
@@ -8531,10 +8739,10 @@
 for ac_func in cbrt closedir dup2 eaccess fmod fpathconf frexp ftime gethostname getpagesize gettimeofday getcwd getwd logb lrand48 matherr mkdir mktime perror poll random rename res_init rint rmdir select setitimer setpgid setlocale setsid sigblock sighold sigprocmask snprintf strcasecmp strerror tzset ulimit usleep utimes waitpid vsnprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8535: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8538 "configure"
+echo "configure:8743: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8746 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8557,7 +8765,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8769: \"$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
@@ -8598,10 +8806,10 @@
       * ) for ac_func in realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8602: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8605 "configure"
+echo "configure:8810: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8813 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8624,7 +8832,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8836: \"$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
@@ -8660,10 +8868,10 @@
 for ac_func in getloadavg
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8664: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8667 "configure"
+echo "configure:8872: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8875 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8686,7 +8894,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8690: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8898: \"$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
@@ -8722,12 +8930,12 @@
 
     
 echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6
-echo "configure:8726: checking for kstat_open in -lkstat" >&5
+echo "configure:8934: checking for kstat_open in -lkstat" >&5
 ac_lib_var=`echo kstat'_'kstat_open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lkstat "
 cat > conftest.$ac_ext <<EOF
-#line 8731 "configure"
+#line 8939 "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
@@ -8738,7 +8946,7 @@
 kstat_open()
 ; return 0; }
 EOF
-if { (eval echo configure:8742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8950: \"$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
@@ -8772,12 +8980,12 @@
 
     
 echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
-echo "configure:8776: checking for kvm_read in -lkvm" >&5
+echo "configure:8984: checking for kvm_read in -lkvm" >&5
 ac_lib_var=`echo kvm'_'kvm_read | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lkvm "
 cat > conftest.$ac_ext <<EOF
-#line 8781 "configure"
+#line 8989 "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
@@ -8788,7 +8996,7 @@
 kvm_read()
 ; return 0; }
 EOF
-if { (eval echo configure:8792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9000: \"$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
@@ -8822,16 +9030,16 @@
 fi
 
 echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6
-echo "configure:8826: checking whether netdb declares h_errno" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8828 "configure"
+echo "configure:9034: checking whether netdb declares h_errno" >&5
+cat > conftest.$ac_ext <<EOF
+#line 9036 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 return h_errno;
 ; return 0; }
 EOF
-if { (eval echo configure:8835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9043: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
    { test "$extra_verbose" = "yes" && cat << \EOF
@@ -8851,16 +9059,16 @@
 rm -f conftest*
 
 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:8855: checking for sigsetjmp" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8857 "configure"
+echo "configure:9063: checking for sigsetjmp" >&5
+cat > conftest.$ac_ext <<EOF
+#line 9065 "configure"
 #include "confdefs.h"
 #include <setjmp.h>
 int main() {
 sigjmp_buf bar; sigsetjmp (bar, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:8864: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9072: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
    { test "$extra_verbose" = "yes" && cat << \EOF
@@ -8880,11 +9088,11 @@
 rm -f conftest*
 
 echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6
-echo "configure:8884: checking whether localtime caches TZ" >&5
+echo "configure:9092: checking whether localtime caches TZ" >&5
 
 if test "$ac_cv_func_tzset" = "yes"; then
 cat > conftest.$ac_ext <<EOF
-#line 8888 "configure"
+#line 9096 "configure"
 #include "confdefs.h"
 #include <time.h>
 #if STDC_HEADERS
@@ -8919,7 +9127,7 @@
   exit (0);
 }
 EOF
-if { (eval echo configure:8923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   emacs_cv_localtime_cache=no
 else
@@ -8949,9 +9157,9 @@
 
 if test "$HAVE_TIMEVAL" = "yes"; then
 echo $ac_n "checking whether gettimeofday accepts one or two arguments""... $ac_c" 1>&6
-echo "configure:8953: checking whether gettimeofday accepts one or two arguments" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8955 "configure"
+echo "configure:9161: checking whether gettimeofday accepts one or two arguments" >&5
+cat > conftest.$ac_ext <<EOF
+#line 9163 "configure"
 #include "confdefs.h"
 
 #ifdef TIME_WITH_SYS_TIME
@@ -8973,7 +9181,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8977: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""two" 1>&6
 else
@@ -8995,19 +9203,19 @@
 
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:8999: checking for inline" >&5
+echo "configure:9207: checking for inline" >&5
 
 ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 9004 "configure"
+#line 9212 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:9011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9219: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -9057,17 +9265,17 @@
 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
 # for constant arguments.  Useless!
 echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
-echo "configure:9061: checking for working alloca.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9064 "configure"
+echo "configure:9269: checking for working alloca.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9272 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:9071: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9279: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -9091,23 +9299,28 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:9095: checking for alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9098 "configure"
+echo "configure:9303: checking for alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9306 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
 # define alloca __builtin_alloca
 #else
-# if HAVE_ALLOCA_H
-#  include <alloca.h>
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
 # else
-#  ifdef _AIX
- #pragma alloca
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
 #  else
-#   ifndef alloca /* predefined by HP cc +Olibcalls */
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
 char *alloca ();
+#    endif
 #   endif
 #  endif
 # endif
@@ -9117,7 +9330,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:9121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9334: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -9145,7 +9358,7 @@
   # that cause trouble.  Some versions do not even contain alloca or
   # contain a buggy version.  If you still want to use their alloca,
   # use ar to extract alloca.o from them instead of compiling alloca.c.
-  ALLOCA=alloca.o
+  ALLOCA=alloca.${ac_objext}
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining C_ALLOCA
 EOF
@@ -9156,10 +9369,10 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:9160: checking whether alloca needs Cray hooks" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9163 "configure"
+echo "configure:9373: checking whether alloca needs Cray hooks" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9376 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -9183,10 +9396,10 @@
 if test $ac_cv_os_cray = yes; then
 for ac_func in _getb67 GETB67 getb67; do
   echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9187: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9190 "configure"
+echo "configure:9400: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9403 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9209,7 +9422,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9426: \"$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
@@ -9239,10 +9452,10 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:9243: checking stack direction for C alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9246 "configure"
+echo "configure:9456: checking stack direction for C alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9459 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -9261,7 +9474,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:9265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_c_stack_direction=1
 else
@@ -9290,16 +9503,16 @@
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:9294: checking for vfork.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9297 "configure"
+echo "configure:9507: checking for vfork.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9510 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:9515: \"$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"
@@ -9326,10 +9539,10 @@
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:9330: checking for working vfork" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9333 "configure"
+echo "configure:9543: checking for working vfork" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9546 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -9424,7 +9637,7 @@
   }
 }
 EOF
-if { (eval echo configure:9428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9641: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_func_vfork_works=yes
 else
@@ -9450,10 +9663,10 @@
 
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:9454: checking for working strcoll" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9457 "configure"
+echo "configure:9667: checking for working strcoll" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9670 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -9463,7 +9676,7 @@
 	strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:9467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_func_strcoll_works=yes
 else
@@ -9491,10 +9704,10 @@
 for ac_func in getpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9495: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9498 "configure"
+echo "configure:9708: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9711 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9517,7 +9730,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9521: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9734: \"$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
@@ -9545,10 +9758,10 @@
 done
 
 echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:9549: checking whether getpgrp takes no argument" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9552 "configure"
+echo "configure:9762: checking whether getpgrp takes no argument" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9765 "configure"
 #include "confdefs.h"
 
 /*
@@ -9603,7 +9816,7 @@
 }
 
 EOF
-if { (eval echo configure:9607: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_func_getpgrp_void=yes
 else
@@ -9630,10 +9843,10 @@
 
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:9634: checking for working mmap" >&5
+echo "configure:9847: checking for working mmap" >&5
 case "$opsys" in ultrix* ) have_mmap=no ;; *)
 cat > conftest.$ac_ext <<EOF
-#line 9637 "configure"
+#line 9850 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <unistd.h>
@@ -9666,7 +9879,7 @@
   return 1;
 }
 EOF
-if { (eval echo configure:9670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:9883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   have_mmap=yes
 else
@@ -9691,16 +9904,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:9695: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9698 "configure"
+echo "configure:9908: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9911 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:9916: \"$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"
@@ -9731,10 +9944,10 @@
 for ac_func in getpagesize
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:9735: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9738 "configure"
+echo "configure:9948: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9951 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -9757,7 +9970,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9761: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9974: \"$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
@@ -9785,10 +9998,10 @@
 done
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:9789: checking for working mmap" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9792 "configure"
+echo "configure:10002: checking for working mmap" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10005 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test.
@@ -9928,7 +10141,7 @@
 }
 
 EOF
-if { (eval echo configure:9932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:10145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -9966,16 +10179,16 @@
 
 ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for termios.h""... $ac_c" 1>&6
-echo "configure:9970: checking for termios.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9973 "configure"
+echo "configure:10183: checking for termios.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10186 "configure"
 #include "confdefs.h"
 #include <termios.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10191: \"$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"
@@ -10017,16 +10230,16 @@
   echo "$ac_t""no" 1>&6
 ac_safe=`echo "termio.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for termio.h""... $ac_c" 1>&6
-echo "configure:10021: checking for termio.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10024 "configure"
+echo "configure:10234: checking for termio.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10237 "configure"
 #include "confdefs.h"
 #include <termio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10029: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10242: \"$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"
@@ -10057,10 +10270,10 @@
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:10061: checking for socket" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10064 "configure"
+echo "configure:10274: checking for socket" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10277 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -10083,7 +10296,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10087: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10300: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -10098,16 +10311,16 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "netinet/in.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for netinet/in.h""... $ac_c" 1>&6
-echo "configure:10102: checking for netinet/in.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10105 "configure"
+echo "configure:10315: checking for netinet/in.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10318 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10323: \"$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"
@@ -10123,16 +10336,16 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "arpa/inet.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for arpa/inet.h""... $ac_c" 1>&6
-echo "configure:10127: checking for arpa/inet.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10130 "configure"
+echo "configure:10340: checking for arpa/inet.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10343 "configure"
 #include "confdefs.h"
 #include <arpa/inet.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10348: \"$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"
@@ -10156,9 +10369,9 @@
 }
 
       echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6
-echo "configure:10160: checking "for sun_len member in struct sockaddr_un"" >&5
+echo "configure:10373: checking "for sun_len member in struct sockaddr_un"" >&5
       cat > conftest.$ac_ext <<EOF
-#line 10162 "configure"
+#line 10375 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10169,7 +10382,7 @@
 static struct sockaddr_un x; x.sun_len = 1;
 ; return 0; }
 EOF
-if { (eval echo configure:10173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_SOCKADDR_SUN_LEN
@@ -10187,9 +10400,9 @@
 fi
 rm -f conftest*
       echo $ac_n "checking "for ip_mreq struct in netinet/in.h"""... $ac_c" 1>&6
-echo "configure:10191: checking "for ip_mreq struct in netinet/in.h"" >&5
+echo "configure:10404: checking "for ip_mreq struct in netinet/in.h"" >&5
       cat > conftest.$ac_ext <<EOF
-#line 10193 "configure"
+#line 10406 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -10199,7 +10412,7 @@
 static struct ip_mreq x;
 ; return 0; }
 EOF
-if { (eval echo configure:10203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_MULTICAST
@@ -10230,10 +10443,10 @@
 
 
 echo $ac_n "checking for msgget""... $ac_c" 1>&6
-echo "configure:10234: checking for msgget" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10237 "configure"
+echo "configure:10447: checking for msgget" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10450 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char msgget(); below.  */
@@ -10256,7 +10469,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_msgget=yes"
 else
@@ -10271,16 +10484,16 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "sys/ipc.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/ipc.h""... $ac_c" 1>&6
-echo "configure:10275: checking for sys/ipc.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10278 "configure"
+echo "configure:10488: checking for sys/ipc.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10491 "configure"
 #include "confdefs.h"
 #include <sys/ipc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10496: \"$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"
@@ -10296,16 +10509,16 @@
   echo "$ac_t""yes" 1>&6
   ac_safe=`echo "sys/msg.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/msg.h""... $ac_c" 1>&6
-echo "configure:10300: checking for sys/msg.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10303 "configure"
+echo "configure:10513: checking for sys/msg.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10516 "configure"
 #include "confdefs.h"
 #include <sys/msg.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10521: \"$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"
@@ -10342,16 +10555,16 @@
 
 ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dirent.h""... $ac_c" 1>&6
-echo "configure:10346: checking for dirent.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10349 "configure"
+echo "configure:10559: checking for dirent.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10562 "configure"
 #include "confdefs.h"
 #include <dirent.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10354: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10567: \"$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"
@@ -10377,16 +10590,16 @@
   echo "$ac_t""no" 1>&6
 ac_safe=`echo "sys/dir.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/dir.h""... $ac_c" 1>&6
-echo "configure:10381: checking for sys/dir.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10384 "configure"
+echo "configure:10594: checking for sys/dir.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10597 "configure"
 #include "confdefs.h"
 #include <sys/dir.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10602: \"$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"
@@ -10418,16 +10631,16 @@
 
 ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for nlist.h""... $ac_c" 1>&6
-echo "configure:10422: checking for nlist.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10425 "configure"
+echo "configure:10635: checking for nlist.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10638 "configure"
 #include "confdefs.h"
 #include <nlist.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10643: \"$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"
@@ -10456,7 +10669,7 @@
 
 
 echo "checking "for sound support"" 1>&6
-echo "configure:10460: checking "for sound support"" >&5
+echo "configure:10673: checking "for sound support"" >&5
 case "$with_sound" in
   native | both ) with_native_sound=yes;;
   nas    | no   ) with_native_sound=no;;
@@ -10467,16 +10680,16 @@
     if test -n "$native_sound_lib"; then
     ac_safe=`echo "multimedia/audio_device.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for multimedia/audio_device.h""... $ac_c" 1>&6
-echo "configure:10471: checking for multimedia/audio_device.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10474 "configure"
+echo "configure:10684: checking for multimedia/audio_device.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10687 "configure"
 #include "confdefs.h"
 #include <multimedia/audio_device.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10692: \"$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"
@@ -10523,12 +10736,12 @@
       if test -z "$native_sound_lib"; then
         
 echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6
-echo "configure:10527: checking for ALopenport in -laudio" >&5
+echo "configure:10740: checking for ALopenport in -laudio" >&5
 ac_lib_var=`echo audio'_'ALopenport | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -laudio "
 cat > conftest.$ac_ext <<EOF
-#line 10532 "configure"
+#line 10745 "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
@@ -10539,7 +10752,7 @@
 ALopenport()
 ; return 0; }
 EOF
-if { (eval echo configure:10543: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10756: \"$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
@@ -10570,12 +10783,12 @@
       if test -z "$native_sound_lib"; then
 	
 echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6
-echo "configure:10574: checking for AOpenAudio in -lAlib" >&5
+echo "configure:10787: checking for AOpenAudio in -lAlib" >&5
 ac_lib_var=`echo Alib'_'AOpenAudio | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lAlib "
 cat > conftest.$ac_ext <<EOF
-#line 10579 "configure"
+#line 10792 "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
@@ -10586,7 +10799,7 @@
 AOpenAudio()
 ; return 0; }
 EOF
-if { (eval echo configure:10590: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10803: \"$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
@@ -10624,16 +10837,16 @@
     for dir in "machine" "sys" "linux"; do
       ac_safe=`echo "${dir}/soundcard.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ${dir}/soundcard.h""... $ac_c" 1>&6
-echo "configure:10628: checking for ${dir}/soundcard.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10631 "configure"
+echo "configure:10841: checking for ${dir}/soundcard.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10844 "configure"
 #include "confdefs.h"
 #include <${dir}/soundcard.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10636: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:10849: \"$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"
@@ -10702,7 +10915,7 @@
  fi
   libs_x="-laudio $libs_x" &&  if test "$extra_verbose" = "yes"; then echo "    Prepending \"-laudio\" to \$libs_x"; fi
       cat > conftest.$ac_ext <<EOF
-#line 10706 "configure"
+#line 10919 "configure"
 #include "confdefs.h"
 #include <audio/Xtutil.h>
 EOF
@@ -10729,7 +10942,7 @@
 
 if test "$with_tty" = "yes"  ; then
   echo "checking for TTY-related features" 1>&6
-echo "configure:10733: checking for TTY-related features" >&5
+echo "configure:10946: checking for TTY-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_TTY
 EOF
@@ -10745,12 +10958,12 @@
     if test -z "$with_ncurses"; then
     
 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:10749: checking for tgetent in -lncurses" >&5
+echo "configure:10962: checking for tgetent in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lncurses "
 cat > conftest.$ac_ext <<EOF
-#line 10754 "configure"
+#line 10967 "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
@@ -10761,7 +10974,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10765: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10978: \"$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
@@ -10794,16 +11007,16 @@
 
     ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6
-echo "configure:10798: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10801 "configure"
+echo "configure:11011: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11014 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10806: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11019: \"$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"
@@ -10824,16 +11037,16 @@
 
     ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6
-echo "configure:10828: checking for ncurses/term.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10831 "configure"
+echo "configure:11041: checking for ncurses/term.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11044 "configure"
 #include "confdefs.h"
 #include <ncurses/term.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11049: \"$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"
@@ -10862,16 +11075,16 @@
       c_switch_site="$c_switch_site -I/usr/include/ncurses"
       ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6
-echo "configure:10866: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10869 "configure"
+echo "configure:11079: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11082 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10874: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11087: \"$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"
@@ -10905,12 +11118,12 @@
 	for lib in curses termlib termcap; do
 	  
 echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6
-echo "configure:10909: checking for tgetent in -l$lib" >&5
+echo "configure:11122: checking for tgetent in -l$lib" >&5
 ac_lib_var=`echo $lib'_'tgetent | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -l$lib "
 cat > conftest.$ac_ext <<EOF
-#line 10914 "configure"
+#line 11127 "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
@@ -10921,7 +11134,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10925: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11138: \"$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
@@ -10952,12 +11165,12 @@
       else
 	
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:10956: checking for tgetent in -lcurses" >&5
+echo "configure:11169: checking for tgetent in -lcurses" >&5
 ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lcurses "
 cat > conftest.$ac_ext <<EOF
-#line 10961 "configure"
+#line 11174 "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
@@ -10968,7 +11181,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11185: \"$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
@@ -10986,12 +11199,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:10990: checking for tgetent in -ltermcap" >&5
+echo "configure:11203: checking for tgetent in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltermcap "
 cat > conftest.$ac_ext <<EOF
-#line 10995 "configure"
+#line 11208 "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
@@ -11002,7 +11215,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:11006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11219: \"$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
@@ -11050,16 +11263,16 @@
 
     test -z "$with_gpm" && { ac_safe=`echo "gpm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for gpm.h""... $ac_c" 1>&6
-echo "configure:11054: checking for gpm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 11057 "configure"
+echo "configure:11267: checking for gpm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11270 "configure"
 #include "confdefs.h"
 #include <gpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11062: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11275: \"$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"
@@ -11081,12 +11294,12 @@
  }
   test -z "$with_gpm" && { 
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:11085: checking for Gpm_Open in -lgpm" >&5
+echo "configure:11298: checking for Gpm_Open in -lgpm" >&5
 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lgpm "
 cat > conftest.$ac_ext <<EOF
-#line 11090 "configure"
+#line 11303 "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
@@ -11097,7 +11310,7 @@
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:11101: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11314: \"$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
@@ -11147,21 +11360,21 @@
 
 test "$with_database_gnudbm $with_database_dbm $with_database_berkdb" \
   != "no no no" && echo "checking for database support" 1>&6
-echo "configure:11151: checking for database support" >&5
+echo "configure:11364: checking for database support" >&5
 
 if test "$with_database_gnudbm $with_database_dbm" != "no no"; then
   ac_safe=`echo "ndbm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ndbm.h""... $ac_c" 1>&6
-echo "configure:11156: checking for ndbm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 11159 "configure"
+echo "configure:11369: checking for ndbm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11372 "configure"
 #include "confdefs.h"
 #include <ndbm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11377: \"$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"
@@ -11190,12 +11403,12 @@
 if test "$with_database_gnudbm" != "no"; then
   
 echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:11194: checking for dbm_open in -lgdbm" >&5
+echo "configure:11407: checking for dbm_open in -lgdbm" >&5
 ac_lib_var=`echo gdbm'_'dbm_open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lgdbm "
 cat > conftest.$ac_ext <<EOF
-#line 11199 "configure"
+#line 11412 "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
@@ -11206,7 +11419,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:11210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11423: \"$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
@@ -11234,10 +11447,10 @@
 
 if test "$with_database_dbm" != "no"; then
   echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:11238: checking for dbm_open" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 11241 "configure"
+echo "configure:11451: checking for dbm_open" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11454 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -11260,7 +11473,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:11264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11477: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -11279,12 +11492,12 @@
 
     
 echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:11283: checking for dbm_open in -ldbm" >&5
+echo "configure:11496: checking for dbm_open in -ldbm" >&5
 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldbm "
 cat > conftest.$ac_ext <<EOF
-#line 11288 "configure"
+#line 11501 "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
@@ -11295,7 +11508,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:11299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11512: \"$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
@@ -11336,10 +11549,10 @@
 
 if test "$with_database_berkdb" != "no"; then
   echo $ac_n "checking for Berkeley db.h""... $ac_c" 1>&6
-echo "configure:11340: checking for Berkeley db.h" >&5
+echo "configure:11553: checking for Berkeley db.h" >&5
   for path in "db/db.h" "db.h"; do
     cat > conftest.$ac_ext <<EOF
-#line 11343 "configure"
+#line 11556 "configure"
 #include "confdefs.h"
 #ifdef HAVE_INTTYPES_H
 #define __BIT_TYPES_DEFINED__
@@ -11357,7 +11570,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:11361: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:11574: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   db_h_path="$path"; break
 else
@@ -11373,9 +11586,9 @@
 
   if test "$with_database_berkdb" != "no"; then
     echo $ac_n "checking for Berkeley DB version""... $ac_c" 1>&6
-echo "configure:11377: checking for Berkeley DB version" >&5
+echo "configure:11590: checking for Berkeley DB version" >&5
     cat > conftest.$ac_ext <<EOF
-#line 11379 "configure"
+#line 11592 "configure"
 #include "confdefs.h"
 #include <$db_h_path>
 #if DB_VERSION_MAJOR > 1
@@ -11394,10 +11607,10 @@
 rm -f conftest*
 
     echo $ac_n "checking for $dbfunc""... $ac_c" 1>&6
-echo "configure:11398: checking for $dbfunc" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 11401 "configure"
+echo "configure:11611: checking for $dbfunc" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11614 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $dbfunc(); below.  */
@@ -11420,7 +11633,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:11424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$dbfunc=yes"
 else
@@ -11439,12 +11652,12 @@
 
     
 echo $ac_n "checking for $dbfunc in -ldb""... $ac_c" 1>&6
-echo "configure:11443: checking for $dbfunc in -ldb" >&5
+echo "configure:11656: checking for $dbfunc in -ldb" >&5
 ac_lib_var=`echo db'_'$dbfunc | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldb "
 cat > conftest.$ac_ext <<EOF
-#line 11448 "configure"
+#line 11661 "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
@@ -11455,7 +11668,7 @@
 $dbfunc()
 ; return 0; }
 EOF
-if { (eval echo configure:11459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11672: \"$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
@@ -11519,12 +11732,12 @@
 if test "$with_socks" = "yes"; then
   
 echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6
-echo "configure:11523: checking for SOCKSinit in -lsocks" >&5
+echo "configure:11736: checking for SOCKSinit in -lsocks" >&5
 ac_lib_var=`echo socks'_'SOCKSinit | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lsocks "
 cat > conftest.$ac_ext <<EOF
-#line 11528 "configure"
+#line 11741 "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
@@ -11535,7 +11748,7 @@
 SOCKSinit()
 ; return 0; }
 EOF
-if { (eval echo configure:11539: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11752: \"$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
@@ -11592,16 +11805,16 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:11596: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 11599 "configure"
+echo "configure:11809: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11812 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:11604: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
+{ (eval echo configure:11817: \"$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"
@@ -11639,12 +11852,12 @@
 
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:11643: checking for dlopen in -ldl" >&5
+echo "configure:11856: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldl "
 cat > conftest.$ac_ext <<EOF
-#line 11648 "configure"
+#line 11861 "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
@@ -11655,7 +11868,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:11659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11872: \"$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
@@ -11684,12 +11897,12 @@
  }
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for _dlopen in -lc""... $ac_c" 1>&6
-echo "configure:11688: checking for _dlopen in -lc" >&5
+echo "configure:11901: checking for _dlopen in -lc" >&5
 ac_lib_var=`echo c'_'_dlopen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lc "
 cat > conftest.$ac_ext <<EOF
-#line 11693 "configure"
+#line 11906 "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
@@ -11700,7 +11913,7 @@
 _dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:11704: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11917: \"$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
@@ -11729,12 +11942,12 @@
  }
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for dlopen in -lc""... $ac_c" 1>&6
-echo "configure:11733: checking for dlopen in -lc" >&5
+echo "configure:11946: checking for dlopen in -lc" >&5
 ac_lib_var=`echo c'_'dlopen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lc "
 cat > conftest.$ac_ext <<EOF
-#line 11738 "configure"
+#line 11951 "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
@@ -11745,7 +11958,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:11749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11962: \"$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
@@ -11774,12 +11987,12 @@
  }
 test -z "$with_shlib" && { 
 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:11778: checking for shl_load in -ldld" >&5
+echo "configure:11991: checking for shl_load in -ldld" >&5
 ac_lib_var=`echo dld'_'shl_load | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldld "
 cat > conftest.$ac_ext <<EOF
-#line 11783 "configure"
+#line 11996 "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
@@ -11790,7 +12003,7 @@
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:11794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:12007: \"$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
@@ -11819,12 +12032,12 @@
  }
 test -z "$with_shlib" && { 
 echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6
-echo "configure:11823: checking for dld_init in -ldld" >&5
+echo "configure:12036: checking for dld_init in -ldld" >&5
 ac_lib_var=`echo dld'_'dld_init | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldld "
 cat > conftest.$ac_ext <<EOF
-#line 11828 "configure"
+#line 12041 "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
@@ -11835,7 +12048,7 @@
 dld_init()
 ; return 0; }
 EOF
-if { (eval echo configure:11839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:12052: \"$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
@@ -11874,7 +12087,7 @@
 xealias=$internal_configuration
 
 echo "checking how to build dynamic libraries for ${xehost}" 1>&6
-echo "configure:11878: checking how to build dynamic libraries for ${xehost}" >&5
+echo "configure:12091: checking how to build dynamic libraries for ${xehost}" >&5
 # Transform *-*-linux* to *-*-linux-gnu*, to support old configure scripts.
 case "$xehost" in
 *-*-linux-gnu*) ;;
@@ -11902,9 +12115,9 @@
   XEGCC=yes
 else
   echo $ac_n "checking checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:11906: checking checking whether we are using GNU C" >&5
+echo "configure:12119: checking checking whether we are using GNU C" >&5
   cat > conftest.$ac_ext <<EOF
-#line 11908 "configure"
+#line 12121 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -11926,7 +12139,7 @@
 fi
 
 echo $ac_n "checking how to produce PIC code""... $ac_c" 1>&6
-echo "configure:11930: checking how to produce PIC code" >&5
+echo "configure:12143: checking how to produce PIC code" >&5
 wl=
 
 can_build_shared=yes
@@ -12019,18 +12232,18 @@
   
   # Check to make sure the dll_cflags actually works.
   echo $ac_n "checking if PIC flag ${dll_cflags} really works""... $ac_c" 1>&6
-echo "configure:12023: checking if PIC flag ${dll_cflags} really works" >&5
+echo "configure:12236: checking if PIC flag ${dll_cflags} really works" >&5
   save_CFLAGS="$CFLAGS"
   CFLAGS="$CFLAGS $dll_cflags -DPIC"
   cat > conftest.$ac_ext <<EOF
-#line 12027 "configure"
+#line 12240 "configure"
 #include "confdefs.h"
 
 int main() {
 int x=0;
 ; return 0; }
 EOF
-if { (eval echo configure:12034: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:12247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   
     # On HP-UX, the stripped-down bundled CC doesn't accept +Z, but also
@@ -12061,7 +12274,7 @@
 xldf=
 xcldf=
 echo $ac_n "checking if C compiler can produce shared libraries""... $ac_c" 1>&6
-echo "configure:12065: checking if C compiler can produce shared libraries" >&5
+echo "configure:12278: checking if C compiler can produce shared libraries" >&5
 if test "$XEGCC" = yes; then
   xcldf="-shared"
   xldf="-shared"
@@ -12112,14 +12325,14 @@
   xe_libs=
   ac_link='${CC-cc} -o conftest $CFLAGS '"$xe_cppflags $xe_ldflags"' conftest.$ac_ext '"$xe_libs"' 1>&5'
   cat > conftest.$ac_ext <<EOF
-#line 12116 "configure"
+#line 12329 "configure"
 #include "confdefs.h"
 
 int main() {
 int x=0;
 ; return 0; }
 EOF
-if { (eval echo configure:12123: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:12336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   cc_produces_so=yes
 else
@@ -12144,7 +12357,7 @@
   if test "$XEGCC" = yes; then
     # Check if gcc -print-prog-name=ld gives a path.
     echo $ac_n "checking for ld used by GCC""... $ac_c" 1>&6
-echo "configure:12148: checking for ld used by GCC" >&5
+echo "configure:12361: checking for ld used by GCC" >&5
     ac_prog=`($CC -print-prog-name=ld) 2>&5`
     case "$ac_prog" in
     # Accept absolute paths.
@@ -12169,7 +12382,7 @@
     esac
   else
     echo $ac_n "checking for GNU ld""... $ac_c" 1>&6
-echo "configure:12173: checking for GNU ld" >&5
+echo "configure:12386: checking for GNU ld" >&5
   fi
 
   if test -z "$LTLD"; then
@@ -12207,7 +12420,7 @@
 
 # Check to see if it really is or isn't GNU ld.
 echo $ac_n "checking if the linker is GNU ld""... $ac_c" 1>&6
-echo "configure:12211: checking if the linker is GNU ld" >&5
+echo "configure:12424: checking if the linker is GNU ld" >&5
 # I'd rather use --version here, but apparently some GNU ld's only accept -v.
 if $LTLD -v 2>&1 </dev/null | egrep '(GNU|with BFD)' 1>&5; then
   xe_gnu_ld=yes
@@ -12234,7 +12447,7 @@
   # OK - only NOW do we futz about with ld.
   # See if the linker supports building shared libraries.
   echo $ac_n "checking whether the linker supports shared libraries""... $ac_c" 1>&6
-echo "configure:12238: checking whether the linker supports shared libraries" >&5
+echo "configure:12451: checking whether the linker supports shared libraries" >&5
   dll_ld=$CC
   dll_ldflags=$LDFLAGS
   ld_shlibs=yes
@@ -12450,10 +12663,10 @@
     for ac_func in dlerror _dlerror
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:12454: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 12457 "configure"
+echo "configure:12667: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 12670 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -12476,7 +12689,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:12480: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:12693: \"$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
@@ -12510,11 +12723,11 @@
 fi
 
 cat > conftest.$ac_ext <<EOF
-#line 12514 "configure"
+#line 12727 "configure"
 #include "confdefs.h"
 int main(int c,char *v[]){return 0;}
 EOF
-if { (eval echo configure:12518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
+if { (eval echo configure:12731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit $?) 2>&5
 then
   :
 else
@@ -12685,6 +12898,7 @@
 
 
 
+
 PREFIX=$prefix
 while true; do
   case "$PREFIX" in
@@ -12695,6 +12909,7 @@
 
 
 
+
 EXEC_PREFIX=$exec_prefix
 while true; do
   case "$EXEC_PREFIX" in
@@ -12805,6 +13020,17 @@
 
 
 
+DOCDIR=$docdir
+while true; do
+  case "$DOCDIR" in
+    *\$* ) eval "DOCDIR=$DOCDIR" ;;
+    *) break ;;
+  esac
+done
+
+
+
+
 ARCHLIBDIR=$archlibdir
 while true; do
   case "$ARCHLIBDIR" in
@@ -12843,6 +13069,16 @@
 : ${XEMACS_CC:=$CC}
 
 
+if test "$with_prefix" = "yes"; then
+  { test "$extra_verbose" = "yes" && cat << \EOF
+    Defining PREFIX_USER_DEFINED
+EOF
+cat >> confdefs.h <<\EOF
+#define PREFIX_USER_DEFINED 1
+EOF
+}
+
+fi
 
 if test "$with_site_lisp" = "no"; then
   { test "$extra_verbose" = "yes" && cat << \EOF
@@ -13292,7 +13528,7 @@
     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 ;;
@@ -13312,9 +13548,11 @@
  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
@@ -13344,6 +13582,7 @@
 s%@lib_gcc@%$lib_gcc%g
 s%@RANLIB@%$RANLIB%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
 s%@INSTALL_DATA@%$INSTALL_DATA%g
 s%@YACC@%$YACC%g
 s%@SET_MAKE@%$SET_MAKE%g
@@ -13373,7 +13612,9 @@
 s%@srcdir@%$srcdir%g
 s%@pkgdir@%$pkgdir%g
 s%@statedir@%$statedir%g
+s%@PREFIX_USER_DEFINED@%$PREFIX_USER_DEFINED%g
 s%@PREFIX@%$PREFIX%g
+s%@EXEC_PREFIX_USER_DEFINED@%$EXEC_PREFIX_USER_DEFINED%g
 s%@EXEC_PREFIX@%$EXEC_PREFIX%g
 s%@INFODIR_USER_DEFINED@%$INFODIR_USER_DEFINED%g
 s%@INFODIR@%$INFODIR%g
@@ -13401,10 +13642,12 @@
 s%@lockdir@%$lockdir%g
 s%@LOCKDIR_USER_DEFINED@%$LOCKDIR_USER_DEFINED%g
 s%@LOCKDIR@%$LOCKDIR%g
+s%@docdir@%$docdir%g
+s%@DOCDIR_USER_DEFINED@%$DOCDIR_USER_DEFINED%g
+s%@DOCDIR@%$DOCDIR%g
 s%@archlibdir@%$archlibdir%g
 s%@ARCHLIBDIR_USER_DEFINED@%$ARCHLIBDIR_USER_DEFINED%g
 s%@ARCHLIBDIR@%$ARCHLIBDIR%g
-s%@docdir@%$docdir%g
 s%@bitmapdir@%$bitmapdir%g
 s%@extra_objs@%$extra_objs%g
 s%@machfile@%$machfile%g
--- a/configure.in	Mon Aug 13 11:23:14 2007 +0200
+++ b/configure.in	Mon Aug 13 11:24:09 2007 +0200
@@ -357,10 +357,13 @@
 etcdir='${datadir}/${PROGNAME}-${version}/etc'
 lockdir='${statedir}/${PROGNAME}/lock'
 archlibdir='${datadir}/${PROGNAME}-${version}/${configuration}'
+docdir='${archlibdir}'
+with_prefix='yes'
 with_site_lisp='no'
 with_site_modules='yes'
 with_menubars=''
 with_scrollbars=''
+with_widgets=''
 with_dialogs=''
 with_file_coding=''
 dnl const_is_losing is removed - we rely on AC_C_CONST instead.
@@ -463,7 +466,8 @@
 
       dnl Process (many) boolean options
 	with_site_lisp	| \
-    with_site_modules | \
+	with_prefix	| \
+	with_site_modules | \
 	with_x		| \
 	with_x11	| \
 	with_msw	| \
@@ -709,6 +713,8 @@
            dnl You need to synchronize this with the way the
            dnl default values are built.
 	   case "$opt" in
+	     dnl prefix is taken care of by --with-prefix
+	     exec_prefix ) AC_DEFINE(EXEC_PREFIX_USER_DEFINED) ;;
              lispdir ) AC_DEFINE(LISPDIR_USER_DEFINED) ;;
              sitelispdir ) AC_DEFINE(SITELISPDIR_USER_DEFINED) ;;
              moduledir ) AC_DEFINE(MODULEDIR_USER_DEFINED) ;;
@@ -722,6 +728,7 @@
             AC_DEFINE(MODULEDIR_USER_DEFINED)
 	        AC_DEFINE(ETCDIR_USER_DEFINED) ;;
              statedir | lockdir ) AC_DEFINE(LOCKDIR_USER_DEFINED) ;;
+	     docdir ) AC_DEFINE(DOCDIR_USER_DEFINED) ;;
              exec_prefix | libdir | archlibdir ) AC_DEFINE(ARCHLIBDIR_USER_DEFINED) ;;
            esac
 	;;
@@ -735,7 +742,8 @@
 	dnl Has the user specified the toolkit(s) to use for GUI elements?
 	"with_menubars"   | \
 	"with_scrollbars" | \
-	"with_dialogs" )
+	"with_dialogs" | \
+	"with_widgets" )
 	  case "$val" in
 	    l | lu | luc | luci | lucid )		val=lucid  ;;
 	    m | mo | mot | moti | motif )		val=motif  ;;
@@ -931,7 +939,7 @@
 AC_DEFINE_UNQUOTED(EMACS_VERSION, "$version")
 
 if test "$with_infodock" = "yes"; then
-  if test ! -f ../ID-INSTALL; then
+  if test ! -f ../../ID-INSTALL; then
     echo "Cannot build InfoDock without InfoDock sources"
     with_infodock=no
   fi
@@ -2874,8 +2882,13 @@
 case "$with_scrollbars" in "" | "yes" )
   with_scrollbars="lucid" ;;
 esac
-
-all_widgets="$with_menubars $with_scrollbars $with_dialogs $with_toolbars"
+case "$with_widgets" in "" | "yes" )
+  if   test "$have_motif" = "yes"; then with_widgets="motif"
+  else with_widgets=no
+  fi ;;
+esac
+
+all_widgets="$with_menubars $with_scrollbars $with_dialogs $with_toolbars $with_widgets"
 
 case "$all_widgets" in *athena* )
   AC_DEFINE(LWLIB_USES_ATHENA)
@@ -2928,7 +2941,7 @@
   test "$with_scrollbars" != "no"      && XE_ADD_OBJS(scrollbar-x.o)
   test "$with_dialogs"    != "no"      && XE_ADD_OBJS(dialog-x.o)
   test "$with_toolbars"   != "no"      && XE_ADD_OBJS(toolbar-x.o)
-  test "$all_widgets" != "no no no no" && XE_ADD_OBJS(gui-x.o)
+  test "$all_widgets" != "no no no no no" && XE_ADD_OBJS(gui-x.o)
 else
   if test \( "$with_sound" = "nas" \) -o \( "$with_sound" = "both" \); then
     echo "Attempt to Build NAS sound without X"
@@ -3741,6 +3754,7 @@
 AC_SUBST(mandir)
 
 AC_SUBST(prefix)
+AC_SUBST(PREFIX_USER_DEFINED)
 dnl Yo, Stephen Bourne!  I want to marry you!
 PREFIX=$prefix
 while true; do
@@ -3752,6 +3766,7 @@
 AC_SUBST(PREFIX)
 
 AC_SUBST(exec_prefix)
+AC_SUBST(EXEC_PREFIX_USER_DEFINED)
 EXEC_PREFIX=$exec_prefix
 while true; do
   case "$EXEC_PREFIX" in
@@ -3860,6 +3875,17 @@
 done
 AC_SUBST(LOCKDIR)
 
+AC_SUBST(docdir)
+AC_SUBST(DOCDIR_USER_DEFINED)
+DOCDIR=$docdir
+while true; do
+  case "$DOCDIR" in
+    *\$* ) eval "DOCDIR=$DOCDIR" ;;
+    *) break ;;
+  esac
+done
+AC_SUBST(DOCDIR)
+
 AC_SUBST(archlibdir)
 AC_SUBST(ARCHLIBDIR_USER_DEFINED)
 ARCHLIBDIR=$archlibdir
@@ -3907,6 +3933,10 @@
 : ${XEMACS_CC:=$CC}
 AC_SUBST(XEMACS_CC)
 
+dnl The default is yes
+if test "$with_prefix" = "yes"; then
+  AC_DEFINE(PREFIX_USER_DEFINED)
+fi
 
 dnl The default is no
 if test "$with_site_lisp" = "no"; then
--- a/configure.usage	Mon Aug 13 11:23:14 2007 +0200
+++ b/configure.usage	Mon Aug 13 11:24:09 2007 +0200
@@ -47,6 +47,9 @@
 Installation options:
 
 --prefix=DIR            Install files below DIR.  Defaults to `/usr/local'.
+--with-prefix		Compile the value of --prefix into the executable.
+                        Defaults to `yes'.
+--without-prefix        Don't compile the value of --prefix into the executable.
 
 
 Window-system options:
@@ -66,6 +69,9 @@
 --with-dialogs=TYPE     Use TYPE dialog boxes (motif, athena, athena3d, or no).
                         Lucid menubars and scrollbars are the default.
                         Motif dialog boxes will be used if Motif can be found.
+--with-widgets=TYPE     Use TYPE widgets (motif, athena, athena3d, or no).
+                        Motif widgets will be used if Motif can be found.
+                        Other widget types are currently unsupported.
 --with-dragndrop (*)    Compile in the generic drag and drop API. This is
                         automatically added if one of the drag and drop
                         protocols is found (currently CDE, OffiX, MSWindows).
@@ -219,10 +225,10 @@
                         Defaults to `${statedir}/xemacs/lock'.
 
 You may also specify any of the `path' variables found in Makefile.in,
-including --bindir, --libdir, --lispdir, --sitelispdir, --datadir,
---infodir, --mandir and so on.  Note that we recommend against
-explicitly setting any of these variables.  See the INSTALL file for a
-complete list plus the reasons we advise not changing them.
+including --bindir, --libdir, --docdir, --lispdir, --sitelispdir,
+--datadir, --infodir, --mandir and so on.  Note that we recommend
+against explicitly setting any of these variables.  See the INSTALL
+file for a complete list plus the reasons we advise not changing them.
 
 If successful, configure leaves its status in config.status.  If
 unsuccessful after disturbing the status quo, it removes config.status.
--- a/etc/NEWS	Mon Aug 13 11:23:14 2007 +0200
+++ b/etc/NEWS	Mon Aug 13 11:24:09 2007 +0200
@@ -33,6 +33,10 @@
 * Changes in XEmacs 21.2
 ========================
 
+** XEmacs now locates the early package hierarchy at ~/.xemacs/packages.
+
+This has changed from simply ~/.xemacs.
+
 ** `delete-key-deletes-forward' now defaults to t.
 
 `delete-key-deletes-forward' is the variable that regulates the
@@ -104,6 +108,18 @@
 
 ** The font-menu is now available under MS-Windows
 
+** MS-Windows support for selection is much more robust
+
+Generally selection should now do what you would expect under
+MS-Windows: the middle mouse button will paste your current selection
+or the clipboard; conversions from different types of selection to the
+clipboard can be made; the kill-ring and friends will be updated as
+per X.
+
+The only thing selection doesn't do is set the clipboard automatically
+as this would break the MS-Windows model. If you want this behaviour
+then set `selection-sets-clipboard' to t
+
 
 * Lisp and internal changes in XEmacs 21.2
 ==========================================
--- a/etc/TUTORIAL.ru	Mon Aug 13 11:23:14 2007 +0200
+++ b/etc/TUTORIAL.ru	Mon Aug 13 11:24:09 2007 +0200
@@ -1079,4 +1079,4 @@
 writing, and sharing free software!
 
 // ÚÁÍÅÞÁÎÉÑ, ÉÓÐÒÁ×ÌÅÎÉÑ ÏÛÉÂÏË Ó ÎÅÔÅÒÐÅÎÉÅÍ ÖÄÕ ÐÏ ÁÄÒÅÓÕ bor@vb.dn.ua
-// Vladimir Bormotov.
\ No newline at end of file
+// Vladimir Bormotov.
--- a/lib-src/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/lib-src/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,7 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/lib-src/config.values.in	Mon Aug 13 11:23:14 2007 +0200
+++ b/lib-src/config.values.in	Mon Aug 13 11:24:09 2007 +0200
@@ -24,9 +24,13 @@
 CPPFLAGS "@CPPFLAGS@"
 CXXFLAGS "@CXXFLAGS@"
 DEFS "@DEFS@"
+DOCDIR "@DOCDIR@"
+DOCDIR_USER_DEFINED "@DOCDIR_USER_DEFINED@"
 ETCDIR "@ETCDIR@"
 ETCDIR_USER_DEFINED "@ETCDIR_USER_DEFINED@"
 EXEC_PREFIX "@EXEC_PREFIX@"
+EXEC_PREFIX_USER_DEFINED "@EXEC_PREFIX_USER_DEFINED@"
+FFLAGS "@FFLAGS@"
 INFODIR "@INFODIR@"
 INFODIR_USER_DEFINED "@INFODIR_USER_DEFINED@"
 INFOPATH "@INFOPATH@"
@@ -35,6 +39,7 @@
 INSTALL_ARCH_DEP_SUBDIR "@INSTALL_ARCH_DEP_SUBDIR@"
 INSTALL_DATA "@INSTALL_DATA@"
 INSTALL_PROGRAM "@INSTALL_PROGRAM@"
+INSTALL_SCRIPT "@INSTALL_SCRIPT@"
 LDFLAGS "@LDFLAGS@"
 LIBS "@LIBS@"
 LISPDIR "@LISPDIR@"
@@ -48,10 +53,12 @@
 PACKAGE_PATH "@PACKAGE_PATH@"
 PACKAGE_PATH_USER_DEFINED "@PACKAGE_PATH_USER_DEFINED@"
 PREFIX "@PREFIX@"
+PREFIX_USER_DEFINED "@PREFIX_USER_DEFINED@"
 PROGNAME "@PROGNAME@"
 RANLIB "@RANLIB@"
 RECURSIVE_MAKE "@RECURSIVE_MAKE@"
 SET_MAKE "@SET_MAKE@"
+SHELL "@SHELL@"
 SITELISPDIR "@SITELISPDIR@"
 SITELISPDIR_USER_DEFINED "@SITELISPDIR_USER_DEFINED@"
 SITEMODULEDIR "@SITEMODULEDIR@"
--- a/lisp/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,130 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
+1999-07-13  SL Baur  <steve@miho>
+
+	* lib-complete.el (read-library-name): Revert previous change.
+	(read-library): Ditto.
+
+1999-06-24  Karl M. Hegbloom  <karlheg@debian.org>
+
+	* packages.el (packages-package-list): Capitalize docstring.
+
+	* packages.el (packages-find-package-library-path): Use #'nconc
+	rather than #'append to reduce consing -- #'mapcar uses Flist,
+	which returns a freshly consed list.  #'append would create yet
+	another fresh list, using Fmake_list in concat.
+
+	* packages.el (package-provide): Use setq with remassq like it
+	says in its docstring.
+
+1999-07-06  SL Baur  <steve@miho.m17n.org>
+
+	* lib-complete.el (progn-with-message): Fix typo.
+
+1999-07-06  SL Baur  <steve@miho.m17n.org>
+
+	* mule/mule-misc.el (char-octet): Make function match docstring.
+	From Katsumi Yamaoka <yamaoka@jpl.org>
+	
+1999-06-15  Karl M. Hegbloom  <karlheg@debian.org>
+
+	* wid-edit.el (widget-documentation): corrected spelling error.
+
+1999-06-23  Jonathan Marten <jonathan.marten@uk.sun.com>
+
+	* x-win-sun.el (x-win-init-sun): Don't rebind Find and Sh-find
+	keys if already bound
+
+1999-07-06  SL Baur  <steve@miho.m17n.org>
+
+	* lib-complete.el (progn-with-message): Revert previous changes.
+
+1999-06-24  Bob Weiner  <weiner@beopen.com>
+
+	* lib-complete.el (find-library): 
+	(find-library-other-window): 
+	(find-library-other-frame): Completely rewrote
+	so that these functions actually work when called non-interactively.  
+	Also made them handle LIBRARY arguments which end with .el or .elc.
+
+1999-06-24  Bob Weiner  <weiner@beopen.com>
+
+	* simple.el (indent-new-comment-line): Locally bound
+	`block-comment-start' to `comstart' or else when this is called
+	from do-auto-fill, e.g. in Lisp mode, it will insert any non-nil
+	`block-comment-start' value, ignoring any existing spacing after a
+	comment prefix in the previous line and producing ugly comments.
+
+1999-06-23  Bob Weiner  <weiner@beopen.com>
+
+	* list-mode.el (mouse-choose-completion): 
+	(choose-completion): 
+	(completion-switch-to-minibuffer): Added.
+	([Tab]): [Tab] previously switched to the minibuffer
+	but since [space] does that and since most applications in the
+	world use [Tab] to select the next item in a list, do that in the
+	*Completions* buffer too.  This will cause the least confusion
+	among the largest population of users.  -- Bob Weiner, BeOpen.com,
+	06/23/1999.
+
+1999-06-22  Bob Weiner  <weiner@beopen.com>
+
+	* help.el (help-buffer-name): Added support for a null value
+	of `help-buffer-prefix-string' since some buffers require no
+	prefix.
+
+1999-06-20  Bob Weiner  <weiner@beopen.com>
+
+	* list-mode.el (completion-list-mode-quit): Added and bound to {q} 
+	in the completion-list-mode-map to bury the completions buffer
+	even when the minibuffer is no longer active.
+
+1999-06-20  Bob Weiner  <weiner@beopen.com>
+
+	* list-mode.el (list-mode): It is visually disconcerting to have
+	the text cursor disappear within list buffers, especially when
+	moving from window to window, so leave it visible.
+
+1999-07-01  SL Baur  <steve@miho.m17n.org>
+
+	* menubar-items.el (default-menubar): Conditionalize the bug
+	report menu item (which may not be possible in this XEmacs).
+	Reported by: Ken'ichi Handa <handa@etl.go.jp>
+	
+1999-06-30  SL Baur  <steve@miho.m17n.org>
+
+	* subr.el (with-current-buffer): DOC string fix.
+	Suggested by Bob Weiner <weiner@altrasoft.com>
+
+1999-06-25  Charles G Waldman <cgw@fnal.gov>
+
+        * cus-face.el (custom-face-italic): insert missing args
+        
+1999-06-24  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* packages.el (package-locations): Changed default early package
+	hierarchies to ~/.xemacs/mule-packages and
+	~/.xemacs/xemacs-packages.
+
+1999-06-23  SL Baur  <steve@miho.m17n.org>
+
+	* mule/mule-category.el (Top Level): ASCII is also latin-1.
+
+1999-06-15  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* packages.el (package-locations): Changed default early package
+	hierarchy to ~/.xemacs/packages.
+	(package-locations): Removed `packages' as a possible name for a
+	late package hierarchy.
+
+1999-06-20  MORIOKA Tomohiko  <tomo@etl.go.jp>
+
+	* mule/mule-category.el (word-combining-categories): Set up new
+	variable.
+	(word-separating-categories): Likewise.
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/lisp/cus-face.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/cus-face.el	Mon Aug 13 11:24:09 2007 +0200
@@ -184,7 +184,7 @@
 
 (defun custom-face-italic (face &rest args)
   "Return non-nil if the font of FACE is italic."
-  (let* ((font (apply 'face-font-name face))
+  (let* ((font (apply 'face-font-name face args))
 	 ;; Gag
 	 (fontobj (font-create-object font)))
     (font-italic-p fontobj)))
--- a/lisp/help.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/help.el	Mon Aug 13 11:24:09 2007 +0200
@@ -461,7 +461,9 @@
   (if (and (integerp help-max-help-buffers)
            (> help-max-help-buffers 0)
            (stringp name))
-      (format "*%s: %s*" help-buffer-prefix-string name)
+      (if help-buffer-prefix-string
+	  (format "*%s: %s*" help-buffer-prefix-string name)
+	(format "*%s*" name))
     (format "*%s*" help-buffer-prefix-string)))
 
 ;; Use this function for displaying help when C-h something is pressed
--- a/lisp/lib-complete.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/lib-complete.el	Mon Aug 13 11:24:09 2007 +0200
@@ -38,7 +38,6 @@
 ;; Last Modified By: Heiko M|nkel <muenkel@tnt.uni-hannover.de>
 ;; Additional XEmacs integration By: Chuck Thompson <cthomp@cs.uiuc.edu>
 ;; Last Modified On: Thu Jul 1 14:23:00 1994
-;; RCS Info        : $Revision: 1.3.2.2 $ $Locker:  $
 ;; ========================================================================
 ;; NOTE: XEmacs must be redumped if this file is changed.
 ;;
@@ -57,6 +56,7 @@
 ;;; ChangeLog:
 
 ;; 4/26/97: sb Mule-ize.
+;; 6/24/1999 much rewriting from Bob Weiner
 
 ;;; Code:
 
@@ -217,7 +217,6 @@
       (if tail (setcdr tail nil)))))
 
 ;;=== Read a filename, with completion in a search path ===================
-(defvar read-library-internal-search-path)
 
 (defun read-library-internal (FILE FILTER FLAG)
   "Don't call this."
@@ -255,79 +254,93 @@
     (cond 
      ((equal library "") DEFAULT)
      (FULL (locate-file library read-library-internal-search-path
-			  '(".el" ".el.gz" ".elc")))
+			 '(".el" ".el.gz" ".elc")))
      (t library))))
 
+(defun read-library-name (prompt)
+  "PROMPTs for and returns an existing Elisp library name (without any suffix) or the empty string."
+  (interactive)
+  (let ((read-library-internal-search-path load-path))
+    (completing-read prompt
+		     'read-library-internal 
+		     (lambda (fn) 
+		       (cond
+			((string-match "\\.el\\(\\.gz\\|\\.Z\\)?$" fn)
+			 (substring fn 0 (match-beginning 0)))))
+		     t nil)))
+
 ;; NOTE: as a special case, read-library may be used to read a filename
 ;; relative to the current directory, returning a *relative* pathname
 ;; (read-file-name returns a full pathname).
 ;;
 ;; eg. (read-library "Local header: " '(nil) nil)
 
-(defun get-library-path ()
-  "Front end to read-library"
-  (read-library "Find Library file: " load-path nil t t
-		  (function (lambda (fn) 
-			      (cond
-			       ;; decompression doesn't work with mule -slb
-			       ((string-match (if (featurep 'mule)
-						  "\\.el$"
-						"\\.el\\(\\.gz\\)?$") fn)
-				(substring fn 0 (match-beginning 0))))))
-		  ))
-
 ;;=== Replacement for load-library with completion ========================
 
 (defun load-library (library)
   "Load the library named LIBRARY.
 This is an interface to the function `load'."
   (interactive 
-   (list (read-library "Load Library: " load-path nil nil nil
-		  (function (lambda (fn) 
-			      (cond 
-			       ((string-match "\\.elc?$" fn)
-				(substring fn 0 (match-beginning 0))))))
-		  ))) 
+   (list (read-library "Load library: " load-path nil nil nil
+		       (function (lambda (fn) 
+				   (cond 
+				    ((string-match "\\.elc?$" fn)
+				     (substring fn 0 (match-beginning 0))))))
+		       ))) 
   (load library))
 
-;;=== find-library with completion (Author: Heiko Muenkel) ===================
+;;=== find-library with completion (Author: Bob Weiner) ===================
 
-(defun find-library (library &optional codesys)
-  "Find and edit the source for the library named LIBRARY.
-The extension of the LIBRARY must be omitted.
-Under XEmacs/Mule, the optional second argument specifies the
-coding system to use when decoding the file.  Interactively,
-with a prefix argument, you will be prompted for the coding system."
+(defun find-library (library &optional codesys display-function)
+  "Find and display in the current window the source for the Elisp LIBRARY.
+LIBRARY should be a name without any path information and may include or omit
+the \".el\" suffix.  Under XEmacs/Mule, the optional second argument CODESYS
+specifies the coding system to use when decoding the file.  Interactively,
+with a prefix argument, this prompts for the coding system.  Optional third
+argument DISPLAY-FUNCTION must take two arguments, the filename to display
+and CODESYS.  The default for DISPLAY-FUNCTION is `find-file'."
   (interactive 
-   (list (get-library-path)
+   (list (read-library-name "Find library: ")
 	 (if current-prefix-arg
 	     (read-coding-system "Coding System: "))))
-  (find-file library codesys))
+  (let ((path (if (or (null library) (equal library ""))
+		   nil
+		(locate-file library load-path
+			     ;; decompression doesn't work with Mule -slb
+			     (if (featurep 'mule)
+				 ":.el:.elc"
+			       ":.el:.el.gz:.el.Z:.elc")))))
+    (if path (funcall (if (fboundp display-function)
+			  display-function 'find-file)
+		      path codesys)
+      (error "(find-library): Cannot locate library `%s'" library))))
 
 (defun find-library-other-window (library &optional codesys)
-  "Load the library named LIBRARY in another window.
-Under XEmacs/Mule, the optional second argument specifies the
-coding system to use when decoding the file.  Interactively,
-with a prefix argument, you will be prompted for the coding system."
+  "Find and display in another window the source for the Elisp LIBRARY.
+LIBRARY should be a name without any path information and may include or omit
+the \".el\" suffix.  Under XEmacs/Mule, the optional second argument CODESYS
+specifies the coding system to use when decoding the file.  Interactively,
+with a prefix argument, this prompts for the coding system."
   (interactive 
-   (list (get-library-path)
+   (list (read-library-name "Find library in other window: ")
 	 (if current-prefix-arg
-	   (read-coding-system "Coding System: "))))
-  (find-file-other-window library codesys))
+	     (read-coding-system "Coding System: "))))
+  (find-library library codesys 'find-file-other-window))
 
 (defun find-library-other-frame (library &optional codesys)
-  "Load the library named LIBRARY in a newly-created frame.
-Under XEmacs/Mule, the optional second argument specifies the
-coding system to use when decoding the file.  Interactively,
-with a prefix argument, you will be prompted for the coding system."
+  "Find and display in another frame the source for the Elisp LIBRARY.
+LIBRARY should be a name without any path information and may include or omit
+the \".el\" suffix.  Under XEmacs/Mule, the optional second argument CODESYS
+specifies the coding system to use when decoding the file.  Interactively,
+with a prefix argument, this prompts for the coding system."
   (interactive 
-   (list (get-library-path)
+   (list (read-library-name "Find library in other frame: ")
 	 (if current-prefix-arg
 	     (read-coding-system "Coding System: "))))
-  (find-file-other-frame library codesys))
+  (find-library library codesys 'find-file-other-frame))
 
-; This conflicts with an existing binding
-;(define-key global-map "\C-xl" 'find-library)
+;; This conflicts with an existing binding.
+;;(define-key global-map "\C-xl" 'find-library)
 (define-key global-map "\C-x4l" 'find-library-other-window)
 (define-key global-map "\C-x5l" 'find-library-other-frame)
 
--- a/lisp/list-mode.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/list-mode.el	Mon Aug 13 11:24:09 2007 +0200
@@ -77,7 +77,10 @@
   (make-local-variable 'next-line-add-newlines)
   (setq next-line-add-newlines nil)
   (setq list-mode-extent nil)
-  (set-specifier text-cursor-visible-p nil (current-buffer))
+;; It is visually disconcerting to have the text cursor disappear within list 
+;; buffers, especially when moving from window to window, so leave it
+;; visible.  -- Bob Weiner, 06/20/1999
+; (set-specifier text-cursor-visible-p nil (current-buffer))
   (setq buffer-read-only t)
   (goto-char (point-min))
   (run-hooks 'list-mode-hook))
@@ -458,21 +461,23 @@
 (define-derived-mode completion-list-mode list-mode 
   "Completion List"
   "Major mode for buffers showing lists of possible completions.
-Type \\<completion-list-mode-map>\\[choose-completion] in the completion list\
- to select the completion near point.
-Use \\<completion-list-mode-map>\\[mouse-choose-completion] to select one\
- with the mouse."
+\\{completion-list-mode-map}"
   (make-local-variable 'completion-base-size)
   (setq completion-base-size nil))
 
 (let ((map completion-list-mode-map))
+  (define-key map 'button2up 'mouse-choose-completion)
+  (define-key map 'button2 'undefined)
+  (define-key map "\C-m" 'choose-completion)
   (define-key map "\e\e\e" 'delete-completion-window)
   (define-key map "\C-g" 'minibuffer-keyboard-quit)
-  (define-key map "q" 'abort-recursive-edit)
-  (define-key map " " (lambda () (interactive)
-			(select-window (minibuffer-window))))
-  (define-key map "\t" (lambda () (interactive)
-			 (select-window (minibuffer-window)))))
+  (define-key map "q" 'completion-list-mode-quit)
+  (define-key map " " 'completion-switch-to-minibuffer)
+  ;; [Tab] used to switch to the minibuffer but since [space] does that and
+  ;; since most applications in the world use [Tab] to select the next item
+  ;; in a list, do that in the *Completions* buffer too.  -- Bob Weiner,
+  ;; BeOpen.com, 06/23/1999.
+  (define-key map "\t" 'next-list-mode-item))
 
 (defvar completion-reference-buffer nil
   "Record the buffer that was current when the completion list was requested.
@@ -486,6 +491,10 @@
 If this is nil, it means to compare text to determine which part
 of the tail end of the buffer's text is involved in completion.")
 
+;; These names are referenced in the doc string for `completion-list-mode'.
+(defalias 'choose-completion 'list-mode-item-keyboard-selected)
+(defalias 'mouse-choose-completion 'list-mode-item-mouse-selected)
+
 (defun delete-completion-window ()
   "Delete the completion list window.
 Go to the window from which completion was requested."
@@ -495,6 +504,21 @@
     (if (get-buffer-window buf)
 	 (select-window (get-buffer-window buf)))))
 
+(defun completion-switch-to-minibuffer ()
+  "Move from a completions buffer to the active minibuffer window."
+  (interactive)
+  (select-window (minibuffer-window)))
+
+(defun completion-list-mode-quit ()
+  "Abort any recursive edit and bury the completions buffer."
+  (interactive)
+  (condition-case ()
+      (abort-recursive-edit)
+    (error nil))
+  ;; If there was no recursive edit to abort, simply bury the completions
+  ;; list buffer.
+  (if (eq major-mode 'completion-list-mode) (bury-buffer)))
+
 (defun completion-do-in-minibuffer ()
   (interactive "_")
   (save-excursion
--- a/lisp/menubar-items.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/menubar-items.el	Mon Aug 13 11:24:09 2007 +0200
@@ -955,7 +955,8 @@
        ["No Warranty" describe-no-warranty]
        ["XEmacs License" describe-copying]
        ["The Latest Version" describe-distribution])
-      ["Send Bug Report..." report-emacs-bug]))))
+      ["Send Bug Report..." report-emacs-bug
+       :active (fboundp 'report-emacs-bug)]))))
 
 
 (defun maybe-add-init-button ()
--- a/lisp/mule/mule-category.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/mule/mule-category.el	Mon Aug 13 11:24:09 2007 +0200
@@ -1,6 +1,8 @@
 ;;; mule-category.el --- category functions for XEmacs/Mule.
 
 ;; Copyright (C) 1992,93,94,95 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 1999 Electrotechnical Laboratory, JAPAN.
+;; Licensed to the Free Software Foundation.
 ;; Copyright (C) 1995 Amdahl Corporation.
 ;; Copyright (C) 1995 Sun Microsystems.
 
@@ -243,9 +245,11 @@
 
 (let (i l)
   (define-category ?a "ASCII character set.")
+  (define-category ?l "Latin-1 through Latin-5 character set")
   (setq i 32)
   (while (< i 127)
     (modify-category-entry i ?a)
+    (modify-category-entry i ?l)
     (setq i (1+ i)))
   (setq l predefined-category-list)
   (while l
@@ -255,6 +259,23 @@
     (modify-category-entry (car (car l)) (nth 1 (car l)))
     (setq l (cdr l))))
 
+;;; Setting word boundary.
+
+(setq word-combining-categories
+      '((?l . ?l)))
+
+(setq word-separating-categories	;  (2-byte character sets)
+      '((?A . ?K)			; Alpha numeric - Katakana
+	(?A . ?C)			; Alpha numeric - Chinese
+	(?H . ?A)			; Hiragana - Alpha numeric
+	(?H . ?K)			; Hiragana - Katakana
+	(?H . ?C)			; Hiragana - Chinese
+	(?K . ?A)			; Katakana - Alpha numeric
+	(?K . ?C)			; Katakana - Chinese
+	(?C . ?A)			; Chinese - Alpha numeric
+	(?C . ?K)			; Chinese - Katakana
+	))
+
 ;;; At the present, I know Japanese and Chinese text can
 ;;; break line at any point under a restriction of 'kinsoku'.
 (defvar word-across-newline "\\(\\cj\\|\\cc\\|\\ct\\)"
--- a/lisp/mule/mule-misc.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/mule/mule-misc.el	Mon Aug 13 11:24:09 2007 +0200
@@ -212,6 +212,7 @@
   "Return the octet numbered N (should be 0 or 1) of char CH.
 N defaults to 0 if omitted."
   (let ((split (split-char ch)))
+    (setq n (or n 0))
     (cond ((eq n 0)
 	   (nth 1 split))
 	  ((eq n 1)
--- a/lisp/packages.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/packages.el	Mon Aug 13 11:24:09 2007 +0200
@@ -55,7 +55,7 @@
 ;;; Package versioning
 
 (defvar packages-package-list nil
-  "database of loaded packages and version numbers")
+  "Database of loaded packages and version numbers")
 
 (defvar packages-hierarchy-depth 1
   "Depth of package hierarchies.")
@@ -86,13 +86,14 @@
 
 (defvar package-locations
   (list
-   (list (paths-construct-path '("~" ".xemacs"))
+   (list (paths-construct-path '("~" ".xemacs" "mule-packages"))
+                             'early #'(lambda () (featurep 'mule)))
+   (list (paths-construct-path '("~" ".xemacs" "xemacs-packages"))
                              'early #'(lambda () t))
    (list "site-packages"     'late  #'(lambda () t))
    (list "infodock-packages" 'late  #'(lambda () (featurep 'infodock)))
    (list "mule-packages"     'late  #'(lambda () (featurep 'mule)))
-   (list "xemacs-packages"   'late  #'(lambda () t))
-   (list "packages"          'late  #'(lambda () t)))
+   (list "xemacs-packages"   'late  #'(lambda () t)))
   "Locations of the various package directories.
 This is a list each of whose elements describes one directory.
 A directory description is a three-element list.
@@ -122,9 +123,8 @@
   (let ((info (if (and attributes (floatp (car attributes)))
 		  (list :version (car attributes))
 		attributes)))
-    (remassq name packages-package-list)
     (setq packages-package-list
-	  (cons (cons name info) packages-package-list))))
+	  (cons (cons name info) (remassq name packages-package-list)))))
 
 (defun package-require (name version)
   (let ((pkg (assq name packages-package-list)))
@@ -452,7 +452,7 @@
 SUFFIXES is a list of names of package subdirectories to look for."
   (let ((directories
 	 (apply
-	  #'append
+	  #'nconc
 	  (mapcar #'(lambda (package)
 		      (mapcar #'(lambda (suffix)
 				  (file-name-as-directory (concat package suffix)))
--- a/lisp/simple.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/simple.el	Mon Aug 13 11:24:09 2007 +0200
@@ -2889,6 +2889,7 @@
       (if (and comcol (not fill-prefix))  ; XEmacs - (ENE) from fa-extras.
 	  (let ((comment-column comcol)
 		(comment-start comstart)
+		(block-comment-start comstart)
 		(comment-end comment-end))
 	    (and comment-end (not (equal comment-end ""))
   ;	       (if (not comment-multi-line)
--- a/lisp/subr.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/subr.el	Mon Aug 13 11:24:09 2007 +0200
@@ -334,7 +334,7 @@
        (erase-buffer))))
 
 (defmacro with-current-buffer (buffer &rest body)
-  "Execute the forms in BODY with BUFFER as the current buffer.
+  "Temporarily make BUFFER the current buffer and execute the forms in BODY.
 The value returned is the value of the last form in BODY.
 See also `with-temp-buffer'."
   `(save-current-buffer
--- a/lisp/wid-edit.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/wid-edit.el	Mon Aug 13 11:24:09 2007 +0200
@@ -49,7 +49,7 @@
   :group 'hypermedia)
 
 (defgroup widget-documentation nil
-  "Options controling the display of documentation strings."
+  "Options controlling the display of documentation strings."
   :group 'widgets)
 
 (defgroup widget-faces nil
--- a/lisp/x-win-sun.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/lisp/x-win-sun.el	Mon Aug 13 11:24:09 2007 +0200
@@ -246,8 +246,10 @@
 ;;; themselves are in x-win.el in case someone wants to use them when
 ;;; not running on a Sun display.)
 
-  (define-key global-map 'find		'ow-find)
-  (define-key global-map '(shift find)	'ow-find-backward)
+  (or (lookup-key global-map 'find)
+      (define-key global-map 'find 'ow-find))
+  (or (lookup-key global-map '(shift find))
+       (define-key global-map '(shift find) 'ow-find-backward))
 
   )
 
--- a/lwlib/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/lwlib/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,34 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
+1999-07-05  Didier Verna  <verna@inf.enst.fr>
+
+	* lwlib-Xm.c (xm_update_one_widget): add missing #ifdefs around
+	call to xm_update_label.
+
+1999-06-28  Andy Piper  <andy@xemacs.org>
+
+	* lwlib-Xm.c: unconditionally enable text field & list code.
+	(make_progress): new function. creates a slider.
+	(make_text_field): new function. creates an edit field.
+	(make_combo_box): new function. creates a combo box.
+	(xm_creation_table): add new widget functions.
+
+1999-06-25  Andy Piper  <andy@xemacs.org>
+
+	* lwlib.h (_widget_value): add arglist slots.
+	declare new functions.
+
+	* lwlib.c (free_widget_value_contents): handle arglists when
+ 	freeing.
+	(lw_add_value_args_to_args): new function. add arglist entries
+ 	from a widget_value structure.
+
+	* lwlib-Xm.c (make_button): new function, create a motif button
+ 	for display in a buffer as a glyph.
+	(xm_creation_table): add make_button.
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/lwlib/lwlib-Xm.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/lwlib/lwlib-Xm.c	Mon Aug 13 11:24:09 2007 +0200
@@ -4,13 +4,13 @@
 
 This file is part of the Lucid Widget Library.
 
-The Lucid Widget Library is free software; you can redistribute it and/or 
+The Lucid Widget Library is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 The Lucid Widget Library is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of 
+but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
@@ -60,15 +60,17 @@
 #include <Xm/Separator.h>
 #include <Xm/DialogS.h>
 #include <Xm/Form.h>
+#include <Xm/Scale.h>
+#if XmVERSION > 1
+#include <Xm/ComboBox.h>
+#endif
 
 #ifdef LWLIB_MENUBARS_MOTIF
 static void xm_pull_down_callback (Widget, XtPointer, XtPointer);
-#if 0
-static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
-#endif /* 0 */
 #endif
 static void xm_internal_update_other_instances (Widget, XtPointer,
 						XtPointer);
+static void xm_pop_down_callback (Widget, XtPointer, XtPointer);
 static void xm_generic_callback (Widget, XtPointer, XtPointer);
 #ifdef LWLIB_DIALOGS_MOTIF
 static void xm_nosel_callback (Widget, XtPointer, XtPointer);
@@ -84,7 +86,7 @@
 #endif
 
 /* Structures to keep destroyed instances */
-typedef struct _destroyed_instance 
+typedef struct _destroyed_instance
 {
   char*		name;
   char*		type;
@@ -124,7 +126,7 @@
   instance->next = NULL;
   return instance;
 }
-			 
+
 static void
 free_destroyed_instance (destroyed_instance* instance)
 {
@@ -143,7 +145,7 @@
 Boolean
 lw_motif_widget_p (Widget widget)
 {
-  return 
+  return
 #ifdef LWLIB_DIALOGS_MOTIF
     XtClass (widget) == xmDialogShellWidgetClass ||
 #endif
@@ -155,7 +157,7 @@
 {
   XtResource resource;
   char *result = NULL;
-  
+
   resource.resource_name  = "labelString";
   resource.resource_class = "LabelString"; /* #### should be Xmsomething... */
   resource.resource_type = XtRString;
@@ -181,7 +183,7 @@
   children = XtCompositeChildren (widget, &number);
   if (children)
     {
-      /* Unmanage all children and destroy them.  They will only be 
+      /* Unmanage all children and destroy them.  They will only be
        * really destroyed when we get out of DispatchEvent. */
       for (i = 0; i < number; i++)
 	{
@@ -283,7 +285,7 @@
       XtSetArg (al [ac], XmNlabelString, built_string); ac++;
       XtSetArg (al [ac], XmNlabelType, XmSTRING);	ac++;
     }
-  
+
   if (val->key)
     {
       key_string = XmStringCreateLtoR (val->key, XmSTRING_DEFAULT_CHARSET);
@@ -363,7 +365,7 @@
       XtRemoveAllCallbacks (widget, XmNcascadingCallback);
       XtAddCallback (widget, XmNcascadingCallback, xm_pull_down_callback,
 		     instance);
-    }      
+    }
 }
 
 #endif /* LWLIB_MENUBARS_MOTIF */
@@ -459,7 +461,7 @@
 
   num_children = 0;
   for (child_index = 0, cur = val; cur; child_index++, cur = cur->next)
-    {    
+    {
       ac = 0;
       button = 0;
       XtSetArg (al [ac], XmNsensitive, cur->enabled);		ac++;
@@ -577,7 +579,7 @@
   menu = NULL;
   XtSetArg (al [0], XmNsubMenuId, &menu);
   XtGetValues (widget, al, 1);
-  
+
   contents = val->contents;
 
   if (!menu)
@@ -658,8 +660,6 @@
 #endif /* LWLIB_MENUBARS_MOTIF */
 
 
-#ifdef LWLIB_DIALOGS_MOTIF
-
 /* update text widgets */
 
 static void
@@ -685,7 +685,6 @@
 		 xm_internal_update_other_instances, instance);
 }
 
-#endif /* LWLIB_DIALOGS_MOTIF */
 
 #ifdef LWLIB_SCROLLBARS_MOTIF
 
@@ -769,7 +768,7 @@
 {
   WidgetClass class;
   Arg al [2];
-  
+
   /* Mark as not edited */
   val->edited = False;
 
@@ -782,8 +781,8 @@
   /* Common to all label like widgets */
   if (XtIsSubclass (widget, xmLabelWidgetClass))
     xm_update_label (instance, widget, val);
-#endif
-  
+#endif /* defined (LWLIB_DIALOGS_MOTIF) || defined (LWLIB_MENUBARS_MOTIF) */
+
   class = XtClass (widget);
   /* Class specific things */
   if (class == xmPushButtonWidgetClass ||
@@ -808,7 +807,7 @@
 
       XtSetArg (al [0], XmNradioBehavior, &radiobox);
       XtGetValues (widget, al, 1);
-      
+
       if (radiobox)
 	xm_update_radiobox (instance, widget, val);
 #ifdef LWLIB_MENUBARS_MOTIF
@@ -816,7 +815,6 @@
 	xm_update_menu (instance, widget, val, deep_p);
 #endif
     }
-#ifdef LWLIB_DIALOGS_MOTIF
   else if (class == xmTextWidgetClass)
     {
       xm_update_text (instance, widget, val);
@@ -825,7 +823,6 @@
     {
       xm_update_text_field (instance, widget, val);
     }
-#endif
   else if (class == xmListWidgetClass)
     {
       xm_update_list (instance, widget, val);
@@ -853,7 +850,7 @@
 	val->call_data = old_wv->call_data;
 	break;
       }
-  
+
   if (class == xmToggleButtonWidgetClass || class == xmToggleButtonGadgetClass)
     {
       Arg al [1];
@@ -861,7 +858,6 @@
       XtGetValues (widget, al, 1);
       val->edited = True;
     }
-#ifdef LWLIB_DIALOGS_MOTIF
   else if (class == xmTextWidgetClass)
     {
       if (val->value)
@@ -876,7 +872,6 @@
       val->value = XmTextFieldGetString (widget);
       val->edited = True;
     }
-#endif
   else if (class == xmRowColumnWidgetClass)
     {
       Boolean radiobox = 0;
@@ -946,7 +941,7 @@
 /* This function is for activating a button from a program.  It's wrong because
    we pass a NULL argument in the call_data which is not Motif compatible.
    This is used from the XmNdefaultAction callback of the List widgets to
-   have a dble-click put down a dialog box like the button woudl do. 
+   have a double-click put down a dialog box like the button would do.
    I could not find a way to do that with accelerators.
  */
 static void
@@ -996,7 +991,7 @@
  /* This is a kludge to disable drag-and-drop in dialog boxes.  The symptom
     was a segv down in libXm somewhere if you used the middle button on a
     dialog box to begin a drag; when you released the button to make a drop
-    things would lose if you were not over the button where you started the 
+    things would lose if you were not over the button where you started the
     drag (canceling the operation).  This was probably due to the fact that
     the dialog boxes were not set up to handle a drag but were trying to do
     so anyway for some reason.
@@ -1029,7 +1024,7 @@
   Arg 	al[64];			/* Arg List */
   int 	ac;			/* Arg Count */
   int 	i;
-  
+
 #ifdef DND_KLUDGE
   XtTranslations dnd_override = XtParseTranslationTable (disable_dnd_trans);
 # define DO_DND_KLUDGE(widget) XtOverrideTranslations ((widget), dnd_override)
@@ -1077,7 +1072,7 @@
   XtSetArg(al[ac], XmNrightAttachment, XmATTACH_FORM);	ac++;
   XtSetArg(al[ac], XmNrightOffset, 13);			ac++;
   row = XmCreateRowColumn (form, "row", al, ac);
-  
+
   n_children = 0;
   for (i = 0; i < left_buttons; i++)
     {
@@ -1119,7 +1114,7 @@
 					 al, ac);
   DO_DND_KLUDGE (children [n_children]);
   n_children++;
-  
+
   for (i = 0; i < right_buttons; i++)
     {
       char button_name [16];
@@ -1131,9 +1126,9 @@
       if (! button) button = children [n_children];
       n_children++;
     }
-  
+
   XtManageChildren (children, n_children);
-  
+
   ac = 0;
   XtSetArg(al[ac], XmNtopAttachment, XmATTACH_NONE);		ac++;
   XtSetArg(al[ac], XmNbottomAttachment, XmATTACH_WIDGET);	ac++;
@@ -1232,7 +1227,7 @@
 	 list activate the default button */
       XtAddCallback (value, XmNdefaultActionCallback, activate_button, button);
     }
-  
+
   ac = 0;
   XtSetArg(al[ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
   XtSetArg(al[ac], XmNtopAttachment, XmATTACH_FORM);		ac++;
@@ -1248,7 +1243,7 @@
   XtSetArg(al[ac], XmNrightOffset, 13);				ac++;
   message = XmCreateLabel (form, "message", al, ac);
   DO_DND_KLUDGE (message);
-  
+
   if (list)
     XtManageChild (value);
 
@@ -1263,7 +1258,7 @@
   children [i] = icon; i++;
   children [i] = icon_separator; i++;
   XtManageChildren (children, i);
-  
+
   if (text_input_slot || list)
     {
       XtInstallAccelerators (value, button);
@@ -1274,7 +1269,7 @@
       XtInstallAccelerators (form, button);
       XmProcessTraversal(value, XmTRAVERSE_CURRENT);
     }
-  
+
 #ifdef DND_KLUDGE
   XtFree ((char *) dnd_override);
 #endif
@@ -1353,7 +1348,7 @@
 
   x = (Position) ((parent_width  - child_width)  / 2);
   y = (Position) ((parent_height - child_height) / 2);
-  
+
   XtTranslateCoords (parent, x, y, &x, &y);
 
   if ((Dimension) (x + child_width) > screen_width)
@@ -1466,7 +1461,7 @@
     shell_name = "Question";
     break;
   }
-  
+
   total_buttons = name [1] - '0';
 
   if (name [3] == 'T' || name [3] == 't')
@@ -1476,9 +1471,9 @@
     }
   else if (name [3])
     right_buttons = name [4] - '0';
-  
+
   left_buttons = total_buttons - right_buttons;
-  
+
   widget = make_dialog (name, parent, pop_up_p,
 			shell_name, icon_name, text_input_slot, radio_box,
 			list, left_buttons, right_buttons);
@@ -1537,7 +1532,7 @@
   { {xm_scrollbar_callback, NULL}, {NULL, NULL} };
 
   callbacks[0].closure  = (XtPointer) instance;
-  
+
   XtSetArg (al[ac], XmNminimum,       1); ac++;
   XtSetArg (al[ac], XmNmaximum, INT_MAX); ac++;
   XtSetArg (al[ac], XmNincrement,     1); ac++;
@@ -1571,10 +1566,154 @@
 
 #endif /* LWLIB_SCROLLBARS_MOTIF */
 
-/* Table of functions to create widgets */
+/* glyph widgets */
+static Widget
+make_button (widget_instance *instance)
+{
+  Arg al[20];
+  int ac = 0;
+  Widget button = 0;
+  widget_value* val = instance->info->val;
+
+  XtSetArg (al [ac], XmNsensitive, val->enabled);		ac++;
+  XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
+  XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
+  XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
+  /* The highlight doesn't appear to be dynamically set which makes it
+     look ugly.  I think this may be a LessTif bug but for now we just
+     get rid of it. */
+  XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+  /* add any args the user supplied for creation time */
+  lw_add_value_args_to_args (val, al, &ac);
+
+  if (!val->call_data)
+    button = XmCreateLabel (instance->parent, val->name, al, ac);
+
+  else if (val->type == TOGGLE_TYPE || val->type == RADIO_TYPE)
+    {
+      XtSetArg (al [ac], XmNset, val->selected);	ac++;
+      XtSetArg (al [ac], XmNindicatorType,
+		(val->type == TOGGLE_TYPE ?
+		 XmN_OF_MANY : XmONE_OF_MANY));    ac++;
+      XtSetArg (al [ac], XmNvisibleWhenOff, True); ac++;
+      button = XmCreateToggleButton (instance->parent, val->name, al, ac);
+      XtRemoveAllCallbacks (button, XmNvalueChangedCallback);
+      XtAddCallback (button, XmNvalueChangedCallback, xm_generic_callback,
+		     (XtPointer)instance);
+    }
+  else
+    {
+      button = XmCreatePushButton (instance->parent, val->name, al, ac);
+      XtAddCallback (button, XmNactivateCallback, xm_generic_callback,
+		     (XtPointer)instance);
+    }
+
+  XtManageChild (button);
+
+  return button;
+}
+
+static Widget
+make_progress (widget_instance *instance)
+{
+  Arg al[20];
+  int ac = 0;
+  Widget scale = 0;
+  widget_value* val = instance->info->val;
+
+  XtSetArg (al [ac], XmNsensitive, val->enabled);		ac++;
+  XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
+  XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
+  XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
+  XtSetArg (al [ac], XmNorientation, XmHORIZONTAL);	ac++;
+  /* The highlight doesn't appear to be dynamically set which makes it
+     look ugly.  I think this may be a LessTif bug but for now we just
+     get rid of it. */
+  XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+  if (!val->call_data)
+    XtSetArg (al [ac], XmNsensitive, False);		ac++;
+
+  /* add any args the user supplied for creation time */
+  lw_add_value_args_to_args (val, al, &ac);
+
+  scale = XmCreateScale (instance->parent, val->name, al, ac);
+  if (val->call_data)
+    XtAddCallback (scale, XmNvalueChangedCallback, xm_generic_callback,
+		   (XtPointer)instance);
+
+  XtManageChild (scale);
+
+  return scale;
+}
+
+static Widget
+make_text_field (widget_instance *instance)
+{
+  Arg al[20];
+  int ac = 0;
+  Widget text = 0;
+  widget_value* val = instance->info->val;
+
+  XtSetArg (al [ac], XmNsensitive, val->enabled && val->call_data);		ac++;
+  XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
+  XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
+  XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
+  /* The highlight doesn't appear to be dynamically set which makes it
+     look ugly.  I think this may be a LessTif bug but for now we just
+     get rid of it. */
+  XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+  /* add any args the user supplied for creation time */
+  lw_add_value_args_to_args (val, al, &ac);
+
+  text = XmCreateTextField (instance->parent, val->name, al, ac);
+  if (val->call_data)
+    XtAddCallback (text, XmNvalueChangedCallback, xm_generic_callback,
+		   (XtPointer)instance);
+
+  XtManageChild (text);
+
+  return text;
+}
+
+#if XmVERSION > 1
+static Widget
+make_combo_box (widget_instance *instance)
+{
+  Arg al[20];
+  int ac = 0;
+  Widget combo = 0;
+  widget_value* val = instance->info->val;
+
+  XtSetArg (al [ac], XmNsensitive, val->enabled);		ac++;
+  XtSetArg (al [ac], XmNalignment, XmALIGNMENT_BEGINNING);	ac++;
+  XtSetArg (al [ac], XmNuserData, val->call_data);		ac++;
+  XtSetArg (al [ac], XmNmappedWhenManaged, FALSE);	ac++;
+  /* The highlight doesn't appear to be dynamically set which makes it
+     look ugly.  I think this may be a LessTif bug but for now we just
+     get rid of it. */
+  XtSetArg (al [ac], XmNhighlightThickness, (Dimension)0);ac++;
+
+  /* add any args the user supplied for creation time */
+  lw_add_value_args_to_args (val, al, &ac);
+
+  combo = XmCreateComboBox (instance->parent, val->name, al, ac);
+  if (val->call_data)
+    XtAddCallback (combo, XmNselectionCallback, xm_generic_callback,
+		   (XtPointer)instance);
+
+  XtManageChild (combo);
+
+  return combo;
+}
+#endif
+
+
+/* Table of functions to create widgets */
 
 widget_creation_entry
-xm_creation_table [] = 
+xm_creation_table [] =
 {
 #ifdef LWLIB_MENUBARS_MOTIF
   {"menubar", 			make_menubar},
@@ -1584,6 +1723,12 @@
   {"vertical-scrollbar",	make_vertical_scrollbar},
   {"horizontal-scrollbar",	make_horizontal_scrollbar},
 #endif
+  {"button",		make_button},
+  {"progress",		make_progress},
+  {"text-field",		make_text_field},
+#if XmVERSION > 1
+  {"combo-box",		make_combo_box},
+#endif
   {NULL, NULL}
 };
 
@@ -1700,12 +1845,12 @@
       if (up)
 	XtManageChild (widget);
       else
-	XtUnmanageChild (widget);	
+	XtUnmanageChild (widget);
     }
 }
 
 
-/* motif callback */ 
+/* motif callback */
 
 enum do_call_type { pre_activate, selection, no_selection, post_activate };
 
@@ -1755,7 +1900,7 @@
 }
 
 /* Like lw_internal_update_other_instances except that it does not do
-   anything if its shell parent is not managed.  This is to protect 
+   anything if its shell parent is not managed.  This is to protect
    lw_internal_update_other_instances to dereference freed memory
    if the widget was ``destroyed'' by caching it in the all_destroyed_instances
    list */
@@ -1790,11 +1935,17 @@
       XtSetArg (al [0], XmNset, !check);
       XtSetValues (widget, al, 1);
     }
-#endif 
+#endif
   lw_internal_update_other_instances (widget, closure, call_data);
   do_call (widget, closure, selection);
 }
 
+static void
+xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
+{
+  do_call (widget, closure, post_activate);
+}
+
 #ifdef LWLIB_DIALOGS_MOTIF
 
 static void
@@ -1823,21 +1974,13 @@
   if (call_data)
     {
       /* new behavior for incremental menu construction */
-      
+
     }
   else
-#endif 
+#endif
     do_call (widget, closure, pre_activate);
 }
 
-#if 0
-static void
-xm_pop_down_callback (Widget widget, XtPointer closure, XtPointer call_data)
-{
-  do_call (widget, closure, post_activate);
-}
-#endif /* 0 */
-
 #endif /* LWLIB_MENUBARS_MOTIF */
 
 #ifdef LWLIB_SCROLLBARS_MOTIF
--- a/lwlib/lwlib.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/lwlib/lwlib.c	Mon Aug 13 11:24:09 2007 +0200
@@ -155,6 +155,12 @@
       free_widget_value_tree (wv->contents);
       wv->contents = (widget_value *) 0xDEADBEEF;
     }
+  if (wv->args && wv->free_args)
+    {
+      free (wv->args);
+      wv->args = (void *) 0xDEADBEEF;
+      wv->nargs = 0;
+    }
   if (wv->next)
     {
       free_widget_value_tree (wv->next);
@@ -263,6 +269,13 @@
       copy->next = copy_widget_value_tree (val->next, change);
       copy->toolkit_data = NULL;
       copy->free_toolkit_data = False;
+      if (val->nargs)
+	{
+	  copy->args = (ArgList)malloc (sizeof (Arg) * val->nargs);
+	  memcpy (copy->args, val->args, sizeof(Arg) * val->nargs);
+	  copy->nargs = val->nargs;
+	  copy->free_args = True;
+	}
 #ifdef NEED_SCROLLBARS
       copy_scrollbar_values (val, copy);
 #endif
@@ -1300,3 +1313,16 @@
 	}
     }
 }
+
+void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset)
+{
+  int i;
+  if (wv->nargs && wv->args)
+    {
+      for (i = 0; i<wv->nargs; i++)
+	{
+	  addto[i + *offset] = wv->args[i];
+	}
+      *offset += wv->nargs;
+    }
+}
--- a/lwlib/lwlib.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/lwlib/lwlib.h	Mon Aug 13 11:24:09 2007 +0200
@@ -148,9 +148,14 @@
   scrollbar_values *scrollbar_data;
 
   /* we resource the widget_value structures; this points to the next
-     one on the free list if this one has been deallocated.
-   */
+     one on the free list if this one has been deallocated.  */
   struct _widget_value *free_list;
+
+  /* some things are only possible at creation time. args are applied
+     to widgets at creation time.  */
+  ArgList args;
+  int	nargs;
+  Boolean	free_args;
 } widget_value;
 
 
@@ -201,6 +206,7 @@
 Boolean lw_get_some_values (LWLIB_ID id, widget_value* val);
 void lw_pop_up_all_widgets (LWLIB_ID id);
 void lw_pop_down_all_widgets (LWLIB_ID id);
+void lw_add_value_args_to_args (widget_value* wv, ArgList addto, int* offset);
 
 widget_value *malloc_widget_value (void);
 void free_widget_value (widget_value *);
--- a/man/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/man/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,7 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/man/xemacs/packages.texi	Mon Aug 13 11:23:14 2007 +0200
+++ b/man/xemacs/packages.texi	Mon Aug 13 11:24:09 2007 +0200
@@ -258,13 +258,18 @@
 @subsection Manual Binary Package Installation
 
 Pre-compiled, binary packages can be installed in either a system
-package directory (this is determined when XEmacs is compiled), or in a
-subdirectory of your @file{$HOME} directory:
+package directory (this is determined when XEmacs is compiled), or in
+one of the following
+subdirectories of your @file{$HOME} directory:
 
 @example
-~/.xemacs/packages
+~/.xemacs/mule-packages
+~/.xemacs/xemacs-packages
 @end example
 
+Packages in the former directory will only be found by a Mule-enabled
+XEmacs.
+
 XEmacs does not have to be running to install binary packages, although
 XEmacs will not know about any newly-installed packages until you
 restart XEmacs.  Note, however, that installing a newer version of a
@@ -278,12 +283,13 @@
 Download the package(s) that you want to install.  Each binary package
 will typically be a gzip'd tarball.
 
-@item
-Decide where to install the packages: in the system package directory,
-or in @file{~/.xemacs/packages}.  If you want to install the
-packages in the system package directory, make sure you can write into
-that directory.  If you want to install in your @file{$HOME} directory,
-create the directory, @file{~/.xemacs/packages}.
+@item Decide where to install the packages: in the system package
+directory, or in @file{~/.xemacs/mule-packages} or
+@file{~/.xemacs/xemacs-packages}, respectively.  If you want to install
+the packages in the system package directory, make sure you can write
+into that directory.  If you want to install in your @file{$HOME}
+directory, create the directory, @file{~/.xemacs/mule-packages} or
+@file{~/.xemacs/xemacs-packages}, respectively.
 
 @item
 Next, @code{cd} to the directory under which you want to install the
--- a/nt/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/nt/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,7 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/src/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,318 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
+1999-07-08  SL Baur  <steve@mule.m17n.org>
+
+	* event-Xt.c (handle_focus_event_1): Guard FRAME_X_XIC with
+	XIM_XLIB.
+	(emacs_Xt_handle_magic_event): Ditto.
+	* redisplay-x.c (x_output_string): Ditto.
+	(x_output_eol_cursor): Ditto.
+
+1999-06-30  Kazuyuki IENAGA <kazz@imasy.or.jp>
+
+	*  event-Xt.c, input-method-xlib.c, redisplay-x.c: Avoid the
+	problem that when XIM is destroyed or missed with some reason,
+	xemacs will die.  Now xim=xlib waits the XIM will be ready and
+	endures the case of XIM end up.
+
+1999-07-03  Gunnar Evermann  <ge204@eng.cam.ac.uk>
+
+        * tooltalk.c (init_tooltalk): save signal actions for SIGQUIT,
+        SIGINT and SIGCHLD before calling tt_open and restore the
+        afterwards. This fixes e.g. the zombie subprocesses on Solaris
+
+1999-07-06  SL Baur  <steve@xemacs.org>
+
+	* s/linux.h: gcc-2.8 changes for powerpc
+	From Justin Vallon <vallon@mindspring.com>
+
+1999-07-05  Didier Verna  <verna@inf.enst.fr>
+
+	* indent.c: new symbol Qcoerce.
+	(Fmove_to_column): use it + doc string update.
+
+1999-07-04  Andy Piper  <andy@xemacs.org>
+
+	* console.c: undo earlier Fprovide changes.
+	* fns.c: ditto.
+	* console.h: ditto.
+
+	* console-tty.c (image_instantiator_format_create_glyphs_tty): new
+ 	function. validate appropriate image formats for tty.
+
+	* glyphs.h (INITIALIZE_IMAGE_INSTANTIATOR_FORMAT_NO_SYM):
+ 	initialize consoles parameter.
+	(struct image_instantiator_methods): add consoles parameter.
+	(IIFORMAT_VALID_CONSOLE): new function. validate the format on the
+ 	console.
+	(INITIALIZE_DEVICE_IIFORMAT): validate the format on the given
+ 	console.
+
+	* glyphs-msw.c: declare instantiators for later use.
+	(image_instantiator_format_create_glyphs_mswindows): validate xpm
+ 	and friends on the mswindows console.
+	* glyphs-x.c: ditto.
+
+	* glyphs.c (valid_image_instantiator_format_p): disallow glyphs
+ 	that have not been registered on the supplied device.
+	(Fvalid_image_instantiator_format_p): add locale argument.
+	(instantiate_image_instantiator): valid image instantiator on the
+ 	device.
+
+	* symsinit.h: add image_instantiator_format_create_glyphs_tty()
+ 	declaration.
+
+	* emacs.c (main_1): add call to
+ 	image_instantiator_format_create_glyphs_tty().
+
+1999-06-29  Olivier Galibert  <galibert@pobox.com>
+
+	* lisp.h: Add #include <stddef.h>.
+
+	* sysdep.c: Remove #include <stddef.h>.
+	* symbols.c: Remove #include <stddef.h>.
+	* sheap.c: Remove #include <stddef.h>.
+	* opaque.c: Remove #include <stddef.h>.
+	* nt.c: Remove #include <stddef.h>.
+	* mule-charset.c: Remove #include <stddef.h>.
+	* marker.c: Remove #include <stddef.h>.
+	* file-coding.c: Remove #include <stddef.h>.
+	* extents.c: Remove #include <stddef.h>.
+	* elhash.c: Remove #include <stddef.h>.
+	* data.c: Remove #include <stddef.h>.
+	* chartab.c: Remove #include <stddef.h>.
+	* bytecode.c: Remove #include <stddef.h>.
+	* alloc.c: Remove #include <stddef.h>.  Fix vector description
+
+1999-06-30  SL Baur  <steve@miho.m17n.org>
+
+	* editfns.c: Document "%s" format spec.
+	Suggested by Bob Weiner <weiner@altrasoft.com>
+
+1999-06-29  Andy Piper  <andy@xemacs.org>
+
+	* event-msw.c: fix definition booboo.
+
+1999-06-28  Andy Piper  <andy@xemacs.org>
+
+	* glyphs-x.c: change tree -> tree-view, progress ->
+ 	progress_gauge, edit -> edit-field, tab -> tab-control, combo ->
+ 	combo-box.
+	(complex_vars_of_glyphs_x): provide-on-console the implemented
+ 	widget types.
+
+	* glyphs-msw.c: ditto.
+	(complex_vars_of_glyphs_mswindows): ditto.
+
+	* lisp.h: add Fprovide_on_console.
+
+	* fns.c (Ffeaturep): add extra optional console argument.
+	(Fprovide_on_console): like Fprovide but provides only on the
+ 	specified console-type.
+	(Frequire): check console-features as well as global features.
+
+	* console.c (Fconsole_features): new function. return features for
+ 	this console.
+	(syms_of_console): add Fconsole_features.
+
+	* console.h (CONMETH_FEATURES): new function for accessing features.
+	(CONSOLE_FEATURES): ditto.
+	(struct console_methods): add features slot.
+	(INITIALIZE_CONSOLE_TYPE): initialize features slot.
+
+1999-06-28  Andy Piper  <andy@xemacs.org>
+
+	* event-Xt.c (handle_focus_event_1): conditionally compile for
+ 	X11R5.
+
+	* s/cygwin32.h: fix me website address.
+
+	* event-msw.c: add NMHDR for pre b20 cygwin builds.
+
+	* gui-x.c (button_item_to_widget_value): only add callback if it
+ 	is non-nil.
+
+	* glyphs-x.c: add progress, edit and combo instantiators.
+	(x_widget_set_property): new function. uses lwlib to set widget
+ 	values.
+	(x_widget_property): new function. uses lwlib to get widget
+ 	values.
+	(x_button_instantiate): support images in buttons.
+	(x_button_property): new function. use lwlib to get the selected
+ 	state.
+	(x_progress_instantiate): new function for instantiating progress
+ 	gauges.
+	(x_progress_set_property): new function. sets the progress gauge
+ 	position.
+	(x_edit_instantiate): new function. for instantiating edit fields.
+	(x_combo_instantiate): new function. for instantiating combo
+ 	boxes.
+	(image_instantiator_format_create_glyphs_x): add new device ii
+ 	formats.
+
+	* glyphs-msw.c (mswindows_tab_instantiate): remove redundant var.
+
+	* console.h (CONSOLE_FEATURES): new features accesor.
+
+	* conslots.h (MARKED_SLOT): add features entry.
+
+1999-06-25  Andy Piper  <andy@xemacs.org>
+
+	* menubar-x.c (menu_item_descriptor_to_widget_value_1): use new
+ 	gui functions.
+
+	* menubar-msw.c: move MAX_MENUITEM_LENGTH to gui.h
+
+	* gui.h (struct Lisp_Gui_Item): add accelerator.
+
+	* gui.c (gui_item_add_keyval_pair): deal with accelerators.
+	(gui_item_init): ditto.
+	(gui_add_item_keywords_to_plist): ditto.
+	(mark_gui_item): ditto.
+	(gui_item_hash): ditto.
+	(gui_item_accelerator): new function.
+	(gui_name_accelerator): new function stolen from gui-x.c
+
+	* gui-x.c (popup_selection_callback): always define. mark
+ 	subwindows changed after calling a callback.
+	(menu_name_to_accelerator): deleted.
+	(button_item_to_widget_value): forward gui_item things to gui_item
+ 	functions.
+
+	* glyphs-x.h (struct x_subwindow_data): add data for widgets. add
+ 	appropriate accesors.
+
+	* glyphs-x.c: declare new glyph formats.
+	(x_finalize_image_instance): unmanage and destroy widgets if they
+ 	exist.
+	(x_unmap_subwindow): handle widgets specially.
+	(x_map_subwindow): ditto. offset display of widgets by offset of
+ 	text widget within container.
+	(x_update_subwindow): new function. call lw_modify_all_widgets
+ 	when we are a widget.
+	(x_widget_instantiate): new function for generically creating
+ 	widgets-glyphs. toolkit specifics forwarded to lwlib.
+	(x_button_instantiate): new function for instantiating
+ 	widgets-glyph buttons.
+	(console_type_create_glyphs_x): register update_subwindow.
+	(image_instantiator_format_create_glyphs_x): register widget and
+ 	button types.
+
+	* event-msw.c (mswindows_wnd_proc): remove redundant variable.
+
+	* event-Xt.c (x_event_to_emacs_event): call handle_focus_event_1
+ 	when we get a button press in case we do not have the focus.
+	(handle_focus_event_1): set the keyboard focus to the text widget
+ 	if we do not have it.
+
+	* dialog-x.c (dbox_descriptor_to_widget_value): use new gui_item
+ 	functions.
+
+1999-06-24  SL Baur  <steve@miho.m17n.org>
+
+	* syntax.c (scan_words): Restore non-Mule code.
+	(word_constituent_p): Restore.
+
+1999-06-23  Olivier Galibert  <galibert@pobox.com>
+
+	* config.h.in: Add missing #undef *_USER_DEFINED.
+
+1999-06-23  SL Baur  <steve@miho.m17n.org>
+
+	* lisp.h (set_bit_vector_bit): Force promotion to unsigned long
+	int (fixes a 64-bit problem).
+
+	* chartab.c (word_boundary_p): Use EQ not == for lisp_object
+	comparison.
+
+1999-03-23  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* paths.h.in (PATH_DOC): Made doc-directory configurable.
+
+1999-06-22  Olivier Galibert  <galibert@pobox.com>
+
+	* lrecord.h: Added basic external description system.
+
+	* symbols.c: Added symbol, symbol-value-buffer-local,
+ 	symbol-value-lisp-magic and symbol-value-varalias description.
+	* mule-charset.c: Added charset description.
+	* marker.c: Added marker description.
+	* keymap.c: Added keymap description.
+	* glyphs.c: Added glyph description.
+	* floatfns.c: Added float description.
+	* file-coding.c: Added coding-system description.
+	* extents.c: Added extent description.
+	* elhash.c: Added hash-table description.
+	* data.c: Added weak-list desciption.
+	* chartab.c: Added char-table-entry and char-table description.
+	* bytecode.c: Added compiled-function description.
+	* alloc.c: Added cons, vector and string description.
+
+1999-06-22  Olivier Galibert  <galibert@pobox.com>
+
+	* lrecord.h (struct lrecord_header): Reduced size to 4 bytes.
+	Updated everything to the removal of the "flags" substructure.
+
+	* lisp.h (subr_lheader_initializer): Updated.
+	* symeval.h (symbol_value_forward_lheader_initializer): Updated.
+
+1999-06-20  MORIOKA Tomohiko  <tomo@etl.go.jp>
+
+	* syntax.c (word_constituent_p): Deleted.
+	(scan_words): Use `WORD_BOUNDARY_P'.
+
+	* chartab.c (Vword_combining_categories): New variable.
+	(Vword_separating_categories): Likewise.
+	(CATEGORYP): New macro.
+	(CATEGORY_SET): Likewise.
+	(CATEGORY_MEMBER): Likewise.
+	(word_boundary_p): New function.
+	(complex_vars_of_chartab): Set up new variable
+	`word-combining-categories' and `word-separating-categories'.
+
+1999-06-18  Olivier Galibert  <galibert@pobox.com>
+
+	* lrecord.h: Added description as a placehold in the lrecord
+ 	implementation structures.  Added the parameter to all constructor
+ 	defines.
+
+	* alloc.c: Added placeholders.
+	* buffer.c: Ditto.
+	* bytecode.c: Ditto.
+	* chartab.c: Ditto.
+	* console.c: Ditto.
+	* data.c: Ditto.
+	* database.c: Ditto.
+	* device.c: Ditto.
+	* eldap.c: Ditto.
+	* elhash.c: Ditto.
+	* eval.c: Ditto.
+	* event-stream.c: Ditto.
+	* events.c: Ditto.
+	* extents.c: Ditto.
+	* faces.c: Ditto.
+	* file-coding.c: Ditto.
+	* floatfns.c: Ditto.
+	* fns.c: Ditto.
+	* frame.c: Ditto.
+	* glyphs.c: Ditto.
+	* gui-x.c: Ditto.
+	* keymap.c: Ditto.
+	* lstream.c: Ditto.
+	* marker.c: Ditto.
+	* mule-charset.c: Ditto.
+	* objects.c: Ditto.
+	* opaque.c: Ditto.
+	* process.c: Ditto.
+	* rangetab.c: Ditto.
+	* specifier.c: Ditto.
+	* symbols.c: Ditto.
+	* toolbar.c: Ditto.
+	* tooltalk.c: Ditto.
+	* window.c: Ditto.
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
@@ -11,7 +326,7 @@
 	(HAVE_UMICH_LDAP): Removed
 	(HAVE_NS_LDAP): Removed
 
-	* eldap.h (struct Lisp_LDAP): Removed the `livep' member as  
+	* eldap.h (struct Lisp_LDAP): Removed the `livep' member as
 	suggested by Olivier Galibert
 	(CHECK_LIVE_LDAP): Test on `ld' instead of `livep'
 
@@ -29,7 +344,7 @@
 
 1999-06-16  Norbert Koch  <n.koch@eai-delta.de>
 
-	* redisplay-msw.c: Run 'ccl_driver' with 'CCL_MODE_ENCODING' as in 
+	* redisplay-msw.c: Run 'ccl_driver' with 'CCL_MODE_ENCODING' as in
 	redisplay-x.c
 
 1999-06-12  MORIOKA Tomohiko  <tomo@etl.go.jp>
@@ -307,9 +622,9 @@
  	ARG2.
 
 1999-05-21  Andy Piper  <andy@xemacs.org>
-	
+
 	* xselect.c: deleted.
-	
+
 	* symsinit.h: declare select initialisation.
 
 	* select.h: new file. declare commonly used select functions and
@@ -442,7 +757,7 @@
 	is interned in the main obarray.
 
 1999-04-23  Gunnar Evermann  <ge204@eng.cam.ac.uk>
-        
+
 	* menubar-x.c (pre_activate_callback): set accelerator field in
 	"No menu" entries to nil. Avoid crash in
 	command_builder_operate_menu_accelerator
@@ -464,13 +779,13 @@
 	* m/intel386.h: remove redundant definitions.
 
 	* s/mingw32.h: new header for mingw32.
-	
+
 	* unexnt.c: (open_input_file): function moved to nt.c.
 	(close_file_data): ditto.
 	(rva_to_section): function moved to ntproc.
 
 	* symsinit.h: declare syms_of_ntproc();
-	
+
 	* objects-msw.c (mswindows_font_instance_truename): new function.
 
 	* ntproc.c: remove many warnings.
@@ -482,7 +797,7 @@
 	(sys_spawnve): fix bad MULE/GCPRO bug in filename handling.
 
 	* ntheap.h: remove declarations of functions that are now static.
-	
+
 	* ntheap.c: support static heap.
 
 	* nt.h: conditionalise X_OK definition.
@@ -493,7 +808,7 @@
 	(_sys_read_ahead): moved to ntproc.c
 
 	* emacs.c: make sure syms_of_ntptroc gets called under windows.
-	
+
 	* console-msw.h: support mingw32.
 	* getloadavg.c: ditto.
 	* ntplay.c: ditto.
@@ -504,14 +819,14 @@
 
 	* config.h.in: dont turn on DEBUG_ENCAPSULATION by default because
  	some systems don't have all of the encapsulated system calls.
-	
+
 	* callproc.c: warning elimination.
 	* dired-msw.c: ditto.
 	* process-nt.c: ditto.
 	* realpath.c: ditto.
-	
+
 	* Makefile.in.in: tweak : and ; for building under mswindows.
-	
+
 1999-04-26  Michael Harnois  <mharnois@willinet.net>
 
 	* eldap.c (allocate_ldap): Adapt to the new semantics of
@@ -627,7 +942,7 @@
 	* symbols.c: Make gung-ho mandatory.  make_pure_pname ->
  		  make_string or make_string_nocopy.  Fix various
 	 	  alloc_lcrecord_type.
-	
+
 	* lread.c: Remove everything purespace related.
 	(Flocate_file_clear_hashing): purified -> c_readonly.
 	(locate_file): Ditto.
@@ -796,7 +1111,7 @@
 
 	* fns.c (base64_decode_1): Remove COUNTER.
 	(base64_decode_1): Accept CRLF in addition to CR.
-	(base64_decode_1): Disallow a stray character after final EOF; the 
+	(base64_decode_1): Disallow a stray character after final EOF; the
 	check was probably a remnant of buggy recode code.
 
 1998-12-05  Hrvoje Niksic  <hniksic@srce.hr>
@@ -965,8 +1280,8 @@
 	(composite_char_string):
 	(make-composite-char):
 	(composite-char-string):
-	(syms_of_mule_charset): 
-	(complex_vars_of_mule_charset): 
+	(syms_of_mule_charset):
+	(complex_vars_of_mule_charset):
 	* mule-charset.h (LEADING_BYTE_COMPOSITE):
 	(CHAR_LEADING_BYTE):
 	(MAKE_CHAR):
@@ -979,8 +1294,8 @@
 	(reset_iso2022):
 	(parse_iso2022_esc):
 	(encode_coding_iso2022):
-	#ifdef out all composite character support using 
-	#ifdef ENABLE_COMPOSITE_CHARS 
+	#ifdef out all composite character support using
+	#ifdef ENABLE_COMPOSITE_CHARS
 
 	* alloc.c: Define lrecord_coding_system only if ! FILE_CODING
 
@@ -5264,4 +5579,3 @@
 1998-05-10  Hrvoje Niksic  <hniksic@srce.hr>
 
 	* frame.c (Ffocus_frame): New function.
-
--- a/src/alloc.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/alloc.c	Mon Aug 13 11:24:09 2007 +0200
@@ -58,8 +58,6 @@
 #include "sysfile.h"
 #include "window.h"
 
-#include <stddef.h>
-
 #ifdef DOUG_LEA_MALLOC
 #include <malloc.h>
 #endif
@@ -967,6 +965,11 @@
   return 0;
 }
 
+static const struct lrecord_description cons_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Cons, car), 2 },
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("cons", cons,
 				     mark_cons, print_cons, 0,
 				     cons_equal,
@@ -976,6 +979,7 @@
 				      * handle conses.
 				      */
 				     0,
+				     cons_description,
 				     struct Lisp_Cons);
 
 DEFUN ("cons", Fcons, 2, 2, 0, /*
@@ -1166,6 +1170,11 @@
   return 1;
 }
 
+static const struct lrecord_description vector_description[] = {
+  { XD_LONG,        offsetof(struct Lisp_Vector, size) },
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Vector, contents), XD_INDIRECT(0) }
+};
+
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION("vector", vector,
 				       mark_vector, print_vector, 0,
 				       vector_equal,
@@ -1175,6 +1184,7 @@
 				        * knows how to handle vectors.
 				        */
 				       0,
+				       vector_description,
 				       size_vector, Lisp_Vector);
 
 /* #### should allocate `small' vectors from a frob-block */
@@ -1743,6 +1753,12 @@
 	  !memcmp (XSTRING_DATA (obj1), XSTRING_DATA (obj2), len));
 }
 
+static const struct lrecord_description string_description[] = {
+  { XD_STRING_DATA, offsetof(Lisp_String, data) },
+  { XD_LISP_OBJECT, offsetof(Lisp_String, plist), 1 },
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("string", string,
 				     mark_string, print_string,
 				     /*
@@ -1756,6 +1772,7 @@
 				      * SWEEP_FIXED_TYPE_BLOCK().
 				      */
 				     0, string_equal, 0,
+				     string_description,
 				     struct Lisp_String);
 
 /* String blocks contain this many useful bytes. */
@@ -2243,7 +2260,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("lcrecord-list", lcrecord_list,
 			       mark_lcrecord_list, internal_object_printer,
-			       0, 0, 0, struct lcrecord_list);
+			       0, 0, 0, 0, struct lcrecord_list);
 Lisp_Object
 make_lcrecord_list (size_t size,
 		    CONST struct lrecord_implementation *implementation)
--- a/src/buffer.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/buffer.c	Mon Aug 13 11:24:09 2007 +0200
@@ -276,7 +276,7 @@
    because all buffers have `kill-buffer' applied to them before
    they disappear, and the children removal happens then. */
 DEFINE_LRECORD_IMPLEMENTATION ("buffer", buffer,
-                               mark_buffer, print_buffer, 0, 0, 0,
+                               mark_buffer, print_buffer, 0, 0, 0, 0,
 			       struct buffer);
 
 DEFUN ("bufferp", Fbufferp, 1, 1, 0, /*
--- a/src/bytecode.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/bytecode.c	Mon Aug 13 11:24:09 2007 +0200
@@ -56,7 +56,6 @@
 #include "opaque.h"
 #include "syntax.h"
 
-#include <stddef.h>
 #include <limits.h>
 
 EXFUN (Ffetch_bytecode, 1);
@@ -2024,11 +2023,20 @@
 		internal_hash (f->constants,    depth + 1));
 }
 
+static const struct lrecord_description compiled_function_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Compiled_Function, instructions), 4 },
+#ifdef COMPILED_FUNCTION_ANNOTATION_HACK
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Compiled_Function, annotated), 1 },
+#endif
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("compiled-function", compiled_function,
 				     mark_compiled_function,
 				     print_compiled_function, 0,
 				     compiled_function_equal,
 				     compiled_function_hash,
+				     compiled_function_description,
 				     Lisp_Compiled_Function);
 
 DEFUN ("compiled-function-p", Fcompiled_function_p, 1, 1, 0, /*
--- a/src/chartab.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/chartab.c	Mon Aug 13 11:24:09 2007 +0200
@@ -2,6 +2,8 @@
    Copyright (C) 1992, 1995 Free Software Foundation, Inc.
    Copyright (C) 1995 Sun Microsystems, Inc.
    Copyright (C) 1995, 1996 Ben Wing.
+   Copyright (C) 1995, 1997, 1999 Electrotechnical Laboratory, JAPAN.
+   Licensed to the Free Software Foundation.
 
 This file is part of XEmacs.
 
@@ -50,6 +52,9 @@
 Lisp_Object Qcategory_table_value_p;
 
 Lisp_Object Vstandard_category_table;
+
+/* Variables to determine word boundary.  */
+Lisp_Object Vword_combining_categories, Vword_separating_categories;
 #endif /* MULE */
 
 
@@ -124,10 +129,16 @@
   return internal_array_hash (cte->level2, 96, depth);
 }
 
+static const struct lrecord_description char_table_entry_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table_Entry, level2), 96 },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("char-table-entry", char_table_entry,
                                mark_char_table_entry, internal_object_printer,
 			       0, char_table_entry_equal,
 			       char_table_entry_hash,
+			       char_table_entry_description,
 			       struct Lisp_Char_Table_Entry);
 #endif /* MULE */
 
@@ -415,9 +426,18 @@
   return hashval;
 }
 
+static const struct lrecord_description char_table_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, ascii), NUM_ASCII_CHARS },
+#ifdef MULE
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Char_Table, level1), NUM_LEADING_BYTES },
+#endif
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("char-table", char_table,
                                mark_char_table, print_char_table, 0,
 			       char_table_equal, char_table_hash,
+			       char_table_description,
 			       struct Lisp_Char_Table);
 
 DEFUN ("char-table-p", Fchar_table_p, 1, 1, 0, /*
@@ -1709,6 +1729,68 @@
   return CATEGORY_TABLE_VALUEP (obj) ? Qt : Qnil;
 }
 
+
+#define CATEGORYP(x) \
+  (CHARP ((x)) && XCHAR ((x)) >= 0x20 && XCHAR ((x)) <= 0x7E)
+
+#define CATEGORY_SET(c)						\
+  (get_char_table(c, XCHAR_TABLE(current_buffer->category_table)))
+
+/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
+   The faster version of `!NILP (Faref (category_set, category))'.  */
+#define CATEGORY_MEMBER(category, category_set)		 	\
+  (bit_vector_bit(XBIT_VECTOR (category_set), category - 32))
+
+/* Return 1 if there is a word boundary between two word-constituent
+   characters C1 and C2 if they appear in this order, else return 0.
+   Use the macro WORD_BOUNDARY_P instead of calling this function
+   directly.  */
+
+int
+word_boundary_p (Emchar c1, Emchar c2)
+{
+  Lisp_Object category_set1, category_set2;
+  Lisp_Object tail;
+  int default_result;
+
+#if 0
+  if (COMPOSITE_CHAR_P (c1))
+    c1 = cmpchar_component (c1, 0, 1);
+  if (COMPOSITE_CHAR_P (c2))
+    c2 = cmpchar_component (c2, 0, 1);
+#endif
+
+  if (EQ (CHAR_CHARSET (c1), CHAR_CHARSET (c2)))
+    {
+      tail = Vword_separating_categories;
+      default_result = 0;
+    }
+  else
+    {
+      tail = Vword_combining_categories;
+      default_result = 1;
+    }
+
+  category_set1 = CATEGORY_SET (c1);
+  if (NILP (category_set1))
+    return default_result;
+  category_set2 = CATEGORY_SET (c2);
+  if (NILP (category_set2))
+    return default_result;
+
+  for (; CONSP (tail); tail = XCONS (tail)->cdr)
+    {
+      Lisp_Object elt = XCONS(tail)->car;
+
+      if (CONSP (elt)
+	  && CATEGORYP (XCONS (elt)->car)
+	  && CATEGORYP (XCONS (elt)->cdr)
+	  && CATEGORY_MEMBER (XCHAR (XCONS (elt)->car), category_set1)
+	  && CATEGORY_MEMBER (XCHAR (XCONS (elt)->cdr), category_set2))
+	return !default_result;
+    }
+  return default_result;
+}
 #endif /* MULE */
 
 
@@ -1780,5 +1862,50 @@
   Vstandard_category_table = Qnil;
   Vstandard_category_table = Fcopy_category_table (Qnil);
   staticpro (&Vstandard_category_table);
+
+  DEFVAR_LISP ("word-combining-categories", &Vword_combining_categories /*
+List of pair (cons) of categories to determine word boundary.
+
+Emacs treats a sequence of word constituent characters as a single
+word (i.e. finds no word boundary between them) iff they belongs to
+the same charset.  But, exceptions are allowed in the following cases.
+
+(1) The case that characters are in different charsets is controlled
+by the variable `word-combining-categories'.
+
+Emacs finds no word boundary between characters of different charsets
+if they have categories matching some element of this list.
+
+More precisely, if an element of this list is a cons of category CAT1
+and CAT2, and a multibyte character C1 which has CAT1 is followed by
+C2 which has CAT2, there's no word boundary between C1 and C2.
+
+For instance, to tell that ASCII characters and Latin-1 characters can
+form a single word, the element `(?l . ?l)' should be in this list
+because both characters have the category `l' (Latin characters).
+
+(2) The case that character are in the same charset is controlled by
+the variable `word-separating-categories'.
+
+Emacs find a word boundary between characters of the same charset
+if they have categories matching some element of this list.
+
+More precisely, if an element of this list is a cons of category CAT1
+and CAT2, and a multibyte character C1 which has CAT1 is followed by
+C2 which has CAT2, there's a word boundary between C1 and C2.
+
+For instance, to tell that there's a word boundary between Japanese
+Hiragana and Japanese Kanji (both are in the same charset), the
+element `(?H . ?C) should be in this list.
+*/ );
+
+  Vword_combining_categories = Qnil;
+
+  DEFVAR_LISP ("word-separating-categories", &Vword_separating_categories /*
+List of pair (cons) of categories to determine word boundary.
+See the documentation of the variable `word-combining-categories'.
+*/ );
+
+  Vword_separating_categories = Qnil;
 #endif /* MULE */
 }
--- a/src/config.h.in	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/config.h.in	Mon Aug 13 11:24:09 2007 +0200
@@ -798,6 +798,11 @@
 #define MAIL_USE_LOCKF
 #endif
 
+#undef PREFIX_USER_DEFINED
+#undef EXEC_PREFIX_USER_DEFINED
+#undef MODULEDIR_USER_DEFINED
+#undef SITEMODULEDIR_USER_DEFINED
+#undef DOCDIR_USER_DEFINED
 #undef LISPDIR_USER_DEFINED
 #undef PACKAGE_PATH_USER_DEFINED
 #undef SITELISPDIR_USER_DEFINED
--- a/src/console-tty.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/console-tty.c	Mon Aug 13 11:24:09 2007 +0200
@@ -32,6 +32,7 @@
 #include "faces.h"
 #include "frame.h"
 #include "lstream.h"
+#include "glyphs.h"
 #include "sysdep.h"
 #include "sysfile.h"
 #ifdef FILE_CODING
@@ -42,6 +43,10 @@
 #endif
 
 DEFINE_CONSOLE_TYPE (tty);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit);
 
 Lisp_Object Qterminal_type;
 Lisp_Object Qcontrolling_process;
@@ -367,6 +372,15 @@
 }
 
 void
+image_instantiator_format_create_glyphs_tty (void)
+{
+  IIFORMAT_VALID_CONSOLE (tty, nothing);
+  IIFORMAT_VALID_CONSOLE (tty, string);
+  IIFORMAT_VALID_CONSOLE (tty, formatted_string);
+  IIFORMAT_VALID_CONSOLE (tty, inherit);
+}
+
+void
 vars_of_console_tty (void)
 {
   Fprovide (Qtty);
--- a/src/console.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/console.c	Mon Aug 13 11:24:09 2007 +0200
@@ -137,7 +137,7 @@
 }
 
 DEFINE_LRECORD_IMPLEMENTATION ("console", console,
-			       mark_console, print_console, 0, 0, 0,
+			       mark_console, print_console, 0, 0, 0, 0,
 			       struct console);
 
 static struct console *
--- a/src/data.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/data.c	Mon Aug 13 11:24:09 2007 +0200
@@ -1623,9 +1623,16 @@
   return result;
 }
 
+static const struct lrecord_description weak_list_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct weak_list, list), 1 },
+  { XD_LISP_OBJECT, offsetof(struct weak_list, next_weak), 1 },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("weak-list", weak_list,
 			       mark_weak_list, print_weak_list,
 			       0, weak_list_equal, weak_list_hash,
+			       weak_list_description,
 			       struct weak_list);
 /*
    -- we do not mark the list elements (either the elements themselves
--- a/src/database.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/database.c	Mon Aug 13 11:24:09 2007 +0200
@@ -195,7 +195,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("database", database,
                                mark_database, print_database,
-			       finalize_database, 0, 0,
+			       finalize_database, 0, 0, 0,
 			       Lisp_Database);
 
 DEFUN ("close-database", Fclose_database, 1, 1, 0, /*
--- a/src/device.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/device.c	Mon Aug 13 11:24:09 2007 +0200
@@ -136,7 +136,7 @@
 }
 
 DEFINE_LRECORD_IMPLEMENTATION ("device", device,
-			       mark_device, print_device, 0, 0, 0,
+			       mark_device, print_device, 0, 0, 0, 0,
 			       struct device);
 
 int
--- a/src/dialog-x.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/dialog-x.c	Mon Aug 13 11:24:09 2007 +0200
@@ -120,7 +120,7 @@
   widget_value *prev = 0, *kids = 0;
   int n = 0;
   int count = specpdl_depth ();
-  Lisp_Object wv_closure;
+  Lisp_Object wv_closure, gui_item;
 
   CHECK_CONS (desc);
   CHECK_STRING (XCAR (desc));
@@ -163,7 +163,8 @@
       CHECK_VECTOR (button);
       wv = xmalloc_widget_value ();
 
-      if (!button_item_to_widget_value (button, wv, allow_text_p, 1))
+      gui_item = gui_parse_item_keywords (button);
+      if (!button_item_to_widget_value (gui_item, wv, allow_text_p, 1))
 	{
 	  free_widget_value (wv);
 	  continue;
--- a/src/editfns.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/editfns.c	Mon Aug 13 11:24:09 2007 +0200
@@ -1040,6 +1040,8 @@
 %p is replaced by AM or PM, as appropriate.
 %r is a synonym for "%I:%M:%S %p".
 %R is a synonym for "%H:%M".
+%s is replaced by the time in seconds since 00:00:00, Jan 1, 1970 (a
+      nonstandard extension)
 %S is replaced by the second (00-60).
 %t is a synonym for "\\t".
 %T is a synonym for "%H:%M:%S".
--- a/src/eldap.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/eldap.c	Mon Aug 13 11:24:09 2007 +0200
@@ -149,7 +149,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap,
                                mark_ldap, print_ldap, finalize_ldap,
-                               NULL, NULL, struct Lisp_LDAP);
+                               NULL, NULL, 0, struct Lisp_LDAP);
 
 
 
--- a/src/elhash.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/elhash.c	Mon Aug 13 11:24:09 2007 +0200
@@ -364,11 +364,28 @@
     }
 }
 
+static const struct lrecord_description hentry_description_1[] = {
+  { XD_LISP_OBJECT, offsetof(hentry, key), 2 },
+  { XD_END }
+};
+
+static const struct struct_description hentry_description = {
+  sizeof(hentry),
+  hentry_description_1
+};
+
+static const struct lrecord_description hash_table_description[] = {
+  { XD_SIZE_T,     offsetof(Lisp_Hash_Table, size) },
+  { XD_STRUCT_PTR, offsetof(Lisp_Hash_Table, hentries), XD_INDIRECT(0), &hentry_description },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("hash-table", hash_table,
                                mark_hash_table, print_hash_table,
 			       finalize_hash_table,
 			       /* #### Implement hash_table_hash()! */
 			       hash_table_equal, 0,
+			       hash_table_description,
 			       Lisp_Hash_Table);
 
 static Lisp_Hash_Table *
--- a/src/emacs.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/emacs.c	Mon Aug 13 11:24:09 2007 +0200
@@ -1200,6 +1200,9 @@
       image_instantiator_format_create ();
       image_instantiator_format_create_glyphs_eimage ();
       image_instantiator_format_create_glyphs_widget ();
+#ifdef HAVE_TTY
+      image_instantiator_format_create_glyphs_tty ();
+#endif
 #ifdef HAVE_X_WINDOWS
       image_instantiator_format_create_glyphs_x ();
 #endif /* HAVE_X_WINDOWS */
--- a/src/eval.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/eval.c	Mon Aug 13 11:24:09 2007 +0200
@@ -296,7 +296,7 @@
 }
 
 DEFINE_LRECORD_IMPLEMENTATION ("subr", subr,
-                               this_one_is_unmarkable, print_subr, 0, 0, 0,
+                               this_one_is_unmarkable, print_subr, 0, 0, 0, 0,
 			       Lisp_Subr);
 
 /************************************************************************/
--- a/src/event-Xt.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/event-Xt.c	Mon Aug 13 11:24:09 2007 +0200
@@ -78,6 +78,7 @@
 #include "events-mod.h"
 
 static void enqueue_Xt_dispatch_event (Lisp_Object event);
+static void handle_focus_event_1 (struct frame *f, int in_p);
 
 static struct event_stream *Xt_event_stream;
 
@@ -807,7 +808,8 @@
   len = XmImMbLookupString (XtWindowToWidget (event->display, event->window),
 			    event, bufptr, bufsiz, &keysym, &status);
 #else /* XIM_XLIB */
-  len = XmbLookupString (xic, event, bufptr, bufsiz, &keysym, &status);
+  if (xic)
+    len = XmbLookupString (xic, event, bufptr, bufsiz, &keysym, &status);
 #endif /* HAVE_XIM */
 
 #ifdef DEBUG_XEMACS
@@ -1046,6 +1048,7 @@
 	  {
 	    XButtonEvent *ev = &x_event->xbutton;
 	    struct frame *frame = x_window_to_frame (d, ev->window);
+
 	    if (! frame)
 	      return 0;	/* not for us */
 	    XSETFRAME (emacs_event->channel, frame);
@@ -1058,7 +1061,11 @@
 	    emacs_event->event.button.button	= ev->button;
 	    emacs_event->event.button.x		= ev->x;
 	    emacs_event->event.button.y		= ev->y;
-
+	    /* because we don't seem to get a FocusIn event for button clicks
+	       when a widget-glyph is selected we will assume that we want the
+	       focus if a button gets pressed. */
+	    if (x_event->type == ButtonPress)
+	      handle_focus_event_1 (frame, 1);
 	  }
       }
     break;
@@ -1304,8 +1311,12 @@
 static void
 handle_focus_event_1 (struct frame *f, int in_p)
 {
-#ifdef HAVE_XIM
-  XIM_focus_event (f, in_p);
+#if XtSpecificationRelease > 5
+  Widget focus_widget = XtGetKeyboardFocusWidget (FRAME_X_TEXT_WIDGET (f));
+#endif
+#if defined(HAVE_XIM) && defined(XIM_XLIB)
+  if (FRAME_X_XIC(f))
+    XIM_focus_event (f, in_p);
 #endif /* HAVE_XIM */
 
   /* On focus change, clear all memory of sticky modifiers
@@ -1319,7 +1330,26 @@
      Actually, we half handle it: we handle it as far as changing the
      box cursor for redisplay, but we don't call any hooks or do any
      select-frame stuff until after the sit-for.
-   */
+
+     Unfortunately native widgets break the model because they grab
+     the keyboard focus and nothing sets it back again. I cannot find
+     any reasonable way to do this elsewhere so we assert here that
+     the keybpard focus is on the emacs text widget. Menus and dialogs
+     do this in their selection callback, but we don't want that since
+     a button having focus is legitimate. An edit field having focus
+     is mandatory. Weirdly you get a FocusOut event when you glick in
+     a widget-glyph but you don't get a correspondng FocusIn when you
+     click in the frame. Why is this?  */
+  if (in_p 
+#if XtSpecificationRelease > 5      
+      && FRAME_X_TEXT_WIDGET (f) != focus_widget
+#endif
+      )
+    {
+      lw_set_keyboard_focus (FRAME_X_SHELL_WIDGET (f),
+			     FRAME_X_TEXT_WIDGET (f));
+    }
+  /* do the generic event-stream stuff. */
   {
     Lisp_Object frm;
     Lisp_Object conser;
@@ -1404,7 +1434,7 @@
 
       /* Bleagh!!!!!!  Apparently some window managers (e.g. MWM)
 	 send synthetic MapNotify events when a window is first
-	 created, EVENT IF IT'S CREATED ICONIFIED OR INVISIBLE.
+	 created, EVEN IF IT'S CREATED ICONIFIED OR INVISIBLE.
 	 Or something like that.  We initially tried a different
 	 solution below, but that ran into a different window-
 	 manager bug.
@@ -1579,6 +1609,7 @@
 
     case FocusIn:
     case FocusOut:
+
 #ifdef EXTERNAL_WIDGET
       /* External widget lossage: Ben said:
 	 YUCK.  The only way to make focus changes work properly is to
@@ -1613,8 +1644,9 @@
       break;
 
     case ConfigureNotify:
-#ifdef HAVE_XIM
-      XIM_SetGeometry (f);
+#if defined(HAVE_XIM) && defined(XIM_XLIB)
+      if (FRAME_X_XIC(f))
+	XIM_SetGeometry (f);
 #endif
       break;
 
--- a/src/event-msw.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/event-msw.c	Mon Aug 13 11:24:09 2007 +0200
@@ -72,6 +72,10 @@
 #include <io.h>
 #include <errno.h>
 
+#if defined (__CYGWIN32__) && !defined (CYGWIN_VERSION_DLL_MAJOR)
+typedef NMHDR *LPNMHDR;
+#endif
+
 #ifdef HAVE_MENUBARS
 #define ADJR_MENUFLAG TRUE
 #else
@@ -1929,7 +1933,6 @@
   case WM_NOTIFY:
     {
       LPNMHDR nmhdr = (LPNMHDR)lParam;
-      int idCtrl = (int)wParam;
 
       if (nmhdr->code ==  TTN_NEEDTEXT)
 	{
--- a/src/event-stream.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/event-stream.c	Mon Aug 13 11:24:09 2007 +0200
@@ -413,7 +413,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("command-builder", command_builder,
                                mark_command_builder, internal_object_printer,
-			       finalize_command_builder, 0, 0,
+			       finalize_command_builder, 0, 0, 0,
 			       struct command_builder);
 
 static void
--- a/src/events.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/events.c	Mon Aug 13 11:24:09 2007 +0200
@@ -375,7 +375,7 @@
 
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("event", event,
 				     mark_event, print_event, 0, event_equal,
-				     event_hash, struct Lisp_Event);
+				     event_hash, 0, struct Lisp_Event);
 
 
 DEFUN ("make-event", Fmake_event, 0, 2, 0, /*
--- a/src/extents.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/extents.c	Mon Aug 13 11:24:09 2007 +0200
@@ -927,7 +927,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("extent-auxiliary", extent_auxiliary,
                                mark_extent_auxiliary, internal_object_printer,
-			       0, 0, 0, struct extent_auxiliary);
+			       0, 0, 0, 0, struct extent_auxiliary);
 
 void
 allocate_extent_auxiliary (EXTENT ext)
@@ -1025,7 +1025,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("extent-info", extent_info,
                                mark_extent_info, internal_object_printer,
-			       finalize_extent_info, 0, 0,
+			       finalize_extent_info, 0, 0, 0,
 			       struct extent_info);
 
 static Lisp_Object
@@ -2924,6 +2924,12 @@
 static int extent_remprop (Lisp_Object obj, Lisp_Object prop);
 static Lisp_Object extent_plist (Lisp_Object obj);
 
+static const struct lrecord_description extent_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct extent, object), 2 },
+  { XD_LISP_OBJECT, offsetof(struct extent, plist), 1 },
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION_WITH_PROPS ("extent", extent,
 						mark_extent,
 						print_extent,
@@ -2933,6 +2939,7 @@
 						   Shaft city. */
 						0,
 						extent_equal, extent_hash,
+						extent_description,
 						extent_getprop, extent_putprop,
 						extent_remprop, extent_plist,
 						struct extent);
--- a/src/faces.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/faces.c	Mon Aug 13 11:24:09 2007 +0200
@@ -266,7 +266,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("face", face,
 					  mark_face, print_face, 0, face_equal,
-					  face_hash, face_getprop,
+					  face_hash, 0, face_getprop,
 					  face_putprop, face_remprop,
 					  face_plist, struct Lisp_Face);
 
--- a/src/file-coding.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/file-coding.c	Mon Aug 13 11:24:09 2007 +0200
@@ -25,6 +25,7 @@
 
 #include <config.h>
 #include "lisp.h"
+
 #include "buffer.h"
 #include "elhash.h"
 #include "insdel.h"
@@ -244,10 +245,46 @@
 static void print_coding_system (Lisp_Object, Lisp_Object, int);
 static void finalize_coding_system (void *header, int for_disksave);
 
+#ifdef MULE
+static const struct lrecord_description ccs_description_1[] = {
+  { XD_LISP_OBJECT, offsetof(charset_conversion_spec, from_charset), 2 },
+  { XD_END }
+};
+
+static const struct struct_description ccs_description = {
+  sizeof(charset_conversion_spec),
+  ccs_description_1
+};
+  
+static const struct lrecord_description ccsd_description_1[] = {
+  XD_DYNARR_DESC(charset_conversion_spec_dynarr, &ccs_description),
+  { XD_END }
+};
+
+static const struct struct_description ccsd_description = {
+  sizeof(charset_conversion_spec_dynarr),
+  ccsd_description_1
+};
+#endif
+
+static const struct lrecord_description coding_system_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Coding_System, name), 2 },
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Coding_System, mnemonic), 3 },
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Coding_System, eol_lf), 3 },
+#ifdef MULE
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Coding_System, iso2022.initial_charset), 4 },
+  { XD_STRUCT_PTR,  offsetof(struct Lisp_Coding_System, iso2022.input_conv),  1, &ccsd_description },
+  { XD_STRUCT_PTR,  offsetof(struct Lisp_Coding_System, iso2022.output_conv), 1, &ccsd_description },
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Coding_System, ccl.decode), 2 },
+#endif
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("coding-system", coding_system,
 			       mark_coding_system, print_coding_system,
 			       finalize_coding_system,
-			       0, 0, struct Lisp_Coding_System);
+			       0, 0, coding_system_description,
+			       struct Lisp_Coding_System);
 
 static Lisp_Object
 mark_coding_system (Lisp_Object obj, void (*markobj) (Lisp_Object))
--- a/src/floatfns.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/floatfns.c	Mon Aug 13 11:24:09 2007 +0200
@@ -179,9 +179,14 @@
   return (unsigned long) fmod (extract_float (obj), 4e9);
 }
 
+static const struct lrecord_description float_description[] = {
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("float", float,
 				     mark_float, print_float, 0, float_equal,
-				     float_hash, struct Lisp_Float);
+				     float_hash, float_description,
+				     struct Lisp_Float);
 
 /* Extract a Lisp number as a `double', or signal an error.  */
 
--- a/src/fns.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/fns.c	Mon Aug 13 11:24:09 2007 +0200
@@ -113,7 +113,7 @@
 
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("bit-vector", bit_vector,
 				     mark_bit_vector, print_bit_vector, 0,
-				     bit_vector_equal, bit_vector_hash,
+				     bit_vector_equal, bit_vector_hash, 0,
 				     struct Lisp_Bit_Vector);
 
 DEFUN ("identity", Fidentity, 1, 1, 0, /*
--- a/src/frame.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/frame.c	Mon Aug 13 11:24:09 2007 +0200
@@ -155,7 +155,7 @@
 }
 
 DEFINE_LRECORD_IMPLEMENTATION ("frame", frame,
-                               mark_frame, print_frame, 0, 0, 0,
+                               mark_frame, print_frame, 0, 0, 0, 0,
 			       struct frame);
 
 static void
--- a/src/glyphs-msw.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs-msw.c	Mon Aug 13 11:24:09 2007 +0200
@@ -1,5 +1,5 @@
 /* mswindows-specific glyph objects.
-   Copyright (C) 1998 Andy Piper.
+   Copyright (C) 1998, 99 Andy Piper.
    
 This file is part of XEmacs.
 
@@ -53,6 +53,22 @@
 
 #define WIDGET_GLYPH_SLOT 0
 
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit);
+#ifdef HAVE_JPEG
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg);
+#endif
+#ifdef HAVE_TIFF
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff);
+#endif  
+#ifdef HAVE_PNG
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (png);
+#endif  
+#ifdef HAVE_GIF
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (gif);
+#endif  
 #ifdef HAVE_XPM
 DEFINE_DEVICE_IIFORMAT (mswindows, xpm);
 #endif
@@ -61,7 +77,7 @@
 DEFINE_DEVICE_IIFORMAT (mswindows, xface);
 #endif
 DEFINE_DEVICE_IIFORMAT (mswindows, button);
-DEFINE_DEVICE_IIFORMAT (mswindows, edit);
+DEFINE_DEVICE_IIFORMAT (mswindows, edit_field);
 #if 0
 DEFINE_DEVICE_IIFORMAT (mswindows, group);
 #endif
@@ -69,10 +85,10 @@
 DEFINE_DEVICE_IIFORMAT (mswindows, widget);
 DEFINE_DEVICE_IIFORMAT (mswindows, label);
 DEFINE_DEVICE_IIFORMAT (mswindows, scrollbar);
-DEFINE_DEVICE_IIFORMAT (mswindows, combo);
-DEFINE_DEVICE_IIFORMAT (mswindows, progress);
-DEFINE_DEVICE_IIFORMAT (mswindows, tree);
-DEFINE_DEVICE_IIFORMAT (mswindows, tab);
+DEFINE_DEVICE_IIFORMAT (mswindows, combo_box);
+DEFINE_DEVICE_IIFORMAT (mswindows, progress_gauge);
+DEFINE_DEVICE_IIFORMAT (mswindows, tree_view);
+DEFINE_DEVICE_IIFORMAT (mswindows, tab_control);
 
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (bmp);
 Lisp_Object Qbmp;
@@ -2319,7 +2335,7 @@
 
 /* instantiate an edit control */
 static void
-mswindows_edit_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 			    Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 			    int dest_mask, Lisp_Object domain)
 {
@@ -2332,7 +2348,7 @@
 
 /* instantiate a progress gauge */
 static void
-mswindows_progress_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_progress_gauge_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 				Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 				int dest_mask, Lisp_Object domain)
 {
@@ -2431,7 +2447,7 @@
 }
 
 static void
-mswindows_tree_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_tree_view_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 			    Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 			    int dest_mask, Lisp_Object domain)
 {
@@ -2509,13 +2525,12 @@
 }
 
 static void
-mswindows_tab_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_tab_control_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 			   Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 			   int dest_mask, Lisp_Object domain)
 {
   Lisp_Object rest;
   HWND wnd;
-  HTREEITEM parent;
   int index = 0;
   struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
   mswindows_widget_instantiate (image_instance, instantiator, pointer_fg,
@@ -2573,7 +2588,7 @@
 
 /* instantiate a combo control */
 static void
-mswindows_combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+mswindows_combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 			     Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 			     int dest_mask, Lisp_Object domain)
 {
@@ -2646,7 +2661,7 @@
 
 /* get properties of a combo box */
 static Lisp_Object
-mswindows_combo_property (Lisp_Object image_instance, Lisp_Object prop)
+mswindows_combo_box_property (Lisp_Object image_instance, Lisp_Object prop)
 {
   struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
   HANDLE wnd = WIDGET_INSTANCE_MSWINDOWS_HANDLE (ii);
@@ -2683,7 +2698,7 @@
 
 /* set the properties of a progres guage */
 static Lisp_Object
-mswindows_progress_set_property (Lisp_Object image_instance, Lisp_Object prop,
+mswindows_progress_gauge_set_property (Lisp_Object image_instance, Lisp_Object prop,
 				 Lisp_Object val)
 {
   struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
@@ -2729,6 +2744,10 @@
 void
 image_instantiator_format_create_glyphs_mswindows (void)
 {
+  IIFORMAT_VALID_CONSOLE (mswindows, nothing);
+  IIFORMAT_VALID_CONSOLE (mswindows, string);
+  IIFORMAT_VALID_CONSOLE (mswindows, formatted_string);
+  IIFORMAT_VALID_CONSOLE (mswindows, inherit);
   /* image-instantiator types */
 #ifdef HAVE_XPM
   INITIALIZE_DEVICE_IIFORMAT (mswindows, xpm);
@@ -2740,13 +2759,25 @@
   INITIALIZE_DEVICE_IIFORMAT (mswindows, xface);
   IIFORMAT_HAS_DEVMETHOD (mswindows, xface, instantiate);
 #endif
+#ifdef HAVE_JPEG
+  IIFORMAT_VALID_CONSOLE (mswindows, jpeg);
+#endif
+#ifdef HAVE_TIFF
+  IIFORMAT_VALID_CONSOLE (mswindows, tiff);
+#endif  
+#ifdef HAVE_PNG
+  IIFORMAT_VALID_CONSOLE (mswindows, png);
+#endif  
+#ifdef HAVE_GIF
+  IIFORMAT_VALID_CONSOLE (mswindows, gif);
+#endif  
   /* button widget */
   INITIALIZE_DEVICE_IIFORMAT (mswindows, button);
   IIFORMAT_HAS_DEVMETHOD (mswindows, button, property);
   IIFORMAT_HAS_DEVMETHOD (mswindows, button, instantiate);
 
-  INITIALIZE_DEVICE_IIFORMAT (mswindows, edit);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, edit, instantiate);
+  INITIALIZE_DEVICE_IIFORMAT (mswindows, edit_field);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, edit_field, instantiate);
   
   INITIALIZE_DEVICE_IIFORMAT (mswindows, subwindow);
   IIFORMAT_HAS_DEVMETHOD (mswindows, subwindow, instantiate);
@@ -2763,27 +2794,27 @@
   IIFORMAT_HAS_DEVMETHOD (mswindows, label, instantiate);
 
   /* combo box */
-  INITIALIZE_DEVICE_IIFORMAT (mswindows, combo);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, combo, property);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, combo, instantiate);
+  INITIALIZE_DEVICE_IIFORMAT (mswindows, combo_box);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, property);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, combo_box, instantiate);
 
   /* scrollbar */
   INITIALIZE_DEVICE_IIFORMAT (mswindows, scrollbar);
   IIFORMAT_HAS_DEVMETHOD (mswindows, scrollbar, instantiate);
 
   /* progress gauge */
-  INITIALIZE_DEVICE_IIFORMAT (mswindows, progress);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, progress, instantiate);
+  INITIALIZE_DEVICE_IIFORMAT (mswindows, progress_gauge);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, set_property);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, progress_gauge, instantiate);
 
   /* tree view widget */
-  INITIALIZE_DEVICE_IIFORMAT (mswindows, tree);
+  INITIALIZE_DEVICE_IIFORMAT (mswindows, tree_view);
   /*  IIFORMAT_HAS_DEVMETHOD (mswindows, progress, set_property);*/
-  IIFORMAT_HAS_DEVMETHOD (mswindows, tree, instantiate);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, tree_view, instantiate);
 
   /* tab control widget */
-  INITIALIZE_DEVICE_IIFORMAT (mswindows, tab);
-  IIFORMAT_HAS_DEVMETHOD (mswindows, tab, instantiate);
+  INITIALIZE_DEVICE_IIFORMAT (mswindows, tab_control);
+  IIFORMAT_HAS_DEVMETHOD (mswindows, tab_control, instantiate);
 
   /* windows bitmap format */
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (bmp, "bmp");
@@ -2794,6 +2825,7 @@
 
   IIFORMAT_VALID_KEYWORD (bmp, Q_data, check_valid_string);
   IIFORMAT_VALID_KEYWORD (bmp, Q_file, check_valid_string);
+  IIFORMAT_VALID_CONSOLE (mswindows, bmp);
 
   /* mswindows resources */
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (mswindows_resource,
@@ -2808,27 +2840,17 @@
 			  check_valid_resource_symbol);
   IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_resource_id, check_valid_resource_id);
   IIFORMAT_VALID_KEYWORD (mswindows_resource, Q_file, check_valid_string);
+  IIFORMAT_VALID_CONSOLE (mswindows, mswindows_resource);
 }
 
 void
 vars_of_glyphs_mswindows (void)
 {
-  Fprovide (Qbmp);
-  Fprovide (Qmswindows_resource);
   DEFVAR_LISP ("mswindows-bitmap-file-path", &Vmswindows_bitmap_file_path /*
 A list of the directories in which mswindows bitmap files may be found.
 This is used by the `make-image-instance' function.
 */ );
   Vmswindows_bitmap_file_path = Qnil;
-
-  Fprovide (Qbutton);
-  Fprovide (Qedit);
-  Fprovide (Qcombo);
-  Fprovide (Qscrollbar);
-  Fprovide (Qlabel);
-  Fprovide (Qprogress);
-  Fprovide (Qtree);
-  Fprovide (Qtab);
 }
 
 void
--- a/src/glyphs-widget.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs-widget.c	Mon Aug 13 11:24:09 2007 +0200
@@ -38,10 +38,10 @@
 #include "opaque.h"
 
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (button);
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo);
-Lisp_Object Qcombo;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit);
-Lisp_Object Qedit;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (combo_box);
+Lisp_Object Qcombo_box;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (edit_field);
+Lisp_Object Qedit_field;
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (scrollbar);
 Lisp_Object Qscrollbar;
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (widget);
@@ -51,12 +51,12 @@
 #endif
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (label);
 Lisp_Object Qlabel;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress);
-Lisp_Object Qprogress;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree);
-Lisp_Object Qtree;
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab);
-Lisp_Object Qtab;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge);
+Lisp_Object Qprogress_gauge;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (tree_view);
+Lisp_Object Qtree_view;
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (tab_control);
+Lisp_Object Qtab_control;
 
 Lisp_Object Q_descriptor, Q_height, Q_width, Q_properties, Q_items;
 Lisp_Object Q_image, Q_text, Q_percent;
@@ -187,7 +187,7 @@
  the instances. This is encoded in the widget type
  field. widget_property gets invoked by decoding the primary type
  (Qwidget), widget property then invokes based on the secondary type
- (Qedit for example). It is debatable that we should wire things in this
+ (Qedit_field for example). It is debatable that we should wire things in this
  generalised way rather than treating widgets specially in
  image_instance_property. */
 static Lisp_Object 
@@ -270,7 +270,7 @@
 }
 
 static void
-combo_validate (Lisp_Object instantiator)
+combo_box_validate (Lisp_Object instantiator)
 {
   widget_validate (instantiator);
   if (NILP (find_keyword_in_vector (instantiator, Q_properties)))
@@ -434,7 +434,7 @@
 
 /* combo-box generic instantiation - get he heigh right */
 static void
-combo_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 		   Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 		   int dest_mask, Lisp_Object domain)
 {
@@ -447,7 +447,7 @@
 }
 
 static void
-tab_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+tab_control_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
 		 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
 		 int dest_mask, Lisp_Object domain)
 {
@@ -541,25 +541,25 @@
   VALID_GUI_KEYWORDS (button);
 
   /* edit fields */
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit, "edit");
-  IIFORMAT_HAS_SHARED_METHOD (edit, validate, widget);
-  IIFORMAT_HAS_SHARED_METHOD (edit, possible_dest_types, widget);
-  IIFORMAT_HAS_SHARED_METHOD (edit, instantiate, widget);
-  VALID_WIDGET_KEYWORDS (edit);
-  VALID_GUI_KEYWORDS (edit);
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (edit_field, "edit-field");
+  IIFORMAT_HAS_SHARED_METHOD (edit_field, validate, widget);
+  IIFORMAT_HAS_SHARED_METHOD (edit_field, possible_dest_types, widget);
+  IIFORMAT_HAS_SHARED_METHOD (edit_field, instantiate, widget);
+  VALID_WIDGET_KEYWORDS (edit_field);
+  VALID_GUI_KEYWORDS (edit_field);
 
   /* combo box */
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo, "combo");
-  IIFORMAT_HAS_METHOD (combo, validate);
-  IIFORMAT_HAS_SHARED_METHOD (combo, possible_dest_types, widget);
-  IIFORMAT_HAS_METHOD (combo, instantiate);
-  VALID_GUI_KEYWORDS (combo);
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (combo_box, "combo-box");
+  IIFORMAT_HAS_METHOD (combo_box, validate);
+  IIFORMAT_HAS_SHARED_METHOD (combo_box, possible_dest_types, widget);
+  IIFORMAT_HAS_METHOD (combo_box, instantiate);
+  VALID_GUI_KEYWORDS (combo_box);
 
-  IIFORMAT_VALID_KEYWORD (combo, Q_width, check_valid_int);
-  IIFORMAT_VALID_KEYWORD (combo, Q_height, check_valid_int);
-  IIFORMAT_VALID_KEYWORD (combo, Q_pixel_width, check_valid_int);
-  IIFORMAT_VALID_KEYWORD (combo, Q_face, check_valid_face);
-  IIFORMAT_VALID_KEYWORD (combo, Q_properties, check_valid_item_list);
+  IIFORMAT_VALID_KEYWORD (combo_box, Q_width, check_valid_int);
+  IIFORMAT_VALID_KEYWORD (combo_box, Q_height, check_valid_int);
+  IIFORMAT_VALID_KEYWORD (combo_box, Q_pixel_width, check_valid_int);
+  IIFORMAT_VALID_KEYWORD (combo_box, Q_face, check_valid_face);
+  IIFORMAT_VALID_KEYWORD (combo_box, Q_properties, check_valid_item_list);
 
   /* scrollbar */
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (scrollbar, "scrollbar");
@@ -573,30 +573,30 @@
   IIFORMAT_VALID_KEYWORD (scrollbar, Q_face, check_valid_face);
 
   /* progress guage */
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress, "progress");
-  IIFORMAT_HAS_SHARED_METHOD (progress, validate, widget);
-  IIFORMAT_HAS_SHARED_METHOD (progress, possible_dest_types, widget);
-  IIFORMAT_HAS_SHARED_METHOD (progress, instantiate, combo);
-  VALID_WIDGET_KEYWORDS (progress);
-  VALID_GUI_KEYWORDS (progress);
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (progress_gauge, "progress-gauge");
+  IIFORMAT_HAS_SHARED_METHOD (progress_gauge, validate, widget);
+  IIFORMAT_HAS_SHARED_METHOD (progress_gauge, possible_dest_types, widget);
+  IIFORMAT_HAS_SHARED_METHOD (progress_gauge, instantiate, combo_box);
+  VALID_WIDGET_KEYWORDS (progress_gauge);
+  VALID_GUI_KEYWORDS (progress_gauge);
 
   /* tree view */
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree, "tree");
-  IIFORMAT_HAS_SHARED_METHOD (tree, validate, combo);
-  IIFORMAT_HAS_SHARED_METHOD (tree, possible_dest_types, widget);
-  IIFORMAT_HAS_SHARED_METHOD (tree, instantiate, combo);
-  VALID_WIDGET_KEYWORDS (tree);
-  VALID_GUI_KEYWORDS (tree);
-  IIFORMAT_VALID_KEYWORD (tree, Q_properties, check_valid_item_list);
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tree_view, "tree-view");
+  IIFORMAT_HAS_SHARED_METHOD (tree_view, validate, combo_box);
+  IIFORMAT_HAS_SHARED_METHOD (tree_view, possible_dest_types, widget);
+  IIFORMAT_HAS_SHARED_METHOD (tree_view, instantiate, combo_box);
+  VALID_WIDGET_KEYWORDS (tree_view);
+  VALID_GUI_KEYWORDS (tree_view);
+  IIFORMAT_VALID_KEYWORD (tree_view, Q_properties, check_valid_item_list);
 
   /* tab control */
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab, "tab");
-  IIFORMAT_HAS_SHARED_METHOD (tab, validate, combo);
-  IIFORMAT_HAS_SHARED_METHOD (tab, possible_dest_types, widget);
-  IIFORMAT_HAS_METHOD (tab, instantiate);
-  VALID_WIDGET_KEYWORDS (tab);
-  VALID_GUI_KEYWORDS (tab);
-  IIFORMAT_VALID_KEYWORD (tab, Q_properties, check_valid_item_list);
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (tab_control, "tab-control");
+  IIFORMAT_HAS_SHARED_METHOD (tab_control, validate, combo_box);
+  IIFORMAT_HAS_SHARED_METHOD (tab_control, possible_dest_types, widget);
+  IIFORMAT_HAS_METHOD (tab_control, instantiate);
+  VALID_WIDGET_KEYWORDS (tab_control);
+  VALID_GUI_KEYWORDS (tab_control);
+  IIFORMAT_VALID_KEYWORD (tab_control, Q_properties, check_valid_item_list);
 
   /* labels */
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (label, "label");
--- a/src/glyphs-x.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 11:24:09 2007 +0200
@@ -4,6 +4,7 @@
    Copyright (C) 1995 Tinker Systems
    Copyright (C) 1995, 1996 Ben Wing
    Copyright (C) 1995 Sun Microsystems
+   Copyright (C) 1999 Andy Piper
 
 This file is part of XEmacs.
 
@@ -51,6 +52,7 @@
 #include "console-x.h"
 #include "glyphs-x.h"
 #include "objects-x.h"
+#include "gui-x.h"
 #include "xmu.h"
 
 #include "buffer.h"
@@ -58,6 +60,8 @@
 #include "frame.h"
 #include "insdel.h"
 #include "opaque.h"
+#include "gui.h"
+#include "faces.h"
 
 #include "imgproc.h"
 
@@ -69,6 +73,11 @@
 #include "file-coding.h"
 #endif
 
+#ifdef LWLIB_USES_MOTIF
+#include <Xm/Xm.h>
+#endif
+#include <X11/IntrinsicP.h>
+
 #if INTBITS == 32
 # define FOUR_BYTE_TYPE unsigned int
 #elif LONGBITS == 32
@@ -81,6 +90,22 @@
 
 #define LISP_DEVICE_TO_X_SCREEN(dev) XDefaultScreenOfDisplay (DEVICE_X_DISPLAY (XDEVICE (dev)))
 
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit);
+#ifdef HAVE_JPEG
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (jpeg);
+#endif
+#ifdef HAVE_TIFF
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (tiff);
+#endif  
+#ifdef HAVE_PNG
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (png);
+#endif  
+#ifdef HAVE_GIF
+DECLARE_IMAGE_INSTANTIATOR_FORMAT (gif);
+#endif  
 #ifdef HAVE_XPM
 DEFINE_DEVICE_IIFORMAT (x, xpm);
 #endif
@@ -97,6 +122,12 @@
 
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (autodetect);
 
+DEFINE_DEVICE_IIFORMAT (x, widget);
+DEFINE_DEVICE_IIFORMAT (x, button);
+DEFINE_DEVICE_IIFORMAT (x, progress_gauge);
+DEFINE_DEVICE_IIFORMAT (x, edit_field);
+DEFINE_DEVICE_IIFORMAT (x, combo_box);
+
 static void cursor_font_instantiate (Lisp_Object image_instance,
 				     Lisp_Object instantiator,
 				     Lisp_Object pointer_fg,
@@ -336,9 +367,16 @@
     {
       Display *dpy = DEVICE_X_DISPLAY (XDEVICE (p->device));
 
-      if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET
-	  || 
-	  IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+      if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET)
+	{
+	  if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
+	    {
+	      XtUnmanageChild (IMAGE_INSTANCE_X_WIDGET_ID (p));
+	      XtDestroyWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+	      IMAGE_INSTANCE_SUBWINDOW_ID (p) = 0;
+	    }
+	}
+      else if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
 	{
 	  if (IMAGE_INSTANCE_SUBWINDOW_ID (p))
 	    XDestroyWindow (dpy, IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
@@ -1967,8 +2005,16 @@
 static void
 x_unmap_subwindow (struct Lisp_Image_Instance *p)
 {
-  XUnmapWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
-		IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
+  if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+    {
+      XUnmapWindow 
+	(DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)), 
+	 IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
+    }
+  else				/* must be a widget */
+    {
+      XtUnmapWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+    }
 }
 
 /* map the subwindow. This is used by redisplay via
@@ -1976,10 +2022,35 @@
 static void
 x_map_subwindow (struct Lisp_Image_Instance *p, int x, int y)
 {
-  XMapWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
-	      IMAGE_INSTANCE_X_SUBWINDOW_ID (p));
-  XMoveWindow (DisplayOfScreen (IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p)),
-	       IMAGE_INSTANCE_X_SUBWINDOW_ID (p), x, y);
+  if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW)
+    {
+      Window subwindow = IMAGE_INSTANCE_X_SUBWINDOW_ID (p);
+      Screen* screen = IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (p);
+      XMapWindow (DisplayOfScreen (screen), subwindow);
+      XMoveWindow (DisplayOfScreen (screen), subwindow, x, y);
+    }
+  else				/* must be a widget */
+    {
+      XtMoveWidget (IMAGE_INSTANCE_X_WIDGET_ID (p), 
+		    x + IMAGE_INSTANCE_X_WIDGET_XOFFSET (p),
+		    y + IMAGE_INSTANCE_X_WIDGET_YOFFSET (p));
+      XtMapWidget (IMAGE_INSTANCE_X_WIDGET_ID (p));
+    }
+}
+
+/* when you click on a widget you may activate another widget this
+   needs to be checked and all appropriate widgets updated */
+static void
+x_update_subwindow (struct Lisp_Image_Instance *p)
+{
+  if (IMAGE_INSTANCE_TYPE (p) == IMAGE_WIDGET)
+    {
+      widget_value* wv = xmalloc_widget_value ();
+      button_item_to_widget_value (IMAGE_INSTANCE_WIDGET_SINGLE_ITEM (p),
+				   wv, 1, 1);
+      lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p), 
+			     wv, 1);
+    }
 }
 
 /* instantiate and x type subwindow */
@@ -2007,11 +2078,7 @@
   dpy = DEVICE_X_DISPLAY (XDEVICE (device));
   xs = DefaultScreenOfDisplay (dpy);
 
-  if (dest_mask & IMAGE_SUBWINDOW_MASK)
-    IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW;
-  else
-    incompatible_image_types (instantiator, dest_mask,
-			      IMAGE_SUBWINDOW_MASK);
+  IMAGE_INSTANCE_TYPE (ii) = IMAGE_SUBWINDOW;
 
   pw = XtWindow (FRAME_X_TEXT_WIDGET (f));
 
@@ -2070,6 +2137,263 @@
 		 w, h);
 }
 
+/************************************************************************/
+/*                            widgets                            */
+/************************************************************************/
+
+static void
+x_widget_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+		      Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+		      int dest_mask, Lisp_Object domain,
+		      CONST char* type, widget_value* wv)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii), pixel;
+  struct device* d = XDEVICE (device);
+  Lisp_Object frame = FW_FRAME (domain);
+  struct frame* f = XFRAME (frame);
+  XColor fcolor, bcolor;
+  Extbyte* nm=0;
+  Widget wid;
+  Arg al [32];
+  int ac = 0;
+  int id = new_lwlib_id ();
+
+  if (!DEVICE_X_P (d))
+    signal_simple_error ("Not an mswindows device", device);
+
+  /* have to set the type this late in case there is no device
+     instantiation for a widget. But we can go ahead and do it without
+     checking because there is always a generic instantiator. */
+  IMAGE_INSTANCE_TYPE (ii) = IMAGE_WIDGET;
+
+  if (!NILP (IMAGE_INSTANCE_WIDGET_TEXT (ii)))
+    GET_C_STRING_OS_DATA_ALLOCA (IMAGE_INSTANCE_WIDGET_TEXT (ii), nm);
+
+  ii->data = xnew_and_zero (struct x_subwindow_data);
+
+  /* copy any args we were given */
+  if (wv->nargs)
+    lw_add_value_args_to_args (wv, al, &ac);
+
+  /* add our own arguments */
+  pixel = FACE_FOREGROUND 
+    (IMAGE_INSTANCE_WIDGET_FACE (ii),
+     IMAGE_INSTANCE_SUBWINDOW_FRAME (ii));
+  fcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel));
+  pixel = FACE_BACKGROUND
+    (IMAGE_INSTANCE_WIDGET_FACE (ii),
+     IMAGE_INSTANCE_SUBWINDOW_FRAME (ii));
+  bcolor = COLOR_INSTANCE_X_COLOR (XCOLOR_INSTANCE (pixel));
+
+  XtSetArg (al [ac], XtNbackground, bcolor.pixel);		ac++;
+  XtSetArg (al [ac], XtNforeground, fcolor.pixel);		ac++;
+  XtSetArg (al [ac], XtNfont, (void*)FONT_INSTANCE_X_FONT 
+	    (XFONT_INSTANCE (widget_face_font_info 
+			     (domain, 
+			      IMAGE_INSTANCE_WIDGET_FACE (ii),
+			      0, 0))));			ac++;
+
+  wv->nargs = ac;
+  wv->args = al;
+  
+  wid = lw_create_widget (type, wv->name, id, wv, FRAME_X_CONTAINER_WIDGET (f),
+			  False, 0, popup_selection_callback, 0);
+
+  IMAGE_INSTANCE_X_WIDGET_LWID (ii) = id;
+
+  /* because the EmacsManager is the widgets parent we have to
+     offset the redisplay of the widget by the amount the text
+     widget is inside the manager. */
+  ac = 0;
+  XtSetArg (al [ac], XtNwidth, 
+	    (Dimension)IMAGE_INSTANCE_SUBWINDOW_WIDTH (ii)); ac++;
+  XtSetArg (al [ac], XtNheight, 
+	    (Dimension)IMAGE_INSTANCE_SUBWINDOW_HEIGHT (ii)); ac++;
+  XtSetValues (wid, al, ac);
+  /* finally get offsets in the frame */
+  ac = 0;
+  XtSetArg (al [ac], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (ii)); ac++;
+  XtSetArg (al [ac], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (ii)); ac++;
+  XtGetValues (FRAME_X_TEXT_WIDGET (f), al, ac);
+
+  IMAGE_INSTANCE_SUBWINDOW_ID (ii) = (void*)wid; 
+
+  free_widget_value (wv);
+}
+
+static Lisp_Object
+x_widget_set_property (Lisp_Object image_instance, Lisp_Object prop,
+		       Lisp_Object val)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+
+  if (EQ (prop, Q_text))
+    {
+      Extbyte* str=0;
+      widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+      CHECK_STRING (val);
+      GET_C_STRING_OS_DATA_ALLOCA (val, str);
+      wv->value = str;
+      lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (ii), wv, False);
+      return Qt;
+    }
+  return Qunbound;
+}
+
+/* get properties of a control */
+static Lisp_Object
+x_widget_property (Lisp_Object image_instance, Lisp_Object prop)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  /* get the text from a control */
+  if (EQ (prop, Q_text))
+    {
+      widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+      return build_ext_string (wv->value, FORMAT_OS);
+    }
+  return Qunbound;
+}
+
+/* Instantiate a button widget. Unfortunately instantiated widgets are
+   particular to a frame since they need to have a parent. It's not
+   like images where you just select the image into the context you
+   want to display it in and BitBlt it. So images instances can have a
+   many-to-one relationship with things you see, whereas widgets can
+   only be one-to-one (i.e. per frame) */
+static void
+x_button_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+		      Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+		      int dest_mask, Lisp_Object domain)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+  Lisp_Object glyph = find_keyword_in_vector (instantiator, Q_image);
+  widget_value* wv = xmalloc_widget_value ();
+
+  button_item_to_widget_value (gui, wv, 1, 1);
+
+  if (!NILP (glyph))
+    {
+      if (!IMAGE_INSTANCEP (glyph))
+	glyph = glyph_image_instance (glyph, domain, ERROR_ME, 1);
+    }
+
+  x_widget_instantiate (image_instance, instantiator, pointer_fg,
+			pointer_bg, dest_mask, domain, "button", wv);
+
+  /* add the image if one was given */
+  if (!NILP (glyph) && IMAGE_INSTANCEP (glyph))
+    {
+      Arg al [2];
+      int ac =0;
+#ifdef LWLIB_USES_MOTIF
+      XtSetArg (al [ac], XmNlabelType, XmPIXMAP);	ac++;
+      XtSetArg (al [ac], XmNlabelPixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph));ac++;
+#else
+      XtSetArg (al [ac], XtNpixmap, XIMAGE_INSTANCE_X_PIXMAP (glyph));	ac++;
+#endif
+      XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, ac);
+    }
+}
+
+/* get properties of a button */
+static Lisp_Object
+x_button_property (Lisp_Object image_instance, Lisp_Object prop)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  /* check the state of a button */
+  if (EQ (prop, Q_selected))
+    {
+      widget_value* wv = lw_get_all_values (IMAGE_INSTANCE_X_WIDGET_LWID (ii));
+
+      if (wv->selected)
+	return Qt;
+      else
+	return Qnil;
+    }
+  return Qunbound;
+}
+
+/* instantiate a progress gauge */
+static void
+x_progress_gauge_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+			Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+			int dest_mask, Lisp_Object domain)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+  widget_value* wv = xmalloc_widget_value ();
+
+  button_item_to_widget_value (gui, wv, 1, 1);
+
+  x_widget_instantiate (image_instance, instantiator, pointer_fg,
+			pointer_bg, dest_mask, domain, "progress", wv);
+}
+
+/* set the properties of a progres guage */
+static Lisp_Object
+x_progress_gauge_set_property (Lisp_Object image_instance, Lisp_Object prop,
+			 Lisp_Object val)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+
+  if (EQ (prop, Q_percent))
+    {
+      Arg al [1];
+      CHECK_INT (val);
+      XtSetArg (al[0], XtNvalue, XINT (val));
+      XtSetValues (IMAGE_INSTANCE_X_WIDGET_ID (ii), al, 1);
+      return Qt;
+    }
+  return Qunbound;
+}
+
+/* instantiate an edit control */
+static void
+x_edit_field_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+		    Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+		    int dest_mask, Lisp_Object domain)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+  widget_value* wv = xmalloc_widget_value ();
+  
+  button_item_to_widget_value (gui, wv, 1, 1);
+  
+  x_widget_instantiate (image_instance, instantiator, pointer_fg,
+			pointer_bg, dest_mask, domain, "text-field", wv);
+}
+
+/* instantiate a combo control */
+static void
+x_combo_box_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+		     Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+		     int dest_mask, Lisp_Object domain)
+{
+  struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object rest;
+  Lisp_Object gui = IMAGE_INSTANCE_WIDGET_ITEM (ii);
+  widget_value* wv = xmalloc_widget_value ();
+
+  button_item_to_widget_value (gui, wv, 1, 1);
+  
+  x_widget_instantiate (image_instance, instantiator, pointer_fg,
+			pointer_bg, dest_mask, domain, "combo-box", wv);
+  /* add items to the combo box */
+  LIST_LOOP (rest, Fplist_get (IMAGE_INSTANCE_WIDGET_PROPS (ii), Q_items, Qnil))
+    {
+#if 0
+      Extbyte* str;
+      XmString xmstr;
+      GET_C_STRING_OS_DATA_ALLOCA (XCAR (rest), str);
+      xmstr = XmStringCreate (str, XmSTRING_DEFAULT_CHARSET);
+      XmListAddItem (IMAGE_INSTANCE_X_WIDGET_ID (ii), xmstr, 0);
+      XmStringFree (xmstr);
+#endif
+    }
+}
+
 
 /************************************************************************/
 /*                            initialization                            */
@@ -2098,22 +2422,59 @@
   CONSOLE_HAS_METHOD (x, unmap_subwindow);
   CONSOLE_HAS_METHOD (x, map_subwindow);
   CONSOLE_HAS_METHOD (x, resize_subwindow);
+  CONSOLE_HAS_METHOD (x, update_subwindow);
 }
 
 void
 image_instantiator_format_create_glyphs_x (void)
 {
+  IIFORMAT_VALID_CONSOLE (x, nothing);
+  IIFORMAT_VALID_CONSOLE (x, string);
+  IIFORMAT_VALID_CONSOLE (x, formatted_string);
+  IIFORMAT_VALID_CONSOLE (x, inherit);
 #ifdef HAVE_XPM
   INITIALIZE_DEVICE_IIFORMAT (x, xpm);
   IIFORMAT_HAS_DEVMETHOD (x, xpm, instantiate);
 #endif
+#ifdef HAVE_JPEG
+  IIFORMAT_VALID_CONSOLE (x, jpeg);
+#endif
+#ifdef HAVE_TIFF
+  IIFORMAT_VALID_CONSOLE (x, tiff);
+#endif  
+#ifdef HAVE_PNG
+  IIFORMAT_VALID_CONSOLE (x, png);
+#endif  
+#ifdef HAVE_GIF
+  IIFORMAT_VALID_CONSOLE (x, gif);
+#endif  
   INITIALIZE_DEVICE_IIFORMAT (x, xbm);
   IIFORMAT_HAS_DEVMETHOD (x, xbm, instantiate);
 
   INITIALIZE_DEVICE_IIFORMAT (x, subwindow);
   IIFORMAT_HAS_DEVMETHOD (x, subwindow, instantiate);
 
+  /* button widget */
+  INITIALIZE_DEVICE_IIFORMAT (x, button);
+  IIFORMAT_HAS_DEVMETHOD (x, button, property);
+  IIFORMAT_HAS_DEVMETHOD (x, button, instantiate);
+
+  INITIALIZE_DEVICE_IIFORMAT (x, widget);
+  IIFORMAT_HAS_DEVMETHOD (x, widget, property);
+  IIFORMAT_HAS_DEVMETHOD (x, widget, set_property);
+  /* progress gauge */
+  INITIALIZE_DEVICE_IIFORMAT (x, progress_gauge);
+  IIFORMAT_HAS_DEVMETHOD (x, progress_gauge, set_property);
+  IIFORMAT_HAS_DEVMETHOD (x, progress_gauge, instantiate);
+  /* text field */
+  INITIALIZE_DEVICE_IIFORMAT (x, edit_field);
+  IIFORMAT_HAS_DEVMETHOD (x, edit_field, instantiate);
+  /* combo box */
+  INITIALIZE_DEVICE_IIFORMAT (x, combo_box);
+  IIFORMAT_HAS_DEVMETHOD (x, combo_box, instantiate);
+
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (cursor_font, "cursor-font");
+  IIFORMAT_VALID_CONSOLE (x, cursor_font);
 
   IIFORMAT_HAS_METHOD (cursor_font, validate);
   IIFORMAT_HAS_METHOD (cursor_font, possible_dest_types);
@@ -2128,6 +2489,7 @@
   IIFORMAT_HAS_METHOD (font, validate);
   IIFORMAT_HAS_METHOD (font, possible_dest_types);
   IIFORMAT_HAS_METHOD (font, instantiate);
+  IIFORMAT_VALID_CONSOLE (x, font);
 
   IIFORMAT_VALID_KEYWORD (font, Q_data, check_valid_string);
   IIFORMAT_VALID_KEYWORD (font, Q_foreground, check_valid_string);
@@ -2145,6 +2507,7 @@
   IIFORMAT_HAS_METHOD (autodetect, normalize);
   IIFORMAT_HAS_METHOD (autodetect, possible_dest_types);
   IIFORMAT_HAS_METHOD (autodetect, instantiate);
+  IIFORMAT_VALID_CONSOLE (x, autodetect);
 
   IIFORMAT_VALID_KEYWORD (autodetect, Q_data, check_valid_string);
 }
--- a/src/glyphs-x.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs-x.h	Mon Aug 13 11:24:09 2007 +0200
@@ -80,22 +80,48 @@
 
 struct x_subwindow_data
 {
-  Screen *xscreen;
-  Window parent_window;
+  union
+  {
+    struct
+    {
+      Screen *xscreen;
+      Window parent_window;
+    } sub;
+    struct 
+    {
+      Position x_offset;
+      Position y_offset;
+      LWLIB_ID	id;
+    } wid;
+  } data;
 };
 
 #define X_SUBWINDOW_INSTANCE_DATA(i) ((struct x_subwindow_data *) (i)->data)
 
 #define IMAGE_INSTANCE_X_SUBWINDOW_SCREEN(i) \
-  (X_SUBWINDOW_INSTANCE_DATA (i)->xscreen)
+  (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.xscreen)
 #define IMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
-  (X_SUBWINDOW_INSTANCE_DATA (i)->parent_window)
+  (X_SUBWINDOW_INSTANCE_DATA (i)->data.sub.parent_window)
+#define IMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
+  (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.x_offset)
+#define IMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
+  (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.y_offset)
+#define IMAGE_INSTANCE_X_WIDGET_LWID(i) \
+  (X_SUBWINDOW_INSTANCE_DATA (i)->data.wid.id)
 #define XIMAGE_INSTANCE_X_SUBWINDOW_PARENT(i) \
   IMAGE_INSTANCE_X_SUBWINDOW_PARENT (XIMAGE_INSTANCE (i))
 #define XIMAGE_INSTANCE_X_SUBWINDOW_SCREEN(i) \
   IMAGE_INSTANCE_X_SUBWINDOW_SCREEN (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_XOFFSET(i) \
+  IMAGE_INSTANCE_X_WIDGET_XOFFSET (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_YOFFSET(i) \
+  IMAGE_INSTANCE_X_WIDGET_YOFFSET (XIMAGE_INSTANCE (i))
+#define XIMAGE_INSTANCE_X_WIDGET_LWID(i) \
+  IMAGE_INSTANCE_X_WIDGET_LWID (XIMAGE_INSTANCE (i))
 #define IMAGE_INSTANCE_X_SUBWINDOW_ID(i) \
   ((Window) IMAGE_INSTANCE_SUBWINDOW_ID (i))
+#define IMAGE_INSTANCE_X_WIDGET_ID(i) \
+  ((Widget) IMAGE_INSTANCE_SUBWINDOW_ID (i))
 
 #endif /* HAVE_X_WINDOWS */
 #endif /* _XEMACS_GLYPHS_X_H_ */
--- a/src/glyphs.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs.c	Mon Aug 13 11:24:09 2007 +0200
@@ -174,21 +174,38 @@
 }
 
 static int
-valid_image_instantiator_format_p (Lisp_Object format)
+valid_image_instantiator_format_p (Lisp_Object format, Lisp_Object locale)
 {
-  return (decode_image_instantiator_format (format, ERROR_ME_NOT) != 0);
+  int i;
+  struct image_instantiator_methods* meths =
+    decode_image_instantiator_format (format, ERROR_ME_NOT);
+  struct console* console = decode_console (locale);
+  Lisp_Object contype = console ? CONSOLE_TYPE (console) : locale;
+  /* nothing is valid in all locales */
+  if (EQ (format, Qnothing))
+    return 1;
+  /* reject unknown formats */
+  else if (!console || !meths)
+    return 0;
+
+  for (i = 0; i < Dynarr_length (meths->consoles); i++)
+    if (EQ (contype, Dynarr_at (meths->consoles, i).symbol))
+      return 1;
+  return 0;
 }
 
 DEFUN ("valid-image-instantiator-format-p", Fvalid_image_instantiator_format_p,
-       1, 1, 0, /*
+       1, 2, 0, /*
 Given an IMAGE-INSTANTIATOR-FORMAT, return non-nil if it is valid.
+If LOCALE is non-nil then the format is checked in that domain.
+If LOCALE is nil the current console is used.
 Valid formats are some subset of 'nothing, 'string, 'formatted-string,
 'xpm, 'xbm, 'xface, 'gif, 'jpeg, 'png, 'tiff, 'cursor-font, 'font,
 'autodetect, 'widget and 'subwindow, depending on how XEmacs was compiled.
 */
-       (image_instantiator_format))
+       (image_instantiator_format, locale))
 {
-  return valid_image_instantiator_format_p (image_instantiator_format) ?
+  return valid_image_instantiator_format_p (image_instantiator_format, locale) ?
     Qt : Qnil;
 }
 
@@ -547,6 +564,11 @@
   int  methp = 0;
 
   GCPRO1 (ii);
+  if (!valid_image_instantiator_format_p (XVECTOR_DATA (instantiator)[0], device))
+    signal_simple_error
+      ("Image instantiator format is invalid in this locale.",
+       instantiator);
+
   meths = decode_image_instantiator_format (XVECTOR_DATA (instantiator)[0],
 					    ERROR_ME);
   methp = (int)HAS_IIFORMAT_METH_P (meths, instantiate);
@@ -911,7 +933,7 @@
 DEFINE_LRECORD_IMPLEMENTATION ("image-instance", image_instance,
 			       mark_image_instance, print_image_instance,
 			       finalize_image_instance, image_instance_equal,
-			       image_instance_hash,
+			       image_instance_hash, 0,
 			       struct Lisp_Image_Instance);
 
 static Lisp_Object
@@ -2926,9 +2948,14 @@
   return result;
 }
 
+static const struct lrecord_description glyph_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Glyph, image), 5 },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS ("glyph", glyph,
 					  mark_glyph, print_glyph, 0,
-					  glyph_equal, glyph_hash,
+					  glyph_equal, glyph_hash, glyph_description,
 					  glyph_getprop, glyph_putprop,
 					  glyph_remprop, glyph_plist,
 					  struct Lisp_Glyph);
@@ -4102,7 +4129,6 @@
   IIFORMAT_HAS_METHOD (formatted_string, validate);
   IIFORMAT_HAS_METHOD (formatted_string, possible_dest_types);
   IIFORMAT_HAS_METHOD (formatted_string, instantiate);
-
   IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
 
   /* subwindows */
--- a/src/glyphs.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/glyphs.h	Mon Aug 13 11:24:09 2007 +0200
@@ -85,6 +85,8 @@
   Lisp_Object device;		/* sometimes used */
 
   ii_keyword_entry_dynarr *keywords;
+  /* consoles this ii is supported on */
+  console_type_entry_dynarr *consoles;
   /* Implementation specific methods: */
 
   /* Validate method: Given an instantiator vector, signal an error if
@@ -170,6 +172,8 @@
   format##_image_instantiator_methods->device = Qnil;		\
   format##_image_instantiator_methods->keywords =		\
     Dynarr_new (ii_keyword_entry);				\
+  format##_image_instantiator_methods->consoles =		\
+    Dynarr_new (console_type_entry);				\
   add_entry_to_image_instantiator_format_list			\
     (Q##format, format##_image_instantiator_methods);		\
 } while (0)
@@ -215,7 +219,20 @@
 		entry);							\
   } while (0)
 
+/* Declare that image-instantiator format FORMAT is supported on 
+   CONSOLE type. */
+#define IIFORMAT_VALID_CONSOLE(console, format)		\
+  do {								\
+    struct console_type_entry entry;				\
+								\
+    entry.symbol = Q##console;					\
+    entry.meths = console##_console_methods;			\
+    Dynarr_add (format##_image_instantiator_methods->consoles,	\
+		entry);						\
+  } while (0)
+
 #define DEFINE_DEVICE_IIFORMAT(type, format)\
+DECLARE_IMAGE_INSTANTIATOR_FORMAT(format);		\
 struct image_instantiator_methods *type##_##format##_image_instantiator_methods
 
 #define INITIALIZE_DEVICE_IIFORMAT(type, format)	\
@@ -228,6 +245,7 @@
     Dynarr_new (ii_keyword_entry);				\
   add_entry_to_device_ii_format_list				\
     (Q##type, Q##format, type##_##format##_image_instantiator_methods);	\
+  IIFORMAT_VALID_CONSOLE(type,format);			\
 } while (0)
 
 /* Declare that image-instantiator format FORMAT has method M; used in
@@ -624,8 +642,8 @@
 
 extern Lisp_Object Qxpm, Qxface;
 extern Lisp_Object Q_data, Q_file, Q_color_symbols, Qconst_glyph_variable;
-extern Lisp_Object Qxbm, Qedit, Qgroup, Qlabel, Qcombo, Qscrollbar, Qprogress;
-extern Lisp_Object Qtree, Qtab;
+extern Lisp_Object Qxbm, Qedit_field, Qgroup, Qlabel, Qcombo_box, Qscrollbar;
+extern Lisp_Object Qtree_view, Qtab_control, Qprogress_gauge;
 extern Lisp_Object Q_mask_file, Q_mask_data, Q_hotspot_x, Q_hotspot_y;
 extern Lisp_Object Q_foreground, Q_background, Q_face, Q_descriptor, Q_group;
 extern Lisp_Object Q_width, Q_height, Q_pixel_width, Q_pixel_height, Q_text;
--- a/src/gui-x.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/gui-x.c	Mon Aug 13 11:24:09 2007 +0200
@@ -35,11 +35,10 @@
 #include "device.h"
 #include "frame.h"
 #include "gui.h"
+#include "redisplay.h"
 #include "opaque.h"
 
-#ifdef HAVE_POPUPS
 Lisp_Object Qmenu_no_selection_hook;
-#endif
 
 /* we need a unique id for each popup menu, dialog box, and scrollbar */
 static unsigned int lwlib_id_tick;
@@ -59,8 +58,6 @@
 }
 
 
-#ifdef HAVE_POPUPS
-
 struct mark_widget_value_closure
 {
   void (*markobj) (Lisp_Object);
@@ -108,7 +105,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("popup-data", popup_data,
                                mark_popup_data, internal_object_printer,
-			       0, 0, 0, struct popup_data);
+			       0, 0, 0, 0, struct popup_data);
 
 /* This is like FRAME_MENUBAR_DATA (f), but contains an alist of
    (id . popup-data) for GCPRO'ing the callbacks of the popup menus
@@ -259,7 +256,10 @@
       arg = Qmenu_no_selection_hook;
     }
   else
-    get_gui_callback (data, &fn, &arg);
+    {
+      MARK_SUBWINDOWS_CHANGED;
+      get_gui_callback (data, &fn, &arg);
+    }
 
   /* This is the timestamp used for asserting focus so we need to get an
      up-to-date value event if no events has been dispatched to emacs
@@ -315,139 +315,44 @@
   return NULL;
 }
 
-/* set menu accelerator key to first underlined character in menu name */
-
-Lisp_Object
-menu_name_to_accelerator (char *name)
-{
-  while (*name) {
-    if (*name=='%') {
-      ++name;
-      if (!(*name))
-	return Qnil;
-      if (*name=='_' && *(name+1))
-	{
-	  int accelerator = (int) (unsigned char) (*(name+1));
-	  return make_char (tolower (accelerator));
-	}
-    }
-    ++name;
-  }
-  return Qnil;
-}
 
 /* This does the dirty work.  gc_currently_forbidden is 1 when this is called.
  */
-
 int
-button_item_to_widget_value (Lisp_Object desc, widget_value *wv,
+button_item_to_widget_value (Lisp_Object gui_item, widget_value *wv,
 			     int allow_text_field_p, int no_keys_p)
 {
   /* !!#### This function has not been Mule-ized */
   /* This function cannot GC because gc_currently_forbidden is set when
      it's called */
-  Lisp_Object name       = Qnil;
-  Lisp_Object callback   = Qnil;
-  Lisp_Object suffix     = Qnil;
-  Lisp_Object active_p   = Qt;
-  Lisp_Object include_p  = Qt;
-  Lisp_Object selected_p = Qnil;
-  Lisp_Object keys       = Qnil;
-  Lisp_Object style      = Qnil;
-  Lisp_Object config_tag = Qnil;
-  Lisp_Object accel = Qnil;
-  int length = XVECTOR_LENGTH (desc);
-  Lisp_Object *contents = XVECTOR_DATA (desc);
-  int plist_p;
-  int selected_spec = 0, included_spec = 0;
-
-  if (length < 2)
-    signal_simple_error ("Button descriptors must be at least 2 long", desc);
-
-  /* length 2:		[ "name" callback ]
-     length 3:		[ "name" callback active-p ]
-     length 4:		[ "name" callback active-p suffix ]
-     		   or	[ "name" callback keyword  value  ]
-     length 5+:		[ "name" callback [ keyword value ]+ ]
-   */
-  plist_p = (length >= 5 || (length > 2 && KEYWORDP (contents [2])));
+  struct Lisp_Gui_Item* pgui = XGUI_ITEM (gui_item);
 
-  if (!plist_p && length > 2)
-    /* the old way */
-    {
-      name = contents [0];
-      callback = contents [1];
-      active_p = contents [2];
-      if (length == 4)
-	suffix = contents [3];
-    }
-  else
-    {
-      /* the new way */
-      int i;
-      if (length & 1)
-	signal_simple_error (
-		"Button descriptor has an odd number of keywords and values",
-			     desc);
-
-      name = contents [0];
-      callback = contents [1];
-      for (i = 2; i < length;)
-	{
-	  Lisp_Object key = contents [i++];
-	  Lisp_Object val = contents [i++];
-	  if (!KEYWORDP (key))
-	    signal_simple_error_2 ("Not a keyword", key, desc);
-
-	  if      (EQ (key, Q_active))   active_p   = val;
-	  else if (EQ (key, Q_suffix))   suffix     = val;
-	  else if (EQ (key, Q_keys))     keys       = val;
-	  else if (EQ (key, Q_style))    style      = val;
-	  else if (EQ (key, Q_selected)) selected_p = val, selected_spec = 1;
-	  else if (EQ (key, Q_included)) include_p  = val, included_spec = 1;
-	  else if (EQ (key, Q_config))	 config_tag = val;
-	  else if (EQ (key, Q_accelerator))
-	    {
-	      if ( SYMBOLP (val)
-		   || CHARP (val))
-		accel = val;
-	      else
-		signal_simple_error ("Bad keyboard accelerator", val);
-	    }
-	  else if (EQ (key, Q_filter))
-	    signal_simple_error(":filter keyword not permitted on leaf nodes", desc);
-	  else
-	    signal_simple_error_2 ("Unknown menu item keyword", key, desc);
-	}
-    }
+  if (!NILP (pgui->filter))
+    signal_simple_error(":filter keyword not permitted on leaf nodes", gui_item);
 
 #ifdef HAVE_MENUBARS
-  if ((!NILP (config_tag) && NILP (Fmemq (config_tag, Vmenubar_configuration)))
-      || (included_spec && NILP (Feval (include_p))))
+  if (!gui_item_included_p (gui_item, Vmenubar_configuration))
     {
       /* the include specification says to ignore this item. */
       return 0;
     }
 #endif /* HAVE_MENUBARS */
 
-  CHECK_STRING (name);
-  wv->name = (char *) XSTRING_DATA (name);
+  CHECK_STRING (pgui->name);
+  wv->name = (char *) XSTRING_DATA (pgui->name);
+  wv->accel = LISP_TO_VOID (gui_item_accelerator (gui_item));
 
-  if (NILP (accel))
-    accel = menu_name_to_accelerator (wv->name);
-  wv->accel = LISP_TO_VOID (accel);
-
-  if (!NILP (suffix))
+  if (!NILP (pgui->suffix))
     {
       CONST char *const_bogosity;
       Lisp_Object suffix2;
 
       /* Shortcut to avoid evaluating suffix each time */
-      if (STRINGP (suffix))
-	suffix2 = suffix;
+      if (STRINGP (pgui->suffix))
+	suffix2 = pgui->suffix;
       else
 	{
-	  suffix2 = Feval (suffix);
+	  suffix2 = Feval (pgui->suffix);
 	  CHECK_STRING (suffix2);
 	}
 
@@ -456,10 +361,11 @@
       wv->value = xstrdup (wv->value);
     }
 
-  wv_set_evalable_slot (wv->enabled, active_p);
-  wv_set_evalable_slot (wv->selected, selected_p);
+  wv_set_evalable_slot (wv->enabled, pgui->active);
+  wv_set_evalable_slot (wv->selected, pgui->selected);
 
-  wv->call_data = LISP_TO_VOID (callback);
+  if (!NILP (pgui->callback))
+    wv->call_data = LISP_TO_VOID (pgui->callback);
 
   if (no_keys_p
 #ifdef HAVE_MENUBARS
@@ -467,28 +373,28 @@
 #endif
       )
     wv->key = 0;
-  else if (!NILP (keys))	/* Use this string to generate key bindings */
+  else if (!NILP (pgui->keys))	/* Use this string to generate key bindings */
     {
-      CHECK_STRING (keys);
-      keys = Fsubstitute_command_keys (keys);
-      if (XSTRING_LENGTH (keys) > 0)
-	wv->key = xstrdup ((char *) XSTRING_DATA (keys));
+      CHECK_STRING (pgui->keys);
+      pgui->keys = Fsubstitute_command_keys (pgui->keys);
+      if (XSTRING_LENGTH (pgui->keys) > 0)
+	wv->key = xstrdup ((char *) XSTRING_DATA (pgui->keys));
       else
 	wv->key = 0;
     }
-  else if (SYMBOLP (callback))	/* Show the binding of this command. */
+  else if (SYMBOLP (pgui->callback))	/* Show the binding of this command. */
     {
       char buf [1024];
       /* #### Warning, dependency here on current_buffer and point */
-      where_is_to_char (callback, buf);
+      where_is_to_char (pgui->callback, buf);
       if (buf [0])
 	wv->key = xstrdup (buf);
       else
 	wv->key = 0;
     }
 
-  CHECK_SYMBOL (style);
-  if (NILP (style))
+  CHECK_SYMBOL (pgui->style);
+  if (NILP (pgui->style))
     {
       /* If the callback is nil, treat this item like unselectable text.
 	 This way, dashes will show up as a separator. */
@@ -515,13 +421,13 @@
 	    wv->type = BUTTON_TYPE;
 	}
     }
-  else if (EQ (style, Qbutton))
+  else if (EQ (pgui->style, Qbutton))
     wv->type = BUTTON_TYPE;
-  else if (EQ (style, Qtoggle))
+  else if (EQ (pgui->style, Qtoggle))
     wv->type = TOGGLE_TYPE;
-  else if (EQ (style, Qradio))
+  else if (EQ (pgui->style, Qradio))
     wv->type = RADIO_TYPE;
-  else if (EQ (style, Qtext))
+  else if (EQ (pgui->style, Qtext))
     {
       wv->type = TEXT_TYPE;
 #if 0
@@ -530,19 +436,18 @@
 #endif
     }
   else
-    signal_simple_error_2 ("Unknown style", style, desc);
+    signal_simple_error_2 ("Unknown style", pgui->style, gui_item);
 
   if (!allow_text_field_p && (wv->type == TEXT_TYPE))
-    signal_simple_error ("Text field not allowed in this context", desc);
+    signal_simple_error ("Text field not allowed in this context", gui_item);
 
-  if (selected_spec && EQ (style, Qtext))
+  if (!NILP (pgui->selected) && EQ (pgui->style, Qtext))
     signal_simple_error (
-         ":selected only makes sense with :style toggle, radio or button",
-			 desc);
+			 ":selected only makes sense with :style toggle, radio or button",
+			 gui_item);
   return 1;
 }
 
-#endif /* HAVE_POPUPS */
 
 /* This is a kludge to make sure emacs can only link against a version of
    lwlib that was compiled in the right way.  Emacs references symbols which
@@ -600,9 +505,7 @@
 void
 syms_of_gui_x (void)
 {
-#ifdef HAVE_POPUPS
   defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook");
-#endif
 }
 
 void
@@ -610,7 +513,6 @@
 {
   lwlib_id_tick = (1<<16);	/* start big, to not conflict with Energize */
 
-#ifdef HAVE_POPUPS
   popup_up_p = 0;
 
   Vpopup_callbacks = Qnil;
@@ -625,7 +527,6 @@
 */ );
 #endif
   Fset (Qmenu_no_selection_hook, Qnil);
-#endif /* HAVE_POPUPS */
 
   /* this makes only safe calls as in emacs.c */
   sanity_check_lwlib ();
--- a/src/gui.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/gui.c	Mon Aug 13 11:24:09 2007 +0200
@@ -122,6 +122,13 @@
   else if (EQ (key, Q_callback))	 pgui_item->callback     = val;
   else if (EQ (key, Q_key_sequence)) ;   /* ignored for FSF compatability */
   else if (EQ (key, Q_label)) ;   /* ignored for 21.0 implement in 21.2  */
+  else if (EQ (key, Q_accelerator))
+    {
+      if (SYMBOLP (val) || CHARP (val))
+	pgui_item->accelerator = val;
+      else if (ERRB_EQ (errb, ERROR_ME))
+	signal_simple_error ("Bad keyboard accelerator", val);
+    }
   else if (ERRB_EQ (errb, ERROR_ME))
     signal_simple_error_2 ("Unknown keyword in gui item", key, pgui_item->name);
 }
@@ -141,6 +148,7 @@
   lp->style    = Qnil;
   lp->selected = Qnil;
   lp->keys     = Qnil;
+  lp->accelerator     = Qnil;
 }
 
 Lisp_Object
@@ -262,6 +270,8 @@
     Fplist_put (plist, Q_selected, pgui_item->selected);
   if (!NILP (pgui_item->keys))
     Fplist_put (plist, Q_keys, pgui_item->keys);
+  if (!NILP (pgui_item->accelerator))
+    Fplist_put (plist, Q_accelerator, pgui_item->accelerator);
 }
 
 /*
@@ -278,6 +288,41 @@
 	  || !NILP (Feval (XGUI_ITEM (gui_item)->active)));
 }
 
+/* set menu accelerator key to first underlined character in menu name */
+Lisp_Object
+gui_item_accelerator (Lisp_Object gui_item)
+{
+  struct Lisp_Gui_Item* pgui = XGUI_ITEM (gui_item);
+  
+  if (!NILP (pgui->accelerator))
+    return pgui->accelerator;
+
+  else
+    return pgui->name;
+}
+
+Lisp_Object
+gui_name_accelerator (Lisp_Object nm)
+{
+  /* !!#### This function has not been Mule-ized */
+  char* name = (char*)XSTRING_DATA (nm);
+
+  while (*name) {
+    if (*name=='%') {
+      ++name;
+      if (!(*name))
+	return Qnil;
+      if (*name=='_' && *(name+1))
+	{
+	  int accelerator = (int) (unsigned char) (*(name+1));
+	  return make_char (tolower (accelerator));
+	}
+    }
+    ++name;
+  }
+  return Qnil;
+}
+
 /*
  * Decide whether a GUI item is selected by evaluating its :selected form
  * if any
@@ -427,6 +472,7 @@
 
   markobj (p->name);
   markobj (p->callback);
+  markobj (p->config);
   markobj (p->suffix);
   markobj (p->active);
   markobj (p->included);
@@ -435,6 +481,7 @@
   markobj (p->style);
   markobj (p->selected);
   markobj (p->keys);
+  markobj (p->accelerator);
 
   return Qnil;
 }
@@ -493,6 +540,8 @@
 	&&
 	EQ (p1->selected, p2->selected)
 	&&
+	EQ (p1->accelerator, p2->accelerator)
+	&&
 	EQ (p1->keys, p2->keys)))
     return 0;
   return 1;
@@ -516,6 +565,7 @@
 			       mark_gui_item, print_gui_item,
 			       0, gui_item_equal,
 			       gui_item_hash,
+			       0,
 			       struct Lisp_Gui_Item);
 
 void
--- a/src/gui.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/gui.h	Mon Aug 13 11:24:09 2007 +0200
@@ -60,6 +60,7 @@
   Lisp_Object style;		/* Symbol */
   Lisp_Object selected;		/* Form */
   Lisp_Object keys;		/* String */
+  Lisp_Object accelerator;	/* Char or Symbol  */
 };
 
 extern Lisp_Object Q_accelerator, Q_active, Q_config, Q_filter, Q_included;
@@ -74,6 +75,8 @@
 int  gui_item_active_p (Lisp_Object);
 int  gui_item_selected_p (Lisp_Object);
 int  gui_item_included_p (Lisp_Object, Lisp_Object into);
+Lisp_Object gui_item_accelerator (Lisp_Object gui_item);
+Lisp_Object gui_name_accelerator (Lisp_Object name);
 int  gui_item_id_hash (Lisp_Object, Lisp_Object gui_item, int);
 unsigned int gui_item_display_flush_left  (Lisp_Object pgui_item,
 					   char* buf, Bytecount buf_len);
@@ -89,4 +92,6 @@
 #define GUI_ITEM_ID_MAX(s) (0x1FFF + GUI_ITEM_ID_MIN (s))
 #define GUI_ITEM_ID_BITS(x,s) (((x) & 0x1FFF) + GUI_ITEM_ID_MIN (s))
 
+#define MAX_MENUITEM_LENGTH 128
+
 #endif /* _XEMACS_GUI_H_ */
--- a/src/indent.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/indent.c	Mon Aug 13 11:24:09 2007 +0200
@@ -40,6 +40,8 @@
 #endif
 #include "window.h"
 
+Lisp_Object Qcoerce;
+
 /* Indentation can insert tabs if this is non-zero;
    otherwise always uses spaces */
 int indent_tabs_mode;
@@ -342,9 +344,11 @@
 If specified column is within a character, point goes after that character.
 If it's past end of line, point goes to end of line.
 
-A non-nil second (optional) argument FORCE means, if the line
-is too short to reach column COLUMN then add spaces/tabs to get there,
-and if COLUMN is in the middle of a tab character, change it to spaces.
+A value of 'coerce for the second (optional) argument FORCE means if
+COLUMN is in the middle of a tab character, change it to spaces.
+Any other non-nil value means the same, plus if the line is too short to
+reach column COLUMN, then add spaces/tabs to get there.
+
 Returns the actual column that it moved to.
 */
        (column, force, buffer))
@@ -428,7 +432,7 @@
     }
 
   /* If line ends prematurely, add space to the end.  */
-  if (col < goal && !NILP (force))
+  if (col < goal && !NILP (force) && !EQ (force, Qcoerce))
     {
       col = goal;
       Findent_to (make_int (col), Qzero, buffer);
@@ -541,7 +545,7 @@
   assert (start <= end);
   assert (start >= 0);
   assert (end < Dynarr_length (cache));
-  
+
   vpix = 0;
   for (i = start; i <= end; i++)
     vpix += Dynarr_atp (cache, i)->height;
@@ -681,7 +685,7 @@
   bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix);
 
   /* Note that the buffer's point is set, not the window's point. */
-  if (selected) 
+  if (selected)
     BUF_SET_PT (XBUFFER (w->buffer), bufpos);
   else
     set_marker_restricted (w->pointm[CURRENT_DISP],
@@ -856,7 +860,7 @@
 
   bufpos = vmotion_pixels (window, orig, XINT (pixels), howto, &motion);
 
-  if (selected) 
+  if (selected)
     BUF_SET_PT (XBUFFER (w->buffer), bufpos);
   else
     set_marker_restricted (w->pointm[CURRENT_DISP],
@@ -879,6 +883,8 @@
 #endif
   DEFSUBR (Fvertical_motion);
   DEFSUBR (Fvertical_motion_pixels);
+
+  defsymbol (&Qcoerce, "coerce");
 }
 
 void
--- a/src/input-method-xlib.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/input-method-xlib.c	Mon Aug 13 11:24:09 2007 +0200
@@ -38,6 +38,9 @@
 #include "EmacsFrame.h"
 #include "events.h"
 
+#include <X11/IntrinsicP.h>
+#include <X11/Xaw/XawImP.h>
+
 #ifndef XIM_XLIB
 #error  XIM_XLIB is not defined??
 #endif
@@ -72,6 +75,8 @@
 "XIMPreeditNone|XIMStatusNothing\n"
 "XIMPreeditNone|XIMStatusNone";
 
+static Boolean xim_initted = False;
+
 static XIMStyle best_style (XIMStyles *user, XIMStyles *xim);
 
 void
@@ -125,60 +130,73 @@
     }
 }
 
-/* Create X input method for device */
-void
-XIM_init_device (struct device *d)
+/******************************************************************/
+/*                     Input method using xlib                    */
+/******************************************************************/
+
+/*
+ * called from when XIM is destroying
+ */
+static void
+IMDestroyCallback (XIM im, XPointer client_data, XPointer call_data)
 {
-  Display *dpy = DEVICE_X_DISPLAY (d);
-  char *name, *class;
-  XIM xim;
-
-  XtGetApplicationNameAndClass (dpy, &name, &class);
-
-  DEVICE_X_XIM (d) = xim = XOpenIM (dpy, XtDatabase (dpy), name, class);
+  struct frame *f = (struct frame *)client_data;
+  struct device *d = XDEVICE (FRAME_DEVICE ((struct frame *)client_data));
+  Lisp_Object frame_list = DEVICE_FRAME_LIST (XDEVICE (FRAME_DEVICE (f)));
+  Lisp_Object tail;
+  struct frame *target_frame = NULL;
 
-  if (xim == NULL)
-    {
-      stderr_out ("Warning: XOpenIM() failed...no input server available\n");
-      return;
-    }
-  else
+  LIST_LOOP (tail, frame_list)
     {
-      /* Get supported styles */
-      XGetIMValues (xim, XNQueryInputStyle, &DEVICE_X_XIM_STYLES (d), NULL);
-#ifdef DEBUG_XIM
-      describe_XIM (xim);
+      if (target_frame = XFRAME (XCAR (tail)))
+	{
+	  if ( FRAME_X_XIC(target_frame) )
+	    {
+	      XDestroyIC (FRAME_X_XIC(target_frame));
+	      FRAME_X_XIC (target_frame) = NULL;
+	    }
+	}
+    }
+
+#if 0
+  if ( DEVICE_X_XIM (d) )
+    {
+      stderr_out ("NULLing d->xim...\n");
+      /* DEVICE_X_XIM (d) = NULL; */
+    }
 #endif
-    }
+
+  xim_initted = False;
+  return;
 }
 
-/* Create an X input context for this frame. */
-void
-XIM_init_frame (struct frame *f)
+/*
+ * called from when FRAME is initializing
+ */
+static void
+IMInstantiateCallback (Display *dpy, XPointer client_data, XPointer call_data)
 {
-  struct device *d = XDEVICE (FRAME_DEVICE (f));
-  XIM xim = DEVICE_X_XIM (d);
-  XIC xic;
-  Widget w = FRAME_X_TEXT_WIDGET (f);
+  struct frame *f = (struct frame *)client_data;
+  struct device *d = XDEVICE (FRAME_DEVICE ((struct frame *)client_data));
+  XIM xim;
+  Widget w = FRAME_X_TEXT_WIDGET ((struct frame *)client_data);
   Window win = XtWindow (w);
-  XRectangle p_area = {0,0,1,1}, s_area={0,0,1,1};
+  XRectangle p_area = {0,0,1,1}, s_area = {0,0,1,1};
   XPoint spot = {0,0};
   XIMStyle style;
   XVaNestedList p_list, s_list;
-
+  char *name, *class;
   typedef struct
   {
     XIMStyles styles;
     XFontSet  fontset;
     Pixel     fg;
     Pixel     bg;
+    char      *inputmethod;
   } xic_vars_t;
-
   xic_vars_t xic_vars;
-
-  /* mrb: #### Fix so that background and foreground is set from
-     default face, rather than foreground and background resources, or
-     that the user can use set-frame-parameters to set xic attributes */
+  XIMCallback ximcallback;
+  XIC xic;
 
 #define res(name, class, representation, field, default_value) \
   { name, class, representation, sizeof(xic_vars.field), \
@@ -190,21 +208,40 @@
     res(XtNximStyles,     XtCXimStyles,  XtRXimStyles, styles,  (XtPointer) DefaultXIMStyles),
     res(XtNfontSet,       XtCFontSet,    XtRFontSet,   fontset, (XtPointer) XtDefaultFontSet),
     res(XtNximForeground, XtCForeground, XtRPixel,     fg,      (XtPointer) XtDefaultForeground),
-    res(XtNximBackground, XtCBackground, XtRPixel,     bg,      (XtPointer) XtDefaultBackground)
+    res(XtNximBackground, XtCBackground, XtRPixel,     bg,      (XtPointer) XtDefaultBackground),
+    res(XtNinputMethod,   XtCInputMethod, XtRString,   inputmethod, (XtPointer) NULL)
   };
 
-  assert (win != 0 && w != NULL && d != NULL);
+  /* ---------- beginning of the action ---------- */
 
-  if (!xim)
-    {                   /* No input method? */
-      FRAME_X_XIC (f) = NULL;
-      return;
+  /*
+   * if no xim is presented, initialize xim ...
+   */
+  if ( xim_initted == False )
+    {
+      xim_initted = True;
+      XtGetApplicationNameAndClass (dpy, &name, &class);
+      DEVICE_X_XIM (d) = xim = XOpenIM (dpy, XtDatabase (dpy), name, class);
+
+      /* destroy callback for im */
+      ximcallback.callback = IMDestroyCallback;
+      ximcallback.client_data = (XPointer)f;
+      XSetIMValues (xim, XNDestroyCallback, &ximcallback, NULL);
+    }
+  else
+    {
+      xim = DEVICE_X_XIM (d);
     }
 
+  w = FRAME_X_TEXT_WIDGET (f);
+
+  /*
+   * initialize XIC
+   */
+  if ( FRAME_X_XIC (f) ) return;
   XtGetApplicationResources (w, &xic_vars,
 			     resources, XtNumber (resources),
 			     NULL, 0);
-
   if (!xic_vars.fontset)
     {
       stderr_out ("Can't get fontset resource for Input Method\n");
@@ -212,45 +249,46 @@
       return;
     }
 
+  /* construct xic */
+  XGetIMValues (xim, XNQueryInputStyle, &DEVICE_X_XIM_STYLES(d), NULL);
   FRAME_X_XIC_STYLE (f) = style =
-    best_style (&xic_vars.styles, DEVICE_X_XIM_STYLES (d));
+    best_style (&xic_vars.styles, (XIMStyles *)DEVICE_X_XIM_STYLES(d));
 
-  /* Hopefully we don't have to conditionalize the following based on
-     style; the IM should ignore values it doesn't use */
   p_list = XVaCreateNestedList (0,
-                                XNArea,         &p_area,
-                                XNSpotLocation, &spot,
-                                XNForeground,   xic_vars.fg,
-                                XNBackground,   xic_vars.bg,
-                                XNFontSet,      xic_vars.fontset,
-                                NULL);
+				XNArea,         &p_area,
+				XNSpotLocation, &spot,
+				XNForeground,   xic_vars.fg,
+				XNBackground,   xic_vars.bg,
+				XNFontSet,      xic_vars.fontset,
+				NULL);
 
   s_list = XVaCreateNestedList (0,
-                                XNArea,         &s_area,
-                                XNForeground,   xic_vars.fg,
-                                XNBackground,   xic_vars.bg,
-                                XNFontSet,      xic_vars.fontset,
-                                NULL);
+				XNArea,         &s_area,
+				XNForeground,   xic_vars.fg,
+				XNBackground,   xic_vars.bg,
+				XNFontSet,      xic_vars.fontset,
+				NULL);
+
   FRAME_X_XIC (f) = xic =
     XCreateIC (xim,
-               XNInputStyle,        style,
-               XNClientWindow,      win,
-               XNFocusWindow,       win,
-               XNPreeditAttributes, p_list,
-               XNStatusAttributes,  s_list,
-               NULL);
+	       XNInputStyle, style,
+	       XNClientWindow, win,
+	       XNFocusWindow, win,
+	       XNPreeditAttributes, p_list,
+	       XNStatusAttributes, s_list,
+	       NULL);
   XFree (p_list);
   XFree (s_list);
 
   if (!xic)
     {
-      stderr_out ("Warning: XCreateIC failed\n");
+      stderr_out ("Warning: XCreateIC failed.\n");
       return;
     }
 
   if (style & XIMPreeditPosition)
-    { /* Init spot to invalid values */
-      XPoint *frame_spot = &(FRAME_X_XIC_SPOT (f));
+    {
+      XPoint *frame_spot = &(FRAME_X_XIC_SPOT(f));
       frame_spot->x = frame_spot->y = -1;
     }
 
@@ -258,11 +296,63 @@
 
   XSetICFocus (xic);
 
-#ifdef DEBUG_XIM
-  describe_XIC (xic);
+  return;
+}
+
+/* Create X input method for device */
+void
+XIM_init_device (struct device *d)
+{
+  /* do nothing here */
+  return;
+}
+
+/* Callback for when the frame was deleted (closed) */
+static void
+XIM_delete_frame (Widget w, XtPointer client_data, XtPointer call_data)
+{
+  struct frame *f = (struct frame *)client_data;
+  struct device *d = XDEVICE (FRAME_DEVICE ((struct frame *)client_data));
+  Display *dpy = DEVICE_X_DISPLAY (d);
+
+  XUnregisterIMInstantiateCallback (dpy, NULL, NULL, NULL,
+				    IMInstantiateCallback, (XtPointer)f);
+
+  if ( FRAME_X_XIC (f) )
+    {
+      XDestroyIC (FRAME_X_XIC(f));
+      FRAME_X_XIC (f) = NULL;
+    }
+  return;
+}
+
+/* Create an X input context for this frame.
+   -  Register the IM to be initiated later using XRegisterIMInstantiateCallback
+ */
+void
+XIM_init_frame (struct frame *f)
+{
+  struct device *d = XDEVICE (FRAME_DEVICE (f));
+
+  XRegisterIMInstantiateCallback (DEVICE_X_DISPLAY (d), NULL, NULL, NULL,
+				  IMInstantiateCallback, (XtPointer)f);
+
+#if 0
+  if ( FRAME_X_XIC (f) )
+    return;
 #endif
+  if ( ! DEVICE_X_XIM (d) )
+    {
+      stderr_out ("X Input Method open failed. Waiting IM to be enabled.\n");
+    }
+
+  /* when frame is going to be destroyed (closed) */
+  XtAddCallback (FRAME_X_TEXT_WIDGET(f), XNDestroyCallback,
+		 XIM_delete_frame, (XtPointer)f);
+  return;
 }
 
+
 void
 XIM_SetGeometry (struct frame *f)
 {
@@ -346,7 +436,7 @@
 void
 XIM_focus_event (struct frame *f, int in_p)
 {
-  if (FRAME_X_XIC (f))
+  if (FRAME_X_XIC (f) /* && FRAME_X_XIM_REGISTERED(f) */)
     (in_p ? XSetICFocus : XUnsetICFocus) (FRAME_X_XIC (f));
 }
 
--- a/src/keymap.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/keymap.c	Mon Aug 13 11:24:09 2007 +0200
@@ -285,9 +285,16 @@
   write_c_string (buf, printcharfun);
 }
 
+static const struct lrecord_description keymap_description[] = {
+  { XD_LISP_OBJECT, offsetof(Lisp_Keymap, parents), 6 },
+  { XD_LISP_OBJECT, offsetof(Lisp_Keymap, name), 1 },
+  { XD_END }
+};
+
 /* No need for keymap_equal #### Why not? */
 DEFINE_LRECORD_IMPLEMENTATION ("keymap", keymap,
                                mark_keymap, print_keymap, 0, 0, 0,
+			       keymap_description,
 			       Lisp_Keymap);
 
 /************************************************************************/
--- a/src/lisp.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/lisp.h	Mon Aug 13 11:24:09 2007 +0200
@@ -39,6 +39,7 @@
 #include <stdio.h>		/* NULL, etc. */
 #include <ctype.h>
 #include <stdarg.h>
+#include <stddef.h>		/* offsetof */
 
 #ifdef __lucid
 # include <sysent.h>
@@ -1113,9 +1114,9 @@
 {
   unsigned int ui = (unsigned int) i;
   if (value)
-    (v)->bits[ui >> LONGBITS_LOG2] |= (1U << (ui & (LONGBITS_POWER_OF_2 - 1)));
+    (v)->bits[ui >> LONGBITS_LOG2] |= (1UL << (ui & (LONGBITS_POWER_OF_2 - 1)));
   else
-    (v)->bits[ui >> LONGBITS_LOG2] &= ~(1U << (ui & (LONGBITS_POWER_OF_2 - 1)));
+    (v)->bits[ui >> LONGBITS_LOG2] &= ~(1UL << (ui & (LONGBITS_POWER_OF_2 - 1)));
 }
 
 /* Number of longs required to hold LEN bits */
@@ -1551,7 +1552,7 @@
 /* Can't be const, because then subr->doc is read-only and
    Snarf_documentation chokes */
 
-#define subr_lheader_initializer { 0, { 0, 0, 0 } }
+#define subr_lheader_initializer { 0, 0, 0, 0 }
 
 #define DEFUN(lname, Fname, min_args, max_args, prompt, arglist)	\
   Lisp_Object Fname (EXFUN_##max_args);					\
--- a/src/lrecord.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/lrecord.h	Mon Aug 13 11:24:09 2007 +0200
@@ -60,15 +60,13 @@
 struct lrecord_header
 {
   /* index into lrecord_implementations_table[] */
-  unsigned char type;
-  struct {
-    /* 1 if the object is marked during GC. */
-    unsigned mark :1;
-    /* 1 if the object resides in read-only space */
-    unsigned c_readonly : 1;
-    /* 1 if the object is readonly from lisp */
-    unsigned lisp_readonly : 1;
-  } flags;
+  unsigned type :8;
+  /* 1 if the object is marked during GC. */
+  unsigned mark :1;
+  /* 1 if the object resides in read-only space */
+  unsigned c_readonly : 1;
+  /* 1 if the object is readonly from lisp */
+  unsigned lisp_readonly : 1;
 };
 
 struct lrecord_implementation;
@@ -77,9 +75,9 @@
 # define set_lheader_implementation(header,imp) do {	\
   struct lrecord_header* SLI_header = (header);		\
   (SLI_header)->type = lrecord_type_index (imp);	\
-  (SLI_header)->flags.mark = 0;				\
-  (SLI_header)->flags.c_readonly = 0;			\
-  (SLI_header)->flags.lisp_readonly = 0;		\
+  (SLI_header)->mark = 0;				\
+  (SLI_header)->c_readonly = 0;				\
+  (SLI_header)->lisp_readonly = 0;			\
 } while (0)
 
 struct lcrecord_header
@@ -156,6 +154,10 @@
      `equal', they *must* hash to the same value or the hashing won't
      work). */
   unsigned long (*hash) (Lisp_Object, int);
+
+  /* External data layout description */
+  const struct lrecord_description *description;
+
   Lisp_Object (*getprop) (Lisp_Object obj, Lisp_Object prop);
   int (*putprop) (Lisp_Object obj, Lisp_Object prop, Lisp_Object val);
   int (*remprop) (Lisp_Object obj, Lisp_Object prop);
@@ -184,20 +186,117 @@
 
 extern int gc_in_progress;
 
-#define MARKED_RECORD_P(obj) (gc_in_progress && XRECORD_LHEADER (obj)->flags.mark)
-#define MARKED_RECORD_HEADER_P(lheader) ((lheader)->flags.mark)
-#define MARK_RECORD_HEADER(lheader)   ((void) ((lheader)->flags.mark = 1))
-#define UNMARK_RECORD_HEADER(lheader) ((void) ((lheader)->flags.mark = 0))
+#define MARKED_RECORD_P(obj) (gc_in_progress && XRECORD_LHEADER (obj)->mark)
+#define MARKED_RECORD_HEADER_P(lheader) ((lheader)->mark)
+#define MARK_RECORD_HEADER(lheader)   ((void) ((lheader)->mark = 1))
+#define UNMARK_RECORD_HEADER(lheader) ((void) ((lheader)->mark = 0))
 
 #define UNMARKABLE_RECORD_HEADER_P(lheader) \
   (LHEADER_IMPLEMENTATION (lheader)->marker == this_one_is_unmarkable)
 
-#define C_READONLY_RECORD_HEADER_P(lheader)  ((lheader)->flags.c_readonly)
-#define LISP_READONLY_RECORD_HEADER_P(lheader)  ((lheader)->flags.lisp_readonly)
+#define C_READONLY_RECORD_HEADER_P(lheader)  ((lheader)->c_readonly)
+#define LISP_READONLY_RECORD_HEADER_P(lheader)  ((lheader)->lisp_readonly)
 #define SET_C_READONLY_RECORD_HEADER(lheader) \
-  ((void) ((lheader)->flags.c_readonly = (lheader)->flags.lisp_readonly = 1))
+  ((void) ((lheader)->c_readonly = (lheader)->lisp_readonly = 1))
 #define SET_LISP_READONLY_RECORD_HEADER(lheader) \
-  ((void) ((lheader)->flags.lisp_readonly = 1))
+  ((void) ((lheader)->lisp_readonly = 1))
+
+/* External description stuff
+
+   A lrecord external description  is an array  of values.  The  first
+   value of each line is a type, the second  the offset in the lrecord
+   structure.  Following values  are parameters, their  presence, type
+   and number is type-dependant.
+
+   The description ends with a "XD_END" record.
+
+   Some example descriptions :
+   static const struct lrecord_description cons_description[] = {
+     { XD_LISP_OBJECT, offsetof(struct Lisp_Cons, car), 2 },
+     { XD_END }
+   };
+
+   Which means "two lisp objects starting at the 'car' element"
+
+  static const struct lrecord_description string_description[] = {
+    { XD_STRING_DATA, offsetof(Lisp_String, data) },
+    { XD_LISP_OBJECT, offsetof(Lisp_String, plist), 1 },
+    { XD_END }
+  };
+  "A string data pointer at 'data', one lisp object at 'plist'"
+
+  The existing types :
+    XD_LISP_OBJECT
+  Lisp objects.  The third element is the count.  This is also the type to use
+  for pointers to other lrecords.
+
+    XD_STRING_DATA
+  Pointer to string data.
+
+    XD_OPAQUE_PTR
+  Pointer to undumpable data.  Must be NULL when dumping.
+
+    XD_STRUCT_PTR
+  Pointer to described struct.  Parameters are number of structures and
+  struct_description.
+
+    XD_OPAQUE_DATA_PTR
+  Pointer to dumpable opaque data.  Parameter is the size of the data.
+  Pointed data must be relocatable without changes.
+
+    XD_SIZE_T
+  size_t value.  Used for counts.
+
+    XD_INT
+  int value.  Used for counts.
+
+    XD_LONG
+  long value.  Used for counts.
+
+    XD_END
+  Special type indicating the end of the array.
+
+
+  Special macros:
+    XD_INDIRECT(line)
+  Usable where a "count" or "size" is requested.  Gives the value of the element
+  which is at line number 'line' in the description (count starts at zero).
+
+    XD_PARENT_INDIRECT(line)
+  Same as XD_INDIRECT but the element number refers to the parent structure.
+  Usable only in struct descriptions.
+*/
+
+enum lrecord_description_type {
+  XD_LISP_OBJECT,
+  XD_STRING_DATA,
+  XD_OPAQUE_PTR,
+  XD_STRUCT_PTR,
+  XD_OPAQUE_DATA_PTR,
+  XD_SIZE_T,
+  XD_INT,
+  XD_LONG,
+  XD_END
+};
+
+struct lrecord_description {
+  enum lrecord_description_type type;
+  int offset;
+  EMACS_INT data1;
+  const struct struct_description *data2;
+};
+
+struct struct_description {
+  size_t size;
+  const struct lrecord_description *description;
+};
+
+#define XD_INDIRECT(count) (-1-(count))
+#define XD_PARENT_INDIRECT(count) (-1000-(count))
+
+#define XD_DYNARR_DESC(base_type, sub_desc) \
+  { XD_STRUCT_PTR, offsetof(base_type, base), XD_INDIRECT(1), sub_desc }, \
+  { XD_INT,        offsetof(base_type, max) }
 
 /* Declaring the following structures as const puts them in the
    text (read-only) segment, which makes debugging inconvenient
@@ -220,29 +319,29 @@
 # define DECLARE_ERROR_CHECK_TYPECHECK(c_name, structtype)
 #endif
 
-#define DEFINE_BASIC_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,structtype) \
-DEFINE_BASIC_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,0,0,0,0,structtype)
+#define DEFINE_BASIC_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
+DEFINE_BASIC_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,0,0,0,0,structtype)
 
-#define DEFINE_BASIC_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,structtype) \
-MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,sizeof(structtype),0,1,structtype)
+#define DEFINE_BASIC_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,structtype) \
+MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,sizeof(structtype),0,1,structtype)
 
-#define DEFINE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,structtype) \
-DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,0,0,0,0,structtype)
+#define DEFINE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,structtype) \
+DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,0,0,0,0,structtype)
 
-#define DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,structtype) \
-MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,sizeof (structtype),0,0,structtype)
+#define DEFINE_LRECORD_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,structtype) \
+MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,sizeof (structtype),0,0,structtype)
 
-#define DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,sizer,structtype) \
-DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,0,0,0,0,sizer,structtype)
+#define DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,sizer,structtype) \
+DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,0,0,0,0,sizer,structtype)
 
-#define DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,sizer,structtype) \
-MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,0,sizer,0,structtype) \
+#define DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION_WITH_PROPS(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,sizer,structtype) \
+MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,0,sizer,0,structtype) \
 
-#define MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,getprop,putprop,remprop,props,size,sizer,basic_p,structtype) \
+#define MAKE_LRECORD_IMPLEMENTATION(name,c_name,marker,printer,nuker,equal,hash,desc,getprop,putprop,remprop,props,size,sizer,basic_p,structtype) \
 DECLARE_ERROR_CHECK_TYPECHECK(c_name, structtype)			\
 static int lrecord_##c_name##_lrecord_type_index;			\
 CONST_IF_NOT_DEBUG struct lrecord_implementation lrecord_##c_name =	\
-  { name, marker, printer, nuker, equal, hash,				\
+  { name, marker, printer, nuker, equal, hash, desc,			\
     getprop, putprop, remprop, props, size, sizer,			\
     &(lrecord_##c_name##_lrecord_type_index), basic_p }			\
 
--- a/src/lstream.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/lstream.c	Mon Aug 13 11:24:09 2007 +0200
@@ -188,7 +188,7 @@
 
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("stream", lstream,
 					mark_lstream, print_lstream,
-					finalize_lstream, 0, 0,
+					finalize_lstream, 0, 0, 0,
 					sizeof_lstream, Lstream);
 
 void
--- a/src/marker.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/marker.c	Mon Aug 13 11:24:09 2007 +0200
@@ -95,9 +95,14 @@
   return hash;
 }
 
+static const struct lrecord_description marker_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Marker, next), 3 },
+  { XD_END }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("marker", marker,
 				     mark_marker, print_marker, 0,
-				     marker_equal, marker_hash,
+				     marker_equal, marker_hash, marker_description,
 				     struct Lisp_Marker);
 
 /* Operations on markers. */
--- a/src/menubar-msw.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/menubar-msw.c	Mon Aug 13 11:24:09 2007 +0200
@@ -116,8 +116,6 @@
 #define MENU_ITEM_ID_BITS(x) (((x) & 0x7FFF) | 0x8000)
 static HMENU top_level_menu;
 
-#define MAX_MENUITEM_LENGTH 128
-
 /*
  * This returns Windows-style menu item string:
  * "Left Flush\tRight Flush"
--- a/src/menubar-x.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/menubar-x.c	Mon Aug 13 11:24:09 2007 +0200
@@ -131,7 +131,8 @@
     }
   else if (VECTORP (desc))
     {
-      if (!button_item_to_widget_value (desc, wv, 1,
+      Lisp_Object gui_item = gui_parse_item_keywords (desc);
+      if (!button_item_to_widget_value (gui_item, wv, 1,
 					(menu_type == MENUBAR_TYPE
 					 && depth <= 1)))
 	{
@@ -157,7 +158,7 @@
 	  wv->enabled = 1;
 	  wv->name = (char *) XSTRING_DATA (LISP_GETTEXT (XCAR (desc)));
 
-	  accel = menu_name_to_accelerator (wv->name);
+	  accel = gui_name_accelerator (LISP_GETTEXT (XCAR (desc)));
 	  wv->accel = LISP_TO_VOID (accel);
 
 	  desc = Fcdr (desc);
--- a/src/mule-charset.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/mule-charset.c	Mon Aug 13 11:24:09 2007 +0200
@@ -441,8 +441,13 @@
   write_c_string (buf, printcharfun);
 }
 
+static const struct lrecord_description charset_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Charset, name), 7 },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("charset", charset,
-                               mark_charset, print_charset, 0, 0, 0,
+                               mark_charset, print_charset, 0, 0, 0, charset_description,
 			       struct Lisp_Charset);
 /* Make a new charset. */
 
--- a/src/nt.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/nt.c	Mon Aug 13 11:24:09 2007 +0200
@@ -43,7 +43,6 @@
 #include <io.h>
 #include <pwd.h>
 #include <signal.h>
-#include <stddef.h> /* for offsetof */
 #include <string.h>
 #include <stdlib.h>
 #include <stdio.h>
--- a/src/objects.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/objects.c	Mon Aug 13 11:24:09 2007 +0200
@@ -127,7 +127,7 @@
 DEFINE_LRECORD_IMPLEMENTATION ("color-instance", color_instance,
 			       mark_color_instance, print_color_instance,
 			       finalize_color_instance, color_instance_equal,
-			       color_instance_hash,
+			       color_instance_hash, 0,
 			       struct Lisp_Color_Instance);
 
 DEFUN ("make-color-instance", Fmake_color_instance, 1, 3, 0, /*
@@ -301,7 +301,7 @@
 DEFINE_LRECORD_IMPLEMENTATION ("font-instance", font_instance,
 			       mark_font_instance, print_font_instance,
 			       finalize_font_instance, font_instance_equal,
-			       font_instance_hash, struct Lisp_Font_Instance);
+			       font_instance_hash, 0, struct Lisp_Font_Instance);
 
 DEFUN ("make-font-instance", Fmake_font_instance, 1, 3, 0, /*
 Return a new `font-instance' object named NAME.
--- a/src/opaque.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/opaque.c	Mon Aug 13 11:24:09 2007 +0200
@@ -42,7 +42,6 @@
 #include <config.h>
 #include "lisp.h"
 #include "opaque.h"
-#include <stddef.h>
 
 Lisp_Object Qopaquep;
 
@@ -176,7 +175,7 @@
 
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("opaque", opaque,
 					mark_opaque, print_opaque, 0,
-					equal_opaque, hash_opaque,
+					equal_opaque, hash_opaque, 0,
 					sizeof_opaque, Lisp_Opaque);
 
 static Lisp_Object
@@ -206,7 +205,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("opaque-list", opaque_list,
 			       mark_opaque_list, internal_object_printer,
-			       0, 0, 0, Lisp_Opaque_List);
+			       0, 0, 0, 0, Lisp_Opaque_List);
 
 Lisp_Object
 allocate_managed_opaque (Lisp_Object opaque_list, CONST void *data)
--- a/src/paths.h.in	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/paths.h.in	Mon Aug 13 11:24:09 2007 +0200
@@ -65,9 +65,13 @@
 
 #define PATH_VERSION "@version@"
 
+#ifdef EXEC_PREFIX_USER_DEFINED
 #define PATH_EXEC_PREFIX "@EXEC_PREFIX@"
+#endif
 
+#ifdef PREFIX_USER_DEFINED
 #define PATH_PREFIX "@PREFIX@"
+#endif
 
 #ifdef LISPDIR_USER_DEFINED
 #define  PATH_LOADSEARCH "@LISPDIR@"
@@ -101,6 +105,10 @@
 #define PATH_LOCK "@LOCKDIR@"
 #endif
 
+#ifdef DOCDIR_USER_DEFINED
+#define PATH_DOC "@DOCDIR@"
+#endif
+
 #ifdef INFODIR_USER_DEFINED
 #define PATH_INFO "@INFODIR@"
 #endif
--- a/src/process.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/process.c	Mon Aug 13 11:24:09 2007 +0200
@@ -186,7 +186,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("process", process,
                                mark_process, print_process, finalize_process,
-                               0, 0, struct Lisp_Process);
+                               0, 0, 0, struct Lisp_Process);
 
 /************************************************************************/
 /*                       basic process accessors                        */
--- a/src/rangetab.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/rangetab.c	Mon Aug 13 11:24:09 2007 +0200
@@ -134,7 +134,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("range-table", range_table,
                                mark_range_table, print_range_table, 0,
-			       range_table_equal, range_table_hash,
+			       range_table_equal, range_table_hash, 0,
 			       struct Lisp_Range_Table);
 
 /************************************************************************/
--- a/src/redisplay-x.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/redisplay-x.c	Mon Aug 13 11:24:09 2007 +0200
@@ -840,10 +840,11 @@
       cachel = WINDOW_FACE_CACHEL (w, findex);
     }
 
-#ifdef HAVE_XIM
+#if defined(HAVE_XIM) && defined(XIM_XLIB)
   if (cursor && focus && (cursor_start == clip_start) && cursor_height)
-    XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
-#endif /* HAVE_XIM */
+    if (FRAME_X_XIC(f))
+      XIM_SetSpotLocation (f, xpos - 2, dl->ypos + dl->descent - 2);
+#endif /* HAVE_XIM && XIM_XLIB */
 
   bg_pmap = cachel->background_pixmap;
   if (!IMAGE_INSTANCEP (bg_pmap)
@@ -2068,8 +2069,9 @@
 
   if (focus)
     {
-#ifdef HAVE_XIM
-      XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
+#if defined(HAVE_XIM) && defined(XIM_XLIB)
+      if (FRAME_X_XIC(f))
+	XIM_SetSpotLocation (f, x - 2 , cursor_y + cursor_height - 2);
 #endif /* HAVE_XIM */
 
       if (NILP (bar_cursor_value))
--- a/src/s/cygwin32.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/s/cygwin32.h	Mon Aug 13 11:24:09 2007 +0200
@@ -38,7 +38,7 @@
  * YMMV. I build with NT4 SP3.
  *
  * Andy Piper <andy@xemacs.org> 8/1/98 
- * http://www.parallax.co.uk/~andyp */
+ * http://www.xemacs.freeserve.co.uk/ */
 
 /* cheesy way to determine cygwin version */
 #ifndef NOT_C_CODE
--- a/src/s/linux.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/s/linux.h	Mon Aug 13 11:24:09 2007 +0200
@@ -26,6 +26,12 @@
 #define USG
 #define LINUX
 
+/* powerpc gcc 2.8.0 doesn't define __ELF__, but it is */
+
+#if defined(__ELF__) || defined(powerpc)
+#define LINUX_ELF
+#endif
+
 /* SYSTEM_TYPE should indicate the kind of system you are using.
  It sets the Lisp variable system-type.  */
 
@@ -81,7 +87,7 @@
 /* Ask GCC where to find libgcc.a.  */
 #define LIB_GCC "`$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`"
 
-#ifndef __ELF__
+#ifndef LINUX_ELF
 /* Linux has crt0.o in a non-standard place */
 #define START_FILES "pre-crt0.o /usr/lib/crt0.o"
 #else
@@ -106,7 +112,7 @@
 /* Best not to include -lg, unless it is last on the command line */
 #define LIBS_DEBUG
 #define LIBS_TERMCAP "-ltermcap -lcurses" /* save some space with shared libs*/
-#ifndef __ELF__
+#ifndef LINUX_ELF
 #define LIB_STANDARD "-lc" /* avoid -lPW */
 #else
 /*#undef LIB_GCC
@@ -124,7 +130,7 @@
 #define LIBS_SYSTEM
 #endif
 
-#ifdef __ELF__
+#ifdef LINUX_ELF
 #define UNEXEC "unexelf.o"
 #define UNEXEC_USE_MAP_PRIVATE
 #if 0
@@ -142,7 +148,7 @@
 #undef START_FILES
 #undef LIB_GCC
 #endif
-#endif /* __ELF__ */
+#endif /* LINUX_ELF */
 
 #ifdef LINUX_QMAGIC
 
--- a/src/sheap.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/sheap.c	Mon Aug 13 11:24:09 2007 +0200
@@ -21,7 +21,6 @@
 #include <config.h>
 #include <stdio.h>
 #include "lisp.h"
-#include <stddef.h>
 #include <unistd.h>
 #include <sheap-adjust.h>
 
--- a/src/specifier.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/specifier.c	Mon Aug 13 11:24:09 2007 +0200
@@ -347,7 +347,7 @@
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("specifier", specifier,
 					mark_specifier, print_specifier,
 					finalize_specifier,
-					specifier_equal, specifier_hash,
+					specifier_equal, specifier_hash, 0,
 					sizeof_specifier,
 					struct Lisp_Specifier);
 
--- a/src/symbols.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/symbols.c	Mon Aug 13 11:24:09 2007 +0200
@@ -108,9 +108,13 @@
   }
 }
 
+static const struct lrecord_description symbol_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct Lisp_Symbol, next), 5 }
+};
+
 DEFINE_BASIC_LRECORD_IMPLEMENTATION ("symbol", symbol,
 				     mark_symbol, print_symbol, 0, 0, 0,
-				     struct Lisp_Symbol);
+				     symbol_description, struct Lisp_Symbol);
 
 
 /**********************************************************************/
@@ -952,28 +956,46 @@
   write_c_string (buf, printcharfun);
 }
 
+static const struct lrecord_description symbol_value_buffer_local_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct symbol_value_buffer_local, default_value), 4 },
+  { XD_END }
+};
+
+static const struct lrecord_description symbol_value_lisp_magic_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct symbol_value_lisp_magic, handler), 2*MAGIC_HANDLER_MAX+1 },
+  { XD_END }
+};
+
+static const struct lrecord_description symbol_value_varalias_description[] = {
+  { XD_LISP_OBJECT, offsetof(struct symbol_value_varalias, aliasee), 2 },
+  { XD_END }
+};
+
 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-forward",
 			       symbol_value_forward,
 			       this_one_is_unmarkable,
-			       print_symbol_value_magic, 0, 0, 0,
+			       print_symbol_value_magic, 0, 0, 0, 0,
 			       struct symbol_value_forward);
 
 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-buffer-local",
 			       symbol_value_buffer_local,
 			       mark_symbol_value_buffer_local,
 			       print_symbol_value_magic, 0, 0, 0,
+			       symbol_value_buffer_local_description,
 			       struct symbol_value_buffer_local);
 
 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-lisp-magic",
 			       symbol_value_lisp_magic,
 			       mark_symbol_value_lisp_magic,
 			       print_symbol_value_magic, 0, 0, 0,
+			       symbol_value_lisp_magic_description,
 			       struct symbol_value_lisp_magic);
 
 DEFINE_LRECORD_IMPLEMENTATION ("symbol-value-varalias",
 			       symbol_value_varalias,
 			       mark_symbol_value_varalias,
 			       print_symbol_value_magic, 0, 0, 0,
+			       symbol_value_varalias_description,
 			       struct symbol_value_varalias);
 
 
--- a/src/symeval.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/symeval.h	Mon Aug 13 11:24:09 2007 +0200
@@ -293,7 +293,7 @@
 
 void defvar_magic (CONST char *symbol_name, CONST struct symbol_value_forward *magic);
 
-#define symbol_value_forward_lheader_initializer { 1, { 0, 0, 0 } }
+#define symbol_value_forward_lheader_initializer { 1, 0, 0, 0 }
 
 #define DEFVAR_SYMVAL_FWD(lname, c_location, forward_type, magicfun) do {	\
   static CONST_IF_NOT_DEBUG struct symbol_value_forward I_hate_C		\
--- a/src/symsinit.h	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/symsinit.h	Mon Aug 13 11:24:09 2007 +0200
@@ -200,6 +200,7 @@
 void image_instantiator_format_create_glyphs_widget (void);
 void image_instantiator_format_create_glyphs_x (void);
 void image_instantiator_format_create_glyphs_mswindows (void);
+void image_instantiator_format_create_glyphs_tty (void);
 
 /* Initialize the lstream types (dump-time only). */
 
--- a/src/syntax.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/syntax.c	Mon Aug 13 11:24:09 2007 +0200
@@ -53,6 +53,7 @@
 two such characters.  */
 
 /* Mule 2.4 doesn't seem to have Sextword - I'm removing it -- mrb */
+/* Recovered by tomo */
 
 Lisp_Object Qsyntax_table_p;
 
@@ -326,7 +327,17 @@
 }
 
 
+#ifdef MULE
+/* Return 1 if there is a word boundary between two word-constituent
+   characters C1 and C2 if they appear in this order, else return 0.
+   There is no word boundary between two word-constituent ASCII
+   characters.  */
+#define WORD_BOUNDARY_P(c1, c2)			\
+  (!(CHAR_ASCII_P (c1) && CHAR_ASCII_P (c2))	\
+   && word_boundary_p (c1, c2))
 
+extern int word_boundary_p (Emchar c1, Emchar c2);
+#else
 static int
 word_constituent_p (struct buffer *buf, Bufpos pos,
 		    struct Lisp_Char_Table *tab)
@@ -336,6 +347,7 @@
 	   (code == Sescape || code == Scharquote))
 	  || (code == Sword));
 }
+#endif
 
 /* Return the position across COUNT words from FROM.
    If that many words cannot be found before the end of the buffer, return 0.
@@ -346,6 +358,11 @@
 {
   Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf);
   struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table);
+#ifdef MULE
+  Emchar ch0, ch1;
+  enum syntaxcode code;
+#endif
+
   while (count > 0)
     {
       QUIT;
@@ -354,15 +371,40 @@
 	{
 	  if (from == limit)
 	    return 0;
+#ifdef MULE
+	  ch0 = BUF_FETCH_CHAR (buf, from);
+	  code = SYNTAX_UNSAFE (mirrortab, ch0);
+#else
 	  if (word_constituent_p (buf, from, mirrortab))
 	    break;
+#endif
 	  from++;
+#ifdef MULE
+	  if (words_include_escapes
+	      && (code == Sescape || code == Scharquote))
+	    break;
+	  if (code == Sword)
+	    break;
+#endif
 	}
 
       QUIT;
 
-      while ((from != limit) && word_constituent_p (buf, from, mirrortab))
+      while ((from != limit)
+#ifndef MULE
+	     && word_constituent_p (buf, from, mirrortab)
+#endif
+	     )
 	{
+#ifdef MULE
+	  ch1 = BUF_FETCH_CHAR (buf, from);
+	  code = SYNTAX_UNSAFE (mirrortab, ch1);
+	  if (!(words_include_escapes
+		&& (code == Sescape || code == Scharquote)))
+	    if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
+	      break;
+	  ch0 = ch1;
+#endif
 	  from++;
 	}
       count--;
@@ -376,15 +418,39 @@
 	{
 	  if (from == limit)
 	    return 0;
+#ifndef MULE
 	  if (word_constituent_p (buf, from - 1, mirrortab))
 	    break;
+#endif
 	  from--;
+#ifdef MULE
+	  ch1 = BUF_FETCH_CHAR (buf, from - 1);
+	  code = SYNTAX_UNSAFE (mirrortab, ch1);
+	  if (words_include_escapes
+	      && (code == Sescape || code == Scharquote))
+	    break;
+	  if (code == Sword)
+	    break;
+#endif
 	}
 
       QUIT;
 
-      while ((from != limit) && word_constituent_p (buf, from - 1, mirrortab))
+      while ((from != limit)
+#ifndef MULE
+	     && word_constituent_p (buf, from - 1, mirrortab)
+#endif
+	     )
 	{
+#ifdef MULE
+	  ch0 = BUF_FETCH_CHAR (buf, from - 1);
+	  code = SYNTAX_UNSAFE (mirrortab, ch0);
+	  if (!(words_include_escapes
+		&& (code == Sescape || code == Scharquote)))
+	    if (code != Sword || WORD_BOUNDARY_P (ch0, ch1))
+	      break;
+	  ch1 = ch0;
+#endif
 	  from--;
 	}
       count++;
--- a/src/sysdep.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/sysdep.c	Mon Aug 13 11:24:09 2007 +0200
@@ -50,7 +50,6 @@
 
 #include "lisp.h"
 
-#include <stddef.h>
 #include <stdlib.h>
 
 /* ------------------------------- */
--- a/src/toolbar.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/toolbar.c	Mon Aug 13 11:24:09 2007 +0200
@@ -90,7 +90,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("toolbar-button", toolbar_button,
 			       mark_toolbar_button, print_toolbar_button,
-			       0, 0, 0,
+			       0, 0, 0, 0,
 			       struct toolbar_button);
 
 DEFUN ("toolbar-button-p", Ftoolbar_button_p, 1, 1, 0, /*
--- a/src/tooltalk.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/tooltalk.c	Mon Aug 13 11:24:09 2007 +0200
@@ -175,7 +175,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-message", tooltalk_message,
                                mark_tooltalk_message, print_tooltalk_message,
-                               0, 0, 0,
+                               0, 0, 0, 0,
 			       struct Lisp_Tooltalk_Message);
 
 static Lisp_Object
@@ -249,7 +249,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("tooltalk-pattern", tooltalk_pattern,
                                mark_tooltalk_pattern, print_tooltalk_pattern,
-                               0, 0, 0,
+                               0, 0, 0, 0,
 			       struct Lisp_Tooltalk_Pattern);
 
 static Lisp_Object
@@ -1256,7 +1256,28 @@
   Lisp_Object lp;
   Lisp_Object fil;
 
+
+  /* tt_open() messes with our signal handler flags (at least when no 
+     ttsessions is running on the machine), therefore we save the 
+     actions and restore them after the call */
+#ifdef HAVE_SIGPROCMASK
+  {
+    struct sigaction ActSIGQUIT;
+    struct sigaction ActSIGINT;
+    struct sigaction ActSIGCHLD;
+    sigaction (SIGQUIT, NULL, &ActSIGQUIT);
+    sigaction (SIGINT, NULL, &ActSIGINT);
+    sigaction (SIGCHLD, NULL, &ActSIGCHLD);
+#endif
   retval = tt_open ();
+#ifdef HAVE_SIGPROCMASK
+    sigaction (SIGQUIT, &ActSIGQUIT, NULL);
+    sigaction (SIGINT, &ActSIGINT, NULL);
+    sigaction (SIGCHLD, &ActSIGCHLD, NULL);
+  }
+#endif
+
+
   if (tt_ptr_error (retval) != TT_OK)
     return;
 
--- a/src/window.c	Mon Aug 13 11:23:14 2007 +0200
+++ b/src/window.c	Mon Aug 13 11:24:09 2007 +0200
@@ -231,7 +231,7 @@
 
 DEFINE_LRECORD_IMPLEMENTATION ("window", window,
                                mark_window, print_window, finalize_window,
-			       0, 0, struct window);
+			       0, 0, 0, struct window);
 
 
 #define INIT_DISP_VARIABLE(field, initialization)	\
@@ -4711,7 +4711,7 @@
 					window_configuration,
 					mark_window_config,
 					print_window_config,
-					0, 0, 0, sizeof_window_config,
+					0, 0, 0, 0, sizeof_window_config,
 					struct window_config);
 
 
--- a/tests/ChangeLog	Mon Aug 13 11:23:14 2007 +0200
+++ b/tests/ChangeLog	Mon Aug 13 11:24:09 2007 +0200
@@ -1,3 +1,7 @@
+1999-07-13  XEmacs Build Bot <builds@cvs.xemacs.org>
+
+	* XEmacs 21.2.18 is released
+
 1999-06-22  XEmacs Build Bot <builds@cvs.xemacs.org>
 
 	* XEmacs 21.2.17 is released
--- a/tests/glyph-test.el	Mon Aug 13 11:23:14 2007 +0200
+++ b/tests/glyph-test.el	Mon Aug 13 11:24:09 2007 +0200
@@ -17,43 +17,56 @@
  (make-extent (point) (point))
  (make-glyph [button :descriptor ["ok" (setq ok-select nil) :style radio 
 				  :selected (not ok-select)]]))
+;; toggle button
+(set-extent-begin-glyph 
+ (make-extent (point) (point))
+ (setq tbutton
+       (make-glyph [button :descriptor ["ok" (setq ok-select nil) 
+					:style toggle 
+					:selected (not ok-select)]])))
+(set-extent-begin-glyph 
+ (make-extent (point) (point))
+ (make-glyph [button :descriptor ["ok" :style toggle 
+				  :callback 
+				  (setq ok-select (not ok-select))
+				  :selected ok-select]]))
+
 ;; normal pushbutton
 (set-extent-begin-glyph 
  (make-extent (point) (point))
  (setq pbutton (make-glyph 
-		[button :width 10 :height 2 
+		[button :width 10 :height 2
 			:face modeline-mousable
 			:descriptor "ok" :callback foo 
 			:selected t])))
-
 ;; tree view
 (set-extent-begin-glyph 
  (make-extent (point) (point))
  (setq tree (make-glyph 
-	       [tree :width 10
-		     :descriptor "My Tree"
-		     :properties (:items (["One" foo]
-					  (["Two" foo]
-					   ["Four" foo]
-					   "Six")
-					  "Three"))])))
+	     [tree-view :width 10
+			:descriptor "My Tree"
+			:properties (:items (["One" foo]
+					     (["Two" foo]
+					      ["Four" foo]
+					      "Six")
+					     "Three"))])))
 
 ;; tab control
 (set-extent-begin-glyph 
  (make-extent (point) (point))
  (setq tab (make-glyph 
-	    [tab :descriptor "My Tab"
-		 :face default
-		 :properties (:items (["One" foo]
-				      ["Two" foo]
-				      ["Three" foo]))])))
+	    [tab-control :descriptor "My Tab"
+			 :face default
+			 :properties (:items (["One" foo]
+					      ["Two" foo]
+					      ["Three" foo]))])))
 
 ;; progress gauge
 (set-extent-begin-glyph 
  (make-extent (point) (point))
  (setq pgauge (make-glyph 
-	       [progress :width 10 :height 2 
-			 :descriptor "ok"])))
+	       [progress-gauge :width 10 :height 2 
+			       :descriptor "ok"])))
 ;; progress the progress ...
 (let ((x 0))
   (while (<= x 100)
@@ -65,8 +78,8 @@
 (setq global-mode-string 
       (cons (make-extent nil nil)
 	    (setq pg (make-glyph 
-		      [progress :width 5 :pixel-height 16
-				:descriptor "ok"]))))
+		      [progress-gauge :width 5 :pixel-height 16
+				      :descriptor "ok"]))))
 ;; progress the progress ...
 (let ((x 0))
   (while (<= x 100)
@@ -90,15 +103,15 @@
 ;; edit box
 (set-extent-begin-glyph 
  (make-extent (point) (point)) 
- (setq hedit (make-glyph [edit :pixel-width 50 :pixel-height 30
-			       :face bold-italic
-			       :descriptor ["Hello"]])))
+ (setq hedit (make-glyph [edit-field :pixel-width 50 :pixel-height 30
+				     :face bold-italic
+				     :descriptor ["Hello"]])))
 ;; combo box
 (set-extent-begin-glyph 
  (make-extent (point) (point))
  (setq hcombo (make-glyph 
-	       [combo :width 10 :height 3 :descriptor ["Hello"] 
-		      :properties (:items ("One" "Two" "Three"))])))
+	       [combo-box :width 10 :height 3 :descriptor ["Hello"] 
+			  :properties (:items ("One" "Two" "Three"))])))
 
 ;; line
 (set-extent-begin-glyph 
@@ -111,6 +124,6 @@
 ; (make-glyph [scrollbar :width 50 :height 20 :descriptor ["Hello"]]))
 
 ;; generic subwindow
-(setq sw (make-glyph [subwindow :pixel-width 50 :pixel-height 50]))
+(setq sw (make-glyph [subwindow :pixel-width 50 :pixel-height 70]))
 (set-extent-begin-glyph (make-extent (point) (point)) sw)
 
--- a/version.sh	Mon Aug 13 11:23:14 2007 +0200
+++ b/version.sh	Mon Aug 13 11:24:09 2007 +0200
@@ -2,8 +2,8 @@
 emacs_is_beta=t
 emacs_major_version=21
 emacs_minor_version=2
-emacs_beta_version=17
-xemacs_codename="Chiyoda"
+emacs_beta_version=18
+xemacs_codename="Toshima"
 infodock_major_version=4
 infodock_minor_version=0
 infodock_build_version=7