changeset 276:6330739388db r21-0b36

Import from CVS: tag r21-0b36
author cvs
date Mon, 13 Aug 2007 10:30:37 +0200
parents a68ae4439f57
children cfdf3ff11843
files CHANGES-beta ChangeLog INSTALL Makefile.in PROBLEMS README configure configure.in configure.usage etc/NEWS etc/PACKAGES etc/refcard.tex etc/xemacs.1 info/dir lib-src/ChangeLog lib-src/Makefile.in.in lib-src/config.values.in lib-src/etags-vmslib.c lib-src/etags.c lib-src/installexe.sh lib-src/update-autoloads.sh lib-src/update-custom.sh lisp/ChangeLog lisp/README lisp/auto-autoloads.el lisp/byte-optimize.el lisp/bytecomp-runtime.el lisp/cmdloop.el lisp/custom-load.el lisp/dump-paths.el lisp/dumped-lisp.el lisp/files.el lisp/find-paths.el lisp/gnuserv.el lisp/keymap.el lisp/ldap.el lisp/loadup.el lisp/msw-init.el lisp/obsolete.el lisp/package-get.el lisp/packages.el lisp/scrollbar.el lisp/setup-paths.el lisp/startup.el lisp/toolbar.el lisp/update-elc.el lisp/wid-edit.el man/cl.texi man/lispref/lispref.texi man/xemacs-faq.texi man/xemacs/custom.texi nt/ChangeLog nt/README nt/xemacs.mak nt/xpm.mak src/ChangeLog src/Makefile.in.in src/buffer.c src/callproc.c src/casetab.c src/cmds.c src/config.h.in src/console-msw.h src/data.c src/depend src/device-x.c src/dired.c src/dll.c src/doprnt.c src/eldap.c src/eldap.h src/emacs.c src/event-msw.c src/event-stream.c src/extents.c src/fileio.c src/fns.c src/frame-msw.c src/glyphs-msw.c src/glyphs-x.c src/glyphs.c src/glyphs.h src/indent.c src/lisp.h src/md5.c src/mem-limits.h src/menubar-msw.c src/menubar-msw.h src/mule-ccl.c src/objects-msw.c src/paths.h.in src/paths.h.in.in src/ppc.ldscript src/print.c src/process-nt.c src/redisplay-msw.c src/redisplay.c src/s/aix3-2-5.h src/s/aix4-1.h src/s/aix4-2.h src/s/bsd386.h src/s/bsdos2-1.h src/s/dgux.h src/s/esix.h src/s/esix5r4.h src/s/hpux8.h src/s/hpux9-shr.h src/s/hpux9-x11r4.h src/s/hpux9.h src/s/hpux9shxr4.h src/s/isc3-0.h src/s/isc4-0.h src/s/linux.h src/s/ptx.h src/s/sco4.h src/s/sco5.h src/s/usg5-3.h src/s/usg5-4-2.h src/s/usg5-4.h src/scrollbar-msw.c src/scrollbar.c src/signal.c src/specifier.c src/specifier.h src/symsinit.h src/sysdll.c src/toolbar-msw.c src/toolbar.c src/toolbar.h src/tooltalk.c src/window.c version.sh
diffstat 132 files changed, 5941 insertions(+), 3370 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 10:29:43 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 10:30:37 2007 +0200
@@ -1,4 +1,30 @@
 							-*- indented-text -*-
+to 21.0 beta36 "Philippine"
+-- Xpm for MS Windows from Jonathan Harris
+-- print stream fix from Hrvoje Niksic
+-- etags.c fix from Andreas Jaeger
+-- dll fixes from Hrvoje Niksic
+-- etags.c synched with InfoDock
+-- ghost specifiers from Kirill Katsnelson
+-- DLL fix from Hrvoje Niksic
+-- cygwin installation fix from Andy Piper
+-- cygwin process fix from Andy Piper
+-- More startup changes from Michael Sperber
+-- new version of LDAP code from Oscar Figueiredo
+-- path debugging patches from Michael Sperber
+-- more fixes from Hrvoje Niksic
+-- miscellaneous patches from Kirill Katsnelson
+-- Toolbar support for MS Windows from Andy Piper
+-- Changes by FUKUI Kaoru for PPC/Linux
+-- various fixes from Martin Buchholz
+-- various patches from Hrvoje Niksic
+-- s/*.h cleanup from Olivier Galibert
+-- display fixes from Greg Klanderman
+-- More MS Windows process patches from Kirill Katsnelson
+-- More path searching fixes from Michael Sperber
+-- path searching changes from Michael Sperber
+-- MS Windows fixes from Kirill Katsnelson
+
 to 21.0 beta35 "Peacock Goat"
 -- info fixes from Oscar Figueiredo
 -- Various fixes from Hrvoje Niksic
@@ -11,7 +37,7 @@
 -- glyphs-x.c cleanup from Colin Rafferty
 -- MS windows fixes from Kirill Katsnelson
 -- toolbar clean up from Jeff Miller
--- Hunt the Wumpus 64 bit cleanness patches from Oliver Graf
+-- Hunt the Wumpus 64 bit cleanness patches from Olivier Galibert
 -- miscellaneous bug fixes
 -- info updates from Oscar Figueiredo
 -- Various patches from Andreas Jaegar, Olivier Galibert, Karl Hegbloom,
--- a/ChangeLog	Mon Aug 13 10:29:43 2007 +0200
+++ b/ChangeLog	Mon Aug 13 10:30:37 2007 +0200
@@ -1,3 +1,48 @@
+1998-04-18  SL Baur  <steve@altair.xemacs.org>
+
+	* XEmacs-21.0-beta36 is released.
+
+Fri Apr 17 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* configure.in: enable install pre-processing for mswindows
+
+Fri Apr 17 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+	
+	* Makefile.in.in: add install_pp to install incantation.
+
+	* installexe.sh: new file. Add .exe to install targets if the
+	result is executable.
+
+Fri Apr 17 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+	
+	* Makefile.in: add install_pp to install incantation.
+
+1998-04-14  Itay Ben-Yaacov <pezz@www-mail.huji.ac.il>
+
+	* configure.in: Large echo split into a few smaller ones,
+	so the cygnus sh.exe does not crash.
+
+Thu Apr 16 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* configure.in: enable toolbar checking for mswindows build
+
+1998-04-06  Martin Buchholz  <martin@xemacs.org>
+
+	* config.h.in: Add _SVID_SOURCE to list of xmkmf #defines.  
+	Used (at least) by RedHat 4.2.
+
+1998-04-11  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* etc/xemacs.1: -no-packages -> -no-early-packages.
+
+	* etc/NEWS: Clarified site-lisp status.
+
+	* configure.in: Re-instated src/paths.h generation from
+	src/paths.h.in.
+
+	* Makefile.in (top_distclean): Remove site-lisp on `make
+	distclean'.
+
 1998-04-10  SL Baur  <steve@altair.xemacs.org>
 
 	* XEmacs 21.0-beta35 is released.
--- a/INSTALL	Mon Aug 13 10:29:43 2007 +0200
+++ b/INSTALL	Mon Aug 13 10:30:37 2007 +0200
@@ -181,7 +181,7 @@
 - XEmacs (and the other utilities users run) go in PREFIXDIR/bin
   (unless the `--exec-prefix' option says otherwise).
 - The architecture-independent files go in PREFIXDIR/lib/xemacs-VERSION
-  (where VERSION is the version number of XEmacs, like `20.5').
+  (where VERSION is the version number of XEmacs, like `21.0').
 - The architecture-dependent files go in
   PREFIXDIR/lib/xemacs-VERSION/CONFIGURATION-NAME
   (where CONFIGURATION-NAME is the host type, like mips-dec-ultrix4.2),
--- a/Makefile.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/Makefile.in	Mon Aug 13 10:30:37 2007 +0200
@@ -181,7 +181,7 @@
 ## ==================== Utility Programs for the Build ====================
 
 ## Allow the user to specify the install program.
-INSTALL = @INSTALL@
+INSTALL = @install_pp@ @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
@@ -330,7 +330,7 @@
 src/config.h: ${srcdir}/src/config.h.in
 	./config.status && touch $@
 
-src/paths.h: ${srcdir}/src/paths.h.in.in
+src/paths.h: ${srcdir}/src/paths.h.in
 	./config.status && touch $@
 
 lwlib/config.h: ${srcdir}/lwlib/config.h.in
@@ -526,7 +526,7 @@
 	done ; \
 	$(RM) core .sbinit Makefile lock/*; \
 	$(RM) lisp/finder-inf.el* Installation.el Installation.elc; \
-	$(RM) packages mule-packages
+	$(RM) packages mule-packages site-lisp
 
 distclean: FRC.distclean
 	for d in $(SUBDIR); do (cd $$d && $(RECURSIVE_MAKE) $@); done
--- a/PROBLEMS	Mon Aug 13 10:29:43 2007 +0200
+++ b/PROBLEMS	Mon Aug 13 10:30:37 2007 +0200
@@ -1,7 +1,7 @@
 -*- mode:outline -*-
 This file describes various problems that have been encountered
 in compiling, installing and running XEmacs.  It has been updated for
-XEmacs 20.5.
+XEmacs 21.0.
 
 This file is large, but we have tried to sort the entries by their
 respective relevance for XEmacs, but may have not succeeded completely
@@ -276,7 +276,7 @@
 the emacstrs.sco is a suitable candidate for /usr/lib/keyboard/strings
 to take advantage of the keyboard map in emacskeys.sco.
 
-Note: Much of the above entry is probably not valid for XEmacs 20.5
+Note: Much of the above entry is probably not valid for XEmacs 21.0
 and later.
 
 ** Under some versions of OSF XEmacs runs fine if built without
@@ -866,7 +866,7 @@
   delayed until mid-june ;-). I think this problem will be an FAQ soon
   after the release otherwise.
 
-Note: The above entry is probably not valid for XEmacs 20.5 and
+Note: The above entry is probably not valid for XEmacs 21.0 and
 later.
 
 ** When Emacs tries to ring the bell, you get an error like
--- a/README	Mon Aug 13 10:29:43 2007 +0200
+++ b/README	Mon Aug 13 10:30:37 2007 +0200
@@ -1,4 +1,4 @@
-This directory tree holds version 20.5 of XEmacs, the extensible,
+This directory tree holds version 21.0 of XEmacs, the extensible,
 customizable, self-documenting real-time display editor.  This version
 of XEmacs also runs on various Microsoft Windows platforms including
 MS Windows '95 and MS Windows NT and Cygwin.
--- a/configure	Mon Aug 13 10:29:43 2007 +0200
+++ b/configure	Mon Aug 13 10:30:37 2007 +0200
@@ -219,6 +219,7 @@
 mandir='${prefix}/man/man1'
 infodir='${datadir}/xemacs-${version}/info'
 infopath=''
+install_pp=''
 lispdir='${datadir}/xemacs-${version}/lisp'
 sitelispdir='${datadir}/xemacs/site-lisp'
 pkgdir='${datadir}/xemacs-${version}/lisp'
@@ -726,7 +727,7 @@
 
 if test -z "$configuration"; then
   echo $ac_n "checking "host system type"""... $ac_c" 1>&6
-echo "configure:730: checking "host system type"" >&5
+echo "configure:731: checking "host system type"" >&5
     if configuration=`${CONFIG_SHELL-/bin/sh} $srcdir/config.guess | \
     sed 's/^\([^-][^-]*-[^-][^-]*-[^-][^-]*\)-.*$/\1/'` ; then
     echo "$ac_t""$configuration" 1>&6
@@ -740,7 +741,7 @@
 fi
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:744: checking whether ln -s works" >&5
+echo "configure:745: checking whether ln -s works" >&5
 
 rm -f conftestdata
 if ln -s X conftestdata 2>/dev/null
@@ -917,7 +918,7 @@
 
 
 echo "checking "the configuration name"" 1>&6
-echo "configure:921: checking "the configuration name"" >&5
+echo "configure:922: checking "the configuration name"" >&5
 internal_configuration=`echo $configuration | sed 's/-\(workshop\)//'`
 if canonical=`$srcdir/config.sub "$internal_configuration"` ; then : ; else
   exit $?
@@ -1381,7 +1382,7 @@
 # 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:1385: checking for $ac_word" >&5
+echo "configure:1386: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1407,7 +1408,7 @@
   # 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:1411: checking for $ac_word" >&5
+echo "configure:1412: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1452,7 +1453,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1456: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1457: 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'
@@ -1464,11 +1465,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1468 "configure"
+#line 1469 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1472: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1473: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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
@@ -1488,19 +1489,19 @@
   { 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:1492: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1493: 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:1497: checking whether we are using GNU C" >&5
+echo "configure:1498: 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:1504: \"$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:1505: \"$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
@@ -1514,7 +1515,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1518: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1519: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1543,7 +1544,7 @@
   # 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:1547: checking for $ac_word" >&5
+echo "configure:1548: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1569,7 +1570,7 @@
   # 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:1573: checking for $ac_word" >&5
+echo "configure:1574: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1614,7 +1615,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1618: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1619: 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'
@@ -1626,11 +1627,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1630 "configure"
+#line 1631 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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
@@ -1650,19 +1651,19 @@
   { 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:1654: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1655: 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:1659: checking whether we are using GNU C" >&5
+echo "configure:1660: 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:1666: \"$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:1667: \"$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
@@ -1676,7 +1677,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1680: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1681: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1705,7 +1706,7 @@
   # 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:1709: checking for $ac_word" >&5
+echo "configure:1710: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1731,7 +1732,7 @@
   # 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:1735: checking for $ac_word" >&5
+echo "configure:1736: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1776,7 +1777,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1780: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1781: 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'
@@ -1788,11 +1789,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1792 "configure"
+#line 1793 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; 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
@@ -1812,19 +1813,19 @@
   { 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:1816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1817: 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:1821: checking whether we are using GNU C" >&5
+echo "configure:1822: 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:1828: \"$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:1829: \"$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
@@ -1838,7 +1839,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1842: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1843: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1871,7 +1872,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:1875: checking how to run the C preprocessor" >&5
+echo "configure:1876: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1884,13 +1885,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1888 "configure"
+#line 1889 "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:1894: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1895: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1901,13 +1902,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1905 "configure"
+#line 1906 "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:1911: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1912: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1930,9 +1931,9 @@
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1934: checking for AIX" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1936 "configure"
+echo "configure:1935: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1937 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1959,9 +1960,9 @@
 
 
 echo $ac_n "checking for GNU libc""... $ac_c" 1>&6
-echo "configure:1963: checking for GNU libc" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1965 "configure"
+echo "configure:1964: checking for GNU libc" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1966 "configure"
 #include "confdefs.h"
 #include <features.h>
 int main() {
@@ -1973,7 +1974,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1977: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1978: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   have_glibc=yes
 else
@@ -1994,9 +1995,9 @@
 
 
 echo $ac_n "checking whether we are using SunPro C""... $ac_c" 1>&6
-echo "configure:1998: checking whether we are using SunPro C" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2000 "configure"
+echo "configure:1999: checking whether we are using SunPro C" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2001 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -2007,7 +2008,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2012: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   __sunpro_c=yes
 else
@@ -2030,6 +2031,8 @@
 
 
 
+echo > $tempcname
+
 echo '
 #define NOT_C_CODE
 #define C_SWITCH_SITE
@@ -2062,6 +2065,9 @@
 configure___ libs_standard=LIB_STANDARD
 
 
+' >> $tempcname
+echo '
+
 #ifndef OBJECTS_MACHINE
 #define OBJECTS_MACHINE
 #endif
@@ -2107,6 +2113,9 @@
 configure___ ld_switch_shared=LD_SWITCH_SHARED
 
 
+' >> $tempcname
+echo '
+
 #ifdef ORDINARY_LINK
 #define LD "$(CC) $(CFLAGS)"
 #else /* no ORDINARY LINK */
@@ -2133,6 +2142,9 @@
 configure___ ld_text_start_addr=LD_TEXT_START_ADDR
 
 
+' >> $tempcname
+echo '
+
 #if ! defined (ORDINARY_LINK) && !defined (START_FILES)
 #ifdef NO_REMAP
 #ifdef COFF_ENCAPSULATE
@@ -2180,7 +2192,7 @@
 #endif
 
 
-' > $tempcname
+' >> $tempcname
 CPP=`eval "echo $CPP"`
 eval `$CPP -Isrc $tempcname \
 	| sed -n -e "s/[ 	]*=[ 	\"]*/='/" -e "s/[ 	\"]*\$/'/" -e "s/^configure___//p"`
@@ -2270,7 +2282,7 @@
  fi
 
 echo $ac_n "checking for dynodump""... $ac_c" 1>&6
-echo "configure:2274: checking for dynodump" >&5
+echo "configure:2286: checking for dynodump" >&5
 if test "$unexec" != "unexsol2.o"; then
   echo "$ac_t""no" 1>&6
 else
@@ -2370,7 +2382,7 @@
 
 if test "$add_runtime_path" = "yes"; then
       echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6
-echo "configure:2374: checking "for runtime libraries flag"" >&5
+echo "configure:2386: checking "for runtime libraries flag"" >&5
   dash_r=""
   for try_dash_r in "-R" "-R " "-rpath "; do
     xe_check_libs="${try_dash_r}/no/such/file-or-directory"
@@ -2388,14 +2400,14 @@
   done
 fi
     cat > conftest.$ac_ext <<EOF
-#line 2392 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 2404 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   dash_r="$try_dash_r"
 else
@@ -2495,10 +2507,10 @@
 fi
 after_morecore_hook_exists=yes
 echo $ac_n "checking for malloc_get_state""... $ac_c" 1>&6
-echo "configure:2499: checking for malloc_get_state" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2502 "configure"
+echo "configure:2511: checking for malloc_get_state" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2514 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char malloc_get_state(); below.  */
@@ -2521,7 +2533,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2537: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_malloc_get_state=yes"
 else
@@ -2541,10 +2553,10 @@
 fi
 
 echo $ac_n "checking for malloc_set_state""... $ac_c" 1>&6
-echo "configure:2545: checking for malloc_set_state" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2548 "configure"
+echo "configure:2557: checking for malloc_set_state" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2560 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char malloc_set_state(); below.  */
@@ -2567,7 +2579,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:2571: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_malloc_set_state=yes"
 else
@@ -2587,16 +2599,16 @@
 fi
 
 echo $ac_n "checking whether __after_morecore_hook exists""... $ac_c" 1>&6
-echo "configure:2591: checking whether __after_morecore_hook exists" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2593 "configure"
+echo "configure:2603: checking whether __after_morecore_hook exists" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2605 "configure"
 #include "confdefs.h"
 extern void (* __after_morecore_hook)();
 int main() {
 __after_morecore_hook = 0
 ; return 0; }
 EOF
-if { (eval echo configure:2600: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
 else
@@ -2655,7 +2667,7 @@
 # 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:2659: checking for $ac_word" >&5
+echo "configure:2671: checking for $ac_word" >&5
 
 if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -2708,7 +2720,7 @@
 # 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:2712: checking for a BSD compatible install" >&5
+echo "configure:2724: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 
   IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
@@ -2759,7 +2771,7 @@
 # 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:2763: checking for $ac_word" >&5
+echo "configure:2775: checking for $ac_word" >&5
 
 if test -n "$YACC"; then
   ac_cv_prog_YACC="$YACC" # Let the user override the test.
@@ -2790,15 +2802,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2794: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2797 "configure"
+echo "configure:2806: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2809 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2814: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2831,15 +2843,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2835: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2838 "configure"
+echo "configure:2847: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2850 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2855: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2872,15 +2884,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2876: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2879 "configure"
+echo "configure:2888: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2891 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2884: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2910,10 +2922,10 @@
 done
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2914: checking for sys/wait.h that is POSIX.1 compatible" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2917 "configure"
+echo "configure:2926: checking for sys/wait.h that is POSIX.1 compatible" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2929 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -2929,7 +2941,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:2933: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -2953,10 +2965,10 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2957: checking for ANSI C header files" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2960 "configure"
+echo "configure:2969: checking for ANSI C header files" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2972 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2964,7 +2976,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2968: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2980: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2981,7 +2993,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 2985 "configure"
+#line 2997 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2999,7 +3011,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 3003 "configure"
+#line 3015 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -3017,7 +3029,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 3021 "configure"
+#line 3033 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -3028,7 +3040,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   :
 else
@@ -3053,10 +3065,10 @@
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3057: checking whether time.h and sys/time.h may both be included" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3060 "configure"
+echo "configure:3069: checking whether time.h and sys/time.h may both be included" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3072 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3065,7 +3077,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3069: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3089,10 +3101,10 @@
 fi
 
 echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:3093: checking for sys_siglist declaration in signal.h or unistd.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3096 "configure"
+echo "configure:3105: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3108 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3104,7 +3116,7 @@
 char *msg = *(sys_siglist + 1);
 ; return 0; }
 EOF
-if { (eval echo configure:3108: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_decl_sys_siglist=yes
 else
@@ -3129,9 +3141,9 @@
 
 
 echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
-echo "configure:3133: checking for struct utimbuf" >&5
-cat > conftest.$ac_ext <<EOF
-#line 3135 "configure"
+echo "configure:3145: checking for struct utimbuf" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3147 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -3150,7 +3162,7 @@
 static struct utimbuf x; x.actime = x.modtime;
 ; return 0; }
 EOF
-if { (eval echo configure:3154: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3166: \"$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
@@ -3170,10 +3182,10 @@
 rm -f conftest*
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:3174: checking return type of signal handlers" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3177 "configure"
+echo "configure:3186: checking return type of signal handlers" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3189 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -3190,7 +3202,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:3194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3206: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -3212,10 +3224,10 @@
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3216: checking for size_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3219 "configure"
+echo "configure:3228: checking for size_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3231 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3246,10 +3258,10 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:3250: checking for pid_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3253 "configure"
+echo "configure:3262: checking for pid_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3265 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3280,10 +3292,10 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:3284: checking for uid_t in sys/types.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3287 "configure"
+echo "configure:3296: checking for uid_t in sys/types.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3299 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3319,10 +3331,10 @@
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3323: checking for mode_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3326 "configure"
+echo "configure:3335: checking for mode_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3338 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3353,10 +3365,10 @@
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3357: checking for off_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3360 "configure"
+echo "configure:3369: checking for off_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3372 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3388,9 +3400,9 @@
 
 
 echo $ac_n "checking for struct timeval""... $ac_c" 1>&6
-echo "configure:3392: checking for struct timeval" >&5
-cat > conftest.$ac_ext <<EOF
-#line 3394 "configure"
+echo "configure:3404: checking for struct timeval" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3406 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -3406,7 +3418,7 @@
 static struct timeval x; x.tv_sec = x.tv_usec;
 ; return 0; }
 EOF
-if { (eval echo configure:3410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
   HAVE_TIMEVAL=yes
@@ -3428,10 +3440,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:3432: checking whether struct tm is in sys/time.h or time.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3435 "configure"
+echo "configure:3444: checking whether struct tm is in sys/time.h or time.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3447 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -3439,7 +3451,7 @@
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:3443: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -3463,10 +3475,10 @@
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3467: checking for tm_zone in struct tm" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3470 "configure"
+echo "configure:3479: checking for tm_zone in struct tm" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3482 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -3474,7 +3486,7 @@
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:3478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3490: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -3497,10 +3509,10 @@
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3501: checking for tzname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3504 "configure"
+echo "configure:3513: checking for tzname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3516 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -3510,7 +3522,7 @@
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:3514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -3536,10 +3548,10 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3540: checking for working const" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3543 "configure"
+echo "configure:3552: checking for working const" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3555 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3588,7 +3600,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3592: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3613,7 +3625,7 @@
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:3617: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:3629: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 
 cat > conftestmake <<\EOF
@@ -3638,12 +3650,12 @@
 
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3642: checking whether byte ordering is bigendian" >&5
+echo "configure:3654: 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 3647 "configure"
+#line 3659 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3654,11 +3666,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3658: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3670: \"$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 3662 "configure"
+#line 3674 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3669,7 +3681,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3673: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3685: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3686,7 +3698,7 @@
 rm -f conftest*
 if test $ac_cv_c_bigendian = unknown; then
 cat > conftest.$ac_ext <<EOF
-#line 3690 "configure"
+#line 3702 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3699,7 +3711,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3715: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_c_bigendian=no
 else
@@ -3725,10 +3737,10 @@
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:3729: checking size of short" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3732 "configure"
+echo "configure:3741: checking size of short" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3744 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3739,7 +3751,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -3766,10 +3778,10 @@
   exit 1
 fi
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:3770: checking size of int" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3773 "configure"
+echo "configure:3782: checking size of int" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3785 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3780,7 +3792,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3784: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -3801,10 +3813,10 @@
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:3805: checking size of long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3808 "configure"
+echo "configure:3817: checking size of long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3820 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3815,7 +3827,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3819: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -3836,10 +3848,10 @@
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:3840: checking size of long long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3843 "configure"
+echo "configure:3852: checking size of long long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3855 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3850,7 +3862,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3866: \"$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
@@ -3871,10 +3883,10 @@
 
 
 echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:3875: checking size of void *" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3878 "configure"
+echo "configure:3887: checking size of void *" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3890 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3885,7 +3897,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3889: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3901: \"$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
@@ -3907,7 +3919,7 @@
 
 
 echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:3911: checking for long file names" >&5
+echo "configure:3923: 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:
@@ -3954,12 +3966,12 @@
 
 
 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:3958: checking for sin in -lm" >&5
+echo "configure:3970: 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 3963 "configure"
+#line 3975 "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
@@ -3970,7 +3982,7 @@
 sin()
 ; return 0; }
 EOF
-if { (eval echo configure:3974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3986: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4012,14 +4024,14 @@
 
 
 cat > conftest.$ac_ext <<EOF
-#line 4016 "configure"
+#line 4028 "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:4023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4035: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_INVERSE_HYPERBOLIC
@@ -4036,7 +4048,7 @@
 rm -f conftest*
 
 echo "checking type of mail spool file locking" 1>&6
-echo "configure:4040: checking type of mail spool file locking" >&5
+echo "configure:4052: 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
@@ -4060,12 +4072,12 @@
 
 
 echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6
-echo "configure:4064: checking for kstat_open in -lkstat" >&5
+echo "configure:4076: 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 4069 "configure"
+#line 4081 "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
@@ -4076,7 +4088,7 @@
 kstat_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4092: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4110,12 +4122,12 @@
 
 
 echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
-echo "configure:4114: checking for kvm_read in -lkvm" >&5
+echo "configure:4126: 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 4119 "configure"
+#line 4131 "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
@@ -4126,7 +4138,7 @@
 kvm_read()
 ; return 0; }
 EOF
-if { (eval echo configure:4130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4160,12 +4172,12 @@
 
 
 echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6
-echo "configure:4164: checking for cma_open in -lpthreads" >&5
+echo "configure:4176: 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 4169 "configure"
+#line 4181 "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
@@ -4176,7 +4188,7 @@
 cma_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4180: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4212,7 +4224,7 @@
 fi
 
 echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6
-echo "configure:4216: checking whether the -xildoff compiler flag is required" >&5
+echo "configure:4228: 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;
@@ -4223,7 +4235,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:4227: checking for \"-z ignore\" linker flag" >&5
+echo "configure:4239: 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 ;;
@@ -4233,7 +4245,7 @@
 
 
 echo "checking "for specified window system"" 1>&6
-echo "configure:4237: checking "for specified window system"" >&5
+echo "configure:4249: checking "for specified window system"" >&5
 
 if test "$with_x11" != "no"; then
     test "$x_includes $x_libraries" != "NONE NONE" && \
@@ -4266,7 +4278,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:4270: checking for X" >&5
+echo "configure:4282: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -4326,12 +4338,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 4330 "configure"
+#line 4342 "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:4335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4347: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4400,14 +4412,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4404 "configure"
+#line 4416 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:4411: \"$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; then
   rm -rf conftest*
   LIBS="$ac_save_LIBS"
 # We can link X programs with no special library path.
@@ -4516,17 +4528,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:4520: checking whether -R must be followed by a space" >&5
+echo "configure:4532: 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 4523 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4530: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4535 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -4542,14 +4554,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 4546 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4558 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -4585,12 +4597,12 @@
 else
 
 echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:4589: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:4601: 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 4594 "configure"
+#line 4606 "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
@@ -4601,7 +4613,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4605: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4625,12 +4637,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:4629: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:4641: 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 4634 "configure"
+#line 4646 "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
@@ -4641,7 +4653,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4645: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4670,10 +4682,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:4674: checking for gethostbyname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4677 "configure"
+echo "configure:4686: checking for gethostbyname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4689 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4696,7 +4708,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -4717,12 +4729,12 @@
     if test $ac_cv_func_gethostbyname = no; then
       
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:4721: checking for gethostbyname in -lnsl" >&5
+echo "configure:4733: 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 4726 "configure"
+#line 4738 "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
@@ -4733,7 +4745,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:4737: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4763,10 +4775,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:4767: checking for connect" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4770 "configure"
+echo "configure:4779: checking for connect" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4782 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -4789,7 +4801,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4805: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -4812,12 +4824,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:4816: checking "$xe_msg_checking"" >&5
+echo "configure:4828: 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 4821 "configure"
+#line 4833 "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
@@ -4828,7 +4840,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:4832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4844: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4852,10 +4864,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:4856: checking for remove" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4859 "configure"
+echo "configure:4868: checking for remove" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4871 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -4878,7 +4890,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4882: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -4899,12 +4911,12 @@
     if test $ac_cv_func_remove = no; then
       
 echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:4903: checking for remove in -lposix" >&5
+echo "configure:4915: 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 4908 "configure"
+#line 4920 "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
@@ -4915,7 +4927,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:4919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4939,10 +4951,10 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:4943: checking for shmat" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4946 "configure"
+echo "configure:4955: checking for shmat" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4958 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -4965,7 +4977,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -4986,12 +4998,12 @@
     if test $ac_cv_func_shmat = no; then
       
 echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:4990: checking for shmat in -lipc" >&5
+echo "configure:5002: 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 4995 "configure"
+#line 5007 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5002,7 +5014,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:5006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5018: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5036,12 +5048,12 @@
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   
 echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:5040: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:5052: checking for IceConnectionNumber in -lICE" >&5
 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lICE "
 cat > conftest.$ac_ext <<EOF
-#line 5045 "configure"
+#line 5057 "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
@@ -5052,7 +5064,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:5056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5068: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5219,7 +5231,7 @@
 
 
     echo "checking for X defines extracted by xmkmf" 1>&6
-echo "configure:5223: checking for X defines extracted by xmkmf" >&5
+echo "configure:5235: checking for X defines extracted by xmkmf" >&5
   rm -fr conftestdir
   if mkdir conftestdir; then
     cd conftestdir
@@ -5251,15 +5263,15 @@
 
     ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6
-echo "configure:5255: checking for X11/Intrinsic.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5258 "configure"
+echo "configure:5267: checking for X11/Intrinsic.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5270 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5275: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5283,12 +5295,12 @@
 
       
 echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:5287: checking for XOpenDisplay in -lX11" >&5
+echo "configure:5299: 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 5292 "configure"
+#line 5304 "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
@@ -5299,7 +5311,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:5303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5324,12 +5336,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:5328: checking "$xe_msg_checking"" >&5
+echo "configure:5340: 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 5333 "configure"
+#line 5345 "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
@@ -5340,7 +5352,7 @@
 XGetFontProperty()
 ; return 0; }
 EOF
-if { (eval echo configure:5344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5367,12 +5379,12 @@
 
     
 echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6
-echo "configure:5371: checking for XShapeSelectInput in -lXext" >&5
+echo "configure:5383: 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 5376 "configure"
+#line 5388 "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
@@ -5383,7 +5395,7 @@
 XShapeSelectInput()
 ; return 0; }
 EOF
-if { (eval echo configure:5387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5406,12 +5418,12 @@
 
     
 echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6
-echo "configure:5410: checking for XtOpenDisplay in -lXt" >&5
+echo "configure:5422: 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 5415 "configure"
+#line 5427 "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
@@ -5422,7 +5434,7 @@
 XtOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:5426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5445,14 +5457,14 @@
 
 
   echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6
-echo "configure:5449: checking the version of X11 being used" >&5
+echo "configure:5461: checking the version of X11 being used" >&5
   cat > conftest.$ac_ext <<EOF
-#line 5451 "configure"
+#line 5463 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
     int main(int c, char *v[]) { return c>1 ? XlibSpecificationRelease : 0; }
 EOF
-if { (eval echo configure:5456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:5468: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ./conftest foobar; x11_release=$?
 else
@@ -5476,15 +5488,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5480: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5483 "configure"
+echo "configure:5492: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5495 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5488: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5500: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5515,7 +5527,7 @@
 
 
     echo $ac_n "checking for XFree86""... $ac_c" 1>&6
-echo "configure:5519: checking for XFree86" >&5
+echo "configure:5531: checking for XFree86" >&5
   if test -d "/usr/X386/include" -o \
           -f "/etc/XF86Config"    -o \
 	  -f "/etc/X11/XF86Config" -o \
@@ -5535,12 +5547,12 @@
 
     test -z "$with_xmu" && { 
 echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6
-echo "configure:5539: checking for XmuReadBitmapDataFromFile in -lXmu" >&5
+echo "configure:5551: 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 5544 "configure"
+#line 5556 "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
@@ -5551,7 +5563,7 @@
 XmuReadBitmapDataFromFile()
 ; return 0; }
 EOF
-if { (eval echo configure:5555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5567: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5590,19 +5602,19 @@
 
       
 echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:5594: checking for main in -lXbsd" >&5
+echo "configure:5606: 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 5599 "configure"
+#line 5611 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5618: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5639,22 +5651,22 @@
 fi 
 if test "$with_msw" != "no"; then
   echo "checking for MS-Windows" 1>&6
-echo "configure:5643: checking for MS-Windows" >&5
+echo "configure:5655: checking for MS-Windows" >&5
   
 echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6
-echo "configure:5646: checking for main in -lgdi32" >&5
+echo "configure:5658: 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 5651 "configure"
+#line 5663 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5683,7 +5695,8 @@
 EOF
 }
 
-    libs_system="$libs_system -lshell32 -lgdi32 -luser32" &&  if test "$extra_verbose" = "yes"; then echo "    Appending \"-lshell32 -lgdi32 -luser32\" to \$libs_system"; fi
+    install_pp="$blddir/lib-src/installexe.sh"
+    libs_system="$libs_system -lshell32 -lgdi32 -luser32 -lcomctl32" &&  if test "$extra_verbose" = "yes"; then echo "    Appending \"-lshell32 -lgdi32 -luser32 -lcomctl32\" to \$libs_system"; fi
     if test "$window_system" != x11; then
  	window_system=msw
 	test "$with_scrollbars" != "no" && with_scrollbars=msw \
@@ -5694,8 +5707,11 @@
 	    && extra_objs="$extra_objs menubar-msw.o" &&  if test "$extra_verbose" = "yes"; then
    echo "    xemacs will be linked with \"menubar-msw.o\""
  fi
+	test "$with_toolbars"   != "no" && with_toolbars=msw \
+	    && extra_objs="$extra_objs toolbar-msw.o" &&  if test "$extra_verbose" = "yes"; then
+   echo "    xemacs will be linked with \"toolbar-msw.o\""
+ fi
 	with_dialogs=msw
-	with_toolbars=no
     else
 	test "$with_scrollbars"   != "no" && extra_objs="$extra_objs scrollbar-msw.o" &&  if test "$extra_verbose" = "yes"; then
    echo "    xemacs will be linked with \"scrollbar-msw.o\""
@@ -5703,6 +5719,9 @@
 	test "$with_menubars"   != "no" && extra_objs="$extra_objs menubar-msw.o" &&  if test "$extra_verbose" = "yes"; then
    echo "    xemacs will be linked with \"menubar-msw.o\""
  fi
+	test "$with_toolbars"   != "no" && extra_objs="$extra_objs toolbar-msw.o" &&  if test "$extra_verbose" = "yes"; then
+   echo "    xemacs will be linked with \"toolbar-msw.o\""
+ fi
     fi
     const_is_losing=no
     with_file_coding=yes
@@ -5712,6 +5731,8 @@
   fi
 fi
 
+
+
 test -z "$window_system" && window_system="none"
 
 if test "$window_system" = "none"; then
@@ -5763,7 +5784,7 @@
 esac
 
 echo "checking for session-management option" 1>&6
-echo "configure:5767: checking for session-management option" >&5;
+echo "configure:5788: checking for session-management option" >&5;
 if test "$with_session" != "no"; then
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_SESSION
@@ -5778,15 +5799,15 @@
 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:5782: checking for X11/Xauth.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5785 "configure"
+echo "configure:5803: checking for X11/Xauth.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5806 "configure"
 #include "confdefs.h"
 #include <X11/Xauth.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5790: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5809,12 +5830,12 @@
  }
 test -z "$with_xauth" && { 
 echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6
-echo "configure:5813: checking for XauGetAuthByAddr in -lXau" >&5
+echo "configure:5834: 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 5818 "configure"
+#line 5839 "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
@@ -5825,7 +5846,7 @@
 XauGetAuthByAddr()
 ; return 0; }
 EOF
-if { (eval echo configure:5829: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5889,15 +5910,15 @@
       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:5893: checking for ${dir}tt_c.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5896 "configure"
+echo "configure:5914: checking for ${dir}tt_c.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5917 "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:5901: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5926,12 +5947,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:5930: checking "$xe_msg_checking"" >&5
+echo "configure:5951: 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 5935 "configure"
+#line 5956 "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
@@ -5942,7 +5963,7 @@
 tt_message_create()
 ; return 0; }
 EOF
-if { (eval echo configure:5946: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5991,15 +6012,15 @@
 
 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:5995: checking for Dt/Dt.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5998 "configure"
+echo "configure:6016: checking for Dt/Dt.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6019 "configure"
 #include "confdefs.h"
 #include <Dt/Dt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6003: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6024: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6022,12 +6043,12 @@
  }
 test -z "$with_cde" && { 
 echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6
-echo "configure:6026: checking for DtDndDragStart in -lDtSvc" >&5
+echo "configure:6047: 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 6031 "configure"
+#line 6052 "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
@@ -6038,7 +6059,7 @@
 DtDndDragStart()
 ; return 0; }
 EOF
-if { (eval echo configure:6042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6075,18 +6096,18 @@
 fi
 
 echo "checking for LDAP" 1>&6
-echo "configure:6079: checking for LDAP" >&5
+echo "configure:6100: 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:6082: checking for ldap.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6085 "configure"
+echo "configure:6103: checking for ldap.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6106 "configure"
 #include "confdefs.h"
 #include <ldap.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6090: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6111: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6109,15 +6130,15 @@
  }
 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:6113: checking for lber.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6116 "configure"
+echo "configure:6134: checking for lber.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6137 "configure"
 #include "confdefs.h"
 #include <lber.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6121: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6142: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6143,12 +6164,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:6147: checking "$xe_msg_checking"" >&5
+echo "configure:6168: 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 6152 "configure"
+#line 6173 "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
@@ -6159,7 +6180,7 @@
 ldap_open()
 ; return 0; }
 EOF
-if { (eval echo configure:6163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6182,12 +6203,12 @@
  }
   test "$with_umich_ldap" = "no" && { 
 echo $ac_n "checking for ldap_set_option in -lldap10""... $ac_c" 1>&6
-echo "configure:6186: checking for ldap_set_option in -lldap10" >&5
+echo "configure:6207: checking for ldap_set_option in -lldap10" >&5
 ac_lib_var=`echo ldap10'_'ldap_set_option | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lldap10 "
 cat > conftest.$ac_ext <<EOF
-#line 6191 "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
@@ -6198,7 +6219,7 @@
 ldap_set_option()
 ; return 0; }
 EOF
-if { (eval echo configure:6202: \"$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; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6263,17 +6284,17 @@
 if test "$with_x11" = "yes"; then
 
   echo "checking for X11 graphics libraries" 1>&6
-echo "configure:6267: checking for X11 graphics libraries" >&5
+echo "configure:6288: checking for X11 graphics libraries" >&5
 
       if test "$with_png $with_tiff" != "no no"; then
     
 echo $ac_n "checking for inflate in -lc""... $ac_c" 1>&6
-echo "configure:6272: checking for inflate in -lc" >&5
+echo "configure:6293: 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 6277 "configure"
+#line 6298 "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
@@ -6284,7 +6305,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6303,12 +6324,12 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for inflate in -lz""... $ac_c" 1>&6
-echo "configure:6307: checking for inflate in -lz" >&5
+echo "configure:6328: 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 6312 "configure"
+#line 6333 "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
@@ -6319,7 +6340,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6338,12 +6359,12 @@
   echo "$ac_t""no" 1>&6
 
 echo $ac_n "checking for inflate in -lgz""... $ac_c" 1>&6
-echo "configure:6342: checking for inflate in -lgz" >&5
+echo "configure:6363: 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 6347 "configure"
+#line 6368 "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
@@ -6354,7 +6375,7 @@
 inflate()
 ; return 0; }
 EOF
-if { (eval echo configure:6358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6384,10 +6405,10 @@
 
     if test -z "$with_xpm"; then
     echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6
-echo "configure:6388: checking for Xpm - no older than 3.4f" >&5
+echo "configure:6409: checking for Xpm - no older than 3.4f" >&5
     xe_check_libs=-lXpm
     cat > conftest.$ac_ext <<EOF
-#line 6391 "configure"
+#line 6412 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
     int main(int c, char **v) {
@@ -6395,7 +6416,7 @@
       XpmIncludeVersion != XpmLibraryVersion() ? 1 :
       XpmIncludeVersion < 30406 ? 2 : 0 ;}
 EOF
-if { (eval echo configure:6399: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:6420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ./conftest dummy_arg; xpm_status=$?;
       if test "$?" = "0"; then
@@ -6439,15 +6460,15 @@
 
     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:6443: checking for compface.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6446 "configure"
+echo "configure:6464: checking for compface.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6467 "configure"
 #include "confdefs.h"
 #include <compface.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6470,12 +6491,12 @@
  }
   test -z "$with_xface" && { 
 echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6
-echo "configure:6474: checking for UnGenFace in -lcompface" >&5
+echo "configure:6495: 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 6479 "configure"
+#line 6500 "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
@@ -6486,7 +6507,7 @@
 UnGenFace()
 ; return 0; }
 EOF
-if { (eval echo configure:6490: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6521,18 +6542,18 @@
   fi
 
     echo $ac_n "checking for giflib - no older than 3.1""... $ac_c" 1>&6
-echo "configure:6525: checking for giflib - no older than 3.1" >&5
+echo "configure:6546: checking for giflib - no older than 3.1" >&5
   test -z "$with_gif" && { ac_safe=`echo "gif_lib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for gif_lib.h""... $ac_c" 1>&6
-echo "configure:6528: checking for gif_lib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6531 "configure"
+echo "configure:6549: checking for gif_lib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6552 "configure"
 #include "confdefs.h"
 #include <gif_lib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6557: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6555,12 +6576,12 @@
  }
   test -z "$with_gif" && { 
 echo $ac_n "checking for GetGifError in -lgif""... $ac_c" 1>&6
-echo "configure:6559: checking for GetGifError in -lgif" >&5
+echo "configure:6580: checking for GetGifError in -lgif" >&5
 ac_lib_var=`echo gif'_'GetGifError | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lgif "
 cat > conftest.$ac_ext <<EOF
-#line 6564 "configure"
+#line 6585 "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
@@ -6571,7 +6592,7 @@
 GetGifError()
 ; return 0; }
 EOF
-if { (eval echo configure:6575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6596: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6607,15 +6628,15 @@
 
     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:6611: checking for jpeglib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6614 "configure"
+echo "configure:6632: checking for jpeglib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6635 "configure"
 #include "confdefs.h"
 #include <jpeglib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6619: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6640: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6638,12 +6659,12 @@
  }
   test -z "$with_jpeg" && { 
 echo $ac_n "checking for jpeg_destroy_decompress in -ljpeg""... $ac_c" 1>&6
-echo "configure:6642: checking for jpeg_destroy_decompress in -ljpeg" >&5
+echo "configure:6663: 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 6647 "configure"
+#line 6668 "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
@@ -6654,7 +6675,7 @@
 jpeg_destroy_decompress()
 ; return 0; }
 EOF
-if { (eval echo configure:6658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6690,9 +6711,9 @@
 
     if test -z "$with_png"; then
     echo $ac_n "checking for png.h - no older than 0.96""... $ac_c" 1>&6
-echo "configure:6694: checking for png.h - no older than 0.96" >&5
+echo "configure:6715: checking for png.h - no older than 0.96" >&5
     cat > conftest.$ac_ext <<EOF
-#line 6696 "configure"
+#line 6717 "configure"
 #include "confdefs.h"
 #include <png.h>
 #if PNG_LIBPNG_VER >= 96
@@ -6712,10 +6733,10 @@
 
   fi
   test -z "$with_png" && { echo $ac_n "checking for pow""... $ac_c" 1>&6
-echo "configure:6716: checking for pow" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6719 "configure"
+echo "configure:6737: checking for pow" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6740 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pow(); below.  */
@@ -6738,7 +6759,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_pow=yes"
 else
@@ -6759,12 +6780,12 @@
  }
   test -z "$with_png" && { 
 echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6
-echo "configure:6763: checking for png_read_image in -lpng" >&5
+echo "configure:6784: 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 6768 "configure"
+#line 6789 "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
@@ -6775,7 +6796,7 @@
 png_read_image()
 ; return 0; }
 EOF
-if { (eval echo configure:6779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6800: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6811,15 +6832,15 @@
 
     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:6815: checking for tiffio.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6818 "configure"
+echo "configure:6836: checking for tiffio.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6839 "configure"
 #include "confdefs.h"
 #include <tiffio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6842,12 +6863,12 @@
  }
   test -z "$with_tiff" && { 
 echo $ac_n "checking for TIFFReadScanline in -ltiff""... $ac_c" 1>&6
-echo "configure:6846: checking for TIFFReadScanline in -ltiff" >&5
+echo "configure:6867: checking for TIFFReadScanline in -ltiff" >&5
 ac_lib_var=`echo tiff'_'TIFFReadScanline | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltiff "
 cat > conftest.$ac_ext <<EOF
-#line 6851 "configure"
+#line 6872 "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
@@ -6858,7 +6879,7 @@
 TIFFReadScanline()
 ; return 0; }
 EOF
-if { (eval echo configure:6862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6894,12 +6915,12 @@
 
     
 echo $ac_n "checking for XawScrollbarSetThumb in -lXaw""... $ac_c" 1>&6
-echo "configure:6898: checking for XawScrollbarSetThumb in -lXaw" >&5
+echo "configure:6919: 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 6903 "configure"
+#line 6924 "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
@@ -6910,7 +6931,7 @@
 XawScrollbarSetThumb()
 ; return 0; }
 EOF
-if { (eval echo configure:6914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6934,15 +6955,15 @@
                     
     ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
-echo "configure:6938: checking for Xm/Xm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6941 "configure"
+echo "configure:6959: checking for Xm/Xm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6962 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6946: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6959,12 +6980,12 @@
   echo "$ac_t""yes" 1>&6
   
 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6
-echo "configure:6963: checking for XmStringFree in -lXm" >&5
+echo "configure:6984: 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 6968 "configure"
+#line 6989 "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
@@ -6975,7 +6996,7 @@
 XmStringFree()
 ; return 0; }
 EOF
-if { (eval echo configure:6979: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7004,9 +7025,9 @@
 
   if test "$have_motif" = "yes"; then
         echo $ac_n "checking for Lesstif""... $ac_c" 1>&6
-echo "configure:7008: checking for Lesstif" >&5
+echo "configure:7029: checking for Lesstif" >&5
     cat > conftest.$ac_ext <<EOF
-#line 7010 "configure"
+#line 7031 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 #ifdef LESSTIF_VERSION
@@ -7290,7 +7311,7 @@
 
 if test "$with_mule" = "yes" ; then
   echo "checking for Mule-related features" 1>&6
-echo "configure:7294: checking for Mule-related features" >&5
+echo "configure:7315: checking for Mule-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining MULE
 EOF
@@ -7315,15 +7336,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:7319: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7322 "configure"
+echo "configure:7340: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7343 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7327: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7354,12 +7375,12 @@
 
   
 echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6
-echo "configure:7358: checking for strerror in -lintl" >&5
+echo "configure:7379: 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 7363 "configure"
+#line 7384 "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
@@ -7370,7 +7391,7 @@
 strerror()
 ; return 0; }
 EOF
-if { (eval echo configure:7374: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7403,19 +7424,19 @@
 
 
   echo "checking for Mule input methods" 1>&6
-echo "configure:7407: checking for Mule input methods" >&5
+echo "configure:7428: checking for Mule input methods" >&5
         case "$with_xim" in "" | "yes" )
     echo "checking for XIM" 1>&6
-echo "configure:7410: checking for XIM" >&5
+echo "configure:7431: checking for XIM" >&5
         if test "$have_lesstif" = "yes"; then with_xim=xlib
     else 
 echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6
-echo "configure:7414: checking for XmImMbLookupString in -lXm" >&5
+echo "configure:7435: 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 7419 "configure"
+#line 7440 "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
@@ -7426,7 +7447,7 @@
 XmImMbLookupString()
 ; return 0; }
 EOF
-if { (eval echo configure:7430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7451: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7492,15 +7513,15 @@
 
     if test "$with_xfs" = "yes" ; then
     echo "checking for XFontSet" 1>&6
-echo "configure:7496: checking for XFontSet" >&5
+echo "configure:7517: checking for XFontSet" >&5
     
 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6
-echo "configure:7499: checking for XmbDrawString in -lX11" >&5
+echo "configure:7520: 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 7504 "configure"
+#line 7525 "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
@@ -7511,7 +7532,7 @@
 XmbDrawString()
 ; return 0; }
 EOF
-if { (eval echo configure:7515: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7551,15 +7572,15 @@
     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:7555: checking for wnn/jllib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7558 "configure"
+echo "configure:7576: checking for wnn/jllib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7579 "configure"
 #include "confdefs.h"
 #include <wnn/jllib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7563: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7584,10 +7605,10 @@
     for ac_func in crypt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7588: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7591 "configure"
+echo "configure:7609: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7612 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7610,7 +7631,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7614: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7639,12 +7660,12 @@
 
     test "$ac_cv_func_crypt" != "yes" && { 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:7643: checking for crypt in -lcrypt" >&5
+echo "configure:7664: 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 7648 "configure"
+#line 7669 "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
@@ -7655,7 +7676,7 @@
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:7659: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7680: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7689,12 +7710,12 @@
   fi
     test -z "$with_wnn" && { 
 echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6
-echo "configure:7693: checking for jl_dic_list_e in -lwnn" >&5
+echo "configure:7714: 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 7698 "configure"
+#line 7719 "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
@@ -7705,7 +7726,7 @@
 jl_dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:7709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7730: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7742,12 +7763,12 @@
  fi
     
 echo $ac_n "checking for jl_fi_dic_list in -lwnn""... $ac_c" 1>&6
-echo "configure:7746: checking for jl_fi_dic_list in -lwnn" >&5
+echo "configure:7767: checking for jl_fi_dic_list in -lwnn" >&5
 ac_lib_var=`echo wnn'_'jl_fi_dic_list | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lwnn "
 cat > conftest.$ac_ext <<EOF
-#line 7751 "configure"
+#line 7772 "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
@@ -7758,7 +7779,7 @@
 jl_fi_dic_list()
 ; return 0; }
 EOF
-if { (eval echo configure:7762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7792,15 +7813,15 @@
   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:7796: checking for canna/jrkanji.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7799 "configure"
+echo "configure:7817: checking for canna/jrkanji.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7820 "configure"
 #include "confdefs.h"
 #include <canna/jrkanji.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7827,15 +7848,15 @@
     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:7831: checking for canna/jrkanji.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7834 "configure"
+echo "configure:7852: checking for canna/jrkanji.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7855 "configure"
 #include "confdefs.h"
 #include <canna/jrkanji.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7860: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7863,15 +7884,15 @@
 
   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:7867: checking for canna/RK.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7870 "configure"
+echo "configure:7888: checking for canna/RK.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7891 "configure"
 #include "confdefs.h"
 #include <canna/RK.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7896: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7894,12 +7915,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6
-echo "configure:7898: checking for RkBgnBun in -lRKC" >&5
+echo "configure:7919: 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 7903 "configure"
+#line 7924 "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
@@ -7910,7 +7931,7 @@
 RkBgnBun()
 ; return 0; }
 EOF
-if { (eval echo configure:7914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7933,12 +7954,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6
-echo "configure:7937: checking for jrKanjiControl in -lcanna" >&5
+echo "configure:7958: 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 7942 "configure"
+#line 7963 "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
@@ -7949,7 +7970,7 @@
 jrKanjiControl()
 ; return 0; }
 EOF
-if { (eval echo configure:7953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -7998,12 +8019,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:8002: checking for layout_object_getvalue in -li18n" >&5
+echo "configure:8023: 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 8007 "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
@@ -8014,7 +8035,7 @@
 layout_object_getvalue()
 ; return 0; }
 EOF
-if { (eval echo configure:8018: \"$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; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -8100,10 +8121,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:8104: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8107 "configure"
+echo "configure:8125: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8128 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8126,7 +8147,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8163,10 +8184,10 @@
     for ac_func in realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8167: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8170 "configure"
+echo "configure:8188: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8191 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8189,7 +8210,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8222,16 +8243,16 @@
 esac
 
 echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6
-echo "configure:8226: checking whether netdb declares h_errno" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8228 "configure"
+echo "configure:8247: checking whether netdb declares h_errno" >&5
+cat > conftest.$ac_ext <<EOF
+#line 8249 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 return h_errno;
 ; return 0; }
 EOF
-if { (eval echo configure:8235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
    { test "$extra_verbose" = "yes" && cat << \EOF
@@ -8251,16 +8272,16 @@
 rm -f conftest*
 
 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:8255: checking for sigsetjmp" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8257 "configure"
+echo "configure:8276: checking for sigsetjmp" >&5
+cat > conftest.$ac_ext <<EOF
+#line 8278 "configure"
 #include "confdefs.h"
 #include <setjmp.h>
 int main() {
 sigjmp_buf bar; sigsetjmp (bar, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:8264: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8285: \"$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
@@ -8280,11 +8301,11 @@
 rm -f conftest*
 
 echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6
-echo "configure:8284: checking whether localtime caches TZ" >&5
+echo "configure:8305: checking whether localtime caches TZ" >&5
 
 if test "$ac_cv_func_tzset" = "yes"; then
 cat > conftest.$ac_ext <<EOF
-#line 8288 "configure"
+#line 8309 "configure"
 #include "confdefs.h"
 #include <time.h>
 #if STDC_HEADERS
@@ -8319,7 +8340,7 @@
   exit (0);
 }
 EOF
-if { (eval echo configure:8323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8344: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   emacs_cv_localtime_cache=no
 else
@@ -8348,9 +8369,9 @@
 
 if test "$HAVE_TIMEVAL" = "yes"; then
 echo $ac_n "checking whether gettimeofday accepts one or two arguments""... $ac_c" 1>&6
-echo "configure:8352: checking whether gettimeofday accepts one or two arguments" >&5
-cat > conftest.$ac_ext <<EOF
-#line 8354 "configure"
+echo "configure:8373: checking whether gettimeofday accepts one or two arguments" >&5
+cat > conftest.$ac_ext <<EOF
+#line 8375 "configure"
 #include "confdefs.h"
 
 #ifdef TIME_WITH_SYS_TIME
@@ -8372,7 +8393,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8376: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""two" 1>&6
 else
@@ -8394,19 +8415,19 @@
 
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:8398: checking for inline" >&5
+echo "configure:8419: checking for inline" >&5
 
 ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 8403 "configure"
+#line 8424 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:8410: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:8431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -8456,17 +8477,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:8460: checking for working alloca.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8463 "configure"
+echo "configure:8481: checking for working alloca.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8484 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:8470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8491: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -8490,10 +8511,10 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:8494: checking for alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8497 "configure"
+echo "configure:8515: checking for alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8518 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -8516,7 +8537,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:8520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -8555,10 +8576,10 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:8559: checking whether alloca needs Cray hooks" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8562 "configure"
+echo "configure:8580: checking whether alloca needs Cray hooks" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8583 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -8582,10 +8603,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:8586: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8589 "configure"
+echo "configure:8607: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8610 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8608,7 +8629,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8612: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8638,10 +8659,10 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:8642: checking stack direction for C alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8645 "configure"
+echo "configure:8663: checking stack direction for C alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8666 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -8660,7 +8681,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:8664: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8685: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_c_stack_direction=1
 else
@@ -8688,15 +8709,15 @@
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:8692: checking for vfork.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8695 "configure"
+echo "configure:8713: checking for vfork.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8716 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8721: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8724,10 +8745,10 @@
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:8728: checking for working vfork" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8731 "configure"
+echo "configure:8749: checking for working vfork" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8752 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -8822,7 +8843,7 @@
   }
 }
 EOF
-if { (eval echo configure:8826: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_vfork_works=yes
 else
@@ -8847,10 +8868,10 @@
 
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:8851: checking for working strcoll" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8854 "configure"
+echo "configure:8872: checking for working strcoll" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8875 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -8860,7 +8881,7 @@
 	strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:8864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_strcoll_works=yes
 else
@@ -8887,10 +8908,10 @@
 for ac_func in getpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8891: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8894 "configure"
+echo "configure:8912: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8915 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8913,7 +8934,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8938: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8941,10 +8962,10 @@
 done
 
 echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:8945: checking whether getpgrp takes no argument" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8948 "configure"
+echo "configure:8966: checking whether getpgrp takes no argument" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8969 "configure"
 #include "confdefs.h"
 
 /*
@@ -8999,7 +9020,7 @@
 }
 
 EOF
-if { (eval echo configure:9003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:9024: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_getpgrp_void=yes
 else
@@ -9025,10 +9046,10 @@
 
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:9029: checking for working mmap" >&5
+echo "configure:9050: checking for working mmap" >&5
 case "$opsys" in ultrix* ) have_mmap=no ;; *)
 cat > conftest.$ac_ext <<EOF
-#line 9032 "configure"
+#line 9053 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <unistd.h>
@@ -9061,7 +9082,7 @@
   return 1;
 }
 EOF
-if { (eval echo configure:9065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:9086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   have_mmap=yes
 else
@@ -9095,15 +9116,15 @@
 
 ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for termios.h""... $ac_c" 1>&6
-echo "configure:9099: checking for termios.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9102 "configure"
+echo "configure:9120: checking for termios.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9123 "configure"
 #include "confdefs.h"
 #include <termios.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9107: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9146,15 +9167,15 @@
   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:9150: checking for termio.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9153 "configure"
+echo "configure:9171: checking for termio.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9174 "configure"
 #include "confdefs.h"
 #include <termio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9158: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9179: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9186,10 +9207,10 @@
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:9190: checking for socket" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9193 "configure"
+echo "configure:9211: checking for socket" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9214 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -9212,7 +9233,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -9227,15 +9248,15 @@
   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:9231: checking for netinet/in.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9234 "configure"
+echo "configure:9252: checking for netinet/in.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9255 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9260: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9252,15 +9273,15 @@
   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:9256: checking for arpa/inet.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9259 "configure"
+echo "configure:9277: checking for arpa/inet.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9280 "configure"
 #include "confdefs.h"
 #include <arpa/inet.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9264: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9285: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9285,9 +9306,9 @@
 }
 
       echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6
-echo "configure:9289: checking "for sun_len member in struct sockaddr_un"" >&5
+echo "configure:9310: checking "for sun_len member in struct sockaddr_un"" >&5
       cat > conftest.$ac_ext <<EOF
-#line 9291 "configure"
+#line 9312 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -9298,7 +9319,7 @@
 static struct sockaddr_un x; x.sun_len = 1;
 ; return 0; }
 EOF
-if { (eval echo configure:9302: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9323: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_SOCKADDR_SUN_LEN
@@ -9316,9 +9337,9 @@
 fi
 rm -f conftest*
       echo $ac_n "checking "for ip_mreq struct in netinet/in.h"""... $ac_c" 1>&6
-echo "configure:9320: checking "for ip_mreq struct in netinet/in.h"" >&5
+echo "configure:9341: checking "for ip_mreq struct in netinet/in.h"" >&5
       cat > conftest.$ac_ext <<EOF
-#line 9322 "configure"
+#line 9343 "configure"
 #include "confdefs.h"
 
 #include <netinet/in.h>
@@ -9327,7 +9348,7 @@
 static struct ip_mreq x;
 ; return 0; }
 EOF
-if { (eval echo configure:9331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_MULTICAST
@@ -9358,10 +9379,10 @@
 
 
 echo $ac_n "checking for msgget""... $ac_c" 1>&6
-echo "configure:9362: checking for msgget" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9365 "configure"
+echo "configure:9383: checking for msgget" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9386 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char msgget(); below.  */
@@ -9384,7 +9405,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9409: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_msgget=yes"
 else
@@ -9399,15 +9420,15 @@
   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:9403: checking for sys/ipc.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9406 "configure"
+echo "configure:9424: checking for sys/ipc.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9427 "configure"
 #include "confdefs.h"
 #include <sys/ipc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9432: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9424,15 +9445,15 @@
   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:9428: checking for sys/msg.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9431 "configure"
+echo "configure:9449: checking for sys/msg.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9452 "configure"
 #include "confdefs.h"
 #include <sys/msg.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9436: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9457: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9470,15 +9491,15 @@
 
 ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dirent.h""... $ac_c" 1>&6
-echo "configure:9474: checking for dirent.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9477 "configure"
+echo "configure:9495: checking for dirent.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9498 "configure"
 #include "confdefs.h"
 #include <dirent.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9503: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9505,15 +9526,15 @@
   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:9509: checking for sys/dir.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9512 "configure"
+echo "configure:9530: checking for sys/dir.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9533 "configure"
 #include "confdefs.h"
 #include <sys/dir.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9546,15 +9567,15 @@
 
 ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for nlist.h""... $ac_c" 1>&6
-echo "configure:9550: checking for nlist.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9553 "configure"
+echo "configure:9571: checking for nlist.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9574 "configure"
 #include "confdefs.h"
 #include <nlist.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9558: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9579: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9584,7 +9605,7 @@
 
 
 echo "checking "for sound support"" 1>&6
-echo "configure:9588: checking "for sound support"" >&5
+echo "configure:9609: checking "for sound support"" >&5
 case "$with_sound" in
   native | both ) with_native_sound=yes;;
   nas    | no   ) with_native_sound=no;;
@@ -9595,15 +9616,15 @@
     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:9599: checking for multimedia/audio_device.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9602 "configure"
+echo "configure:9620: checking for multimedia/audio_device.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9623 "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:9607: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9651,12 +9672,12 @@
       if test -z "$native_sound_lib"; then
         
 echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6
-echo "configure:9655: checking for ALopenport in -laudio" >&5
+echo "configure:9676: 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 9660 "configure"
+#line 9681 "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
@@ -9667,7 +9688,7 @@
 ALopenport()
 ; return 0; }
 EOF
-if { (eval echo configure:9671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9692: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9698,12 +9719,12 @@
       if test -z "$native_sound_lib"; then
 	
 echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6
-echo "configure:9702: checking for AOpenAudio in -lAlib" >&5
+echo "configure:9723: 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 9707 "configure"
+#line 9728 "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
@@ -9714,7 +9735,7 @@
 AOpenAudio()
 ; return 0; }
 EOF
-if { (eval echo configure:9718: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9752,15 +9773,15 @@
     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:9756: checking for ${dir}/soundcard.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9759 "configure"
+echo "configure:9777: checking for ${dir}/soundcard.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9780 "configure"
 #include "confdefs.h"
 #include <${dir}/soundcard.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9764: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9830,7 +9851,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 9834 "configure"
+#line 9855 "configure"
 #include "confdefs.h"
 #include <audio/Xtutil.h>
 EOF
@@ -9857,7 +9878,7 @@
 
 if test "$with_tty" = "yes"  ; then
   echo "checking for TTY-related features" 1>&6
-echo "configure:9861: checking for TTY-related features" >&5
+echo "configure:9882: checking for TTY-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_TTY
 EOF
@@ -9873,12 +9894,12 @@
     if test -z "$with_ncurses"; then
     
 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:9877: checking for tgetent in -lncurses" >&5
+echo "configure:9898: 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 9882 "configure"
+#line 9903 "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
@@ -9889,7 +9910,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:9893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -9922,15 +9943,15 @@
 
     ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6
-echo "configure:9926: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9929 "configure"
+echo "configure:9947: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9950 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9934: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9955: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9952,15 +9973,15 @@
 
     ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6
-echo "configure:9956: checking for ncurses/term.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9959 "configure"
+echo "configure:9977: checking for ncurses/term.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9980 "configure"
 #include "confdefs.h"
 #include <ncurses/term.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9990,15 +10011,15 @@
       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:9994: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9997 "configure"
+echo "configure:10015: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10018 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10002: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10023: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10033,12 +10054,12 @@
 	for lib in curses termlib termcap; do
 	  
 echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6
-echo "configure:10037: checking for tgetent in -l$lib" >&5
+echo "configure:10058: 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 10042 "configure"
+#line 10063 "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
@@ -10049,7 +10070,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10080,12 +10101,12 @@
       else
 	
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:10084: checking for tgetent in -lcurses" >&5
+echo "configure:10105: 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 10089 "configure"
+#line 10110 "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
@@ -10096,7 +10117,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10121: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10114,12 +10135,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:10118: checking for tgetent in -ltermcap" >&5
+echo "configure:10139: 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 10123 "configure"
+#line 10144 "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
@@ -10130,7 +10151,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:10134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10178,15 +10199,15 @@
 
     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:10182: checking for gpm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10185 "configure"
+echo "configure:10203: checking for gpm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10206 "configure"
 #include "confdefs.h"
 #include <gpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10190: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10211: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10209,12 +10230,12 @@
  }
   test -z "$with_gpm" && { 
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:10213: checking for Gpm_Open in -lgpm" >&5
+echo "configure:10234: 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 10218 "configure"
+#line 10239 "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
@@ -10225,7 +10246,7 @@
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:10229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10274,22 +10295,22 @@
 
 
 echo "checking for database support" 1>&6
-echo "configure:10278: checking for database support" >&5
+echo "configure:10299: checking for database support" >&5
 
 if test "$with_database_gnudbm" != "no"; then
   for ac_hdr in ndbm.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10285: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10288 "configure"
+echo "configure:10306: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10309 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10314: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10321,12 +10342,12 @@
   if test "$have_ndbm_h" = "yes"; then
     
 echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:10325: checking for dbm_open in -lgdbm" >&5
+echo "configure:10346: 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 10330 "configure"
+#line 10351 "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
@@ -10337,7 +10358,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:10341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10360,10 +10381,10 @@
   fi
   if test "$with_database_gnudbm" != "yes"; then
     echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:10364: checking for dbm_open" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10367 "configure"
+echo "configure:10385: checking for dbm_open" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10388 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -10386,7 +10407,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10390: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -10422,10 +10443,10 @@
 
 if test "$with_database_dbm" != "no"; then
   echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:10426: checking for dbm_open" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10429 "configure"
+echo "configure:10447: checking for dbm_open" >&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 dbm_open(); below.  */
@@ -10448,7 +10469,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10452: \"$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; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -10469,12 +10490,12 @@
   if test "$need_libdbm" != "no"; then
     
 echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:10473: checking for dbm_open in -ldbm" >&5
+echo "configure:10494: 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 10478 "configure"
+#line 10499 "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
@@ -10485,7 +10506,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:10489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10522,10 +10543,10 @@
 
 if test "$with_database_berkdb" != "no"; then
   echo $ac_n "checking for dbopen""... $ac_c" 1>&6
-echo "configure:10526: checking for dbopen" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10529 "configure"
+echo "configure:10547: checking for dbopen" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10550 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbopen(); below.  */
@@ -10548,7 +10569,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbopen=yes"
 else
@@ -10569,12 +10590,12 @@
   if test "$need_libdb" != "no"; then
     
 echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:10573: checking for dbopen in -ldb" >&5
+echo "configure:10594: checking for dbopen in -ldb" >&5
 ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldb "
 cat > conftest.$ac_ext <<EOF
-#line 10578 "configure"
+#line 10599 "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
@@ -10585,7 +10606,7 @@
 dbopen()
 ; return 0; }
 EOF
-if { (eval echo configure:10589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10609,7 +10630,7 @@
   if test "$with_database_berkdb" = "yes"; then
     for path in "db/db.h" "db.h"; do
 cat > conftest.$ac_ext <<EOF
-#line 10613 "configure"
+#line 10634 "configure"
 #include "confdefs.h"
 #ifdef HAVE_INTTYPES_H
 #define __BIT_TYPES_DEFINED__
@@ -10627,7 +10648,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:10631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:10652: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   db_h_path="$path"; break
 else
@@ -10678,12 +10699,12 @@
 if test "$with_socks" = "yes"; then
   
 echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6
-echo "configure:10682: checking for SOCKSinit in -lsocks" >&5
+echo "configure:10703: 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 10687 "configure"
+#line 10708 "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
@@ -10694,7 +10715,7 @@
 SOCKSinit()
 ; return 0; }
 EOF
-if { (eval echo configure:10698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10751,15 +10772,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:10755: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 10758 "configure"
+echo "configure:10776: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 10779 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:10763: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:10784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -10790,12 +10811,12 @@
 
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:10794: checking for dlopen in -ldl" >&5
+echo "configure:10815: 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 10799 "configure"
+#line 10820 "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
@@ -10806,7 +10827,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:10810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10835,12 +10856,12 @@
  }
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for _dlopen in -lc""... $ac_c" 1>&6
-echo "configure:10839: checking for _dlopen in -lc" >&5
+echo "configure:10860: 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 10844 "configure"
+#line 10865 "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
@@ -10851,7 +10872,7 @@
 _dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:10855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10880,12 +10901,12 @@
  }
 test -z "$with_shlib" && test ! -z "$have_dlfcn" && { 
 echo $ac_n "checking for dlopen in -lc""... $ac_c" 1>&6
-echo "configure:10884: checking for dlopen in -lc" >&5
+echo "configure:10905: 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 10889 "configure"
+#line 10910 "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
@@ -10896,7 +10917,7 @@
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:10900: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10921: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10925,12 +10946,12 @@
  }
 test -z "$with_shlib" && { 
 echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6
-echo "configure:10929: checking for shl_load in -ldld" >&5
+echo "configure:10950: 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 10934 "configure"
+#line 10955 "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
@@ -10941,7 +10962,7 @@
 shl_load()
 ; return 0; }
 EOF
-if { (eval echo configure:10945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:10966: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -10970,12 +10991,12 @@
  }
 test -z "$with_shlib" && { 
 echo $ac_n "checking for dld_init in -ldld""... $ac_c" 1>&6
-echo "configure:10974: checking for dld_init in -ldld" >&5
+echo "configure:10995: 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 10979 "configure"
+#line 11000 "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
@@ -10986,7 +11007,7 @@
 dld_init()
 ; return 0; }
 EOF
-if { (eval echo configure:10990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:11011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -11036,7 +11057,7 @@
 dll_oflags="-o "
 
 echo $ac_n "checking how to build a shared library""... $ac_c" 1>&6
-echo "configure:11040: checking how to build a shared library" >&5
+echo "configure:11061: checking how to build a shared library" >&5
 case `uname -rs` in
 	UNIX_SV*|UNIX_System_V*)
 		dll_lflags="-G"
@@ -11124,6 +11145,62 @@
 
 
 
+  for ac_func in dlerror
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:11152: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 11155 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:11178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  { test "$extra_verbose" = "yes" && cat << EOF
+    Defining $ac_tr_func
+EOF
+cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+}
+ 
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
   ld_dynamic_link_flags=
     case "$opsys" in
   hpux*)  ld_dynamic_link_flags="-Wl,-E" ;;
@@ -11133,11 +11210,11 @@
 fi
 
 cat > conftest.$ac_ext <<EOF
-#line 11137 "configure"
+#line 11214 "configure"
 #include "confdefs.h"
 int main(int c,char *v[]){return 0;}
 EOF
-if { (eval echo configure:11141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:11218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   :
 else
@@ -11794,7 +11871,7 @@
     file="src/Makefile.in:src/Makefile.in.in:src/depend"
   ac_output_files="${ac_output_files+$ac_output_files }$file"
 done
-ac_output_files="$ac_output_files src/paths.h.in lib-src/config.values"
+ac_output_files="$ac_output_files src/paths.h lib-src/config.values"
 
 trap '' 1 2 15
 
@@ -11851,7 +11928,7 @@
 ac_given_srcdir=$srcdir
 ac_given_INSTALL="$INSTALL"
 
-trap 'rm -fr `echo "$ac_output_files src/config.h src/paths.h lwlib/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
+trap 'rm -fr `echo "$ac_output_files src/config.h lwlib/config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
 cat >> $CONFIG_STATUS <<EOF
 
@@ -11899,6 +11976,7 @@
 s%@X_PRE_LIBS@%$X_PRE_LIBS%g
 s%@X_LIBS@%$X_LIBS%g
 s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
+s%@install_pp@%$install_pp%g
 s%@libs_xauth@%$libs_xauth%g
 s%@dnd_objs@%$dnd_objs%g
 s%@lwlib_objs@%$lwlib_objs%g
@@ -12082,7 +12160,7 @@
 if test "${CONFIG_HEADERS+set}" != set; then
 EOF
 cat >> $CONFIG_STATUS <<EOF
-  CONFIG_HEADERS="src/config.h src/paths.h lwlib/config.h"
+  CONFIG_HEADERS="src/config.h lwlib/config.h"
 EOF
 cat >> $CONFIG_STATUS <<\EOF
 fi
--- a/configure.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/configure.in	Mon Aug 13 10:30:37 2007 +0200
@@ -289,7 +289,7 @@
 ac_max_here_lines=12
 ])dnl
 AC_INIT(src/lisp.h)dnl
-AC_CONFIG_HEADER(src/config.h src/paths.h lwlib/config.h)
+AC_CONFIG_HEADER(src/config.h lwlib/config.h)
 dnl Remove any more than one leading "." element from the path name.
 dnl If we do not remove them, then another "./" will be prepended to
 dnl the file name each time we use config.status, and the program name
@@ -325,6 +325,7 @@
 mandir='${prefix}/man/man1'
 infodir='${datadir}/xemacs-${version}/info'
 infopath=''
+install_pp=''
 lispdir='${datadir}/xemacs-${version}/lisp'
 sitelispdir='${datadir}/xemacs/site-lisp'
 pkgdir='${datadir}/xemacs-${version}/lisp'
@@ -1571,6 +1572,8 @@
 ])
 
 
+echo > $tempcname
+
 echo '
 #define NOT_C_CODE
 #define C_SWITCH_SITE
@@ -1587,6 +1590,9 @@
 CPP_to_sh(LIBS_TERMCAP, libs_termcap)
 CPP_to_sh(LIB_STANDARD, libs_standard)
 
+' >> $tempcname
+echo '
+
 CPP_to_sh(OBJECTS_MACHINE, objects_machine)
 CPP_to_sh(OBJECTS_SYSTEM,  objects_system)
 
@@ -1600,6 +1606,9 @@
 
 CPP_to_sh(LD_SWITCH_SHARED, ld_switch_shared, -c)
 
+' >> $tempcname
+echo '
+
 #ifdef ORDINARY_LINK
 #define LD "$(CC) $(CFLAGS)"
 #else /* no ORDINARY LINK */
@@ -1618,6 +1627,9 @@
 CPP_to_sh(LIB_GCC, lib_gcc)
 CPP_to_sh(LD_TEXT_START_ADDR, ld_text_start_addr)
 
+' >> $tempcname
+echo '
+
 #if ! defined (ORDINARY_LINK) && !defined (START_FILES)
 #ifdef NO_REMAP
 #ifdef COFF_ENCAPSULATE
@@ -1640,7 +1652,7 @@
 CPP_boolean_to_sh(MAIL_USE_FLOCK, mail_use_flock)
 CPP_boolean_to_sh(MAIL_USE_LOCKF, mail_use_lockf)
 
-' > $tempcname
+' >> $tempcname
 dnl The value of CPP is a quoted variable reference, so we need to do this
 dnl to get its actual value...
 CPP=`eval "echo $CPP"`
@@ -2346,18 +2358,21 @@
   AC_CHECK_LIB(gdi32,main,with_msw=yes)
   if test "$with_msw" = "yes"; then
     AC_DEFINE(HAVE_MS_WINDOWS)
-    XE_APPEND(-lshell32 -lgdi32 -luser32, libs_system)
+    install_pp="$blddir/lib-src/installexe.sh"
+    XE_APPEND(-lshell32 -lgdi32 -luser32 -lcomctl32, libs_system)
     if test "$window_system" != x11; then
  	window_system=msw
 	test "$with_scrollbars" != "no" && with_scrollbars=msw \
 	    && XE_ADD_OBJS(scrollbar-msw.o)
 	test "$with_menubars"   != "no" && with_menubars=msw \
 	    && XE_ADD_OBJS(menubar-msw.o)
+	test "$with_toolbars"   != "no" && with_toolbars=msw \
+	    && XE_ADD_OBJS(toolbar-msw.o)
 	with_dialogs=msw
-	with_toolbars=no
     else
 	test "$with_scrollbars"   != "no" && XE_ADD_OBJS(scrollbar-msw.o)
 	test "$with_menubars"   != "no" && XE_ADD_OBJS(menubar-msw.o)
+	test "$with_toolbars"   != "no" && XE_ADD_OBJS(toolbar-msw.o)
     fi
     const_is_losing=no
     with_file_coding=yes
@@ -2365,6 +2380,8 @@
   fi
 fi
 
+AC_SUBST(install_pp)
+
 test -z "$window_system" && window_system="none"
 
 dnl Test for features that require a window system - ANY window system
@@ -3366,6 +3383,7 @@
   XE_ADD_OBJS(dll.o)
   test ! -z "$DLL_LIB" && XE_PREPEND(-l${DLL_LIB}, LIBS)
   XE_MAKE_SHAREDLIB
+  AC_CHECK_FUNCS(dlerror)
   ld_dynamic_link_flags=
   dnl Fill this in with other values as this gets more testing
   case "$opsys" in
@@ -3836,7 +3854,7 @@
     file="src/Makefile.in:src/Makefile.in.in:src/depend"
   ac_output_files="${ac_output_files+$ac_output_files }$file"
 done
-ac_output_files="$ac_output_files src/paths.h.in lib-src/config.values"
+ac_output_files="$ac_output_files src/paths.h lib-src/config.values"
 
 AC_OUTPUT($ac_output_files,
 [for dir in $MAKE_SUBDIR; do
--- a/configure.usage	Mon Aug 13 10:29:43 2007 +0200
+++ b/configure.usage	Mon Aug 13 10:30:37 2007 +0200
@@ -3,8 +3,9 @@
 Set compilation and installation parameters for XEmacs, and report.
 
 Note that for most of the following options, you can explicitly enable
-them using `--OPTION=yes' and explicitly disable them using `--OPTION=no'.
+them using `--OPTION=yes' and explicitly disable them using `--OPTION=no'.  
 This is especially useful for auto-detected options.
+The option `--without-FEATURE' is a synonym for `--with-FEATURE=no'.
 
 Options marked with a (*) are auto-detected.
 
--- a/etc/NEWS	Mon Aug 13 10:29:43 2007 +0200
+++ b/etc/NEWS	Mon Aug 13 10:30:37 2007 +0200
@@ -4,7 +4,8 @@
 ==============
 
 This file presents some general information about XEmacs.  It is
-primarily about the evolution of XEmacs and its release history.
+primarily about the changes in recent XEmacs versions and its release
+history.
 
 Use `C-c C-f' to move to the next equal level of outline, and
 `C-c C-b' to move to previous equal level.  `C-h m' will give more
@@ -42,7 +43,7 @@
 ** The `imenu' package has been ported to XEmacs.
 
 ** `echo-keystrokes' can now be a floating-point number, so that you
-can set it to values smaller than one second.
+can set it to intervals shorter than one second.
 
    (setq echo-keystrokes 0.1)
 
@@ -135,8 +136,8 @@
 well as the new function `profile-call-count-results'.
 
 ** The `make-event' function now supports the TYPE and PLIST
-arguments, which can be used to create many various events from Lisp.
-See the documentation for details.
+arguments, which can be used to create various events from Lisp.  See
+the documentation for details.
 
 ** `function-interactive' is a new function that returns the
 interactive specification of a funcallable object.
@@ -153,7 +154,7 @@
 a formatted warning, with a non-default CLASS or LABEL.
 
 ** Specifiers and symbols whose value is a specifier are now allowed
-as modeline specifications.  #### Provide an example.
+as modeline specifications.
 
 ** defcustom now accepts the keyword `:version'.  Use this to specify
 in which version of Emacs a certain variable's default value changed.
@@ -162,7 +163,7 @@
    (defcustom foo-max 34 "*Maximum number of foo's allowed."
      :type 'integer
      :group 'foo
-     :version "20.5")
+     :version "21.0")
 
 This information is used to control the customize-changed-options
 command.
@@ -176,18 +177,16 @@
 be used.  This should result in better performance on Linux systems
 with libc6.
 
-** The code XEmacs uses to assemble its various paths into the directory
-   hierarchy has been completely rewritten to support the package system.
-
-*** Since site-lisp is now off by default, the variable `site-directory'
-    is now obsolete.  Code that depends on its value is probably wrong.
-    In a default setup, it is set to nil.
-
-*** `Info-default-directory-list' is obsolete.
-    It never served any useful function anyway.
-
-    If you want to change the path which XEmacs uses to search for
-    info files, set `Info-directory-list' instead.
+** The code XEmacs uses to assemble its various paths into the
+directory hierarchy has been rewritten to support the package system.
+
+*** site-lisp is now longer part of the load-path by default.
+Its use is deprecated, but you can specify --with-site-lisp=yes at the
+configure command line to get it back.
+
+*** `Info-default-directory-list' is now obsolete.  If you want to
+change the path which XEmacs uses to search for info files, set
+`Info-directory-list' instead.
 
 
 * Changes in XEmacs 20.4
--- a/etc/PACKAGES	Mon Aug 13 10:29:43 2007 +0200
+++ b/etc/PACKAGES	Mon Aug 13 10:30:37 2007 +0200
@@ -2,7 +2,7 @@
 * Introduction to XEmacs Packages
 =================================
 
-As of XEmacs 20.5, XEmacs is no longer distributed in a large
+As of XEmacs 21.0, XEmacs is no longer distributed in a large
 monolithic distribution.  The distribution has been broken up into
 separate units called packages.  In the general case, one may install
 and uninstall various packages freely without having to modify the
@@ -92,7 +92,7 @@
 
 You must have GNU cp, GNU ginstall (or a BSD compatible install
 program) GNU make (3.75 or later preferred), makeinfo (1.68 from
-texinfo-3.11 or later required), GNU tar and XEmacs 20.5 :-).  The
+texinfo-3.11 or later required), GNU tar and XEmacs 21.0 :-).  The
 source packages will untar into a correct directory structure.  At
 the top level you must have XEmacs.rules and package-compile.el.
 These files are available from the XEmacs FTP site from the same
--- a/etc/refcard.tex	Mon Aug 13 10:29:43 2007 +0200
+++ b/etc/refcard.tex	Mon Aug 13 10:30:37 2007 +0200
@@ -254,7 +254,7 @@
 
 \title{XEmacs Reference Card}
 
-\centerline{(for version 20.5+)}
+\centerline{(for version 21.0+)}
 
 \section{Starting Emacs}
 
--- a/etc/xemacs.1	Mon Aug 13 10:29:43 2007 +0200
+++ b/etc/xemacs.1	Mon Aug 13 10:30:37 2007 +0200
@@ -142,8 +142,8 @@
 .B \-q, \-no\-init\-file
 Do not load an init file.
 .TP
-.B \-no-packages
-Do not process the package path.
+.B \-no-early-packages
+Do not process the early packages.
 .TP
 .B \-vanilla
 Load no extra files at startup.  Equivalent to the combination of
--- a/info/dir	Mon Aug 13 10:29:43 2007 +0200
+++ b/info/dir	Mon Aug 13 10:30:37 2007 +0200
@@ -38,12 +38,12 @@
 ===========
 * Info::	Documentation browsing system.
 * XEmacs::	The extensible user-friendly self-documenting text editor.
-		This manual is for XEmacs 20.5.
+		This manual is for XEmacs 21.0.
 * Lispref::	XEmacs Lisp technical reference.
-		This manual is for XEmacs 20.5.
+		This manual is for XEmacs 21.0.
 * New-Users-Guide::
-	        XEmacs User's Guide for XEmacs 20.5.
-* XEmacs-FAQ::	XEmacs Frequently Asked Questions for 20.5.
+	        XEmacs User's Guide for XEmacs 21.0.
+* XEmacs-FAQ::	XEmacs Frequently Asked Questions for 21.0.
 * Internals::	Guide to the internals of XEmacs.
 
 Local Packages:
--- a/lib-src/ChangeLog	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/ChangeLog	Mon Aug 13 10:30:37 2007 +0200
@@ -1,3 +1,27 @@
+1998-04-18  Andreas Jaeger  <aj@arthur.rhein-neckar.de>
+
+	* etags.c (C_entries): Add parentheses.
+
+	* etags-vmslib.c: Remove.  It's not needed anymore.
+
+Fri Apr 17 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* installexe.sh: New file.
+
+1998-04-17  Olivier Galibert  <galibert@pobox.com>
+
+	* etags.c (print_help): Correct typo.
+
+1998-04-16  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile.in.in: Add -DOO_BROWSER to etags arguments.
+
+	* etags.c: Synch with InfoDock.
+
+	* update-autoloads.sh: Don't attempt to eval `make-special' stuffs
+	anymore.  They are no longer used.
+	* update-custom.sh: Always check in lisp/.
+
 1998-03-18  Jan Vroonhof  <vroonhof@math.ethz.ch>
 
 	* gnuclient.c (main): Do not copy string unnecessary in (too)
--- a/lib-src/Makefile.in.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/Makefile.in.in	Mon Aug 13 10:30:37 2007 +0200
@@ -53,7 +53,7 @@
 configuration=@configuration@
 ## ==================== Utility Programs for the Build =================
 
-INSTALL = @INSTALL@
+INSTALL = @install_pp@ @INSTALL@
 INSTALL_PROGRAM = @INSTALL_PROGRAM@
 INSTALL_DATA = @INSTALL_DATA@
 
@@ -252,7 +252,7 @@
 	$(CC) -c `echo $(cflags) | sed 's/-Demacs/ /'` \
 		-DINHIBIT_STRING_HEADER ${srcdir}/../src/regex.c
 
-etags_args = -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
+etags_args = -DOO_BROWSER -I. $(cflags) -I${srcdir} -I${srcdir}/../src \
 	-DVERSION='"${version}"' ${srcdir}/etags.c \
 	$(GETOPTOBJS) regex.o $(ldflags)
 etags_deps   = ${srcdir}/etags.c $(GETOPTDEPS) regex.o ../src/config.h
--- a/lib-src/config.values.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/config.values.in	Mon Aug 13 10:30:37 2007 +0200
@@ -80,6 +80,7 @@
 includedir "@includedir@"
 infodir "@infodir@"
 infopath "@infopath@"
+install_pp "@install_pp@"
 internal_makefile_list "@internal_makefile_list@"
 ld "@ld@"
 ld_dynamic_link_flags "@ld_dynamic_link_flags@"
--- a/lib-src/etags-vmslib.c	Mon Aug 13 10:29:43 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/* File name wild card expansion for VMS.
-   This file is part of the etags program.
-   Copyright (C) 1987 Free Software Foundation, Inc.
-     
-   This program 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.
-
-   This program is distributed in the hope that it will be useful,
-   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.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; see the file COPYING.  If not, write to
-   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-#include	<stdio.h>
-typedef	char	tbool;
-
-/* This is a BUG!  ANY arbitrary limit is a BUG!
-   Won't someone please fix this?  */
-#define	MAX_FILE_SPEC_LEN	255
-typedef struct	{
-  short   curlen;
-  char    body[MAX_FILE_SPEC_LEN + 1];
-} vspec;
-#define	EOS	'\0'
-#define	NO	0
-#define	YES	1
-#define	NULL	0
-
-/* gfnames - return in successive calls the 
- name of each file specified by all the remaining args in the command-line
- expanding wild cards and 
- stepping over arguments when they have been processed completely
-*/
-char*
-gfnames(pac, pav, p_error)
-	int	*pac;
-	char	**pav[];
-	tbool	*p_error;
-{
-	static	vspec	filename = {MAX_FILE_SPEC_LEN, "\0"};
-	short	fn_exp();
-
-	while (1)
-		if (*pac == 0)
-			{
-			*p_error = NO;
-			return(NULL);
-			}
-		else switch(fn_exp(&filename, **pav))
-			{
-		case 1:
-			*p_error = NO;
-			return(filename.body);
-			break;
-		case 0:
-			--*pac;
-			++*pav;
-			break;
-		default:
-			*p_error = YES;
-			return(filename.body);
-			break;
-			}
-				
-}
-
-/* fn_exp - expand specification of list of file names
- returning in each successive call the next filename matching the input
- spec. The function expects that each in_spec passed
- to it will be processed to completion; in particular, up to and
- including the call following that in which the last matching name
- is returned, the function ignores the value of in_spec, and will
- only start processing a new spec with the following call. 
- If an error occurs, on return out_spec contains the value
- of in_spec when the error occurred.
-
- With each successive filename returned in out_spec, the
- function's return value is one. When there are no more matching
- names the function returns zero. If on the first call no file
- matches in_spec, or there is any other error, -1 is returned. 
-*/
-
-#include	<rmsdef.h>
-#include	<descrip.h>
-#define		OUTSIZE	MAX_FILE_SPEC_LEN
-short
-fn_exp(out, in)
-	vspec	*out;
-	char	*in;
-{
-	static	long	context = 0;
-	static	struct	dsc$descriptor_s	o;
-	static	struct	dsc$descriptor_s	i;
-	static	tbool	pass1 = YES;
-		long	status;
-		short	retval;
-
-	if (pass1)
-		{
-		pass1 = NO;
-		o.dsc$a_pointer = (char *) out;
-		o.dsc$w_length = (short)OUTSIZE;
-		i.dsc$a_pointer = in;
-		i.dsc$w_length = (short)strlen(in);
-		i.dsc$b_dtype = DSC$K_DTYPE_T;
-		i.dsc$b_class = DSC$K_CLASS_S;
-		o.dsc$b_dtype = DSC$K_DTYPE_VT;
-		o.dsc$b_class = DSC$K_CLASS_VS;
-		}
-	if ( (status = lib$find_file(&i, &o, &context, 0, 0)) == RMS$_NORMAL)
-		{
-		out->body[out->curlen] = EOS;
-		return(1);
-		}
-	else if (status == RMS$_NMF)
-		retval = 0;
-	else
-		{
-		strcpy(out->body, in);
-		retval = -1;
-		}
-	lib$find_file_end(&context);
-	pass1 = YES;
-	return(retval);
-}	
-
-#ifndef OLD  /* Newer versions of VMS do provide `system'.  */
-system(cmd)
-     char *cmd;
-{
-  fprintf(stderr, "system() function not implemented under VMS\n");
-}
-#endif
-
-#define	VERSION_DELIM	';'
-char *massage_name(s)
-	char	*s;
-{
-	char	*start = s;	
-
-	for ( ; *s; s++)
-		if (*s == VERSION_DELIM)
-			{
-			*s = EOS;
-			break;
-			}
-		else
-			*s = tolower(*s);
-	return(start);
-}
--- a/lib-src/etags.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/etags.c	Mon Aug 13 10:30:37 2007 +0200
@@ -166,6 +166,18 @@
 #define	intoken(c)	(_itk[CHAR(c)]) /* c can be in token */
 #define	endtoken(c)	(_etk[CHAR(c)]) /* c ends tokens */
 
+#ifdef INFODOCK
+#undef OO_BROWSER
+#define OO_BROWSER 1
+#endif
+
+#ifdef OO_BROWSER
+#define set_construct(construct) \
+  if (!oo_browser_construct) oo_browser_construct = construct
+void oo_browser_clear_all_globals();
+void oo_browser_clear_some_globals();
+void oo_browser_check_and_clear_structtype();
+#endif
 
 /*
  *	xnew, xrnew -- allocate, reallocate storage
@@ -199,6 +211,9 @@
 typedef struct node_st
 {				/* sorting structure		*/
   char *name;			/* function or type name	*/
+#ifdef OO_BROWSER
+  short int construct;		/* Construct type for the OO-Browser */
+#endif
   char *file;			/* file name			*/
   bool is_func;			/* use pattern or line no	*/
   bool been_warned;		/* set if noticed dup		*/
@@ -208,6 +223,24 @@
   struct node_st *left, *right;	/* left and right sons		*/
 } node;
 
+#ifdef OO_BROWSER
+/* If you add to this array, you must add a corresponding entry to the
+   following enum. */
+static char *oo_browser_default_classes[] =
+  /* Lack of square brackets around some of these entries are intentional. */
+  {"null", "class", "method", "[constant]", "[enumeration]", "[enum_label]",
+   "extern", "[function]", "[macro]", "objc", "[structure]", "[type]",
+   "[union]", "[variable]"};
+
+/* If you add to this enum, you must add a corresponding entry to the
+   preceding array. */
+enum oo_browser_constructs {C_NULL, C_CLASS, C_METHOD, C_CONSTANT, C_ENUMERATION,
+                            C_ENUM_LABEL, C_EXTERN, C_FUNCTION, C_MACRO,
+                            C_OBJC, C_STRUCTURE, C_TYPE, C_UNION, C_VARIABLE};
+
+enum oo_browser_constructs oo_browser_construct = C_NULL;
+#endif
+
 /*
  * A `linebuffer' is a structure which holds a line of text.
  * `readline_internal' reads a line from a stream into a linebuffer
@@ -353,6 +386,9 @@
 bool cxref_style;		/* -x: create cxref style output */
 bool cplusplus;			/* .[hc] means C++, not C */
 bool noindentypedefs;		/* -I: ignore indentation in C */
+#ifdef OO_BROWSER
+bool oo_browser_format;		/* -O: OO-Browser tags format */
+#endif
 
 #ifdef LONG_OPTIONS
 struct option longopts[] =
@@ -374,6 +410,9 @@
   { "no-members",		no_argument,	   &members, FALSE },
   { "no-warn",			no_argument,	   NULL,     'w'   },
   { "output",			required_argument, NULL,     'o'   },
+#ifdef OO_BROWSER
+  { "oo-browser",		no_argument,	   NULL,     'O'   },
+#endif
 #ifdef ETAGS_REGEXPS  
   { "regex",			required_argument, NULL,     'r'   },
   { "no-regex",			no_argument,	   NULL,     'R'   },
@@ -626,6 +665,10 @@
 #endif /* ETAGS_REGEXPS */
   puts ("-o FILE, --output=FILE\n\
         Write the tags to FILE.");
+#ifdef OO_BROWSER
+  puts ("-O, --oo-browser\n\
+	Generate a specialized tags format used only by the Altrasoft OO-Browser.");
+#endif
   puts ("-I, --ignore-indentation\n\
         Don't rely on indentation quite as much as normal.  Currently,\n\
         this means not to assume that a closing brace in the first\n\
@@ -867,9 +910,17 @@
       char *optstring;
 
 #ifdef ETAGS_REGEXPS
+#ifndef OO_BROWSER
       optstring = "-aCdDf:Il:o:r:RStTi:BuvxwVhH";
 #else
+      optstring = "-aCdDf:Il:o:r:RStTi:BOuvxwVhH";
+#endif
+#else
+#ifndef OO_BROWSER
       optstring = "-aCdDf:Il:o:StTi:BuvxwVhH";
+#else
+      optstring = "-aCdDf:Il:o:StTi:BOuvxwVhH";
+#endif
 #endif /* ETAGS_REGEXPS */
 
 #ifndef LONG_OPTIONS
@@ -912,6 +963,11 @@
 	    }
 	  tagfile = optarg;
 	  break;
+#ifdef OO_BROWSER
+	case 'O':
+	  oo_browser_format = TRUE;
+	  break;
+#endif
 	case 'I':
 	case 'S':		/* for backward compatibility */
 	  noindentypedefs = TRUE;
@@ -1055,11 +1111,21 @@
 #else
 	      this_file = argbuffer[i].what;
 #endif
+#ifdef OO_BROWSER
+	      oo_browser_clear_all_globals();
+#endif
 	      /* Input file named "-" means read file names from stdin
 		 (one per line) and use them. */
 	      if (streq (this_file, "-"))
 		while (readline_internal (&filename_lb, stdin) > 0)
+#ifdef OO_BROWSER
+		  {
+		    oo_browser_clear_some_globals();
+#endif
 		  process_file (filename_lb.buffer);
+#ifdef OO_BROWSER
+		  }
+#endif
 	      else
 		process_file (this_file);
 #ifdef VMS
@@ -1235,6 +1301,11 @@
 	     to the directory of the tags file. */
 	  filename = relative_filename (file, tagfiledir);
 	}
+#ifdef OO_BROWSER
+      if (oo_browser_format)
+	fprintf (tagf, "\f\n%s\n", filename);
+      else
+#endif
       fprintf (tagf, "\f\n%s,%d\n", filename, total_size_of_entries (head));
       free (filename);
       put_entries (head);
@@ -1414,6 +1485,13 @@
   else
     np->pat = savenstr (linestart, linelen);
 
+#ifdef OO_BROWSER
+  if (oo_browser_format)
+    np->construct = oo_browser_construct;
+  oo_browser_construct = C_NULL;
+  oo_browser_check_and_clear_structtype();
+#endif
+
   add_node (np, &head);
 }
 
@@ -1459,7 +1537,12 @@
 	  cp = linestart + linelen - namelen;
 	  if (notinname (linestart[linelen-1]))
 	    cp -= 1;				/* rule #4 */
+#ifdef OO_BROWSER
+	  if (!oo_browser_format
+	      && cp >= linestart		/* rule #2 */
+#else
 	  if (cp >= linestart			/* rule #2 */
+#endif
 	      && (cp == linestart
 		  || notinname (cp[-1]))	/* rule #3 */
 	      && strneq (name, cp, namelen))	/* rule #2 */
@@ -1561,6 +1644,13 @@
     }
 }
 
+#ifdef OO_BROWSER
+/* Default class name for the current OO-Browser tag. */
+static char *oo_browser_class;
+/* Prefix character to use in OO-Browser listings for the current tag. */
+static char oo_browser_prefix;
+#endif
+
 void
 put_entries (np)
      register node *np;
@@ -1577,12 +1667,56 @@
 
   if (!CTAGS)
     {
+#ifdef OO_BROWSER
+      if (oo_browser_format)
+        {
+          /* Omit C++ `class' and `method' entries as well as Objective-C
+             entries from this OO-Browser tags file since the browser handles
+             them independently of this file.  Omit `extern' variable declarations
+             as they are unused by the OO-Browser. */
+          if (np->construct != C_CLASS
+              && np->construct != C_METHOD
+              && np->construct != C_EXTERN
+              && np->construct != C_OBJC)
+            {
+              oo_browser_class = oo_browser_default_classes[np->construct];
+              switch (np->construct)
+                {
+                case C_CONSTANT:
+                case C_ENUMERATION:
+                case C_ENUM_LABEL:
+                case C_STRUCTURE:
+                case C_TYPE:
+                case C_UNION:
+                case C_VARIABLE:
+                  oo_browser_prefix = '=';
+                  break;
+                case C_FUNCTION:
+                case C_MACRO:
+                  oo_browser_prefix = '-';
+                  break;
+                }
+              if (np->name != NULL)
+                fprintf (tagf, "%s@%c %s@%s\n",
+                         oo_browser_class, oo_browser_prefix,
+                         np->name, np->pat);
+              else
+                fprintf (tagf, "%s@%c ???@%s\n",
+                         oo_browser_class, oo_browser_prefix, np->pat);
+            }
+        }
+      else
+        {
+#endif
       if (np->name != NULL)
 	fprintf (tagf, "%s\177%s\001%d,%ld\n",
 		 np->pat, np->name, np->lno, np->cno);
       else
 	fprintf (tagf, "%s\177%d,%ld\n",
 		 np->pat, np->lno, np->cno);
+#ifdef OO_BROWSER
+	}
+#endif
     }
   else
     {
@@ -1681,6 +1815,9 @@
   st_C_ignore,
   st_C_javastruct,
   st_C_struct, st_C_enum, st_C_define, st_C_typedef, st_C_typespec
+#ifdef OO_BROWSER
+  , st_C_union, st_C_class, st_C_extern, st_C_inline
+#endif
 };
 
 /* Feed stuff between (but not including) %[ and %] lines to:
@@ -1698,14 +1835,15 @@
 extends,  	C_JAVA,	st_C_javastruct
 implements,  	C_JAVA,	st_C_javastruct
 interface,	C_JAVA, st_C_struct
-class,  	C_PLPL,	st_C_struct
+class,  	C_PLPL,	st_C_class
 namespace,	C_PLPL,	st_C_struct
 domain, 	C_STAR,	st_C_struct
-union,  	0,	st_C_struct
+union,  	0,	st_C_union
 struct, 	0,	st_C_struct
 enum,    	0,	st_C_enum
 typedef, 	0,	st_C_typedef
 define,  	0,	st_C_define
+inline,		0,	st_C_inline
 bool,		C_PLPL,	st_C_typespec
 long,    	0,	st_C_typespec
 short,   	0,	st_C_typespec
@@ -1717,7 +1855,7 @@
 unsigned,	0,	st_C_typespec
 auto,    	0,	st_C_typespec
 void,    	0,	st_C_typespec
-extern,  	0,	st_C_typespec
+extern,  	0,	st_C_extern
 static,  	0,	st_C_typespec
 const,   	0,	st_C_typespec
 volatile,	0,	st_C_typespec
@@ -1736,125 +1874,115 @@
 %]
 and replace lines between %< and %> with its output. */
 /*%<*/
-/* starting time is 10:15:51 */
-/* C code produced by gperf version 2.1 (K&R C version) */
+/* C code produced by gperf version 2.5 (GNU C++ version) */
 /* Command-line: gperf -c -k 1,3 -o -p -r -t  */
-
-
 struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
 
+#define TOTAL_KEYWORDS 41
 #define MIN_WORD_LENGTH 3
 #define MAX_WORD_LENGTH 15
-#define MIN_HASH_VALUE 11
-#define MAX_HASH_VALUE 117
-/*
-   40 keywords
-  107 is the maximum key range
-*/
-
-static int
+#define MIN_HASH_VALUE 19
+#define MAX_HASH_VALUE 100
+/* maximum key range = 82, duplicates = 0 */
+
+static unsigned int
 hash (str, len)
      register char *str;
-     register unsigned int len;
+     register int unsigned len;
 {
-  static unsigned char hash_table[] =
+  static unsigned char asso_values[] =
     {
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-     117, 117, 117, 117,   1, 117, 117, 117,   2,  42,
-      16, 117, 117, 117, 117, 117, 117, 117, 117, 117,
-       5, 117, 117,  21,  54, 117, 117, 117, 117, 117,
-     117, 117, 117, 117, 117, 117, 117,  24,  19,  43,
-       2,  35,   3,  10, 117,  26, 117, 117,   9,  20,
-      35,   9,  61, 117,  40,  52,  10,  57,   3, 117,
-     117, 117, 117, 117, 117, 117, 117, 117
-  };
-  return len + hash_table[(int) str[2]] + hash_table[(int) str[0]];
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+     101, 101, 101, 101,  25, 101, 101, 101,  31,  33,
+      46, 101, 101, 101, 101, 101, 101, 101, 101, 101,
+      60, 101, 101,  43,   1, 101, 101, 101, 101, 101,
+     101, 101, 101, 101, 101, 101, 101,  11,  17,   4,
+      44,  63,  31,   8, 101,  29, 101, 101,  14,  15,
+      44,   5,  13, 101,  38,  15,  25,  33,  55, 101,
+     101, 101, 101, 101, 101, 101, 101, 101,
+    };
+  return len + asso_values[str[2]] + asso_values[str[0]];
 }
 
-struct C_stab_entry * in_word_set PP ((char *str, unsigned int len));
 struct C_stab_entry *
 in_word_set (str, len)
      register char *str;
      register unsigned int len;
 {
-
-  static struct C_stab_entry  wordlist[] =
+  static struct C_stab_entry wordlist[] =
     {
       {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"",}, {"",}, 
-      {"define",   	0,	st_C_define},
-      {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"float",    	0,	st_C_typespec},
-      {"",}, {"",}, 
-      {"volatile", 	0,	st_C_typespec},
-      {"",}, {"",}, 
-      {"DEFUN", 		0,	st_C_gnumacro},
-      {"",}, {"",}, {"",}, {"",}, 
-      {"domain",  	C_STAR,	st_C_struct},
+      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
+      {"",},       {"char",             0,      st_C_typespec},
+      {"class",         C_PLPL, st_C_class},
       {"",}, {"",}, {"",}, 
-      {"bool", 		C_PLPL,	st_C_typespec},
-      {"void",     	0,	st_C_typespec},
+      {"package",       C_JAVA, st_C_ignore},
+      {"short",         0,      st_C_typespec},
+      {"bool",          C_PLPL, st_C_typespec},
+      {"",}, {"",}, 
+      {"signed",        0,      st_C_typespec},
+      {"",}, {"",}, 
+      {"static",        0,      st_C_typespec},
+      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
+      {"ENTRY",                 0,      st_C_gnumacro},
+      {"auto",          0,      st_C_typespec},
+      {"float",         0,      st_C_typespec},
+      {"",}, {"",}, {"",}, 
+      {"typedef",       0,      st_C_typedef},
+      {"typename",      C_PLPL, st_C_typespec},
+      {"mutable",       C_PLPL, st_C_typespec},
+      {"import",                C_JAVA, st_C_ignore},
+      {"inline",                0,      st_C_inline},
+      {"",}, {"",}, 
+      {"implements",    C_JAVA, st_C_javastruct},
+      {"const",         0,      st_C_typespec},
       {"",}, 
-      {"friend", 		C_PLPL,	st_C_ignore},
-      {"@implementation", 0,	st_C_objimpl},
-      {"mutable", 	C_PLPL,	st_C_typespec},
-      {"auto",     	0,	st_C_typespec},
-      {"int",      	0,	st_C_typespec},
-      {"@end", 		0,	st_C_objend},
-      {"",}, {"",}, {"",}, {"",}, 
-      {"interface", 	C_JAVA, st_C_struct},
-      {"@interface", 	0,	st_C_objprot},
+      {"@implementation", 0,    st_C_objimpl},
+      {"unsigned",      0,      st_C_typespec},
+      {"int",           0,      st_C_typespec},
       {"",}, 
-      {"long",     	0,	st_C_typespec},
-      {"SYSCALL", 	0,	st_C_gnumacro},
-      {"@protocol", 	0,	st_C_objprot},
-      {"extern",   	0,	st_C_typespec},
-      {"extends",   	C_JAVA,	st_C_javastruct},
-      {"PSEUDO", 		0,	st_C_gnumacro},
-      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"",}, 
-      {"namespace", 	C_PLPL,	st_C_struct},
-      {"double",   	0,	st_C_typespec},
-      {"short",    	0,	st_C_typespec},
-      {"",}, 
-      {"signed",   	0,	st_C_typespec},
+      {"struct",        0,      st_C_struct},
       {"",}, {"",}, 
-      {"char",     	0,	st_C_typespec},
-      {"class",   	C_PLPL,	st_C_struct},
-      {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"typedef",  	0,	st_C_typedef},
-      {"typename", 	C_PLPL,	st_C_typespec},
-      {"",}, {"",}, 
-      {"static",   	0,	st_C_typespec},
-      {"const",    	0,	st_C_typespec},
-      {"",}, {"",}, {"",}, {"",}, 
-      {"union",   	0,	st_C_struct},
+      {"long",          0,      st_C_typespec},
+      {"interface",     C_JAVA, st_C_struct},
+      {"",}, 
+      {"domain",        C_STAR, st_C_struct},
+      {"friend",                C_PLPL, st_C_ignore},
+      {"union",         0,      st_C_union},
+      {"namespace",     C_PLPL, st_C_struct},
+      {"",}, {"",}, {"",}, 
+      {"@protocol",     0,      st_C_objprot},
+      {"@end",          0,      st_C_objend},
+      {"",}, {"",}, {"",}, 
+      {"volatile",      0,      st_C_typespec},
+      {"",}, 
+      {"@interface",    0,      st_C_objprot},
+      {"",}, 
+      {"define",        0,      st_C_define},
+      {"DEFUN",                 0,      st_C_gnumacro},
+      {"double",        0,      st_C_typespec},
+      {"explicit",      C_PLPL, st_C_typespec},
+      {"",}, {"",}, {"",}, 
+      {"void",          0,      st_C_typespec},
       {"",}, {"",}, {"",}, {"",}, 
-      {"import", 		C_JAVA,	st_C_ignore},
-      {"",}, {"",}, 
-      {"enum",     	0,	st_C_enum},
-      {"implements",   	C_JAVA,	st_C_javastruct},
-      {"struct",  	0,	st_C_struct},
-      {"",}, {"",}, 
-      {"ENTRY", 		0,	st_C_gnumacro},
-      {"",}, {"",}, 
-      {"explicit", 	C_PLPL,	st_C_typespec},
-      {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"package", 	C_JAVA,	st_C_ignore},
-      {"",}, {"",}, {"",}, {"",}, {"",}, 
-      {"unsigned", 	0,	st_C_typespec},
+      {"SYSCALL",       0,      st_C_gnumacro},
+      {"extern",        0,      st_C_extern},
+      {"extends",       C_JAVA, st_C_javastruct},
+      {"",}, {"",}, {"",}, 
+      {"PSEUDO",                0,      st_C_gnumacro},
+      {"enum",          0,      st_C_enum},
     };
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
       register int key = hash (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= MIN_HASH_VALUE)
+      if (key <= MAX_HASH_VALUE && key >= 0)
         {
           register char *s = wordlist[key].name;
 
@@ -1864,7 +1992,6 @@
     }
   return 0;
 }
-/* ending time is 10:15:52 */
 /*%>*/
 
 enum sym_type C_symtype PP ((char *str, int len, int c_ext));
@@ -1933,6 +2060,16 @@
 char *structtag = "<uninited>";
 enum sym_type structtype;
 
+#ifdef OO_BROWSER
+void
+oo_browser_check_and_clear_structtype()
+{
+  /* Allow for multiple enum_label tags. */
+  if (structtype != st_C_enum)
+    structtype = st_none;
+}
+#endif
+
 /*
  * When objdef is different from onone, objtag is the name of the class.
  */
@@ -1969,7 +2106,6 @@
   oignore			/* wait for @end */
 } objdef;
 
-
 /*
  * Use this structure to keep info about the token read, and how it
  * should be tagged.  Used by the make_C_tag function to build a tag.
@@ -2003,6 +2139,26 @@
  */
 int methodlen;
 
+#ifdef OO_BROWSER
+void
+oo_browser_clear_all_globals()
+{
+  /* Initialize globals so there is no carry over between files. */
+  oo_browser_construct = C_NULL;
+  fvdef = fvnone; typdef = tnone; structdef = snone;
+  definedef = dnone; objdef = onone;
+  structtype = st_none;
+  next_token_is_func = yacc_rules = FALSE;
+}
+
+void
+oo_browser_clear_some_globals()
+{
+  oo_browser_construct = C_NULL;
+  structtype = st_none;
+}
+#endif
+
 /*
  * consider_token ()
  *	checks to see if the current token is at the start of a
@@ -2039,6 +2195,33 @@
 {
   enum sym_type toktype = C_symtype (str, len, c_ext);
 
+#ifdef OO_BROWSER
+  switch (toktype)
+    {
+      case st_C_struct:
+        set_construct(C_STRUCTURE);
+        break;
+      case st_C_union:
+        set_construct(C_UNION);
+        break;
+      case st_C_class:
+        set_construct(C_CLASS);
+        break;
+      case st_C_enum:
+        set_construct(C_ENUMERATION);
+        break;
+      case st_C_typedef:
+        set_construct(C_TYPE);
+        break;
+      case st_C_extern:
+        set_construct(C_EXTERN);
+        break;
+      case st_C_inline:
+        set_construct(C_FUNCTION);
+        break;
+    }
+#endif
+
   /*
    * Advance the definedef state machine.
    */
@@ -2063,7 +2246,55 @@
        * and constantypedefs is FALSE.
        */
       definedef = dignorerest;
+#ifndef OO_BROWSER
       *is_func_or_var = (c == '(');
+#else
+      {
+        char *p = str + len * sizeof(char);
+
+        if (*p == '(')
+          /* This must be a macro since there is no
+             whitespace between the opening parenthesis
+             and the definition name. */
+          *is_func_or_var = TRUE;
+        else
+          {
+            *is_func_or_var = FALSE;
+
+            /* Handle possible whitespace between macro tag and opening
+               parenthesis and ensure this is an actual macro.
+               -- Bob Weiner, Altrasoft, 11/19/1997 */
+            while (*p && isspace(*p)) p++;
+            if (*p) c = *p;
+
+            /* Skip over nested parentheses. */
+            if (c == '(')
+              {
+                short depth = 1;
+
+                while (*++p && depth > 0 && *p != '\n')
+                  {
+                    switch (*p)
+                      {
+                      case '(':
+                        depth++; break;
+                      case ')':
+                        depth--; break;
+                      }
+                  }
+
+                /* If this is a macro, we have just passed
+                   the arguments and there will be more on
+                   the line before the NULL character that marks
+                   the end of the line token. */
+                while (*p == ' ' || *p == '\t') p++;
+                if (*p) *is_func_or_var = TRUE;
+              }
+          }
+      }
+
+      set_construct((*is_func_or_var) ? C_MACRO : C_CONSTANT);
+#endif
       if (!*is_func_or_var && !constantypedefs)
 	return FALSE;
       else
@@ -2093,10 +2324,17 @@
 	{
 	case st_none:
 	case st_C_typespec:
+#ifdef OO_BROWSER
+	case st_C_extern:
+#endif
 	  typdef = tend;
 	  break;
 	case st_C_struct:
 	case st_C_enum:
+#ifdef OO_BROWSER
+	case st_C_union:
+	case st_C_class:
+#endif
 	  break;
 	}
       /* Do not return here, so the structdef stuff has a chance. */
@@ -2107,6 +2345,11 @@
 	case st_C_typespec:
 	case st_C_struct:
 	case st_C_enum:
+#ifdef OO_BROWSER
+	case st_C_extern:
+	case st_C_union:
+	case st_C_class:
+#endif
 	  return FALSE;
 	}
       return TRUE;
@@ -2130,6 +2373,11 @@
       return FALSE;
     case st_C_struct:
     case st_C_enum:
+#ifdef OO_BROWSER
+    case st_C_union:
+    case st_C_class:
+    case st_C_extern:
+#endif
       if (typdef == ttypedseen
 	  || (typedefs_and_cplusplus && cblev == 0 && structdef == snone))
 	{
@@ -2143,7 +2391,13 @@
     {
       /* Save the tag for struct/union/class, for functions and variables
 	 that may be defined inside. */
+#ifndef OO_BROWSER
       if (structtype == st_C_struct)
+#else
+      if (structtype == st_C_struct
+	  || structtype == st_C_union
+	  || structtype == st_C_class)
+#endif
 	structtag = savenstr (str, len);
       else
 	structtag = "<enum>";
@@ -2192,9 +2446,15 @@
       switch (toktype)
 	{
 	case st_C_objprot:
+#ifdef OO_BROWSER
+	  set_construct(C_OBJC);
+#endif
 	  objdef = oprotocol;
 	  return FALSE;
 	case st_C_objimpl:
+#ifdef OO_BROWSER
+	  set_construct(C_OBJC);
+#endif
 	  objdef = oimplementation;
 	  return FALSE;
 	}
@@ -2261,6 +2521,9 @@
   switch (toktype)
     {
     case st_C_typespec:
+#ifdef OO_BROWSER
+    case st_C_extern:
+#endif
       if (fvdef != finlist && fvdef != fignore  && fvdef != vignore)
         fvdef = fvnone;		/* should be useless */
       return FALSE;
@@ -2269,7 +2532,14 @@
       return FALSE;
     case st_none:
       if (constantypedefs && structdef == sinbody && structtype == st_C_enum)
+#ifdef OO_BROWSER
+        {
+	  oo_browser_construct = C_ENUM_LABEL;
+#endif
 	return TRUE;
+#ifdef OO_BROWSER
+	}
+#endif
       if (fvdef == fvnone)
 	{
 	  fvdef = fvnameseen;	/* function or variable */
@@ -2546,6 +2816,9 @@
 		       */
 		      lp += 2;
 		      toklen += 3;
+#ifdef OO_BROWSER
+		      set_construct(C_METHOD);
+#endif
 		    }
 		  else
 		    {
@@ -2569,6 +2842,9 @@
 				       newlb.buffer + tokoff, toklen);
 			      token_name.len = len;
 			      tok.named = TRUE;
+#ifdef OO_BROWSER
+			      oo_browser_construct = C_METHOD;
+#endif
 			    }
 			  else if (objdef == ocatseen)
 			    /* Objective C category */
@@ -2582,12 +2858,18 @@
 			      strcat (token_name.buffer, ")");
 			      token_name.len = len;
 			      tok.named = TRUE;
+#ifdef OO_BROWSER
+			      oo_browser_construct = C_OBJC;
+#endif
 			    }
 			  else if (objdef == omethodtag
 				   || objdef == omethodparm)
 			    /* Objective C method */
 			    {
 			      tok.named = TRUE;
+#ifdef OO_BROWSER
+			      oo_browser_construct = C_OBJC;
+#endif
 			    }
 			  else
 			    {
@@ -2597,10 +2879,23 @@
 			      token_name.buffer[toklen] = '\0';
 			      token_name.len = toklen;
 			      /* Name macros. */
+#ifdef OO_BROWSER
+			      /* Also name #define constants,
+				 enumerations and enum_labels.
+				 -- Bob Weiner, Altrasoft */
+			      tok.named
+				      = (structdef == stagseen
+					 || typdef == tend
+					 || definedef == dignorerest
+					 || (oo_browser_format
+					     && (oo_browser_construct == C_ENUMERATION
+					     || oo_browser_construct == C_ENUM_LABEL)));
+#else
 			      tok.named = (structdef == stagseen
 					   || typdef == tend
 					   || (funorvar
 					       && definedef == dignorerest));
+#endif
 			    }
 			  tok.lineno = lineno;
 			  tok.linelen = tokoff + toklen + 1;
@@ -2640,6 +2935,9 @@
 		      fvdef = finlist;
 		      continue;
 		    case flistseen:
+#ifdef OO_BROWSER
+		      set_construct(C_MACRO);
+#endif
 		      make_C_tag (TRUE); /* a function */
 		      fvdef = fignore;
 		      break;
@@ -2710,6 +3008,9 @@
 	    switch (typdef)
 	      {
 	      case tend:
+#ifdef OO_BROWSER
+		set_construct(C_TYPE);
+#endif
 		make_C_tag (FALSE); /* a typedef */
 		/* FALLTHRU */
 	      default:
@@ -2720,8 +3021,30 @@
 	    case fignore:
 	      break;
 	    case fvnameseen:
+#ifndef OO_BROWSER
 	      if ((globals && cblev == 0) || (members && cblev == 1))
 		make_C_tag (FALSE); /* a variable */
+#else
+	      if (constantypedefs && structdef == snone)
+		{
+		  tok.named = TRUE;
+		  switch (structtype)
+		    {
+		      case st_C_enum:
+			set_construct(C_ENUMERATION);
+			break;
+		      case st_C_class:
+			set_construct(C_CLASS);
+			break;
+		      default:
+			set_construct(C_VARIABLE);
+			break;
+		    }
+		  make_C_tag (FALSE);
+		  /* Force reset of st_C_enum structtype value. */
+		  structtype = st_none;
+		}
+#endif
 	      /* FALLTHRU */
 	    default:
 	      fvdef = fvnone;
@@ -2765,6 +3088,9 @@
 	    break;
 	  if (cblev == 0 && typdef == tend)
 	    {
+#ifdef OO_BROWSER
+	      set_construct(C_TYPE);
+#endif
 	      typdef = tignore;
 	      make_C_tag (FALSE);	/* a typedef */
 	      break;
@@ -2776,8 +3102,30 @@
 	    case vignore:
 	      break;
 	    case fvnameseen:
+#ifndef OO_BROWSER
 	      if ((globals && cblev == 0) || (members && cblev == 1))
 		make_C_tag (FALSE); /* a variable */
+#else
+	      if (constantypedefs && structdef == snone)
+	        {
+		  tok.named = TRUE;
+		  switch (structtype)
+		    {
+		      case st_C_enum:
+			set_construct(C_ENUMERATION);
+			break;
+		      case st_C_class:
+			set_construct(C_CLASS);
+			break;
+		      default:
+			set_construct(C_VARIABLE);
+			break;
+		    }
+		  make_C_tag (FALSE);
+		  /* Force reset of st_C_enum structtype value. */
+		  structtype = st_none;
+		}
+#endif
 	      /* FALLTHRU */
 	    default:
 	      fvdef = fvnone;
@@ -2801,6 +3149,9 @@
 		    {
 		      /* This handles constructs like:
 			 typedef void OperatorFun (int fun); */
+#ifdef OO_BROWSER
+		      set_construct(C_TYPE);
+#endif
 		      make_C_tag (FALSE);
 		      typdef = tignore;
 		    }
@@ -2835,6 +3186,9 @@
 		}
 	      if (cblev == 0 && typdef == tend)
 		{
+#ifdef OO_BROWSER
+		  set_construct(C_TYPE);
+#endif
 		  typdef = tignore;
 		  make_C_tag (FALSE); /* a typedef */
 		}
@@ -2862,6 +3216,12 @@
 	  switch (fvdef)
 	    {
 	    case flistseen:
+#ifdef OO_BROWSER
+	      set_construct(C_FUNCTION);
+	      /* Ensure function name is recorded.
+		 -- Bob Weiner, Altrasoft */
+	      tok.named = TRUE;
+#endif
 	      make_C_tag (TRUE); /* a function */
 	      /* FALLTHRU */
 	    case fignore:
@@ -2917,6 +3277,11 @@
 
 	      structdef = snone;
 	      structtag = "<error>";
+#ifdef OO_BROWSER
+	      /* Next line added to avoid any state carryover between
+		 functions. -- Bob Weiner, Altrasoft, 11/19/1997 */
+	      fvdef = fvnone; oo_browser_construct = C_NULL;
+#endif
 	    }
 	  break;
 	case '=':
@@ -2929,8 +3294,31 @@
 	    case vignore:
 	      break;
 	    case fvnameseen:
+#ifndef OO_BROWSER
 	      if ((globals && cblev == 0) || (members && cblev == 1))
 		make_C_tag (FALSE); /* a variable */
+#else
+	      if (constantypedefs)
+		{
+		  tok.named = TRUE;
+                  switch (structtype)
+                    {
+                      case st_C_enum:
+                        set_construct(C_ENUMERATION);
+                        break;
+                      case st_C_class:
+                        set_construct(C_CLASS);
+                        break;
+                      default:
+                        /* a global variable */
+                        set_construct(C_VARIABLE);
+                        break;
+                    }
+		  make_C_tag (FALSE);
+                  /* Force reset of st_C_enum structtype value. */
+                  structtype = st_none;
+		}
+#endif
 	      /* FALLTHRU */
 	    default:
 	      fvdef = vignore;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib-src/installexe.sh	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,21 @@
+#!sh
+
+install_prog=$1
+shift
+
+tstr=""
+while [ $# -gt 0 ]
+do
+  if [ -e $1.exe ]
+  then
+    tstr="$tstr$1.exe $2.exe"
+    shift
+  else
+    tstr="$tstr$1 "
+  fi
+  shift
+done
+echo "$install_prog $tstr"
+eval "$install_prog $tstr"
+exit
+
--- a/lib-src/update-autoloads.sh	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/update-autoloads.sh	Mon Aug 13 10:30:37 2007 +0200
@@ -124,4 +124,4 @@
 	$EMACS -batch -q -no-site-file -l autoload -f batch-update-directory $dir
 done
 
-eval "$make_special_commands"
+# eval "$make_special_commands"
--- a/lib-src/update-custom.sh	Mon Aug 13 10:29:43 2007 +0200
+++ b/lib-src/update-custom.sh	Mon Aug 13 10:30:37 2007 +0200
@@ -81,7 +81,7 @@
 fi
 
 echon "Checking directories..."
-dirs=
+dirs=lisp/
 for dir in lisp/*; do
 	if test -d $dir \
 		-a $dir != lisp/CVS \
--- a/lisp/ChangeLog	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 10:30:37 2007 +0200
@@ -1,3 +1,129 @@
+1998-04-17  Jonathan Harris <jhar@tardis.ed.ac.uk>
+
+	* toolbar.el: Remove (featurep 'x) test from
+	toolbar-make-button-list
+
+1998-04-17  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* gnuserv.el (gnuserv-edit): Switch to the next gnuserv buffer
+	only if in the same frame.
+
+1998-04-17  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* packages.el (package-locations): Added site-packages hierarchy.
+
+	* setup-paths.el (paths-default-info-directories): Introduced and
+	used.
+
+	* packages.el, setup-paths.el: Set various path searching depths
+	to 1.
+
+	* packages.el (packages-hierarchy-depth): 
+	(packages-load-path-depth): Introduced and used.
+
+	* setup-paths.el (paths-load-path-depth): Introduced and used.
+
+	* find-paths.el (paths-find-recursive-path): Added max-depth
+	parameter.
+
+1998-04-15  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* setup-paths.el (paths-construct-info-path): Removed 
+	dependency on behavior of (file-name-as-directory "").
+
+1998-04-09  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* ldap.el (ldap-search): Adapt to the new low-level API using ldap 
+	lisp objects
+
+1998-04-14  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* dump-paths.el, startup.el: Added handling for --debug-paths.
+
+1998-04-15  William M. Perry  <wmperry@aventail.com>
+
+	* wid-edit.el: We cannot just set the help-echo or balloon-help
+	  properties for an extent based on the :help-echo widget
+	  property, since help-echo and balloon-help cause an EXTENT to
+	  get passed in, where :help-echo functions are expecting a WIDGET 
+
+1998-04-15  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* scrollbar.el (init-scrollbar-from-resources): Call
+	mswindows-init-scrollbar-metrics when appropriate.
+
+Thu Apr 16 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* dumped-lisp.el: dump x-toolbar for window system
+
+	* msw-init.el (init-post-mswindows-win): enable toolbars if we
+	have support and xpm.
+
+1998-04-16  SL Baur  <steve@altair.xemacs.org>
+
+	* files.el (toggle-read-only): Fix docstring.
+	From Didier Verna <verna@inf.enst.fr>
+
+1998-04-14  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* startup.el (normal-top-level): Load autoload-file-name without
+	specifying an extension---some people only auto-autoload.el.gz.
+
+1998-04-06  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* files.el (backup-enable-predicate): Don't bomb on NAME being
+	nil.
+
+1998-04-13  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* find-paths.el, packages.el: Now prefers configure'd paths.
+	This shouldn't cause any of the originally anticipated problems as
+	the current paths architecture will not define the various
+	configure-xxx variables if they're not specified on the configure
+	command line.
+
+	* find-paths.el, setup-paths.el, packages.el: Removed all
+	mentionings of "/" as a path separator.
+	Used paths-construct-path throughout.
+
+	* find-paths.el (paths-construct-path): Created to assemble paths
+	from directory components.
+
+	* setup-paths.el, packages.el: Used paths-decode-directory-path
+	instead of decode-path-internal.
+
+	* find-paths.el: Removed unused (and bogus) paths-find-emacs-path
+	and associates.
+	(paths-decode-directory-path) Created.
+
+	* setup-paths.el: Changed configure-exec-path to
+	configure-exec-directory.
+
+1998-04-11  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* packages.el (packages-find-packages): Fixed decoding of
+	EMACSPACKAGEPATH.
+
+	* startup.el: -no-packages -> -no-early-packages.
+
+	(packages-load-package-lisps): Fixed loading of auto-autoload
+	files.
+
+	* startup.el (normal-top-level): Fixed loading of core
+	auto-autoload.
+
+	* obsolete.el: Un-obsoleted site-directory.  Sigh.
+
+	* startup.el, packages.el, dump-paths.el: Added proper settings
+	for site-directory and lisp-directory variables.
+
+	* startup.el, loadup.el: Renamed inhibit-update-autoloads to
+	inhibit-package-autoloads and fixed handling of it.
+
+	* startup.el, packages.el, dump-paths.el, loadup.el: Fixed
+	handling of former inhibit-package-init, now
+	inhibit-early-packages, to make -vanilla etc. work.
+
 1998-04-10  Kirill M. Katsnelson  <kkm@kis.ru>
 
 	* code-process.el (start-process): Fallback to 'undecided instead
--- a/lisp/README	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/README	Mon Aug 13 10:30:37 2007 +0200
@@ -1,23 +1,25 @@
+The files in this directory contain source code for the XEmacs
+facilities written in Emacs Lisp.  *.el files are Elisp source, and
+*.elc files are byte-compiled versions of the corresponding *.el
+files.  Byte-compiled files are architecture-independent.
 
-The subdirectories of this directory contain source code for the XEmacs
-facilities written in Emacs Lisp.  *.el files are Elisp source, and *.elc
-files are byte-compiled versions of the corresponding *.el files.
-Byte-compiled files are architecture-independent.
+#### Someone please update this.
 
-When XEmacs starts up, it adds all subdirectories of the site-lisp
-directory.  The site-lisp directory normally exists only in
-installation trees.  For more information about the site-lisp
-directory see the NEWS file.
+bogus> When XEmacs starts up, it adds all subdirectories of the
+bogus> site-lisp directory.  The site-lisp directory normally exists
+bogus> only in installation trees.  For more information about the
+bogus> site-lisp directory see the NEWS file.
 
-After XEmacs adds all subdirectories of the site-lisp directory, it
-adds all subdirectories of this directory to the load-path (the list
-of directories to be searched when loading files.)  To speed up this
-process, this directory has been rearranged to have very few files at
-the top-level, so that emacs doesn't have to stat() several hundred
-files to find the dozen or so which are actually subdirectories.
+bogus> After XEmacs adds all subdirectories of the site-lisp
+bogus> directory, it adds all subdirectories of this directory to the
+bogus> load-path (the list of directories to be searched when loading
+bogus> files.)  To speed up this process, this directory has been
+bogus> rearranged to have very few files at the top-level, so that
+bogus> emacs doesn't have to stat() several hundred files to find the
+bogus> dozen or so which are actually subdirectories.
 
-Directories whose names begin with "-" or "." are not added to the default
-load-path.
+bogus> Directories whose names begin with "-" or "." are not added to
+bogus> the default load-path.
 
 The only files which remain at top-level are those which you might
 reasonably want to alter when installing or customizing XEmacs at your
@@ -48,127 +50,3 @@
 			inhibit-default-init to t.
 
 	version.el	This contains the version information for XEmacs.
-
-
-These are the main subdirectories:
-
-	prim		Fundamental XEmacs functionality.  Some of this is
-			pre-dumped with XEmacs, some is autoloaded.
-
-	utils		Various utility functions that some other XEmacs
-			packages build on.  These are not user commands.
-
-	modes		Text-editing and programming-language-sensitive modes.
-
-	emulators	XEmacs can emulate a few different editors.  These are
-			a bit more than what `modes' generally are.
-
-	term		Terminal-specific customization files.  When XEmacs
-			starts, it checks the $TERM environment variable to
-			see what type of terminal the user is running on, and
-			loads a file named $TERM.el from this directory, if
-			that file exists.
-
-	x11		X Window System-specific code.
-
-	games		Various fun sorts of things.
-
-	packages	Random other utilities that are not primarily about
-			editing text.  For example, code for automatically
-			uncompressing .Z files would be here.  This is an
-			`everything else' sort of directory.
-
-Some packages are fairly large; those have been given their own	directories:
-
-	auctex		A package for editing TeX documents. [Available as
-			installable package]
-
-	bytecomp	The XEmacs-lisp compiler.
-
-	calendar	A calendar and appointment manager.
-
-	cl		Common Lisp compatibility code.
-
-	comint		General code for interacting with inferior processes,
-			like shell buffers and lisp interpreters.
-
-	custom		User environment customization code.
-
-	edebug		A source-level debugger for Elisp.
-
-	ediff		A comprehensive visual interface to diff and patch.
-
-	efs		The directory editor, remote FTP frontend.
-
-	egg		MULE Input Method.
-
-	electric	The "electric" commands; these implement temporary
-			windows for help, list-buffers, etc.
-
-	eos		An interface to Sun's SparcWorks product.
-
-	eterm		A merge of the comint shell mode with an
-			ANSI-compatible terminal-emulator.
-
-	gnats		Interface to XEmacs bug reporting system based on
-			Cygnus GNATS.
-
-	gnus		A network news and mail reader.  [Available as
-			installable package]
-
-	hm--html-menus	Menu interface to html-mode.
-
-	hyperbole	An information management and hypertext system.
-
-	ilisp		A comint-based package for interacting with inferior
-			lisp processes.
-
-	iso		ISO Latin language support.
-
-	its		MULE Input Method.  [Requires installing LEIM at
-			XEmacs build]
-
-	language	MULE non-English language support.  [Requires
-			installing LEIM at XEmacs build]
-
-	locale		IE18N stuff.
-
-	mailcrypt	Package for dealing with PGP encrypted messages.
-
-	mel		MIME encoding library (part of the Tools for MIME).
-
-	mh-e		An interface to the MH-E mail handling system.
-
-	mu		Message Utilities library (part of the Tools for
-			MIME).
-
-	mule		Multi-lingual extensions for XEmacs.  [Requires
-			installing LEIM at XEmacs build]
-
-	oobr		An Object-Oriented class browser.
-
-	pcl-cvs		An interface to the Concurrent Version System.
-
-	psgml		General purpose SGML editing support with extra
-			support for editing HTML.
-
-	quail		MULE Input Method.  [Requires installing LEIM at
-			XEmacs build]
-
-	rmail		A BABYL-format mail reader.
-
-	sunpro		Additional code for interfacing with SunPro products.
-
-	tl		Tiny Library (Part of the Tools for MIME).
-
-	tm		Tools for MIME.  MIME support for emacs lisp based
-			news and mail readers.
-
-	tooltalk	An inteface to the ToolTalk communication protocol.
-
-	viper		A full-featured VI emulator.
-
-	vm		View Mail, an UNIX-format alternative to RMAIL.
-
-	w3		A World Wide Web interface.  [Available as installable
-			package]
--- a/lisp/auto-autoloads.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/auto-autoloads.el	Mon Aug 13 10:30:37 2007 +0200
@@ -155,7 +155,7 @@
 Use this from the command line, with `-batch';
 it won't work in an interactive Emacs.
 Each file is processed even if an error occurred previously.
-For example, invoke \"emacs -batch -f batch-byte-compile $emacs/ ~/*.el\"" nil nil)
+For example, invoke \"xemacs -batch -f batch-byte-compile $emacs/ ~/*.el\"" nil nil)
 
 (autoload 'batch-byte-recompile-directory-norecurse "bytecomp" "\
 Same as `batch-byte-recompile-directory' but without recursion." nil nil)
@@ -503,7 +503,7 @@
 ;;;### (autoloads (config-value config-value-hash-table) "config" "lisp/config.el")
 
 (autoload 'config-value-hash-table "config" "\
-Returns hashtable of configuration parameters and their values." nil nil)
+Return hashtable of configuration parameters and their values." nil nil)
 
 (autoload 'config-value "config" "\
 Return the value of the configuration parameter CONFIG_SYMBOL." nil nil)
@@ -1038,7 +1038,7 @@
 (autoload 'gnuserv-start "gnuserv" "\
 Allow this Emacs process to be a server for client processes.
 This starts a gnuserv communications subprocess through which
-client \"editors\" (gnuclient and gnudoit) can send editing commands to 
+client \"editors\" (gnuclient and gnudoit) can send editing commands to
 this Emacs job.  See the gnuserv(1) manual page for more details.
 
 Prefix arg means just kill any existing server communications subprocess." t nil)
@@ -1099,6 +1099,14 @@
 
 ;;;### (autoloads (Info-elisp-ref Info-emacs-key Info-goto-emacs-key-command-node Info-goto-emacs-command-node Info-emacs-command Info-search Info-visit-file Info-goto-node Info-query info) "info" "lisp/info.el")
 
+(defvar Info-directory-list nil "\
+List of directories to search for Info documentation files.
+
+The first directory in this list, the \"dir\" file there will become
+the (dir)Top node of the Info documentation tree.  If you wish to
+modify the info search path, use `M-x customize-variable,
+Info-directory-list' to do so.")
+
 (autoload 'info "info" "\
 Enter Info, the documentation browser.
 Optional argument FILE specifies the file to examine;
@@ -1175,7 +1183,7 @@
 `file' should be the full path to the lisp file to install.
 `destdir' should be a simple directory name.
 The optional `pkg-dir' can be used to override the default package hierarchy
-\(last package-path)." t nil)
+\(car (last late-packages))." t nil)
 
 (autoload 'package-admin-add-binary-package "package-admin" "\
 Install a pre-bytecompiled XEmacs package into package hierarchy." t nil)
--- a/lisp/byte-optimize.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/byte-optimize.el	Mon Aug 13 10:30:37 2007 +0200
@@ -148,7 +148,8 @@
 ;; modify the interpreter to obey this (unless the loader was hacked 
 ;; in some grody way, but that's a really bad idea.)
 ;;
-;; Opinions are mixed on the following paragraph.  -slb.
+;; HA!  RMS removed the following paragraph from his version of
+;; byte-opt.el.
 ;;
 ;; Really the Right Thing is to make lexical scope the default across
 ;; the board, in the interpreter and compiler, and just FIX all of 
--- a/lisp/bytecomp-runtime.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/bytecomp-runtime.el	Mon Aug 13 10:30:37 2007 +0200
@@ -189,6 +189,8 @@
 ;;; Interface to file-local byte-compiler parameters.
 ;;; Redefined in bytecomp.el.
 
+;;; The great RMS speaketh:
+;;;
 ;;; I nuked this because it's not a good idea for users to think of
 ;;; using it.  These options are a matter of installation preference,
 ;;; and have nothing to do with particular source files; it's a
--- a/lisp/cmdloop.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/cmdloop.el	Mon Aug 13 10:30:37 2007 +0200
@@ -260,8 +260,9 @@
   :type 'number
   :group 'keyboard)
 
-;;; This is implemented differently in GNU Emacs.
-;;; We can't support both properly until we have Lisp magic variables.
+;That damn RMS went off and implemented something differently, after
+;we had already implemented it.  We can't support both properly until
+;we have Lisp magic variables.
 ;(defvar suggest-key-bindings t
 ;  "*FSFmacs equivalent of `teach-extended-commands-*'.
 ;Provided for compatibility only.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/custom-load.el	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,79 @@
+;;; custom-load.el --- automatically extracted custom dependencies
+
+;;; Code:
+
+(custom-add-loads 'extensions '("auto-show" "wid-edit"))
+(custom-add-loads 'info-faces '("info"))
+(custom-add-loads 'custom-buffer '("cus-edit"))
+(custom-add-loads 'custom-faces '("cus-edit"))
+(custom-add-loads 'auto-show '("auto-show"))
+(custom-add-loads 'mouse '("mouse" "mwheel"))
+(custom-add-loads 'etags '("etags"))
+(custom-add-loads 'widgets '("wid-browse" "wid-edit"))
+(custom-add-loads 'menu '("x-menubar"))
+(custom-add-loads 'minibuffer '("simple" "minibuf"))
+(custom-add-loads 'log-message '("simple"))
+(custom-add-loads 'environment '("frame" "keydefs" "minibuf" "modeline" "window-xemacs" "menubar" "x-init" "x-toolbar" "cus-edit" "gnuserv" "sound"))
+(custom-add-loads 'sound '("sound"))
+(custom-add-loads 'terminals '("gnuserv"))
+(custom-add-loads 'auto-save '("files" "auto-save"))
+(custom-add-loads 'mail '("simple"))
+(custom-add-loads 'custom-menu '("cus-edit"))
+(custom-add-loads 'docs '("hyper-apropos" "info"))
+(custom-add-loads 'tools '("etags" "hyper-apropos"))
+(custom-add-loads 'editing-basics '("cmdloop" "simple" "files" "lisp"))
+(custom-add-loads 'internal '("cus-edit"))
+(custom-add-loads 'help-appearance '("help" "help-macro"))
+(custom-add-loads 'build-report '("build-report"))
+(custom-add-loads 'buffers-menu '("x-menubar"))
+(custom-add-loads 'hypermedia '("wid-edit"))
+(custom-add-loads 'lisp '("lisp" "lisp-mode" "hyper-apropos"))
+(custom-add-loads 'applications '("cus-edit"))
+(custom-add-loads 'help '("help" "cus-edit" "hyper-apropos" "info"))
+(custom-add-loads 'keyboard '("cmdloop"))
+(custom-add-loads 'hyper-apropos-faces '("hyper-apropos"))
+(custom-add-loads 'widget-browse '("wid-browse"))
+(custom-add-loads 'data '("auto-save"))
+(custom-add-loads 'warnings '("simple"))
+(custom-add-loads 'widget-documentation '("wid-edit"))
+(custom-add-loads 'backup '("files"))
+(custom-add-loads 'frames '("frame" "window-xemacs" "gui" "gnuserv"))
+(custom-add-loads 'customize '("cus-edit" "wid-edit"))
+(custom-add-loads 'custom-browse '("cus-edit"))
+(custom-add-loads 'abbrev '("abbrev" "files"))
+(custom-add-loads 'programming '("cus-edit"))
+(custom-add-loads 'toolbar '("x-toolbar"))
+(custom-add-loads 'dired '("files"))
+(custom-add-loads 'killing '("simple"))
+(custom-add-loads 'widget-button '("wid-edit"))
+(custom-add-loads 'paren-blinking '("simple"))
+(custom-add-loads 'find-file '("files"))
+(custom-add-loads 'files '("files"))
+(custom-add-loads 'build '("build-report"))
+(custom-add-loads 'font-lock '("font-lock"))
+(custom-add-loads 'external '("process" "cus-edit"))
+(custom-add-loads 'development '("process" "lisp-mode" "cus-edit"))
+(custom-add-loads 'gnuserv '("gnuserv"))
+(custom-add-loads 'fill-comments '("simple"))
+(custom-add-loads 'windows '("window" "window-xemacs"))
+(custom-add-loads 'widget-faces '("wid-edit"))
+(custom-add-loads 'languages '("lisp-mode" "cus-edit" "font-lock"))
+(custom-add-loads 'fill '("simple" "fill"))
+(custom-add-loads 'custom-magic-faces '("cus-edit"))
+(custom-add-loads 'display '("auto-show"))
+(custom-add-loads 'faces '("faces" "cus-edit" "font-lock" "font" "hyper-apropos" "info" "wid-edit"))
+(custom-add-loads 'emacs '("faces" "help" "files" "cus-edit"))
+(custom-add-loads 'processes '("process" "gnuserv"))
+(custom-add-loads 'hyper-apropos '("hyper-apropos"))
+(custom-add-loads 'wp '("cus-edit"))
+(custom-add-loads 'vc '("files"))
+(custom-add-loads 'isearch '("isearch-mode"))
+(custom-add-loads 'font-lock-faces '("font-lock"))
+(custom-add-loads 'modeline '("modeline"))
+(custom-add-loads 'editing '("simple" "abbrev" "fill" "mouse" "cus-edit"))
+(custom-add-loads 'matching '("simple" "isearch-mode" "hyper-apropos"))
+(custom-add-loads 'i18n '("cus-edit"))
+(custom-add-loads 'info '("x-toolbar" "info"))
+(custom-add-loads 'x '("x-faces" "x-font-menu"))
+
+;;; custom-load.el ends here
--- a/lisp/dump-paths.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/dump-paths.el	Mon Aug 13 10:30:37 2007 +0200
@@ -29,18 +29,44 @@
 ;; This sets up the various paths for continuing loading files for
 ;; dumping.
 
-(let ((roots (paths-find-emacs-roots invocation-directory
+(let ((debug-paths (or debug-paths
+		      (and (getenv "EMACSDEBUGPATHS")
+			   t)))
+      (roots (paths-find-emacs-roots invocation-directory
 				     invocation-name)))
 
-  (let ((stuff (packages-find-packages roots inhibit-package-init)))
+  (if debug-paths
+      (princ (format "XEmacs thinks the roots of its hierarchy are:\n%S\n"
+		     roots)))
+
+  (let ((stuff (packages-find-packages roots)))
     (setq late-packages (car (cdr stuff))))
 
   (setq late-package-load-path (packages-find-package-load-path late-packages))
 
+  (if debug-paths
+      (progn
+	(princ (format "configure-package-path:\n%S\n" configure-package-path)
+	       'external-debugging-output)
+	(princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
+		       late-packages late-package-load-path)
+	       'external-debugging-output)))
+
+  (setq lisp-directory (paths-find-lisp-directory roots))
+  (if debug-paths
+      (princ (format "lisp-directory:\n%S\n" lisp-directory)
+	     'external-debugging-output))
+  (setq site-directory (and (null inhibit-site-lisp)
+			    (paths-find-site-lisp-directory roots)))
+  (if (and debug-paths (null inhibit-site-lisp))
+      (princ (format "site-directory:\n%S\n" site-directory)
+	     'external-debugging-output))
+
   (setq load-path (paths-construct-load-path roots
 					     '()
 					     late-package-load-path
 					     '()
-					     inhibit-site-lisp)))
+					     lisp-directory
+					     site-directory)))
 
 ;;; dump-paths.el ends here
--- a/lisp/dumped-lisp.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/dumped-lisp.el	Mon Aug 13 10:30:37 2007 +0200
@@ -140,12 +140,12 @@
 
 	;; Specialized language support
 	#+(and mule CANNA) "canna-leim"
-;; Egg/Its is now a package with its own dumped-lisp.el file
+;; Egg/Its is now a package
 ;	#+(and mule wnn) "egg-leim"
 ;	#+(and mule wnn) "egg-kwnn-leim"
 ;	#+(and mule wnn) "egg-cwnn-leim"
 ;	#+mule "egg-sj3-leim"
-;; SKK is now a package with its own dumped-lisp.el file
+;; SKK is now a package
 ;	#+mule "skk-leim"
 
 ;; Set up the XEmacs environment for Mule.
@@ -169,7 +169,7 @@
 	#+(and x scrollbar) "x-scrollbar"
 	#+x "x-misc"
 	#+x "x-init"
-	#+(and (not infodock) x toolbar) "x-toolbar"
+	#+(and (not infodock) window-system toolbar) "x-toolbar"
 	#+x "x-win-xfree86"
 	#+x "x-win-sun"
 ;; preload the mswindows code.
--- a/lisp/files.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/files.el	Mon Aug 13 10:30:37 2007 +0200
@@ -129,11 +129,12 @@
   :group 'backup)
 
 (defvar backup-enable-predicate
-  '(lambda (name)
-     (not (or (string-match "^/tmp/" name)
+  #'(lambda (name)
+     (not (or (null name)
+	      (string-match "^/tmp/" name)
 	      (let ((tmpdir (temp-directory)))
 		(and tmpdir
-		     (string-match (concat "^" (regexp-quote tmpdir) "/")
+		     (string-match (concat "\\`" (regexp-quote tmpdir) "/")
 				   tmpdir))))))
   "Predicate that looks at a file name and decides whether to make backups.
 Called with an absolute file name as argument, it returns t to enable backup.")
@@ -2454,7 +2455,7 @@
   (set-buffer-modified-p arg))
 
 (defun toggle-read-only (&optional arg)
-  "Change whether this buffer is visiting its file read-only.
+  "Toggle the current buffer's read-only status.
 With arg, set read-only iff arg is positive."
   (interactive "_P")
   (setq buffer-read-only
--- a/lisp/find-paths.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/find-paths.el	Mon Aug 13 10:30:37 2007 +0200
@@ -39,16 +39,22 @@
 (defvar paths-version-control-bases '("RCS" "CVS" "SCCS")
   "File bases associated with version control.")
 
-(defun paths-find-recursive-path (directories &optional exclude)
+(defun paths-find-recursive-path (directories &optional max-depth exclude)
   "Return a list of the directory hierarchy underneath DIRECTORIES.
-The returned list is sorted by pre-order and lexicographically."
+The returned list is sorted by pre-order and lexicographically.
+MAX-DEPTH limits the depth of the search to MAX-DEPTH level,
+if it is a number.  If MAX-DEPTH is NIL, the search depth is unlimited.
+EXCLUDE is a list of directory names to exclude from the search."
   (let ((path '()))
     (while directories
       (let ((directory (file-name-as-directory
 			(expand-file-name
 			 (car directories)))))
 	(if (file-directory-p directory)
-	    (let ((raw-dirs (directory-files directory nil "^[^-.]" nil 'dirs-only))
+	    (let ((raw-dirs
+		   (if (equal 0 max-depth)
+		       '()
+		     (directory-files directory nil "^[^-.]" nil 'dirs-only)))
 		  (reverse-dirs '()))
 
 	      (while raw-dirs
@@ -59,27 +65,32 @@
 		(setq raw-dirs (cdr raw-dirs)))
 
 	      (let ((sub-path
-		     (paths-find-recursive-path (reverse reverse-dirs) exclude)))
+		     (paths-find-recursive-path (reverse reverse-dirs)
+						(if (numberp max-depth)
+						    (- max-depth 1)
+						  max-depth)
+						exclude)))
 		(setq path (nconc path
 				  (list directory)
 				  sub-path))))))
       (setq directories (cdr directories)))
     path))
 
-(defun paths-find-recursive-load-path (directories)
+(defun paths-find-recursive-load-path (directories &optional max-depth)
   "Construct a recursive load path underneath DIRECTORIES."
-  (paths-find-recursive-path directories paths-version-control-bases))
+  (paths-find-recursive-path directories
+			     max-depth  paths-version-control-bases))
 
 (defun paths-emacs-root-p (directory)
   "Check if DIRECTORY is a plausible installation root for XEmacs."
   (or
    ;; installed
-   (file-directory-p (concat directory "lib/xemacs"))
+   (file-directory-p (paths-construct-path (list directory "lib" "xemacs")))
    ;; in-place
    (and 
-    (file-directory-p (concat directory "lib-src"))
-    (file-directory-p (concat directory "lisp"))
-    (file-directory-p (concat directory "src")))))
+    (file-directory-p (paths-construct-path (list directory "lib-src")))
+    (file-directory-p (paths-construct-path (list directory "lisp")))
+    (file-directory-p (paths-construct-path (list directory "src"))))))
 
 (defun paths-chase-symlink (file-name)
   "Chase a symlink until the bitter end."
@@ -98,14 +109,29 @@
 					invocation-name)))
 	 (executable-directory (file-name-directory executable-file-name))
 	 (maybe-root-1 (file-name-as-directory
-			(expand-file-name ".." executable-directory)))
+			(paths-construct-path '("..") executable-directory)))
 	 (maybe-root-2 (file-name-as-directory
-			(expand-file-name "../.." executable-directory))))
+			(paths-construct-path '(".." "..") executable-directory))))
     (or (and (paths-emacs-root-p maybe-root-1)
 	     maybe-root-1)
 	(and (paths-emacs-root-p maybe-root-2)
 	     maybe-root-2))))
 
+(defun paths-construct-path (components &optional expand-directory)
+  "Convert list of path components COMPONENTS into a path.
+If EXPAND-DIRECTORY is non-NIL, use it as a directory to feed
+to EXPAND-FILE-NAME."
+  (let* ((reverse-components (reverse components))
+	 (last-component (car reverse-components))
+	 (first-components (reverse (cdr reverse-components)))
+	 (path
+	  (apply #'concat
+		 (append (mapcar #'file-name-as-directory first-components)
+			 (list last-component)))))
+    (if expand-directory
+	(expand-file-name path expand-directory)
+      path)))
+
 (defun paths-construct-emacs-directory (root suffix base)
   "Construct a directory name within the XEmacs hierarchy."
   (file-name-as-directory
@@ -122,11 +148,12 @@
 BASE is the base to look for.
 ENVVAR is the name of the environment variable that might also
 specify the directory.
-DEFAULT is a fall-back value."
-  (let ((envvar-value (and envvar (getenv envvar))))
-    (if (and envvar-value
-	     (file-directory-p envvar-value))
-	(file-name-as-directory envvar-value)
+DEFAULT is the preferred value."
+  (let ((preferred-value (or (and envvar (getenv envvar))
+			     default)))
+    (if (and preferred-value
+	     (file-directory-p preferred-value))
+	(file-name-as-directory preferred-value)
       (catch 'gotcha
 	(while roots
 	  (let* ((root (car roots))
@@ -139,19 +166,24 @@
 		(if (file-directory-p path)
 		    (throw 'gotcha path)))))
 	  (setq roots (cdr roots)))
-	(if (and default
-		 (file-directory-p default))
-	    (file-name-as-directory default)
-	  nil)))))
+	nil))))
 
 (defun paths-find-site-directory (roots base &optional envvar default)
   "Find a site-specific directory in the XEmacs hierarchy."
-  (paths-find-emacs-directory roots "lib/xemacs/" base envvar default))
+  (paths-find-emacs-directory roots
+			      (file-name-as-directory
+			       (paths-construct-path '("lib" "xemacs")))
+			      base
+			      envvar default))
 
 (defun paths-find-version-directory (roots base &optional envvar default)
   "Find a version-specific directory in the XEmacs hierarchy."
   (paths-find-emacs-directory roots
-			      (concat "lib/xemacs-" (construct-emacs-version) "/")
+			      (file-name-as-directory
+			       (paths-construct-path
+				(list "lib"
+				      (concat "xemacs-"
+					      (construct-emacs-version)))))
 			      base
 			      envvar default))
 
@@ -189,22 +221,6 @@
 					       (match-beginning 1) (match-end 1)))))
 	  (setq paths-path-emacs-version version)
 	  version)))))
-  
-(defun paths-find-emacs-path (roots suffix base &optional envvar default)
-  "Find a path in the XEmacs hierarchy.
-ROOTS must be a list of installation roots.
-SUFFIX is the subdirectory from there.
-BASE is the base to look for.
-ENVVAR is the name of the environment variable that might also
-specify the path.
-DEFAULT is a fall-back value."
-  (let ((envvar-value (and envvar (getenv envvar))))
-    (if envvar-value
-	(decode-path-internal envvar-value)
-      (let ((directory (paths-find-emacs-directory roots base suffix)))
-	(if (and directory (file-directory-p directory))
-	    (list directory)
-	  (paths-directories-which-exist default))))))
 
 (defun paths-directories-which-exist (directories)
   "Return the directories among DIRECTORIES."
@@ -227,17 +243,33 @@
     (append list-1
 	    (reverse reverse-survivors))))
 
-(defun paths-find-site-path (roots base &optional envvar default)
-  "Find a path underneath the site hierarchy."
-  (paths-find-emacs-path roots "lib/xemacs/" base envvar default))
+(defun paths-delete (predicate list)
+  "Delete all matches of PREDICATE from LIST."
+  (let ((reverse-result '()))
+    (while list
+      (if (not (funcall predicate (car list)))
+	  (setq reverse-result (cons (car list) reverse-result)))
+      (setq list (cdr list)))
+    (nreverse reverse-result)))
 
-(defun paths-find-version-path (roots base &optional envvar default)
-  "Find a path underneath the site hierarchy."
-  (paths-find-emacs-path roots
-			 (concat "lib/xemacs-" (construct-emacs-version) "/")
-			 base
-			 envvar default))
-		   
+(defun paths-decode-directory-path (string &optional drop-empties)
+  "Split STRING at path separators into a directory list.
+Non-\"\" comonents are converted into directory form.
+If DROP-EMPTIES is non-NIL, \"\" components are dropped from the output.
+Otherwise, they are left alone."
+  (let* ((components (decode-path-internal string))
+	 (directories
+	  (mapcar #'(lambda (component)
+		      (if (string-equal "" component)
+			  component
+			(file-name-as-directory component)))
+		  components)))
+    (if drop-empties
+	(paths-delete #'(lambda (component)
+			  (string-equal "" component))
+		      directories)
+      directories)))
+
 (defun paths-find-emacs-roots (invocation-directory
 			       invocation-name)
   "Find all plausible installation roots for XEmacs."
--- a/lisp/gnuserv.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/gnuserv.el	Mon Aug 13 10:30:37 2007 +0200
@@ -1,7 +1,7 @@
 ;;; gnuserv.el --- Lisp interface code between Emacs and gnuserv
 ;; Copyright (C) 1989-1997 Free Software Foundation, Inc.
 
-;; Version: 3.10
+;; Version: 3.11
 ;; Author: Andy Norman (ange@hplb.hpl.hp.com), originally based on server.el
 ;;         Hrvoje Niksic <hniksic@srce.hr>
 ;; Maintainer: Jan Vroonhof <vroonhof@math.ethz.ch>,
@@ -751,19 +751,22 @@
 Files that match `gnuserv-temp-file-regexp' are considered temporary and
 are saved unconditionally and backed up if `gnuserv-make-temp-file-backup'
 is non-nil.  They are disposed of using `gnuserv-done-temp-file-function'
-(also bound to `kill-buffer' by default).
+\(also bound to `kill-buffer' by default).
 
 When all of a client's buffers are marked as \"done\", the client is notified."
   (interactive "P")
   (when (null count)
     (setq count 1))
   (cond ((numberp count)
-	 (let (next)
-	   (while (natnump (decf count))
+	 (while (natnump (decf count))
+	   (let ((frame (selected-frame)))
 	     (gnuserv-buffer-done (current-buffer))
-	     (setq next (gnuserv-next-buffer))
-	     (when next
-	       (switch-to-buffer next)))))
+	     (when (eq frame (selected-frame))
+	       ;; Switch to the next gnuserv buffer.  However, do this
+	       ;; only if we remain in the same frame.
+	       (let ((next (gnuserv-next-buffer)))
+		 (when next
+		   (switch-to-buffer next)))))))
 	(count
 	   (let* ((buf (current-buffer))
 		  (clients (gnuserv-buffer-clients buf)))
--- a/lisp/keymap.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/keymap.el	Mon Aug 13 10:30:37 2007 +0200
@@ -199,7 +199,7 @@
       (define-key (current-local-map) key nil)))
 
 
-;; brain-death.
+;; FSF-inherited brain-death.
 (defun minor-mode-key-binding (key &optional accept-default)
   "Find the visible minor mode bindings of KEY.
 Return an alist of pairs (MODENAME . BINDING), where MODENAME is
--- a/lisp/ldap.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/ldap.el	Mon Aug 13 10:30:37 2007 +0200
@@ -5,7 +5,7 @@
 ;; Author: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
 ;; Created: Jan 1998
-;; Version: $Revision: 1.2 $
+;; Version: $Revision: 1.3 $
 ;; Keywords: help comm
 
 ;; This file is part of XEmacs
@@ -36,10 +36,13 @@
 ;;; Code:
 
 (eval-when '(load eval)
-  (require 'ldap-internal))
+  (require 'ldap))
+
+(defvar ldap-default-host nil
+  "*Default LDAP server.")
 
 (defvar ldap-host-parameters-alist nil
-  "An alist describing per host options to use for LDAP transactions
+  "*An alist describing per host options to use for LDAP transactions
 The list has the form ((HOST OPTION OPTION ...) (HOST OPTION OPTION ...))
 HOST is the name of an LDAP server. OPTIONs are cons cells describing
 parameters for the server.  Valid options are:
@@ -73,20 +76,22 @@
 Additional search parameters can be specified through 
 `ldap-host-parameters-alist' which see."
   (interactive "sFilter:")
-  (let (host-alist)
+  (let (host-alist res ldap)
     (if (null host)
 	(setq host ldap-default-host))
     (if (null host)
 	(error "No LDAP host specified"))
     (setq host-alist
 	  (assoc host ldap-host-parameters-alist))
-    (ldap-search-internal (append
-			   (list 'host host
-				 'filter filter
-				 'attributes attributes 
-				 'attrsonly attrsonly)
-			   (alist-to-plist host-alist)))
-    ))
+    (message "Opening LDAP connection to %s..." host)
+    (setq ldap (ldap-open host (alist-to-plist host-alist)))
+    (message "Searching with LDAP on %s..." host)
+    (setq res (ldap-search-internal ldap filter 
+				    (cdr (assq 'base host-alist))
+				    (cdr (assq 'scope host-alist))
+				    attributes attrsonly))
+    (ldap-close ldap)
+    res))
 
 		
 
--- a/lisp/loadup.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/loadup.el	Mon Aug 13 10:30:37 2007 +0200
@@ -28,8 +28,7 @@
 
 ;;; Commentary:
 
-;; Please do not edit this file.  Use site-init.el, site-load.el, or
-;; packaged dumped-lisp.el's instead.
+;; Please do not edit this file.  Use site-init.el or site-load.el instead.
 
 ;; This is loaded into a bare XEmacs to make a dumpable one.
 
@@ -97,14 +96,14 @@
 
 	(load (concat default-directory "../lisp/dumped-lisp.el"))
 
-	(let ((dumped-lisp-packages preloaded-file-list)
+	(let ((files preloaded-file-list)
 	      file)
-	  (while (setq file (car dumped-lisp-packages))
+	  (while (setq file (car files))
 	    (or (pureload file)
 	      (progn
 		(external-debugging-output "Fatal error during load, aborting")
 		(kill-emacs 1)))
-	    (setq dumped-lisp-packages (cdr dumped-lisp-packages)))
+	    (setq files (cdr files)))
 	  (if (not (featurep 'toolbar))
 	      (progn
 		;; else still define a few functions.
@@ -112,8 +111,7 @@
 		(defun toolbar-specifier-p (obj) "No toolbar support." nil)))
 	  (fmakunbound 'pureload))
 
-	(if (null inhibit-package-init)
-	    (packages-load-package-dumped-lisps late-package-load-path))
+	(packages-load-package-dumped-lisps late-package-load-path)
 
 	)) ;; end of call-with-condition-handler
 
@@ -186,9 +184,8 @@
 (when (member "run-temacs" command-line-args)
   (message "\nBootstrapping from temacs...")
   (setq purify-flag nil)
-  (setq inhibit-package-init t)
-  (setq inhibit-update-dumped-lisp t)
-  (setq inhibit-update-autoloads t)
+  (setq inhibit-early-packages t)
+  (setq inhibit-autoloads t)
   ;; Remove all args up to and including "run-temacs"
   (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
   ;; run-emacs-from-temacs doesn't actually return anyway.
--- a/lisp/msw-init.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/msw-init.el	Mon Aug 13 10:30:37 2007 +0200
@@ -43,6 +43,11 @@
 (defun init-post-mswindows-win (console)
   "Initialize mswindows GUI at startup (post).  Don't call this."
   (unless mswindows-post-win-initted
+    ;; We can't load this until after the initial device is created
+    ;; because the icon initialization needs to access the display to get
+    ;; any toolbar-related color resources.
+    (if (and (featurep 'xpm) (featurep 'toolbar))
+        (init-x-toolbar))
     ;; Old-style mswindows bindings. The new-style mswindows bindings
     ;; (namely Ctrl-X, Ctrl-C and Ctrl-V) are already spoken for by XEmacs.
     (define-key global-map '(control insert) 'mswindows-copy-clipboard)
--- a/lisp/obsolete.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/obsolete.el	Mon Aug 13 10:30:37 2007 +0200
@@ -316,10 +316,6 @@
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;; paths
 
-(defvar site-directory nil
-  "This used to be the location of the site-lisp directory.")
-(make-obsolete-variable 'site-directory "call paths-find-site-lisp-directory instead.")
-
 (defvar Info-default-directory-list nil
   "This used to be the initial value of Info-directory-list.
 If you want to change the locations where XEmacs looks for info files,
--- a/lisp/package-get.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/package-get.el	Mon Aug 13 10:30:37 2007 +0200
@@ -150,8 +150,8 @@
 
 (defvar package-get-remote
   '(
-    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/binary-packages")
-    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/single-file-packages")
+    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-21.0/packages/binary-packages")
+    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-21.0/packages/single-file-packages")
     ("ftp.xemacs.org" "/pub/xemacs/package"))
   "*List of remote sites to contact for downloading packages.
 List format is '(site-name directory-on-site).  Each site is tried in
--- a/lisp/packages.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/packages.el	Mon Aug 13 10:30:37 2007 +0200
@@ -57,6 +57,12 @@
 (defvar packages-package-list nil
   "database of loaded packages and version numbers")
 
+(defvar packages-hierarchy-depth 1
+  "Depth of package hierarchies.")
+
+(defvar packages-load-path-depth 1
+  "Depth of load-path search in package hierarchies.")
+
 (defvar early-packages nil
   "Packages early in the load path.")
 
@@ -77,7 +83,9 @@
 
 (defvar package-locations
   (list
-   (list "~/.xemacs"         'early #'(lambda () t))
+   (list (paths-construct-path '("~" ".xemacs"))
+                             'early #'(lambda () t))
+   (list "site-packages"     'late  #'(lambda () t))
    (list "mule-packages"     'late  #'(lambda () (featurep 'mule)))
    (list "packages"          'late  #'(lambda () t))
    (list "infodock-packages" 'late  #'(lambda () (featurep 'infodock))))
@@ -216,7 +224,7 @@
   ;; Source directory may not be initialized yet.
   ;; (print (prin1-to-string load-path))
   (if (null source-directory)
-      (setq source-directory (concat (car load-path) "./")))
+      (setq source-directory (car load-path)))
   (let ((files (directory-files (file-name-as-directory source-directory)
 				t ".*"))
 	file autolist)
@@ -224,8 +232,10 @@
     ;; (print (prin1-to-string files))
     (while (setq file (car-safe files))
       (if (and (file-directory-p file)
-	       (file-exists-p (concat file "/" autoload-file-name)))
-	  (setq autolist (cons (concat file "/" autoload-file-name)
+	       (file-exists-p (concat (file-name-as-directory file)
+				      autoload-file-name)))
+	  (setq autolist (cons (concat (file-name-as-directory file)
+				       autoload-file-name)
 			       autolist)))
       (setq files (cdr files)))
     autolist))
@@ -278,13 +288,6 @@
 	  (t nil)))
       (setq autoload-list (cdr autoload-list)))))
 
-;; The following function cannot be called from a bare temacs
-(defun packages-reload-dumped-lisp ()
-  "Reload new or updated dumped lisp files (with exceptions).
-This is an extremely dangerous function to call at any time."
-  ;; Nothing for the moment
-  nil)
-
 ;; Data-directory is really a list now.  Provide something to search it for
 ;; directories.
 
@@ -295,7 +298,7 @@
     (setq dir-list data-directory-list))
   (let (found found-dir)
     (while (and (null found-dir) dir-list)
-      (setq found (concat (car dir-list) name "/")
+      (setq found (file-name-as-directory (concat (car dir-list) name))
 	    found-dir (file-directory-p found))
       (or found-dir
 	  (setq found nil))
@@ -329,15 +332,16 @@
 (defun packages-find-packages-in-directories (directories)
   "Find all packages underneath directories in DIRECTORIES."
   (paths-find-recursive-path directories
+			     packages-hierarchy-depth
 			     (append paths-version-control-bases
 				     packages-special-bases)))
 
 (defun packages-split-path (path)
-  "Split PATH at \"/\", return pair with two components.
+  "Split PATH at \"\", return pair with two components.
 The second component is shared with PATH."
   (let ((reverse-tail '())
 	(rest path))
-    (while (and rest (null (string-equal "/" (car rest))))
+    (while (and rest (null (string-equal "" (car rest))))
       (setq reverse-tail (cons (car rest) reverse-tail))
       (setq rest (cdr rest)))
     (if (null rest)
@@ -346,7 +350,7 @@
 
 (defun packages-split-package-path (package-path)
   "Split up PACKAGE-PATH into early, late and last components.
-The separation is by \"/\" components.
+The separation is by \"\" components.
 This returns (LIST EARLY-PACKAGES LATE-PACKAGES LAST-PACKAGES)."
   ;; When in doubt, it's late
   (let* ((stuff (packages-split-path package-path))
@@ -377,38 +381,36 @@
 For the format of PACKAGE-LOCATIONS, see the global variable of the same name.
 TIME is either 'EARLY, 'LATE, or 'LAST.
 DEFAULT is a default list of packages."
-  (let ((packages '()))
-    (while package-locations
-      (packages-deconstruct 
-       (car package-locations)
-       #'(lambda (name a-time thunk)
-	   (if (and (eq time a-time)
-		    (funcall thunk))
-	       (setq packages
-		     (nconc packages
-			    (packages-find-packages-by-name roots name))))))
-      (setq package-locations (cdr package-locations)))
-    (paths-uniq-append packages
-		       default)))
+  (or default
+      (let ((packages '()))
+	(while package-locations
+	  (packages-deconstruct 
+	   (car package-locations)
+	   #'(lambda (name a-time thunk)
+	       (if (and (eq time a-time)
+			(funcall thunk))
+		   (setq packages
+			 (nconc packages
+				(packages-find-packages-by-name roots name))))))
+	  (setq package-locations (cdr package-locations)))
+	packages)))
 
-(defun packages-find-packages (roots &optional inhibit)
+(defun packages-find-packages (roots)
   "Find the packages."
-  (if inhibit
-      (list '() '() '())
-    (let ((envvar-value (getenv "EMACSPACKAGEPATH")))
-      (if envvar-value
-	  (packages-split-package-path envvar-value)
-	(packages-deconstruct
-	 (packages-split-package-path configure-package-path)
-	 #'(lambda (configure-early-packages
-		    configure-late-packages
-		    configure-last-packages)
-	     (list (packages-find-packages-at-time roots package-locations 'early
-						   configure-early-packages)
-		   (packages-find-packages-at-time roots package-locations 'late
-						   configure-late-packages)
-		   (packages-find-packages-at-time roots package-locations 'last
-						   configure-last-packages))))))))
+  (let ((envvar-value (getenv "EMACSPACKAGEPATH")))
+    (if envvar-value
+	(packages-split-package-path (paths-decode-directory-path envvar-value))
+      (packages-deconstruct
+       (packages-split-package-path configure-package-path)
+       #'(lambda (configure-early-packages
+		  configure-late-packages
+		  configure-last-packages)
+	   (list (packages-find-packages-at-time roots package-locations 'early
+						 configure-early-packages)
+		 (packages-find-packages-at-time roots package-locations 'late
+						 configure-late-packages)
+		 (packages-find-packages-at-time roots package-locations 'last
+						 configure-last-packages)))))))
 
 (defun packages-find-package-library-path (packages suffixes)
   "Construct a path into a component of the packages hierarchy.
@@ -419,7 +421,7 @@
 	  #'append
 	  (mapcar #'(lambda (package)
 		      (mapcar #'(lambda (suffix)
-				  (concat package suffix))
+				  (file-name-as-directory (concat package suffix)))
 			      suffixes))
 		  packages))))
     (paths-directories-which-exist directories)))
@@ -428,18 +430,21 @@
   "Construct the load-path component for packages.
 PACKAGES is a list of package directories."
   (paths-find-recursive-load-path
-   (packages-find-package-library-path packages '("lisp/"))))
+   (packages-find-package-library-path packages
+				       '("lisp"))
+   packages-load-path-depth))
 
 (defun packages-find-package-exec-path (packages)
   (packages-find-package-library-path packages
-				   (list (concat "bin/" system-configuration "/")
-					 "lib-src/")))
+				      (list (paths-construct-path
+					     (list "bin" system-configuration))
+					    "lib-src")))
 
 (defun packages-find-package-info-path (packages)
-  (packages-find-package-library-path packages '("info/")))
+  (packages-find-package-library-path packages '("info")))
 
 (defun packages-find-package-data-path (packages)
-  (packages-find-package-library-path packages '("etc/")))
+  (packages-find-package-library-path packages '("etc")))
 
 ;; Loading package initialization files
 
@@ -448,14 +453,13 @@
 BASE is the base name of the files."
   (mapc #'(lambda (dir)
 	    (let ((file-name (expand-file-name base dir)))
-	      (if (file-exists-p file-name)
-		  (condition-case error
-		      (load file-name)
-		    (error
-		     (warn (format "Autoload error in: %s:\n\t%s"
-				   file-name
-				   (with-output-to-string
-				     (display-error error nil)))))))))
+	      (condition-case error
+		  (load file-name t t)
+		(error
+		 (warn (format "Autoload error in: %s:\n\t%s"
+			       file-name
+			       (with-output-to-string
+				 (display-error error nil))))))))
 	package-load-path))
 
 (defun packages-load-package-auto-autoloads (package-load-path)
@@ -478,7 +482,7 @@
 			(mapc #'(lambda (base)
 				  (funcall handle base))
 			      package-lisp))))))
-	  package-load-path))
+	package-load-path))
 
 (defun packages-load-package-dumped-lisps (package-load-path)
   "Load dumped-lisp.el files along a load path.
--- a/lisp/scrollbar.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/scrollbar.el	Mon Aug 13 10:30:37 2007 +0200
@@ -34,7 +34,11 @@
   (when (and (featurep 'x)
 	     (or (eq locale 'global)
 		 (eq 'x (device-or-frame-type locale))))
-    (x-init-scrollbar-from-resources locale)))
+    (x-init-scrollbar-from-resources locale))
+  (when (and (featurep 'mswindows)
+	     (or (eq locale 'global)
+		 (eq 'mswindows (device-or-frame-type locale))))
+    (mswindows-init-scrollbar-metrics locale)))
 
 ;;
 ;; vertical scrollbar functions
--- a/lisp/setup-paths.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/setup-paths.el	Mon Aug 13 10:30:37 2007 +0200
@@ -38,6 +38,16 @@
 
 ;;; Code:
 
+(defvar paths-load-path-depth 1
+  "Depth of load-path searches in core Lisp paths.")
+
+(defvar paths-default-info-directories
+  (list (paths-construct-path '("usr" "local" "info")
+			      (char-to-string directory-sep-char))
+	(paths-construct-path '("usr" "info")
+			      (char-to-string directory-sep-char)))
+  "Directories appended to the end of the info path by default.")
+
 (defun paths-find-site-lisp-directory (roots)
   "Find the site Lisp directory of the XEmacs hierarchy."
   (paths-find-site-directory roots "site-lisp"
@@ -52,21 +62,20 @@
 
 (defun paths-construct-load-path
   (roots early-package-load-path late-package-load-path last-package-load-path
-	 &optional inhibit-site-lisp)
+	 lisp-directory
+	 &optional site-lisp-directory)
   "Construct the load path."
   (let* ((envvar-value (getenv "EMACSLOADPATH"))
-	 (env-load-path (and envvar-value
-			     (decode-path-internal envvar-value)))
-	 (site-lisp-directory
-	  (and (null inhibit-site-lisp)
-	       (paths-find-site-lisp-directory roots)))
+	 (env-load-path
+	  (and envvar-value
+	       (paths-decode-directory-path envvar-value 'drop-empties)))
 	 (site-lisp-load-path
 	  (and site-lisp-directory
-	       (paths-find-recursive-load-path (list site-lisp-directory))))
-	 (lisp-directory (paths-find-lisp-directory roots))
+	       (paths-find-recursive-load-path (list site-lisp-directory)
+					       paths-load-path-depth)))
 	 (lisp-load-path
-	  (and lisp-directory
-	       (paths-find-recursive-load-path (list lisp-directory)))))
+	  (paths-find-recursive-load-path (list lisp-directory)
+					  paths-load-path-depth)))
     (append env-load-path
 	    early-package-load-path
 	    site-lisp-load-path
@@ -89,11 +98,11 @@
       (packages-find-package-info-path late-packages)
       (packages-find-package-info-path last-packages)
       (and info-path-envval
-	   (decode-path-internal info-path-envval)))
+	   (paths-decode-directory-path info-path-envval 'drop-empties)))
      (and (not info-path-envval)
 	  (paths-uniq-append
 	   (paths-directories-which-exist configure-info-path)
-	   (paths-directories-which-exist '("/usr/local/info/" "/usr/info/")))))))
+	   (paths-directories-which-exist paths-default-info-directories))))))
 
 (defun paths-find-doc-directory (roots)
   "Find the documentation directory."
@@ -116,7 +125,7 @@
 
 (defun paths-find-exec-directory (roots)
   "Find the binary directory."
-  (paths-find-architecture-directory roots "lib-src"))
+  (paths-find-architecture-directory roots "lib-src" configure-exec-directory))
 
 (defun paths-construct-exec-path (roots exec-directory
 				  early-packages late-packages last-packages)
@@ -124,14 +133,13 @@
   (append
    (let ((path-envval (getenv "PATH")))
      (if path-envval
-	 (decode-path-internal path-envval)))
+	 (paths-decode-directory-path path-envval 'drop-empties)))
    (packages-find-package-exec-path early-packages)
    (packages-find-package-exec-path late-packages)
    (packages-find-package-exec-path last-packages)
    (let ((emacspath-envval (getenv "EMACSPATH")))
-     (if emacspath-envval
-	 (decode-path-internal emacspath-envval)
-       (paths-directories-which-exist configure-exec-path)))
+     (and emacspath-envval
+	  (decode-path-internal emacspath-envval)))
    (and exec-directory
 	(list exec-directory))))
 
--- a/lisp/startup.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/startup.el	Mon Aug 13 10:30:37 2007 +0200
@@ -100,6 +100,9 @@
 (defconst initial-major-mode 'lisp-interaction-mode
   "Major mode command symbol to use for the initial *scratch* buffer.")
 
+(defvar emacs-roots nil
+  "List of plausible roots of the XEmacs hierarchy.")
+
 (defvar init-file-user nil
   "Identity of user whose `~/.xemacs/init.el' file is or was read.
 The value is nil if no init file is being used; otherwise, it may be either
@@ -211,10 +214,10 @@
   -unmapped             Do not map the initial frame.
   -no-site-file         Do not load the site-specific init file (site-start.el).
   -no-init-file         Do not load the user-specific init file (~/.emacs).
-  -no-packages		Do not process the package path.
+  -no-early-packages	Do not process early packages.
   -no-autoloads		Do not load global symbol files (auto-autoloads) at
 			startup.  Also implies `-vanilla'.
-  -vanilla		Equivalent to -q -no-site-file -no-packages.
+  -vanilla		Equivalent to -q -no-site-file -no-early-packages.
   -q                    Same as -no-init-file.
   -user <user>          Load user's init file instead of your own.
   -u <user>             Same as -user.\n")
@@ -373,20 +376,35 @@
 
     (startup-set-invocation-environment)
 
-    (let ((roots (paths-find-emacs-roots invocation-directory
-					 invocation-name)))
-      (if (null roots)
+    (let ((debug-paths (or debug-paths
+			   (and (getenv "EMACSDEBUGPATHS")
+				t))))
+
+      (setq emacs-roots (paths-find-emacs-roots invocation-directory
+						invocation-name))
+    
+      (if debug-paths
+	  (princ (format "emacs-roots:\n%S\n" emacs-roots)
+		 'external-debugging-output))
+    
+      (if (null emacs-roots)
 	  (startup-find-roots-warning)
-	(startup-setup-paths roots
-			     inhibit-package-init
-			     inhibit-site-lisp))
+	(startup-setup-paths emacs-roots
+			     inhibit-early-packages
+			     inhibit-site-lisp
+			     debug-paths))
       (startup-setup-paths-warning))
 
-    (if (not inhibit-package-init)
+    (if (not inhibit-autoloads)
+	(load (expand-file-name (file-name-sans-extension autoload-file-name)
+				lisp-directory) nil t))
+    
+    (if (not inhibit-autoloads)
 	(progn
 	  (packages-load-package-auto-autoloads last-package-load-path)
 	  (packages-load-package-auto-autoloads late-package-load-path)
-	  (packages-load-package-auto-autoloads early-package-load-path)))
+	  (if (not inhibit-early-packages)
+	      (packages-load-package-auto-autoloads early-package-load-path))))
 
     (unwind-protect
 	(command-line)
@@ -484,17 +502,16 @@
 	(setq init-file-user nil))
        ((string= arg "-no-site-file")
 	(setq site-start-file nil))
-       ((or (string= arg "-no-packages")
-	    (string= arg "--no-packages"))
-	(setq inhibit-package-init t))
+       ((or (string= arg "-no-early-packages")
+	    (string= arg "--no-early-packages"))
+	(setq inhibit-early-packages t))
        ((or (string= arg "-vanilla")
 	    (string= arg "--vanilla")
 	    ;; Some work on this one already done in emacs.c.
 	    (string= arg "-no-autoloads")
 	    (string= arg "--no-autoloads"))
 	(setq init-file-user nil
-	      site-start-file nil
-	      inhibit-package-init t))
+	      site-start-file nil))
        ((or (string= arg "-u")
 	    (string= arg "-user"))
 	(setq init-file-user (pop args)))
@@ -502,6 +519,9 @@
 	(setq init-file-debug t))
        ((string= arg "-unmapped")
 	(setq initial-frame-unmapped-p t))
+       ((or (string= arg "-debug-paths")
+	    (string= arg "--debug-paths"))
+	t)
        ((or (string= arg "--") (string= arg "-"))
 	(while args
 	  (push (pop args) new-args)))
@@ -630,20 +650,6 @@
 
 ;;; Load user's init file and default ones.
 (defun load-init-file ()
-  ;; Disabled for now
-  (unless inhibit-update-dumped-lisp
-    (packages-reload-dumped-lisp))
-
-;;  (unless inhibit-update-autoloads
-;;    (packages-reload-autoloads))
-  (unless inhibit-update-autoloads
-    (let ((dir load-path))
-      (while dir
-	(condition-case nil
-	    (load (expand-file-name "auto-autoloads" (car dir)) nil t)
-	  (t nil))
-	(pop dir))))
-
   (run-hooks 'before-init-hook)
 
   ;; Run the site-start library if it exists.  The point of this file is
@@ -1010,52 +1016,115 @@
 	;; don't let /tmp_mnt/... get into the load-path or exec-path.
 	(abbreviate-file-name invocation-directory)))
 
-(defun startup-setup-paths (roots &optional inhibit-packages inhibit-site-lisp)
+(defun startup-setup-paths (roots &optional
+				  inhibit-early-packages inhibit-site-lisp
+				  debug-paths)
   "Setup all the various paths.
 ROOTS is a list of plausible roots of the XEmacs directory hierarchy.
 If INHIBIT-PACKAGES is non-NIL, don't do packages.
 If INHIBIT-SITE-LISP is non-NIL, don't do site-lisp.
+If DEBUG-PATHS is non-NIL, print paths as they are detected.
 It's idempotent, so call this as often as you like!"
 
   (apply #'(lambda (early late last)
-	     (setq early-packages early)
+	     (setq early-packages (and (not inhibit-early-packages)
+				       early))
 	     (setq late-packages late)
 	     (setq last-packages last))
-	 (packages-find-packages roots inhibit-packages))
+	 (packages-find-packages roots))
 
   (setq early-package-load-path (packages-find-package-load-path early-packages))
   (setq late-package-load-path (packages-find-package-load-path late-packages))
   (setq last-package-load-path (packages-find-package-load-path last-packages))
 
+  (if debug-paths
+      (progn
+	(princ (format "configure-package-path:\n%S\n" configure-package-path)
+	       'external-debugging-output)
+	(princ (format "early-packages and early-package-load-path:\n%S\n%S\n"
+		       early-packages early-package-load-path)
+	       'external-debugging-output)
+	(princ (format "late-packages and late-package-load-path:\n%S\n%S\n"
+		       late-packages late-package-load-path)
+	       'external-debugging-output)
+	(princ (format "last-packages and last-package-load-path:\n%S\n%S\n"
+		       last-packages last-package-load-path)
+	       'external-debugging-output)))
+
+  (setq lisp-directory (paths-find-lisp-directory roots))
+
+  (if debug-paths
+      (princ (format "lisp-directory:\n%S\n" lisp-directory)
+	     'external-debugging-output))
+
+  (setq site-directory (and (null inhibit-site-lisp)
+			    (paths-find-site-lisp-directory roots)))
+
+  (if (and debug-paths (null inhibit-site-lisp))
+      (princ (format "site-directory:\n%S\n" site-directory)
+	     'external-debugging-output))
+
   (setq load-path (paths-construct-load-path roots
 					     early-package-load-path
 					     late-package-load-path
 					     last-package-load-path
-					     inhibit-site-lisp))
+					     lisp-directory
+					     site-directory))
 
   (setq Info-directory-list
 	(paths-construct-info-path roots
 				   early-packages late-packages last-packages))
 
+  
+  (if debug-paths
+      (princ (format "Info-directory-list:\n%S\n" Info-directory-list)
+	     'external-debugging-output))
+
   (if (boundp 'lock-directory)
       (progn
 	(setq lock-directory (paths-find-lock-directory roots))
-	(setq superlock-file (paths-find-superlock-file lock-directory))))
+	(setq superlock-file (paths-find-superlock-file lock-directory))
+	
+	(if debug-paths
+	    (progn
+	      (princ (format "lock-directory:\n%S\n" lock-directory)
+		     'external-debugging-output)
+	      (princ (format "superlock-file:\n%S\n" superlock-file)
+		     'external-debugging-output)))))
 
   (setq exec-directory (paths-find-exec-directory roots))
 
+  (if debug-paths
+      (princ (format "exec-directory:\n%s\n" exec-directory)
+	     'external-debugging-output))
+
   (setq exec-path
 	(paths-construct-exec-path roots exec-directory
 				   early-packages late-packages last-packages))
+
+  (if debug-paths
+      (princ (format "exec-path:\n%S\n" exec-path)
+	     'external-debugging-output))
   
   (setq doc-directory (paths-find-doc-directory roots))
 
+  (if debug-paths
+      (princ (format "doc-directory:\n%S\n" doc-directory)
+	     'external-debugging-output))
+
   (setq data-directory (paths-find-data-directory roots))
 
+  (if debug-paths
+      (princ (format "data-directory:\n%S\n" data-directory)
+	     'external-debugging-output))
+
   (setq data-directory-list (paths-construct-data-directory-list data-directory
 								 early-packages
 								 late-packages
-								 last-packages)))
+								 last-packages))
+  (if debug-paths
+      (princ (format "data-directory-list:\n%S\n" data-directory-list)
+	     'external-debugging-output)))
 
 (defun startup-find-roots-warning ()
   (save-excursion
--- a/lisp/toolbar.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/toolbar.el	Mon Aug 13 10:30:37 2007 +0200
@@ -38,8 +38,7 @@
 
 (defun toolbar-make-button-list (up &optional down disabled cap-up cap-down cap-disabled)
   "Call make-glyph on each arg and return a list of the results."
-  (if (featurep 'x)
-      (let ((up-glyph (make-glyph up))
+  (let ((up-glyph (make-glyph up))
 	    (down-glyph (and down (make-glyph down)))
 	    (disabled-glyph (and disabled (make-glyph disabled)))
 	    (cap-up-glyph (and cap-up (make-glyph cap-up)))
@@ -57,8 +56,7 @@
 		  (list up-glyph down-glyph disabled-glyph)
 		(if down-glyph
 		    (list up-glyph down-glyph)
-		  (list up-glyph)))))))
-    nil))
+		  (list up-glyph))))))))
 
 (defun init-toolbar-location ()
   (if (not toolbar-icon-directory)
--- a/lisp/update-elc.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/update-elc.el	Mon Aug 13 10:30:37 2007 +0200
@@ -95,11 +95,11 @@
   ;; Path setup
   (let ((package-preloaded-file-list
 	 (packages-collect-package-dumped-lisps late-package-load-path)))
-
+ 
     (setq preloaded-file-list
-	  (append package-preloaded-file-list
-		  preloaded-file-list
-		  packages-hardcoded-lisp)))
+ 	  (append package-preloaded-file-list
+ 		  preloaded-file-list
+ 		  packages-hardcoded-lisp)))
 
   (load (concat default-directory "../site-packages") t t)
   (setq preloaded-file-list
--- a/lisp/wid-edit.el	Mon Aug 13 10:29:43 2007 +0200
+++ b/lisp/wid-edit.el	Mon Aug 13 10:30:37 2007 +0200
@@ -294,6 +294,23 @@
   :type 'boolean
   :group 'widgets)
 
+(defun widget-echo-this-extent (extent)
+  (let* ((widget (or (extent-property extent 'button)
+		     (extent-property extent 'field)
+		     (extent-property extent 'glyph-widget)))
+	 (help-echo (and widget (widget-get widget :help-echo))))
+    (and (functionp help-echo)
+	 (setq help-echo (funcall help-echo widget)))
+    (when (stringp help-echo)
+      (display-message 'help-echo help-echo))))
+
+(defsubst widget-handle-help-echo (extent help-echo)
+  (set-extent-property extent 'balloon-help help-echo)
+  (set-extent-property extent 'help-echo help-echo)
+  (when (functionp help-echo)
+    (set-extent-property extent 'balloon-help 'widget-echo-this-extent)
+    (set-extent-property extent 'help-echo 'widget-echo-this-extent)))
+
 (defun widget-specify-field (widget from to)
   "Specify editable button for WIDGET between FROM and TO."
   (save-excursion
@@ -321,8 +338,7 @@
     (set-extent-property extent 'button-or-field t)
     (set-extent-property extent 'keymap map)
     (set-extent-property extent 'face face)
-    (set-extent-property extent 'balloon-help help-echo)
-    (set-extent-property extent 'help-echo help-echo)))
+    (widget-handle-help-echo extent help-echo)))
 
 (defun widget-specify-button (widget from to)
   "Specify button for WIDGET between FROM and TO."
@@ -337,8 +353,7 @@
     (set-extent-property extent 'button widget)
     (set-extent-property extent 'button-or-field t)
     (set-extent-property extent 'mouse-face widget-mouse-face)
-    (set-extent-property extent 'balloon-help help-echo)
-    (set-extent-property extent 'help-echo help-echo)
+    (widget-handle-help-echo extent help-echo)
     (set-extent-property extent 'face face)
     (set-extent-property extent 'keymap map)))
 
@@ -412,6 +427,7 @@
 (defun widget-activation-widget-mapper (extent action)
   "Activate or deactivate EXTENT's widget (button or field).
 Suitable for use with `map-extents'."
+  (message "FUCK")
   (ecase action
     (:activate
      (decf (extent-property extent :inactive-count))
@@ -434,6 +450,7 @@
   nil)
 
 (defun widget-activation-glyph-mapper (extent action)
+  (message "FUCK")
   (let ((activate-p (if (eq action :activate) t nil)))
     (if activate-p
 	(decf (extent-property extent :inactive-count))
@@ -478,7 +495,7 @@
 (defun widget-specify-active (widget)
   "Make WIDGET active for user modifications."
   (let ((inactive (widget-get widget :inactive)))
-    (when inactive
+    (when (and inactive (not (extent-detached-p inactive)))
       ;; Reactivate the buttons and fields covered by the extent.
       (map-extents 'widget-activation-widget-mapper
 		   inactive nil nil :activate nil 'button-or-field)
@@ -764,8 +781,7 @@
     (unless (or (stringp help-echo) (null help-echo))
       (setq help-echo 'widget-mouse-help))
     (when help-echo
-      (set-extent-property extent 'balloon-help help-echo)
-      (set-extent-property extent 'help-echo help-echo)))
+      (widget-handle-help-echo extent help-echo)))
   (when widget
     (widget-put widget :glyph-up glyph)
     (when down (widget-put widget :glyph-down down))
--- a/man/cl.texi	Mon Aug 13 10:29:43 2007 +0200
+++ b/man/cl.texi	Mon Aug 13 10:30:37 2007 +0200
@@ -3411,7 +3411,7 @@
 random (time-dependent) value to avoid trouble when two files that
 each used @code{gensym} in their compilation are loaded together.
 
-@strong{XEmacs note:} As of XEmacs 20.5, an uninterned symbol remains
+@strong{XEmacs note:} As of XEmacs 21.0, an uninterned symbol remains
 uninterned even after being dumped to bytecode.  Older versions of Emacs
 didn't distinguish the printed representation of interned and uninterned
 symbols, so their names had to be treated more carefully.
--- a/man/lispref/lispref.texi	Mon Aug 13 10:29:43 2007 +0200
+++ b/man/lispref/lispref.texi	Mon Aug 13 10:30:37 2007 +0200
@@ -16,7 +16,7 @@
 XEmacs Lisp Programmer's Manual (for 19.13) Third Edition, July 1995
 XEmacs Lisp Reference Manual (for 19.14 and 20.0) v3.1, March 1996
 XEmacs Lisp Reference Manual (for 19.15 and 20.1, 20.2, 20.3) v3.2, April, May, November 1997
-XEmacs Lisp Reference Manual (for 20.5) v3.3, April 1998
+XEmacs Lisp Reference Manual (for 21.0) v3.3, April 1998
 @c Please REMEMBER to update edition number in *four* places in this file
 @c                 and also in *one* place in intro.texi
 
@@ -76,7 +76,7 @@
 @c and also in the file intro.texi.
 @c This manual documents XEmacs 19.14 and 20.0 and was based on the
 @c documentation for FSF Emacs 19.29 (v2.4).
-@subtitle Version 3.3 (for XEmacs 20.5), April 1998
+@subtitle Version 3.3 (for XEmacs 21.0), April 1998
 
 @author by Ben Wing
 @author
@@ -90,7 +90,7 @@
 Copyright @copyright{} 1995, 1996 Ben Wing.
 @sp 2
 Version 3.3 @*
-Revised for XEmacs Versions 20.5,@*
+Revised for XEmacs Versions 21.0,@*
 April 1998.@*
 
 Permission is granted to make and distribute verbatim copies of this
@@ -118,7 +118,7 @@
 
 @ifinfo
 This Info file contains the third edition of the XEmacs Lisp
-Reference Manual, corresponding to XEmacs version 20.5.
+Reference Manual, corresponding to XEmacs version 21.0.
 @end ifinfo
 
 @menu
--- a/man/xemacs-faq.texi	Mon Aug 13 10:29:43 2007 +0200
+++ b/man/xemacs-faq.texi	Mon Aug 13 10:30:37 2007 +0200
@@ -8,7 +8,7 @@
 @titlepage
 @title XEmacs FAQ
 @subtitle Frequently asked questions about XEmacs
-@subtitle Last Modified: $Date: 1998/04/07 05:39:30 $
+@subtitle Last Modified: $Date: 1998/04/18 23:25:13 $
 @sp 1
 @author Tony Rossini <arossini@@stat.sc.edu>
 @author Ben Wing <wing@@666.com>
@@ -1459,7 +1459,7 @@
 @end quotation
 
 @quotation
-XEmacs 20.5 will unbundle the lisp hierarchy and allow the installer
+XEmacs 21 will unbundle the lisp hierarchy and allow the installer
 to choose exactly how much support code gets installed.
 @end quotation
 
--- a/man/xemacs/custom.texi	Mon Aug 13 10:29:43 2007 +0200
+++ b/man/xemacs/custom.texi	Mon Aug 13 10:30:37 2007 +0200
@@ -2068,10 +2068,10 @@
 sharing of the application class often leads to trouble if you want to
 run both variants.
 
-Starting with XEmacs 20.5, XEmacs will use the class @samp{XEmacs} if it
-finds any XEmacs resources in the resource database when the X
-connection is initialized.  Otherwise, it will use the class @samp{Emacs}
-for backwards compatability.  The variable @var{x-emacs-application-class}
+Starting with XEmacs 21, XEmacs uses the class @samp{XEmacs} if it finds
+any XEmacs resources in the resource database when the X connection is
+initialized.  Otherwise, it will use the class @samp{Emacs} for
+backwards compatability.  The variable @var{x-emacs-application-class}
 may be consulted to determine the application class being used.
 
 The examples in this section assume the application class is @samp{Emacs}.
--- a/nt/ChangeLog	Mon Aug 13 10:29:43 2007 +0200
+++ b/nt/ChangeLog	Mon Aug 13 10:30:37 2007 +0200
@@ -1,3 +1,15 @@
+1998-04-17  Jonathan Harris <jhar@tardis.ed.ac.uk>
+
+	* README: Documented new msvc build procedure, including XPM
+	support.
+
+	* xemacs.mak: Added XPM and TOOLBARS support for native msvc
+	build.
+
+	* xpm.mak: New file
+	Makefile for building xpm library under msvc. Hopefully this
+	will be part of future xpm distributions.
+
 1998-04-10  Kirill M. Katsnelson  <kkm@kis.ru>
 
 	* config.h: Do not USE_ASSERTION when DEBUG_XEMACS is not
--- a/nt/README	Mon Aug 13 10:29:43 2007 +0200
+++ b/nt/README	Mon Aug 13 10:30:37 2007 +0200
@@ -14,25 +14,36 @@
 
 1.  You will need Visual C++ V4.2 or later to compile everything. Personally we
     have tested V4.2 and V5.0.
-2.  Grab the latest XEmacs beta from ftp.xemacs.org if necessary. All Win32
-    support is in the nt/ subdirectory.
-3.  Edit the xemacs.mak file and ensure variables point to the correct place.
     Note that Visual C++ assumes a couple of environment variables INCLUDE and
     LIB to be set which specify the location of the includes and libraries.
     At this point you can select X or Win32 native support.
-4.  Run make. I simply use nmake -f xemacs.mak. This will build temacs, the
-    DOC file, if startup.elc does not exist it will update the elc's and
-    then it will dump xemacs.
-5.  The build process creates debugging and "Source Browser" information for
-    use with MS DevStudio. To use this create a new "console" project and set
-    the Project/Settings/Debug executable name to the full path of
-    src\xemacs.exe. Remember to close the Source Browser file in DevStudio
-    before rebuilding.
-6.  If you're going to edit sources I recommend that you first get a copy of
-    makedepend and make a list of dependencies in the makefile by doing
-    "nmake -f xemacs.mak depend". I (jhar) have a hacked-up copy of X11R5
-    makedepend which I can distribute if anyone wants it. Is there a real
-    version anywhere which handles '\' as the path delimiter?
+2.  Grab the latest XEmacs beta from ftp.xemacs.org if necessary. All Win32
+    support is in the nt/ subdirectory. You'll also need the xemacs-base
+    package from the binary-packages subdirectory and you'll probably alsi
+    want at least the edit-utils, text-utils, cc-mode and prog-utils packages.
+    Unpack the packages into, say, c:\src\xemacs\packages.
+
+If you want to build for native GUI:
+
+1.  If you want XPM and toolbar support grab the latest version of the xpm
+    sources (xpm-3.4k.tar.gz at time of writing) and unpack it.
+    Copy nt/xpm.mak from the xemacs distribution to the lib subdirectory of
+    the xpm distribution, cd to that directory and build xpm with
+   `nmake -f xpm.mak`.
+2.  cd to the nt subdirectory of the xemacs distribution and build xemacs:
+    `nmake -f xemacs.mak HAVE_MSW=1 PATH_PACKAGEPATH="c:/src/xemacs/packages"`,
+    replacing "c:/src/xemacs/packages" with the location of your packages. Note
+    the double quotes and *forward* slashes in that path.
+    If you're building with XPM support, add this to the nmake command line:
+    `HAVE_XPM=1 XPM_DIR=x:\location\of\your\xpm\source\tree`.
+    Nmake will build temacs, the DOC file, update the elc's and dump xemacs.
+3.  The build process creates debugging and "Source Browser" information for
+    use with MS DevStudio. To use this create a new "console" project and
+    under Project/Settings set:
+	Debug: executable name = full path of src\xemacs.exe
+	Link: output file name = full path of src\temacs.exe
+	Browse Info: browse info file name = full path of src\temacs.bsc
+    Remember to close the Source Browser file in DevStudio before rebuilding.
 
 If you want support for X you will need:
 
@@ -45,6 +56,9 @@
     nt/X11.patch in the xc/lib/X11 directory which will fix the DLL definition
     file. Once compiled and installed, you will need to apply the following
     patch to Xmd.h. This is messy and better solutions would be appreciated. 
+4.  Goto 2 under 'native GUI' above and also supply:
+    `HAVE_X=1 X11_DIR=x:\root\directory\of\your\X11\installation'
+    to the nmake command line.
 
 --- Xmd.h~	Thu Jun 08 23:20:40 1995
 +++ Xmd.h	Sun Mar 16 13:09:10 1997
--- a/nt/xemacs.mak	Mon Aug 13 10:29:43 2007 +0200
+++ b/nt/xemacs.mak	Mon Aug 13 10:30:37 2007 +0200
@@ -42,6 +42,12 @@
 !if !defined(HAVE_MULE)
 HAVE_MULE=0
 !endif
+!if !defined(HAVE_XPM)
+HAVE_XPM=0
+!endif
+!if !defined(HAVE_TOOLBARS)
+HAVE_TOOLBARS=$(HAVE_XPM)
+!endif
 !if !defined(HAVE_MSW_C_DIRED)
 HAVE_MSW_C_DIRED=1
 !endif
@@ -67,6 +73,12 @@
 !if $(HAVE_X) && !defined(X11_DIR)
 !error Please specify root directory for your X11 installation: X11_DIR=path
 !endif
+!if $(HAVE_MSW) && $(HAVE_XPM) && !defined(XPM_DIR)
+!error Please specify root directory for your XPM installation: XPM_DIR=path
+!endif
+!if $(HAVE_MSW) && $(HAVE_TOOLBARS) && !$(HAVE_XPM)
+!error Toolbars require XPM support
+!endif
 
 #
 # Handle GUNG_HO
@@ -92,6 +104,12 @@
 !if $(HAVE_MULE)
 !message Compiling in MULE.
 !endif
+!if $(HAVE_XPM)
+!message Compiling in support for XPM images.
+!endif
+!if $(HAVE_TOOLBARS)
+!message Compiling in support for toolbars.
+!endif
 !if $(HAVE_MSW_C_DIRED)
 # Define HAVE_MSW_C_DIRED to be non-zero if you want Xemacs to use C
 # primitives to significantly speed up dired, at the expense of an
@@ -130,11 +148,24 @@
 
 !if $(HAVE_MSW)
 MSW_DEFINES=-DHAVE_MS_WINDOWS -DHAVE_SCROLLBARS -DHAVE_MENUBARS
+MSW_INCLUDES=
+MSW_LIBS=
 !if $(HAVE_MSW_C_DIRED)
-MSW_C_DIRED_DEFINES=-DHAVE_MSW_C_DIRED
+MSW_DEFINES=$(MSW_DEFINES) -DHAVE_MSW_C_DIRED
 MSW_C_DIRED_SRC=$(XEMACS)\src\dired-msw.c
 MSW_C_DIRED_OBJ=$(OUTDIR)\dired-msw.obj
 !endif
+!if $(HAVE_XPM)
+MSW_DEFINES=$(MSW_DEFINES) -DHAVE_XPM -DFOR_MSW
+MSW_INCLUDES=$(MSW_INCLUDES) -I$(XPM_DIR) -I$(XPM_DIR)\lib
+MSW_LIBS=$(MSW_LIBS) $(XPM_DIR)\lib\Xpm.lib
+!endif
+!if $(HAVE_TOOLBARS)
+MSW_DEFINES=$(MSW_DEFINES) -DHAVE_TOOLBARS
+MSW_TOOLBAR_SRC=$(XEMACS)\src\toolbar.c $(XEMACS)\src\toolbar-msw.c
+MSW_TOOLBAR_OBJ=$(OUTDIR)\toolbar.obj $(OUTDIR)\toolbar-msw.obj
+MSW_LIBS=$(MSW_LIBS) comctl32.lib
+!endif
 !endif
 
 !if $(HAVE_MULE)
@@ -150,9 +181,9 @@
 
 # Generic variables
 
-INCLUDES=$(X_INCLUDES) -I$(XEMACS)\nt\inc -I$(XEMACS)\src -I$(XEMACS)\lwlib -I"$(MSVCDIR)\include"
+INCLUDES=$(X_INCLUDES) $(MSW_INCLUDES) -I$(XEMACS)\nt\inc -I$(XEMACS)\src -I$(XEMACS)\lwlib -I"$(MSVCDIR)\include"
 
-DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) $(MSW_C_DIRED_DEFINES) \
+DEFINES=$(X_DEFINES) $(MSW_DEFINES) $(MULE_DEFINES) \
 	-DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN -DWINDOWSNT -Demacs \
 	-DHAVE_CONFIG_H -D_DEBUG
 
@@ -391,7 +422,8 @@
  $(XEMACS)\src\redisplay-msw.c \
  $(XEMACS)\src\scrollbar-msw.c \
  $(XEMACS)\src\select-msw.c \
- $(MSW_C_DIRED_SRC)
+ $(MSW_C_DIRED_SRC) \
+ $(MSW_TOOLBAR_SRC)
 !endif
 
 !if $(HAVE_MULE)
@@ -440,9 +472,9 @@
 TEMACS=$(TEMACS_DIR)\temacs.exe
 TEMACS_BROWSE=$(TEMACS_DIR)\temacs.bsc
 TEMACS_SRC=$(XEMACS)\src
-TEMACS_LIBS=$(LASTFILE) $(LWLIB) $(X_LIBS) kernel32.lib user32.lib gdi32.lib \
- winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib \
- uuid.lib wsock32.lib winmm.lib libc.lib
+TEMACS_LIBS=$(LASTFILE) $(LWLIB) $(X_LIBS) $(MSW_LIBS) \
+ kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib \
+ shell32.lib ole32.lib oleaut32.lib uuid.lib wsock32.lib winmm.lib libc.lib
 TEMACS_LFLAGS=-nologo $(LIBRARIES) $(DEBUG_FLAGS) -base:0x1000000\
  -stack:0x800000 -entry:_start -subsystem:console\
  -pdb:$(TEMACS_DIR)\temacs.pdb -map:$(TEMACS_DIR)\temacs.map \
@@ -494,7 +526,8 @@
 	$(OUTDIR)\redisplay-msw.obj \
 	$(OUTDIR)\scrollbar-msw.obj \
 	$(OUTDIR)\select-msw.obj \
-	$(MSW_C_DIRED_OBJ)
+	$(MSW_C_DIRED_OBJ) \
+	$(MSW_TOOLBAR_OBJ)
 !endif
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nt/xpm.mak	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,47 @@
+#
+# XPM Makefile for Microsoft NMAKE without X libraries
+#
+
+!if !defined(DEBUG_XEMACS)
+DEBUG_XEMACS=0
+!endif
+
+!if $(DEBUG_XEMACS)
+OPT=-Od -Zi
+!else
+OPT=-O2 -G5 -Zi
+!endif
+
+WARN_CPP_FLAGS = -W3
+
+CC=cl
+CFLAGS=-nologo -DFOR_MSW $(WARN_CPP_FLAGS) $(OPT) $(INCLUDES) -Fo$@ -c
+
+OBJS= data.obj create.obj misc.obj rgb.obj scan.obj parse.obj hashtab.obj \
+      WrFFrI.obj RdFToI.obj CrIFrDat.obj CrDatFrI.obj \
+      CrIFrBuf.obj CrBufFrI.obj \
+      RdFToDat.obj WrFFrDat.obj \
+      Attrib.obj Image.obj Info.obj RdFToBuf.obj WrFFrBuf.obj \
+      simx.obj
+
+# nmake rule
+
+.SUFFIXES:
+.SUFFIXES:	.c
+
+.c.obj:
+	$(CC) $(CFLAGS) $< -Fo$@
+
+
+# targets
+
+all: ..\X11\xpm.h Xpm.lib
+
+..\X11\xpm.h: ..\X11\NUL xpm.h
+	copy xpm.h ..\X11
+
+..\X11\NUL:
+	mkdir ..\X11
+
+Xpm.lib: $(OBJS)
+	link.exe -lib -nologo -out:$@ $(OBJS)
--- a/src/ChangeLog	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 10:30:37 2007 +0200
@@ -1,3 +1,405 @@
+1998-04-17  Jonathan Harris <jhar@tardis.ed.ac.uk>
+
+	* console-msw.h:
+	Added "commctrl.h" and "X11/xpm.h" includes to support toolbars
+	and XPM.
+
+	* glyphs-msw.c:
+	Removed (!NILP (Vmswindows_bitmap_file_path)) check in
+	locate_pixmap_file() so that lookups of absolute paths don't fail
+	if this is unset.
+	Added new mswindows_xpm_normalize();
+
+	* glyphs.h:
+	* glyphs.c:
+	* glyphs-x.c:
+	Moved generic XPM support out of glyphs-x.c into glyphs.c.
+	Functions moved:
+	signal_image_error, signal_image_error_2,
+	check_valid_xpm_color_symbols, evaluate_xpm_color_symbols,
+	xpm_possible_dest_types.
+	xpm_normalize and xpm_instantiate in glyphs.c just call the
+	appropriate x_ or mswindows_ funtion in glyphs-x.c or
+	glyphs-msw.c.
+
+	* toolbar-msw.c:
+	Don't assert on empty toolbar.
+
+	* toolbar.c:
+	* toolbar.h:
+	Adjusted mswindows default toolbar height/widths so redisplay is
+	correct.
+
+1998-04-18  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* tooltalk.c (tt_message_arg_ival_string): Ditto.
+
+	* redisplay.c (window_line_number): Ditto.
+	(decode_mode_spec): Ditto.
+
+	* glyphs.c (print_image_instance): Ditto.
+
+	* doprnt.c (emacs_doprnt_1): Ditto.
+
+	* data.c (Fnumber_to_string): Use long_to_string().
+
+	* lisp.h: Declare long_to_string().
+
+	* print.c (Fprin1_to_string): Do the Vprint_gensym_alist stunt.
+
+	* emacs.c (main_1): Don't create print stream.
+
+	* print.c: Removed print_stream implementation.
+	(print_prepare): Don't create a print_stream.
+	(long_to_string): New function, from GNU Wget.
+	(print_internal): Use it.
+	(output_string): alloca() copies only for strings smaller than
+	65536 bytes; else, inhibit gc.
+
+1998-04-18  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* config.h.in: Check for DLERROR.
+
+	* sysdll.c: Cosmetic changes.
+
+1998-04-18  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* sysdll.c (dll_error): It's `dlerror', not `dl_error'.
+
+1998-04-17  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* specifier.c (prune_specifiers): Fix for Vall_specifiers
+	corruption.
+
+	* specifier.h: Fixed GC_* macros to utilize GC_EQ, as suggested by
+	Steve.
+
+1998-04-17  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* dll.c (Fdll_open): Simplify interface.
+
+	* sysdll.c: Allocate BUF dynamically.
+
+	* cmds.c (internal_self_insert): Removed `no-self-insert' hack.
+
+Fri Apr 17 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* event-msw.c: don't use LocalAlloc()/LocalFree(). With unix
+	processes use a filestream for output. This makes subprocess
+	support work under cygwin.
+
+1998-04-17  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* fileio.c (vars_of_fileio): Resurreced directory-sep-char to be
+	DIRECTORY_SEP instead of hardwired "/".
+
+1998-04-16  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* fileio.c (file_name_as_directory): Now returns "./" (or NT
+	equivalent) for "".
+
+1998-04-09  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* eldap.c: Fully rewritten introducing a new opaque LDAP Lisp
+	data type.
+
+	* eldap.h: Ditto
+
+1998-04-17  Olivier Galibert  <galibert@pobox.com>
+
+	* fileio.c (vars_of_fileio): Finish directory_sep_char removal.
+
+1998-04-14  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* emacs.c (main_1): Added option --debug-paths and analogous
+	variable.
+
+1998-04-15  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* frame-msw.c (Vmswindows_frame_being_created): Don't staticpro.
+
+	* console-msw.h, event-msw.c, frame-msw.c: Renamed
+	mswindows_frame_being_created to Vmswindows_frame_being_created.
+
+1998-04-12  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* fileio.c: Removed Vdirectory_sep_char variable.
+
+	* lisp.h: Removed extern decl for the above.
+
+1998-04-16  SL Baur  <steve@altair.xemacs.org>
+
+	* indent.c (vertical_motion_1): set_marker_restricted takes
+	Lisp_Objects.
+
+1998-04-17  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* md5.c (Fmd5): Correctly rename argument.
+
+	* print.c (Fprin1_to_string): Remove useless variable.
+
+1998-04-13  Greg Klanderman  <greg@alphatech.com>
+
+	* indent.c (vertical_motion_1): new helper function to share
+	common code between Fvertical_motion and Fvertical_motion_pixels.
+	Properly handle the WINDOW argument as the doc string indicates it 
+	should.  Update docstrings to be more clear and concise.
+	(Fvertical_motion): use vertical_motion_1.
+	(Fvertical_motion_pixels): use vertical_motion_1.
+
+1998-04-15  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* specifier.h: Introduced magic specifiers. Please read comments
+	in specifier.h.
+
+	* specifier.c: Reworked many functions to support magic
+	specifiers.
+
+	* scrollbar.c (specifier_vars_of_scrollbar): Made magic specifiers 
+	Vscrollbar_width and Vscrollbar_height.
+	(init_frame_scrollbars): Enabled critical lisp code operate on
+	ghost specifiers.
+	(init_device_scrollbars): Ditto.
+	(init_global_scrollbars): Ditto.
+
+	* scrollbar-msw.c (Fmswindows_init_scrollbar_metrics): Scrollbar
+	init function, called from init-scrollbars-from-resuorce in
+	lisp/scrollbar.c 
+	(syms_of_scrollbar_mswindows): DEFSUBR it.
+
+	* emacs.c (main_1): Called syms_of_scrollbar_mswindows()
+
+	* symsinit.h: Declared syms_of_scrollbar_mswindows()
+
+Thu Apr 16 12:59:35 1998  Andy Piper  <andyp@parallax.co.uk>
+
+	* frame-msw.c:
+	* console-msw.h: add toolbars to frame parameters.
+
+	* emacs.c: call console_type_create_mswindows_toolbar
+
+	* event-msw.c: call toolbar handling code in main event loop.
+
+	* glyphs-msw.c (mswindows_create_icon_from_image)
+	(mswindows_resize_dibitmap_instance): new functions. Remove mask
+	stuff from various others.
+
+	* redisplay-msw.c:
+	* menubar-msw.c: warning elimination.
+
+	* toolbar-msw.c: new file. Reasonable implementation of toolbars
+	for mswindows. Some features are not complete.
+
+	* toolbar.c: enable toolbar parameters for mswindows.
+
+	* toolbar.h: choose slightly different toolbar defaults for
+	mswindows.
+
+1998-04-16  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* lisp.h (CHECK_IMPURE): Use it.
+
+	* data.c (pure_write_error): Accept an argument.
+
+	* emacs.c (vars_of_emacs): New variable `internal-error-checking'; 
+	initialize it.
+
+1998-04-16  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* fileio.c (Fmake_temp_name): Avoid random(); simplify.
+
+1998-04-13  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* emacs.c (complex_vars_of_emacs): Changed configure-exec-path to
+	configure-exec-directory.
+	(decode_path): Doesn't call file-name-as-directory no more as
+	empty components would lead to evil behavior.
+
+1998-04-16  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* extents.c (decode_extent): Unify the error message.
+
+1998-04-17  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* md5.c (Fmd5): Simplify; use only input and encoding streams.
+	(Fmd5): Separate coding guesswork into md5_coding_system().
+	(Fmd5): Don't close the stream; deleting it is enough.
+
+1998-04-16  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* fileio.c (Finsert_file_contents_internal): Prefer fstat() over
+	stat.
+
+1998-04-15  Martin Buchholz  <martin@xemacs.org>
+
+	* fns.c (Fsubseq): Make (subseq nil 0 0) return nil, not #*.
+
+1998-04-16  SL Baur  <steve@altair.xemacs.org>
+
+	* device-x.c (get_device_from_display): Use "infodock" as the
+	fallback name when running as InfoDock.
+
+1998-04-14  Greg Klanderman  <greg@alphatech.com>
+
+	* device-x.c (compute_x_app_name): New function needed to compute
+	application name to use now that XtOpenDisplay is decomposed into
+	XOpenDisplay and XtDisplayInitialize.
+	(x_init_device): use it.
+
+1998-04-06  Greg Klanderman  <greg@alphatech.com>
+
+	* device-x.c (have_xemacs_resources_in_xrdb): adhere to coding
+	standards and avoid opening display twice by breaking
+	XtOpenDisplay into XOpenDisplay and XtDisplayInitialize. 
+	(x_init_device): Ditto.
+
+1998-04-15  Olivier Galibert  <galibert@pobox.com>
+
+	* s/aix3-2-5.h: Ditto.
+
+	* s/aix4-1.h: Ditto.
+
+	* s/aix4-2.h: Ditto.
+
+	* s/bsd386.h: Ditto.
+
+	* s/bsdos2-1.h: Ditto.
+
+	* s/dgux.h: Ditto.
+
+	* s/esix.h: Ditto.
+
+	* s/esix5r4.h: Ditto.
+
+	* s/hpux8.h: Ditto.
+
+	* s/hpux9-shr.h: Ditto.
+
+	* s/hpux9-x11r4.h: Ditto.
+
+	* s/hpux9.h: Ditto.
+
+	* s/hpux9shxr4.h: Ditto.
+
+	* s/isc3-0.h: Ditto.
+
+	* s/isc4-0.h: Ditto.
+
+	* s/ptx.h: Ditto.
+
+	* s/sco4.h: Ditto.
+
+	* s/sco5.h: Ditto.
+
+	* s/usg5-3.h: Ditto.
+
+	* s/usg5-4-2.h: Ditto.
+
+	* s/usg5-4.h: Kill a bunch of now autodetected defines.
+
+1998-04-05  Greg Klanderman  <greg@alphatech.com>
+
+	* window.c (Fwindow_displayed_pixel_height): rename more
+	appropriately as window-text-pixel-height.
+	(syms_of_window): Update the DEFSUBR.
+	(Fwindow_text_pixel_width): New function for completeness.
+	(Fwindow_text_pixel_edges): New function.
+	(syms_of_window): DEFSUBR 2 new functions.
+
+1998-04-13  Greg Klanderman  <greg@alphatech.com>
+
+	* redisplay.c (redisplay_window): When echo area is active, and we 
+	swap in the echo area buffer, restore the minibuffer's pointm and
+	startp when we restore the minibuffer to the window.  This avoids
+	having the minibuffer point randomly change when it is active but
+	not selected and a message is shown.
+
+1998-04-16  Hrvoje Niksic <hniksic@srce.hr>
+
+	* md5.c: replaced RSA reference code with GNU textutils implementation.
+
+1998-04-14  Martin Buchholz  <martin@xemacs.org>
+
+	* signal.c (init_signals_very_early): Make `nohup xemacs &' work.
+	Wrap #ifdefs around uses of SIGQUIT and SIGILL.
+
+1998-04-12  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* objects-msw.c (mswindows_initialize_font_instance): Fixed assert
+	abuse; proper cleanup on GDI error.
+
+1998-04-14  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* console-msw.h: Declared get_nt_process_handle() and
+	mswindows_bump_queue().
+	Removed declarations for mswindows_enqueue_dispatch_event() and
+	mswindows_enqueue_magic_event().
+
+	* event-msw.c (emacs_mswindows_create_stream_pair): Casts on
+	handle types and get_osfhandle() return type. From Andy Piper.
+	(emacs_mswindows_select_process): Get Win32 process handle
+	directly from process lrecord.
+	(get_process_handle): Removed function.
+	(emacs_mswindows_handle_magic_event): Removed handling of 
+	XM_BUMPQUEUE magic event.
+	(mswindows_wnd_proc): Removed handling of WM_EXITMENULOOP message, 
+	which called a do-nothing handler in menubar-msw.c
+	(mswindows_wnd_proc, WM_EXITSIZEMOVE): Queue an empty event
+	instead of magic event, via mswindows_bump_queue().
+	(mswindows_wnd_proc, WM_CLOSE): Ditto.
+	(mswindows_need_event): Call mswindows_bump_queue() upon process
+	termination, in case process pipe does not get closed along.
+	Do not close process handle.
+	(mswindows_bump_queue): Added function.
+	(mswindows_enqueue_dispatch_event): Made static.
+	(ntpipe_slurp_*): Revamped the slurp thread implementation so the
+	stream does not expect the thread to terminate when stream is closed.
+	(ntpipe_slurp_reader): Fixed an attempt to read zero bytes from
+	the pipe.
+
+	* event-stream.c (event_stream_deal_with_async_timeout):
+	Conditionalized timer-based polling for finished processes on
+	HAVE_UNIX_PROCESSES. 
+
+	* menubar-msw.c (mswindows_handle_wm_command): Queued proper bump
+	queue event.
+	(mswindows_handle_wm_exitmenuloop): Removed function.
+	
+	* menubar-msw.h: Removed unused function prototype.
+
+	* process-nt.c (get_nt_process_handle): Added function.
+
+	* signal.c (init_poll_for_sigchld): Conditionalized on
+	HAVE_UNIX_PROCESSES. 
+
+1998-04-13  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* frame-msw.c: Implemented the following methods:
+	mswindows_get_mouse_position()
+	mswindows_set_mouse_position()
+	mswindows_frame_totally_visible_p()
+
+1998-04-11  Michael Sperber [Mr. Preprocessor]  <sperber@informatik.uni-tuebingen.de>
+
+	* emacs.c: Renamed inhibit-package-init to inhibit-early-packages
+	to better reflect its semantics.
+	Renamed inhibit-update-autoloads to inhibit-package-autoloads.
+	(complex_vars_of_emacs): Added site-directory and lisp-directory.
+	-no-packages -> no-early-packages.
+
+	* Makefile.in.in: Reflected reinstatement of paths.h.in.
+
+	* paths.h.in: Reinstated.
+
+	* paths.h.in.in: Removed.
+
+	* config.h.in: Moved configure path and directory options from
+	paths.h.in.in.
+
+1998-04-11  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* event-msw.c (emacs_mswindows_quit_p): don't recurse.
+
 1998-04-10  Kirill M. Katsnelson  <kkm@kis.ru>
 
 	* callproc.c (init_callproc): Correctly initialize
--- a/src/Makefile.in.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/Makefile.in.in	Mon Aug 13 10:30:37 2007 +0200
@@ -658,7 +658,7 @@
 ## This is used in making a distribution.
 ## Do not use it on development directories!
 distclean: clean
-	$(RM) config.h paths.h paths.h.in Emacs.ad.h \
+	$(RM) config.h paths.h Emacs.ad.h \
 	  Makefile Makefile.in TAGS xemacs.*
 realclean: distclean
 versionclean:
@@ -667,7 +667,7 @@
 	$(RM) *~ \#* m/*~ m/\#* s/*~ s/\#*
 
 .PHONY : lock unlock
-SOURCES = *.[chm] *.pswm [sm]/* COPYING paths.h.in.in Makefile.in.in \
+SOURCES = *.[chm] *.pswm [sm]/* COPYING paths.h.in Makefile.in.in \
 	config.h.in README COPYING ChangeLog
 unlock:
 	chmod u+w $(SOURCES)
--- a/src/buffer.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/buffer.c	Mon Aug 13 10:30:37 2007 +0200
@@ -1137,7 +1137,7 @@
 */
        (buffer))
 {
-  /* Allowing nil is an Emacs-ism */
+  /* Allowing nil is an RMSism */
   struct buffer *real_buf = decode_buffer (buffer, 1);
   real_buf->undo_list = Qt;
   return Qnil;
@@ -1149,7 +1149,7 @@
 */
        (buffer))
 {
-  /* Allowing nil is an Emacs-ism */
+  /* Allowing nil is an RMSism */
   struct buffer *real_buf = decode_buffer (buffer, 1);
   if (EQ (real_buf->undo_list, Qt))
     real_buf->undo_list = Qnil;
--- a/src/callproc.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/callproc.c	Mon Aug 13 10:30:37 2007 +0200
@@ -215,7 +215,8 @@
     current_dir = Funhandled_file_name_directory (current_dir);
     current_dir = expand_and_dir_to_file (current_dir, Qnil);
 #if 0
-    /* reportedly causes problems with ange-ftp-visited-files */
+    /* This is in FSF, but it breaks everything in the presence of
+       ange-ftp-visited files, so away with it.  */
     if (NILP (Ffile_accessible_directory_p (current_dir)))
       report_file_error ("Setting current directory",
                          Fcons (current_buffer->directory, Qnil));
--- a/src/casetab.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/casetab.c	Mon Aug 13 10:30:37 2007 +0200
@@ -19,9 +19,9 @@
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
-/* Synched up with: FSF 19.28.  Between FSF 19.28 and 19.30, casetab.c
-   was rewritten to use junky char tables.  Meanwhile I rewrote it
-   to use more logical char tables.  Emacs also discards the "list of four
+ /* Synched up with: FSF 19.28.  Between FSF 19.28 and 19.30, casetab.c
+   was rewritten to use junky FSF char tables.  Meanwhile I rewrote it
+   to use more logical char tables.  RMS also discards the "list of four
    tables" format and instead stuffs the other tables as "extra slots"
    in the downcase table.  I've kept the four-lists format for now. */
 
--- a/src/cmds.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/cmds.c	Mon Aug 13 10:30:37 2007 +0200
@@ -371,18 +371,20 @@
 
       if (WORD_SYNTAX_P (syntax_table, c2))
 	{
+#if 1
+	  Fexpand_abbrev ();
+#else  /* FSFmacs */
 	  Lisp_Object sym = Fexpand_abbrev ();
 
+	  /* I think this is too bogus to add.  The function should
+             have a way of examining the character to be inserted, so
+             it can decide whether to insert it or not.  We should
+             design it better than that.  */
+
 	  /* Here FSFmacs remembers MODIFF, compares it after
-             Fexpand_abbrev() finishes, and updates HAIRY.
+             Fexpand_abbrev() finishes, and updates HAIRY.  */
 
-	     A synch with Emacs 20.2.  I'm not sure if it's too bogus
-	     to copy, but I guess it can be useful.  If we expanded an
-	     abbrev which has a hook, and the hook has a non-nil
-	     `no-self-insert' property, return right away -- don't
-	     really self-insert.
-
-	     NOTE: we cannot simply check for Vlast_abbrev, because
+	  /* NOTE: we cannot simply check for Vlast_abbrev, because
 	     Fexpand_abbrev() can bail out before setting it to
 	     anything meaningful, leaving us stuck with an old value.
 	     Thus Fexpand_abbrev() was extended to return the actual
@@ -396,6 +398,7 @@
 	      if (!NILP (prop))
 		return;
 	    }
+#endif /* FSFmacs */
         }
     }
   if ((c1 == ' ' || c1 == '\n')
--- a/src/config.h.in	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/config.h.in	Mon Aug 13 10:30:37 2007 +0200
@@ -124,6 +124,7 @@
 #undef AIXV3
 #undef _POSIX_SOURCE
 #undef _BSD_SOURCE
+#undef _SVID_SOURCE
 #undef X_LOCALE
 #undef NARROWPROTO
 /* The following should always be defined, no matter what xmkmf thinks. */
@@ -204,6 +205,7 @@
 
 /* Have shared library support */
 #undef HAVE_DLOPEN
+#undef HAVE_DLERROR
 #undef HAVE_SHL_LOAD
 #undef HAVE_DLD_INIT
 #undef HAVE_SHLIB
@@ -777,4 +779,13 @@
 #define MAIL_USE_LOCKF
 #endif
 
+#undef LISPDIR_USER_DEFINED
+#undef PACKAGE_PATH_USER_DEFINED
+#undef SITELISPDIR_USER_DEFINED
+#undef ARCHLIBDIR_USER_DEFINED
+#undef ETCDIR_USER_DEFINED
+#undef LOCKDIR_USER_DEFINED
+#undef INFODIR_USER_DEFINED
+#undef INFOPATH_USER_DEFINED
+
 #endif /* _SRC_CONFIG_H_ */
--- a/src/console-msw.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/console-msw.h	Mon Aug 13 10:30:37 2007 +0200
@@ -40,6 +40,11 @@
 #include "ddeml.h"	/* DDE management library */
 #ifndef __CYGWIN32__
 #include "shellapi.h"	/* FileManager/Explorer drag and drop */
+#include "commctrl.h"
+#endif
+
+#ifdef HAVE_XPM
+#include <X11/xpm.h>
 #endif
 
 /*
@@ -119,6 +124,11 @@
 
   /* Coordinates of last click event, screen-relative */
   POINTS last_click_point;
+#ifdef HAVE_TOOLBARS
+  HWND htoolbar;
+  /* Toolbar hashtable. See toolbar-msw.c */
+  Lisp_Object toolbar_hashtable;
+#endif
 
   /* Menu hashtable. See menubar-msw.c */
   Lisp_Object menu_hashtable;
@@ -145,9 +155,11 @@
 #define FRAME_MSWINDOWS_DATA(f) FRAME_TYPE_DATA (f, mswindows)
 
 #define FRAME_MSWINDOWS_HANDLE(f)	  (FRAME_MSWINDOWS_DATA (f)->hwnd)
+#define FRAME_MSWINDOWS_TOOLBAR(f)	  (FRAME_MSWINDOWS_DATA (f)->htoolbar)
 #define FRAME_MSWINDOWS_DC(f)		  (FRAME_MSWINDOWS_DATA (f)->hdc)
 #define FRAME_MSWINDOWS_CDC(f)		  (FRAME_MSWINDOWS_DATA (f)->cdc)
 #define FRAME_MSWINDOWS_MENU_HASHTABLE(f) (FRAME_MSWINDOWS_DATA (f)->menu_hashtable)
+#define FRAME_MSWINDOWS_TOOLBAR_HASHTABLE(f) (FRAME_MSWINDOWS_DATA (f)->toolbar_hashtable)
 #define FRAME_MSWINDOWS_MENU_CHECKSUM(f)  (FRAME_MSWINDOWS_DATA (f)->menu_checksum)
 #define FRAME_MSWINDOWS_TITLE_CHECKSUM(f) (FRAME_MSWINDOWS_DATA (f)->title_checksum)
 #define FRAME_MSWINDOWS_CHARWIDTH(f)	  (FRAME_MSWINDOWS_DATA (f)->charwidth)
@@ -197,15 +209,18 @@
 					  HSZ hszTopic, HSZ hszItem, HDDEDATA hdata,
 					  DWORD dwData1, DWORD dwData2);
 
-void mswindows_enqueue_dispatch_event (Lisp_Object event);
-void mswindows_enqueue_magic_event (HWND hwnd, UINT message);
+void mswindows_bump_queue (void);
 Lisp_Object mswindows_cancel_dispatch_event (struct Lisp_Event* event);
 Lisp_Object mswindows_pump_outstanding_events (void);
 Lisp_Object mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg),
 					  Lisp_Object barg);
 void mswindows_unmodalize_signal_maybe (void);
 
-/* #### This wants to go to lisp.h */
+#ifdef HAVE_WIN32_PROCESSES
+HANDLE get_nt_process_handle (struct Lisp_Process *p);
+#endif
+
+extern Lisp_Object Vmswindows_frame_being_created;
 typedef struct
 {
   int left;
--- a/src/data.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/data.c	Mon Aug 13 10:30:37 2007 +0200
@@ -128,9 +128,9 @@
 }
 
 DOESNT_RETURN
-pure_write_error (void)
+pure_write_error (Lisp_Object obj)
 {
-  error ("Attempt to modify read-only object");
+  signal_simple_error ("Attempt to modify read-only object", obj);
 }
 
 DOESNT_RETURN
@@ -1202,7 +1202,7 @@
     }
 #endif /* LISP_FLOAT_TYPE */
 
-  sprintf (buffer, "%ld", (long) (XINT (num)));
+  long_to_string (buffer, XINT (num));
   return build_string (buffer);
 }
 
--- a/src/depend	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/depend	Mon Aug 13 10:30:37 2007 +0200
@@ -10,14 +10,15 @@
 console-msw.o: $(LISP_H) conslots.h console-msw.h console.h events.h opaque.h systime.h
 device-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console-stream.h console.h device.h events.h faces.h frame.h frameslots.h mule-charset.h scrollbar.h specifier.h sysdep.h systime.h toolbar.h
 dired-msw.o: $(LISP_H) buffer.h bufslots.h msdos.h mule-charset.h ndir.h nt.h regex.h sysdir.h sysfile.h
-event-msw.o: $(LISP_H) conslots.h console-msw.h console.h device.h events-mod.h events.h frame.h frameslots.h menubar-msw.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysproc.h systime.h syswait.h toolbar.h
-frame-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h device.h events.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h
+event-msw.o: $(LISP_H) conslots.h console-msw.h console.h device.h events-mod.h events.h frame.h frameslots.h lstream.h menubar-msw.h mule-charset.h process.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h sysproc.h systime.h syswait.h toolbar.h
+frame-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h device.h events.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h
 glyphs-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h device.h faces.h file-coding.h frame.h frameslots.h glyphs-msw.h glyphs.h imgproc.h insdel.h lstream.h msdos.h mule-charset.h nt.h objects-msw.h objects.h opaque.h scrollbar.h specifier.h sysfile.h toolbar.h
 menubar-msw.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console-msw.h console.h device.h elhash.h events.h frame.h frameslots.h gui.h menubar-msw.h menubar.h mule-charset.h opaque.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h
 objects-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h device.h hash.h insdel.h mule-charset.h objects-msw.h objects.h specifier.h
 redisplay-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h debug.h device.h events.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h mule-ccl.h mule-charset.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h sysdep.h systime.h toolbar.h window.h
 scrollbar-msw.o: $(LISP_H) conslots.h console-msw.h console.h device.h events.h frame.h frameslots.h redisplay.h scrollbar-msw.h scrollbar.h specifier.h systime.h toolbar.h window.h
 select-msw.o: $(LISP_H) conslots.h console-msw.h console.h
+toolbar-msw.o: $(LISP_H) buffer.h bufslots.h conslots.h console-msw.h console.h device.h faces.h frame.h frameslots.h glyphs-msw.h glyphs.h gui.h mule-charset.h objects-msw.h objects.h redisplay.h scrollbar.h specifier.h toolbar.h window.h
 #endif
 #ifdef HAVE_X_WINDOWS
 balloon-x.o: $(LISP_H) balloon_help.h conslots.h console-x.h console.h device.h xintrinsic.h
@@ -88,7 +89,7 @@
 dynarr.o: $(LISP_H)
 ecrt0.o: config.h
 editfns.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console.h device.h events.h extents.h frame.h frameslots.h insdel.h line-number.h mule-charset.h redisplay.h scrollbar.h specifier.h sysdep.h syspwd.h systime.h toolbar.h window.h
-eldap.o: $(LISP_H)
+eldap.o: $(LISP_H) eldap.h
 elhash.o: $(LISP_H) bytecode.h elhash.h hash.h
 emacs.o: $(LISP_H) backtrace.h buffer.h bufslots.h commands.h conslots.h console.h msdos.h mule-charset.h nt.h paths.h process.h sysdep.h sysdll.h sysfile.h syssignal.h systime.h systty.h
 eval.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h commands.h conslots.h console.h mule-charset.h opaque.h
@@ -133,7 +134,7 @@
 macros.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console.h device.h events.h frame.h frameslots.h keymap.h macros.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h
 malloc.o: config.h getpagesize.h
 marker.o: $(LISP_H) buffer.h bufslots.h mule-charset.h
-md5.o: $(LISP_H) buffer.h bufslots.h file-coding.h insdel.h lstream.h mule-charset.h
+md5.o: $(LISP_H) buffer.h bufslots.h file-coding.h lstream.h mule-charset.h
 menubar.o: $(LISP_H) buffer.h bufslots.h conslots.h console.h device.h frame.h frameslots.h gui.h menubar.h mule-charset.h redisplay.h scrollbar.h specifier.h toolbar.h window.h
 minibuf.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console-stream.h console.h device.h events.h frame.h frameslots.h insdel.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h
 msdos.o: $(LISP_H) conslots.h console.h device.h frame.h frameslots.h msdos.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h
@@ -147,6 +148,7 @@
 offix.o: offix-cursors.h offix-types.h offix.h xintrinsic.h
 opaque.o: $(LISP_H) opaque.h
 print.o: $(LISP_H) backtrace.h buffer.h bufslots.h bytecode.h conslots.h console-stream.h console-tty.h console.h device.h extents.h frame.h frameslots.h insdel.h lstream.h msdos.h mule-charset.h nt.h scrollbar.h specifier.h sysfile.h syssignal.h systty.h toolbar.h
+process-nt.o: $(LISP_H) hash.h lstream.h mule-charset.h process.h procimpl.h
 process-unix.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console.h device.h events.h file-coding.h frame.h frameslots.h hash.h insdel.h lstream.h msdos.h mule-charset.h nt.h opaque.h process.h procimpl.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h toolbar.h window.h
 process.o: $(LISP_H) buffer.h bufslots.h commands.h conslots.h console.h device.h events.h file-coding.h frame.h frameslots.h hash.h insdel.h lstream.h msdos.h mule-charset.h nt.h opaque.h process.h procimpl.h redisplay.h scrollbar.h specifier.h sysdep.h sysfile.h sysproc.h syssignal.h systime.h systty.h syswait.h toolbar.h window.h
 profile.o: $(LISP_H) backtrace.h bytecode.h hash.h syssignal.h systime.h
--- a/src/device-x.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/device-x.c	Mon Aug 13 10:30:37 2007 +0200
@@ -126,16 +126,24 @@
 {
   struct device *d = get_device_from_display_1 (dpy);
 
+#if !defined(INFODOCK)
+# define FALLBACK_RESOURCE_NAME "xemacs"
+# else
+# define FALLBACK_RESOURCE_NAME "infodock"
+#endif
+
   if (!d) {
     /* This isn't one of our displays.  Let's crash? */
     stderr_out
       ("\n%s: Fatal X Condition.  Asked about display we don't own: \"%s\"\n",
        (STRINGP (Vinvocation_name) ?
-	(char *) XSTRING_DATA (Vinvocation_name) : "xemacs"),
+	(char *) XSTRING_DATA (Vinvocation_name) : FALLBACK_RESOURCE_NAME),
        DisplayString (dpy) ? DisplayString (dpy) : "???");
     abort();
   }
 
+#undef FALLBACK_RESOURCE_NAME
+
   return d;
 }
 
@@ -224,43 +232,68 @@
     DEVICE_CLASS (d) = Qmono;
 }
 
-static int
-have_xemacs_resources_in_xrdb (CONST char *disp_name)
+/*
+ * Figure out what application name to use for xemacs
+ *
+ * Since we have decomposed XtOpenDisplay into XOpenDisplay and
+ * XtDisplayInitialize, we no longer get this for free.
+ *
+ * If there is a `-name' argument in argv, use that.
+ * Otherwise use the last component of argv[0].
+ *
+ * I have removed the gratuitous use of getenv("RESOURCE_NAME")
+ * which was in X11R5, but left the matching of any prefix of `-name'.
+ * Finally, if all else fails, return `xemacs', as it is more
+ * appropriate (X11R5 returns `main').
+ */
+static char *
+compute_x_app_name (int argc, char **argv)
 {
-  Display *dpy;
-  char *xdefs, *key;
-  int len, found;
+  int i;
+  char *ptr;
 
-  /*
-  ** This function figures out whether the user has any resources of the
-  ** form "XEmacs.foo" or "XEmacs*foo".
-  **
-  ** Currently we only consult the display's global resources; to look
-  ** for screen specific resources, we would need to also consult:
-  ** xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno));
-  */
+  for (i = 1; i < argc - 1; i++)
+    if (!strncmp(argv[i], "-name", max (2, strlen (argv[1]))))
+      return argv[i+1];
+
+  if (argc > 0 && argv[0] && *argv[0])
+    return (ptr = strrchr (argv[0], '/')) ? ++ptr : argv[0];
+
+  return "xemacs";
+}
+
+/*
+ * This function figures out whether the user has any resources of the
+ * form "XEmacs.foo" or "XEmacs*foo".
+ *
+ * Currently we only consult the display's global resources; to look
+ * for screen specific resources, we would need to also consult:
+ * xdefs = XScreenResourceString(ScreenOfDisplay(dpy, scrno));
+ */
+static int
+have_xemacs_resources_in_xrdb (Display *dpy)
+{
+  char *xdefs, *key;
+  int len;
 
   key = "XEmacs";
-  len = strlen(key);
+  len = strlen (key);
 
-  dpy = XOpenDisplay(disp_name);
-
-  if (!dpy) return 0;
+  if (!dpy)
+    return 0;
 
-  xdefs = XResourceManagerString(dpy);       /* don't free - owned by X */
-  for (found = 0; xdefs && *xdefs; ) {
-    if (strncmp(xdefs, key, len) == 0  &&
-        (xdefs[len] == '*' || xdefs[len] == '.')) {
-      found = 1;
-      break;
+  xdefs = XResourceManagerString (dpy);      /* don't free - owned by X */
+  while (xdefs && *xdefs)
+    {
+      if (strncmp (xdefs, key, len) == 0  &&
+          (xdefs[len] == '*' || xdefs[len] == '.'))
+        return 1;
+
+      while (*xdefs && *xdefs++ != '\n')     /* find start of next entry.. */
+        ;
     }
 
-    while (*xdefs && *xdefs++ != '\n')       /* find start of next entry.. */
-      ;
-  }
-
-  XCloseDisplay(dpy);
-  return found;
+  return 0;
 }
 
 /* Only the characters [-_A-Za-z0-9] are allowed in the individual
@@ -312,23 +345,16 @@
 
   GET_C_STRING_CTEXT_DATA_ALLOCA (display, disp_name);
 
-  if (STRINGP (Vx_emacs_application_class) &&
-      XSTRING_LENGTH (Vx_emacs_application_class) > 0)
-    GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class);
-  else {
-    app_class = (NILP (Vx_emacs_application_class)  &&
-                 have_xemacs_resources_in_xrdb (disp_name))
-                ? "XEmacs"
-                : "Emacs";
-    /* need to update Vx_emacs_application_class: */
-    Vx_emacs_application_class = build_string (app_class);
-  }
-
+  /*
+   * Break apart the old XtOpenDisplay call into XOpenDisplay and
+   * XtDisplayInitialize so we can figure out whether there
+   * are any XEmacs resources in the resource database before
+   * we intitialize Xt.  This is so we can automagically support
+   * both `Emacs' and `XEmacs' application classes.
+   */
   slow_down_interrupts ();
-  /* The Xt code can't deal with signals here.  Yuck. */
-  dpy = DEVICE_X_DISPLAY (d) =
-    XtOpenDisplay (Xt_app_con, disp_name, NULL, app_class, emacs_options,
-                   XtNumber (emacs_options), &argc, argv);
+  /* May not be needed but XtOpenDisplay could not deal with signals here. */
+  dpy = DEVICE_X_DISPLAY (d) = XOpenDisplay (disp_name);
   speed_up_interrupts ();
 
   if (dpy == 0)
@@ -337,6 +363,27 @@
       signal_simple_error ("X server not responding\n", display);
     }
 
+  if (STRINGP (Vx_emacs_application_class) &&
+      XSTRING_LENGTH (Vx_emacs_application_class) > 0)
+    GET_C_STRING_CTEXT_DATA_ALLOCA (Vx_emacs_application_class, app_class);
+  else
+    {
+      app_class = (NILP (Vx_emacs_application_class)  &&
+                   have_xemacs_resources_in_xrdb (dpy))
+                  ? "XEmacs"
+                  : "Emacs";
+      /* need to update Vx_emacs_application_class: */
+      Vx_emacs_application_class = build_string (app_class);
+    }
+
+  slow_down_interrupts ();
+  /* May not be needed but XtOpenDisplay could not deal with signals here.
+     Yuck. */
+  XtDisplayInitialize (Xt_app_con, dpy, compute_x_app_name (argc, argv),
+                       app_class, emacs_options,
+                       XtNumber (emacs_options), &argc, argv);
+  speed_up_interrupts ();
+
   screen = DefaultScreen(dpy);
   if (NILP (Vdefault_x_device))
     Vdefault_x_device = device;
--- a/src/dired.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/dired.c	Mon Aug 13 10:30:37 2007 +0200
@@ -147,7 +147,7 @@
 		 anymore.  The crashes in this function were reported
 		 because MAXNAMLEN was used to remember the *whole*
 		 statbuf, instead of using MAXPATHLEN.  This should be
-		 tested after 20.5 is released.  */
+		 tested after 21.0 is released.  */
 
 	      /* We normally use the buffer created by alloca.
 		 However, if the file name we get too big, we'll use a
--- a/src/dll.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/dll.c	Mon Aug 13 10:30:37 2007 +0200
@@ -21,29 +21,23 @@
 
 /* Synched up with: Not in FSF. */
 
-/* A shared object may have the following symbols defined:
-      syms_of
-      vars_of
-      complex_vars_of
-   They are called in that order.  Each takes and returns void
-   arguments.
+/* A shared object must have the symbol `emacs_initialize' defined.
+   It should contain initialization of functions, symbols, etc. and
+   their loading into Lisp-land.  The function will be called without
+   arguments and is not expected to return any.
 
    All of this needs lots and LOTS of work.  Some things to work on:
 
-   1) A good foreign interface.  We probably need to get rid of
-   syms_of and similar junk, and define a more normal interfacing to
-   the outside world, e.g. an init_emacs_module() function.  See below
-   for more discussion about it.  Also, we need a modules/ directory
-   with a few nice sample modules, a sample Makefile, etc. so people
-   can start hacking.
+   1) A good foreign interface.  This is probably tough, because it
+   implies drawing a new border between "external" and "internal"
+   stuff (traditionally, Lisp code was external, while C was
+   internal).  Also, we need a modules/ directory with a few nice
+   sample modules, a sample Makefile, etc. so people can start
+   hacking.
 
-   2) I'm getting coredumps very often -- practically every time I
-   compile without USE_MINIMAL_TAGBITS, and even with it sometimes.  I
-   wasn't able to resolve these.
-
-   3) All of this is sooo simple-minded.  As it gets more complex,
+   2) All of this is sooo simple-minded.  As it gets more complex,
    we'll have to look at how others have done similar things
-   (e.g. Perl and Zsh 3.1), to avoid botching it up.  */
+   (e.g. Perl 5 and Zsh 3.1), to avoid botching it up.  */
 
 #include <config.h>
 #include "lisp.h"
@@ -51,23 +45,13 @@
 #include "sysdll.h"
 #include <errno.h>
 
-static void
-maybe_call_library_function (dll_handle *handle, CONST char *funcname)
-{
-  void (*function)(void) = (void (*)(void)) dll_function (handle, funcname);
-  if (function)
-    (*function) ();
-}
-
 DEFUN ("dll-open", Fdll_open, 1, 1, "FShared object: ", /*
 Load LIBRARY as a shared object file.
 
 After the LIBRARY is dynamically linked with the executable, the
-following functions are called:
-
-  syms_of(),		containing definitions of symbols and subr's;
-  vars_of(),		containing definitions of variables;
-  complex_vars_of(),	containing complex definitions of variables.
+`emacs_initialize' function will be called without arguments.  It
+should define all the symbols, subr's and variables the module
+introduces.
 
 After this point, any lisp symbols defined in the shared object are
 available for use.
@@ -76,6 +60,7 @@
 {
   /* This function can GC */
   dll_handle *handle;
+  void (*function) (void);
   CONST char *filename;
 
   CHECK_STRING (library);
@@ -91,23 +76,14 @@
 			   library, build_translated_string (dll_error (handle))));
     }
 
-  /* #### This looks unnecessary here, because at this time one
-     initialization function is fully sufficient.  However, I am not
-     removing this support, since we may wish to add mechanisms for
-     static linking, which would have invoke these function via normal
-     paths.
+  /* #### Perhaps emacs_initialize() should return a Lisp_Object, so
+     we can return it?  */
 
-     #### But then this is not sufficient, because one could as well
-     honor specifier_vars_of_foo(), etc.  Maybe we should scrap it
-     after all.
-
-     #### What if one of the first two functions signal an error?
-     Should we take care to execute the other two?  My fingers are
-     getting itchy!  */
-
-  maybe_call_library_function (handle, "syms_of");
-  maybe_call_library_function (handle, "vars_of");
-  maybe_call_library_function (handle, "complex_vars_of");
+  function = (void (*)(void)) dll_function (handle, "emacs_initialize");
+  if (!function)
+    signal_simple_error ("Shared library does not define `emacs_initialize'",
+			 library);
+  (*function) ();
 
   return Qnil;
 }
--- a/src/doprnt.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/doprnt.c	Mon Aug 13 10:30:37 2007 +0200
@@ -654,8 +654,8 @@
 	      if (spec->precision >= 0)
 		{
 		  strcat (constructed_spec, ".");
-		  sprintf (constructed_spec + strlen (constructed_spec), "%d",
-			   spec->precision);
+		  long_to_string (constructed_spec + strlen (constructed_spec),
+				  spec->precision);
 		}
 	      sprintf (constructed_spec + strlen (constructed_spec), "%c", ch);
 
--- a/src/eldap.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/eldap.c	Mon Aug 13 10:30:37 2007 +0200
@@ -36,6 +36,8 @@
 #include <lber.h>
 #include <ldap.h>
 
+#include "eldap.h"
+
 #ifdef HAVE_NS_LDAP
 #define HAVE_LDAP_SET_OPTION 1
 #define HAVE_LDAP_GET_ERRNO 1
@@ -44,12 +46,14 @@
 #undef HAVE_LDAP_GET_ERRNO
 #endif
 
-static Lisp_Object Vldap_default_base;
-static Lisp_Object Vldap_default_host;
+
 
-/* ldap-search-internal plist keywords */
-static Lisp_Object Qhost, Qfilter, Qattributes, Qattrsonly, Qbase, Qscope,
-  Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit, Qsizelimit;
+static int ldap_default_port;
+static Lisp_Object Vldap_default_base;
+
+/* ldap-open plist keywords */
+static Lisp_Object Qport, Qauth, Qbinddn, Qpasswd, Qderef, Qtimelimit,
+  Qsizelimit;
 /* Search scope limits */
 static Lisp_Object Qbase, Qonelevel, Qsubtree;
 /* Authentication methods */
@@ -62,19 +66,153 @@
 /* Deref policy */
 static Lisp_Object Qnever, Qalways, Qfind;
 
-DEFUN ("ldap-search-internal", Fldap_search_internal, 1, 1, 0, /*
-Perform a search on a LDAP server.
-SEARCH-PLIST is a property list describing the search request.
+static Lisp_Object Qldapp;
+
+
+/************************************************************************/
+/*                         Utility Functions                            */
+/************************************************************************/
+
+static void
+signal_ldap_error (LDAP *ld)
+{
+#if HAVE_LDAP_GET_ERRNO
+  signal_simple_error
+    ("LDAP error",
+     build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL))));
+#else
+  signal_simple_error ("LDAP error",
+                       build_string (ldap_err2string (ld->ld_errno)));
+#endif
+}
+
+
+/************************************************************************/
+/*                          The ldap Lisp object                        */
+/************************************************************************/
+
+/*
+ * Structure records pertinent information about an open LDAP connection.
+ */
+
+struct Lisp_LDAP
+{
+  /* lcrecord header */
+  struct lcrecord_header header;
+  /* The LDAP connection handle used by the LDAP API */
+  LDAP *ld;
+  /* Name of the host we connected to */
+  Lisp_Object host;
+  /* Status of the LDAP connection.
+     This is a symbol: open or closed */
+  Lisp_Object status_symbol;
+};
+
+
+
+static Lisp_Object
+mark_ldap (Lisp_Object obj, void (*markobj) (Lisp_Object))
+{
+  struct Lisp_LDAP *ldap = XLDAP (obj);
+  ((markobj) (ldap->host));
+  return ldap->status_symbol;
+}
+
+static void
+print_ldap (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
+{
+  char buf[16];
+
+  struct Lisp_LDAP *ldap = XLDAP (obj);
+
+  if (print_readably)
+    error ("printing unreadable object #<ldap %s>",
+           XSTRING_DATA (ldap->host));
+
+  if (!escapeflag)
+    {
+      print_internal (ldap->host, printcharfun, 0);
+    }
+  else
+    {
+      write_c_string (GETTEXT ("#<ldap "), printcharfun);
+      print_internal (ldap->host, printcharfun, 1);
+      write_c_string (" state:",printcharfun);
+      print_internal (ldap->status_symbol, printcharfun, 1);
+      sprintf (buf, " 0x%x>", ldap);
+      write_c_string (buf, printcharfun);
+    }
+}
+
+static struct Lisp_LDAP *
+allocate_ldap (void)
+{
+  struct Lisp_LDAP *ldap =
+    alloc_lcrecord_type (struct Lisp_LDAP, lrecord_ldap);
+
+  ldap->ld = (LDAP *) NULL;
+  ldap->host = Qnil;
+  ldap->status_symbol = Qnil;
+  return ldap;
+}
+
+DEFINE_LRECORD_IMPLEMENTATION ("ldap", ldap,
+                               mark_ldap, print_ldap, NULL,
+                               NULL, NULL, struct Lisp_LDAP);
+
+
+
+
+/************************************************************************/
+/*                        Basic ldap accessors                          */
+/************************************************************************/
+
+DEFUN ("ldapp", Fldapp, 1, 1, 0, /*
+Return t if OBJECT is a LDAP connection.
+*/
+       (object))
+{
+  return LDAPP (object) ? Qt : Qnil;
+}
+
+
+DEFUN ("ldap-host", Fldap_host, 1, 1, 0, /*
+Return the server host of the connection LDAP, as a string.
+*/
+       (ldap))
+{
+  CHECK_LDAP (ldap);
+  return (XLDAP (ldap))->host;
+}
+
+
+
+DEFUN ("ldap-status", Fldap_status, 1, 1, 0, /*
+Return the status of the connection LDAP.
+This is a symbol, one of these:
+
+open   -- for a LDAP connection that is open.
+closed -- for a LDAP connection that is closed.
+*/
+       (ldap))
+{
+  CHECK_LDAP (ldap);
+  return (XLDAP (ldap))->status_symbol;
+}
+
+
+
+/************************************************************************/
+/*                  Opening/Closing a LDAP connection                   */
+/************************************************************************/
+
+
+DEFUN ("ldap-open", Fldap_open, 1, 2, 0, /*
+Open a LDAP connection to HOST.
+PLIST is a plist containing additional parameters for the connection.
 Valid keys in that list are:
-  `host' is a string naming one or more (blank separated) LDAP servers to
-to try to connect to. Each host name may optionally be of the form host:port.
-  `filter' is a filter string for the search as described in RFC 1558
-  `attributes' is a list of strings indicating which attributes to retrieve
-for each matching entry. If nil return all available attributes.
-  `attrsonly' if non-nil indicates that only the attributes are retrieved, not
-the associated values.
-  `base' is the base for the search as described in RFC 1779.
-  `scope' is one of the three symbols `subtree', `base' or `onelevel'.
+  `port' the TCP port to use for the connection if different from
+`ldap-default-port'.
   `auth' is the authentication method to use, possible values depend on
 the LDAP library XEmacs was compiled with: `simple', `krbv41' and `krbv42'.
   `binddn' is the distinguished name of the user to bind as (in RFC 1779 syntax).
@@ -82,115 +220,40 @@
   `deref' is one of the symbols `never', `always', `search' or `find'.
   `timelimit' is the timeout limit for the connection in seconds.
   `sizelimit' is the maximum number of matches to return.
-The function returns a list of matching entries.  Each entry is itself
-an alist of attribute/values.
 */
-       (search_plist))
+       (host, plist))
 {
- /* This function calls lisp */
+  /* This function can call lisp */
 
-  /* Vars for query */
+  struct Lisp_LDAP *lisp_ldap;
   LDAP *ld;
-  LDAPMessage *res, *e;
-  BerElement *ptr;
-  char *a;
-  int i, rc, err;
-
-  char *ldap_host = NULL;
-  char *ldap_filter = NULL;
-  char **ldap_attributes = NULL;
-  int  ldap_attrsonly = 0;
-  char *ldap_base = NULL;
-  int  ldap_scope = LDAP_SCOPE_SUBTREE;
+  int   ldap_port = 0;
   int  ldap_auth = LDAP_AUTH_SIMPLE;
   char *ldap_binddn = NULL;
   char *ldap_passwd = NULL;
   int  ldap_deref = LDAP_DEREF_NEVER;
   int  ldap_timelimit = 0;
   int  ldap_sizelimit = 0;
-
-  char **vals = NULL;
-  int  matches;
-
-  Lisp_Object list, entry, result, keyword, value;
-  struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
-
-  list = entry = result = keyword = value = Qnil;
-  GCPRO5 (list, entry, result, keyword, value);
-
+  int err;
 
-  EXTERNAL_PROPERTY_LIST_LOOP(list, keyword, value, search_plist)
-    {
-      /* Host */
-      if (EQ (keyword, Qhost))
-        {
-          CHECK_STRING (value);
-          ldap_host = alloca (XSTRING_LENGTH (value) + 1);
-          strcpy (ldap_host, (char *)XSTRING_DATA (value));
-        }
-      /* Filter */
-      else if (EQ (keyword, Qfilter))
-        {
-          CHECK_STRING (value);
-          ldap_filter = alloca (XSTRING_LENGTH (value) + 1);
-          strcpy (ldap_filter, (char *)XSTRING_DATA (value));
-        }
-      /* Attributes */
-      else if (EQ (keyword, Qattributes))
-        {
-          if (! NILP (value))
-            {
-              Lisp_Object attr_left = value;
-              struct gcpro ngcpro1;
+  Lisp_Object ldap, list, keyword, value;
+  struct gcpro gcpro1;
 
-              NGCPRO1 (attr_left);
-              CHECK_CONS (value);
-
-              ldap_attributes = alloca ((XINT (Flength (value)) + 1)*sizeof (char *));
+  ldap =  Qnil;
+  GCPRO1 (ldap);
 
-              for (i=0; !NILP (attr_left); i++) {
-                CHECK_STRING (XCAR (attr_left));
-                ldap_attributes[i] = alloca (XSTRING_LENGTH (XCAR (attr_left)) + 1);
-                strcpy(ldap_attributes[i],
-                       (char *)(XSTRING_DATA( XCAR (attr_left))));
-                attr_left = XCDR (attr_left);
-              }
-              ldap_attributes[i] = NULL;
-              NUNGCPRO;
-            }
-        }
-      /* Attributes Only */
-      else if (EQ (keyword, Qattrsonly))
-        {
-          CHECK_SYMBOL (value);
-          ldap_attrsonly = NILP (value) ? 0 : 1;
-        }
-      /* Base */
-      else if (EQ (keyword, Qbase))
+  CHECK_STRING (host);
+
+  EXTERNAL_PROPERTY_LIST_LOOP(list, keyword, value, plist)
+    {
+      /* TCP Port */
+      if (EQ (keyword, Qport))
         {
-          if (!NILP (value))
-            {
-              CHECK_STRING (value);
-              ldap_base = alloca (XSTRING_LENGTH (value) + 1);
-              strcpy (ldap_base, (char *)XSTRING_DATA (value));
-            }
-        }
-      /* Scope */
-      else if (EQ (keyword, Qscope))
-        {
-          CHECK_SYMBOL (value);
-
-          if (EQ (value, Qbase))
-            ldap_scope = LDAP_SCOPE_BASE;
-          else if (EQ (value, Qonelevel))
-            ldap_scope = LDAP_SCOPE_ONELEVEL;
-          else if (EQ (value, Qsubtree))
-            ldap_scope = LDAP_SCOPE_SUBTREE;
-          else
-            signal_simple_error ("Invalid scope", value);
+          CHECK_INT (value);
+          ldap_port = XINT (value);
         }
       /* Authentication method */
-      else if (EQ (keyword, Qauth))
+      if (EQ (keyword, Qauth))
         {
           CHECK_SYMBOL (value);
 
@@ -210,22 +273,16 @@
       /* Bind DN */
       else if (EQ (keyword, Qbinddn))
         {
-          if (!NILP (value))
-            {
-              CHECK_STRING (value);
-              ldap_binddn = alloca (XSTRING_LENGTH (value) + 1);
-              strcpy (ldap_binddn, (char *)XSTRING_DATA (value));
-            }
+          CHECK_STRING (value);
+          ldap_binddn = alloca (XSTRING_LENGTH (value) + 1);
+          strcpy (ldap_binddn, (char *)XSTRING_DATA (value));
         }
       /* Password */
       else if (EQ (keyword, Qpasswd))
         {
-          if (!NILP (value))
-            {
-              CHECK_STRING (value);
-              ldap_passwd = alloca (XSTRING_LENGTH (value) + 1);
-              strcpy (ldap_passwd, (char *)XSTRING_DATA (value));
-            }
+          CHECK_STRING (value);
+          ldap_passwd = alloca (XSTRING_LENGTH (value) + 1);
+          strcpy (ldap_passwd, (char *)XSTRING_DATA (value));
         }
       /* Deref */
       else if (EQ (keyword, Qderef))
@@ -245,67 +302,41 @@
       /* Timelimit */
       else if (EQ (keyword, Qtimelimit))
         {
-          if (!NILP (value))
-            {
-              CHECK_INT (value);
-              ldap_timelimit = XINT (value);
-            }
+          CHECK_INT (value);
+          ldap_timelimit = XINT (value);
         }
       /* Sizelimit */
       else if (EQ (keyword, Qsizelimit))
         {
-          if (!NILP (value))
-            {
-              CHECK_INT (value);
-              ldap_sizelimit = XINT (value);
-            }
+          CHECK_INT (value);
+          ldap_sizelimit = XINT (value);
         }
     }
 
-  /* Use ldap-default-base if no default base was given */
-  if (ldap_base == NULL && !NILP (Vldap_default_base))
+  if (ldap_port == 0)
     {
-      CHECK_STRING (Vldap_default_base);
-      ldap_base = alloca (XSTRING_LENGTH (Vldap_default_base) + 1);
-      strcpy (ldap_base, (char *)XSTRING_DATA (Vldap_default_base));
-    }
-
-  /* Use ldap-default-host if no host was given */
-  if (ldap_host == NULL && !NILP (Vldap_default_host))
-    {
-      CHECK_STRING (Vldap_default_host);
-      ldap_host = alloca (XSTRING_LENGTH (Vldap_default_host) + 1);
-      strcpy (ldap_host, (char *)XSTRING_DATA (Vldap_default_host));
+      ldap_port = ldap_default_port;
     }
 
-  if (ldap_filter == NULL)
-    error ("Empty search filter");
+  /* Connect to the server and bind */
+  ld = ldap_open ((char *)XSTRING_DATA (host), ldap_port);
+  if (ld == NULL )
+    signal_simple_error_2 ("Failed connecting to host",
+                           host,
+                           lisp_strerror (errno));
 
-  /* Garbage collect before connecting (if using UMich lib).
-     This is ugly, I know, but without this, the UMich LDAP library 3.3
-     frequently reports "Can't contact LDAP server".  I really need to
-     check what happens inside that lib. Anyway this should be harmless to
-     XEmacs and makes things work. */
-#if defined (HAVE_UMICH_LDAP)
-  garbage_collect_1 ();
-#endif
-
-  /* Connect to the server and bind */
-  message ("Connecting to %s...", ldap_host);
-  if ( (ld = ldap_open (ldap_host, LDAP_PORT)) == NULL )
-     signal_simple_error_2 ("Failed connecting to host",
-                            build_string (ldap_host),
-                            lisp_strerror (errno));
 
 #if HAVE_LDAP_SET_OPTION
   if (ldap_set_option (ld, LDAP_OPT_DEREF, (void *)&ldap_deref) != LDAP_SUCCESS)
-    error ("Failed to set deref option");
-  if (ldap_set_option (ld, LDAP_OPT_TIMELIMIT, (void *)&ldap_timelimit) != LDAP_SUCCESS)
-    error ("Failed to set timelimit option");
-  if (ldap_set_option (ld, LDAP_OPT_SIZELIMIT, (void *)&ldap_sizelimit) != LDAP_SUCCESS)
-    error ("Failed to set sizelimit option");
+    signal_ldap_error (ld);
+  if (ldap_set_option (ld, LDAP_OPT_TIMELIMIT,
+                       (void *)&ldap_timelimit) != LDAP_SUCCESS)
+    signal_ldap_error (ld);
+  if (ldap_set_option (ld, LDAP_OPT_SIZELIMIT,
+                       (void *)&ldap_sizelimit) != LDAP_SUCCESS)
+    signal_ldap_error (ld);
   if (ldap_set_option (ld, LDAP_OPT_REFERRALS, LDAP_OPT_ON) != LDAP_SUCCESS)
-    error ("Failed to set referral option");
+    signal_ldap_error (ld);
 #else /* HAVE_LDAP_SET_OPTION */
   ld->ld_deref = ldap_deref;
   ld->ld_timelimit = ldap_timelimit;
@@ -317,31 +348,164 @@
 #endif /* LDAP_REFERRALS */
 #endif /* HAVE_LDAP_SET_OPTION */
 
-  message ("Binding to %s...", ldap_host);
-  if ( (err = (ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth ))) != LDAP_SUCCESS )
+  /* ldap_bind_s calls select and may be wedged by spurious signals */
+  slow_down_interrupts ();
+  err = ldap_bind_s (ld, ldap_binddn, ldap_passwd, ldap_auth);
+  speed_up_interrupts ();
+  if (err != LDAP_SUCCESS)
     signal_simple_error ("Failed binding to the server",
                          build_string (ldap_err2string (err)));
 
-  /* Perform the search */
-  message ("Searching with LDAP on %s...", ldap_host);
-  if ( ldap_search (ld, ldap_base, ldap_scope, ldap_filter,
-                      ldap_attributes, ldap_attrsonly) == -1)
+  lisp_ldap = allocate_ldap ();
+  lisp_ldap->ld = ld;
+  lisp_ldap->host = host;
+  lisp_ldap->status_symbol = Qopen;
+  XSETLDAP (ldap,lisp_ldap);
+
+  UNGCPRO;
+  return ldap;
+}
+
+
+
+DEFUN ("ldap-close", Fldap_close, 1, 1, 0, /*
+Close an LDAP connection.
+Return t if the connection was actually closed or nil if
+it was already closed before the call
+*/
+      (ldap))
+{
+  CHECK_LDAP (ldap);
+  if ( EQ ((XLDAP (ldap))->status_symbol, Qopen) )
     {
-      ldap_unbind (ld);
-#if HAVE_LDAP_GET_ERRNO
-      signal_simple_error ("Error during LDAP search",
-                           build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL))));
-#else
-      signal_simple_error ("Error during LDAP search",
-                           build_string (ldap_err2string (ld->ld_errno)));
-#endif
+      ldap_unbind ((XLDAP (ldap))->ld);
+      (XLDAP (ldap))->status_symbol = Qclosed;
+      return Qt;
+    }
+  return Qnil;
+}
+
+
+
+/************************************************************************/
+/*                  Working on a LDAP connection                        */
+/************************************************************************/
+
+DEFUN ("ldap-search-internal", Fldap_search_internal, 2, 6, 0, /*
+Perform a search on an open LDAP connection.
+LDAP is an LDAP connection object created with `ldap-open'.
+FILTER is a filter string for the search as described in RFC 1558
+BASE is the distinguished name at which to start the search
+SCOPE is an integer or a symbol indicating the scope of the search
+ Possible values are `ldap-scope-base', `ldap-scope-onelevel' or
+ `ldap-scope-subtree'
+ATTRS is a list of strings indicating which attributes to retrieve
+ for each matching entry. If nil return all available attributes.
+If ATTRSONLY is non-nil then only the attributes are retrieved, not
+the associated values
+The function returns a list of matching entries.  Each entry is itself
+an alist of attribute/values.
+*/
+       (ldap, filter, base, scope, attrs, attrsonly))
+{
+  /* This function can call lisp */
+
+  /* Vars for query */
+  LDAP *ld;
+  LDAPMessage *res, *e;
+  BerElement *ptr;
+  char *a;
+  int i, rc, err;
+
+  char **vals = NULL;
+  int  matches;
+
+  int  ldap_scope = LDAP_SCOPE_SUBTREE;
+  char **ldap_attributes = NULL;
+
+  Lisp_Object list, entry, result;
+  struct gcpro gcpro1, gcpro2, gcpro3;
+
+  list = entry = result = Qnil;
+  GCPRO3(list, entry, result);
+
+  /* Do all the parameter checking  */
+  CHECK_LIVE_LDAP (ldap);
+  ld = (XLDAP (ldap))->ld;
+
+  /* Filter */
+  CHECK_STRING (filter);
+
+  /* Search base */
+  if (NILP (base))
+    {
+      base = Vldap_default_base;
+    }
+  if (!NILP (base))
+    {
+      CHECK_STRING (Vldap_default_base);
+    }
+
+  /* Search scope */
+  if (!NILP (scope))
+    {
+      CHECK_SYMBOL (scope);
+      if (EQ (scope, Qbase))
+        ldap_scope = LDAP_SCOPE_BASE;
+      else if (EQ (scope, Qonelevel))
+        ldap_scope = LDAP_SCOPE_ONELEVEL;
+      else if (EQ (scope, Qsubtree))
+        ldap_scope = LDAP_SCOPE_SUBTREE;
+      else
+        signal_simple_error ("Invalid scope", scope);
+    }
+
+  /* Attributes to search */
+  if (!NILP (attrs))
+    {
+      Lisp_Object attr_left = attrs;
+      struct gcpro ngcpro1;
+
+      NGCPRO1 (attr_left);
+      CHECK_CONS (attrs);
+
+      ldap_attributes = alloca ((XINT (Flength (attrs)) + 1)*sizeof (char *));
+
+      for (i=0; !NILP (attr_left); i++) {
+        CHECK_STRING (XCAR (attr_left));
+        ldap_attributes[i] = alloca (XSTRING_LENGTH (XCAR (attr_left)) + 1);
+        strcpy(ldap_attributes[i],
+               (char *)(XSTRING_DATA( XCAR (attr_left))));
+        attr_left = XCDR (attr_left);
+      }
+      ldap_attributes[i] = NULL;
+      NUNGCPRO;
+    }
+
+  /* Attributes only ? */
+  CHECK_SYMBOL (attrsonly);
+
+
+  /* Perform the search */
+  if (ldap_search (ld,
+                   NILP (base) ? "" : (char *) XSTRING_DATA (base),
+                   ldap_scope,
+                   NILP (filter) ? "" : (char *) XSTRING_DATA (filter),
+                   ldap_attributes,
+                   NILP (attrsonly) ? 0 : 1)
+       == -1)
+    {
+      signal_ldap_error (ld);
     }
 
   /* Build the results list */
   matches = 0;
 
-  while ( (rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &res))
-          == LDAP_RES_SEARCH_ENTRY )
+  /* ldap_result calls select() and can get wedged by EINTR signals */
+  slow_down_interrupts ();
+  rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &res);
+  speed_up_interrupts ();
+  while ( rc == LDAP_RES_SEARCH_ENTRY )
     {
       matches ++;
       e = ldap_first_entry (ld, res);
@@ -368,32 +532,23 @@
       result = Fcons (Fnreverse (entry),
                       result);
       ldap_msgfree (res);
+
+      slow_down_interrupts ();
+      rc = ldap_result (ld, LDAP_RES_ANY, 0, NULL, &res);
+      speed_up_interrupts ();
     }
 
   if (rc == -1)
     {
-#if HAVE_LDAP_GET_ERRNO
-      signal_simple_error ("Error retrieving result",
-                           build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL))));
-#else
-      signal_simple_error ("Error retrieving result",
-                           build_string (ldap_err2string (ld->ld_errno)));
-#endif
+      signal_ldap_error (ld);
     }
 
   if ((rc = ldap_result2error (ld, res, 0)) != LDAP_SUCCESS)
     {
-#if HAVE_LDAP_GET_ERRNO
-      signal_simple_error ("Error on result",
-                           build_string (ldap_err2string (ldap_get_lderrno (ld, NULL, NULL))));
-#else
-      signal_simple_error ("Error on result",
-                           build_string (ldap_err2string (ld->ld_errno)));
-#endif
+      signal_ldap_error (ld);
     }
 
   ldap_msgfree (res);
-  ldap_unbind (ld);
   message ("Done.");
 
   result = Fnreverse (result);
@@ -407,40 +562,27 @@
 void
 syms_of_eldap (void)
 {
-  DEFSUBR(Fldap_search_internal);
+  defsymbol (&Qldapp, "ldapp");
 
-  defsymbol (&Qhost, "host");
-  defsymbol (&Qfilter, "filter");
-  defsymbol (&Qattributes, "attributes");
-  defsymbol (&Qattrsonly, "attrsonly");
-  defsymbol (&Qbase, "base");
-  defsymbol (&Qscope, "scope");
-  defsymbol (&Qauth, "auth");
-  defsymbol (&Qbinddn, "binddn");
-  defsymbol (&Qpasswd, "passwd");
-  defsymbol (&Qderef, "deref");
-  defsymbol (&Qtimelimit, "timelimit");
-  defsymbol (&Qsizelimit, "sizelimit");
-  defsymbol (&Qonelevel, "onelevel");
-  defsymbol (&Qsubtree, "subtree");
-#ifdef LDAP_AUTH_KRBV41
-  defsymbol (&Qkrbv41, "krbv41");
-#endif
-#ifdef LDAP_AUTH_KRBV42
-  defsymbol (&Qkrbv42, "krbv42");
-#endif
-  defsymbol (&Qnever, "never");
-  defsymbol (&Qalways, "always");
-  defsymbol (&Qfind, "find");
+  DEFSUBR (Fldapp);
+  DEFSUBR (Fldap_host);
+  DEFSUBR (Fldap_status);
+  DEFSUBR (Fldap_open);
+  DEFSUBR (Fldap_close);
+  DEFSUBR (Fldap_search_internal);
 }
 
 void
 vars_of_eldap (void)
 {
-  Fprovide (intern ("ldap-internal"));
+  Fprovide (intern ("ldap"));
 
-  DEFVAR_LISP ("ldap-default-host", &Vldap_default_host /*
-Default LDAP host.
+  ldap_default_port = LDAP_PORT;
+  Vldap_default_base =  Qnil;
+
+  DEFVAR_INT ("ldap-default-port", &ldap_default_port /*
+Default TCP port for LDAP connections.
+Initialized from the LDAP library. Default value is 389.
 */ );
 
   DEFVAR_LISP ("ldap-default-base", &Vldap_default_base /*
@@ -450,6 +592,6 @@
 Acme organization in the United States.
 */ );
 
-  Vldap_default_host =  Qnil;
-  Vldap_default_base =  Qnil;
 }
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/eldap.h	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,75 @@
+/* Definitions for the LDAP client interface for XEmacs.
+   Copyright (C) 1998 Free Software Foundation, Inc.
+
+This file is part of XEmacs.
+
+XEmacs 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.
+
+XEmacs is distributed in the hope that it will be useful, 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.
+
+You should have received a copy of the GNU General Public License
+along with XEmacs; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+#ifndef _XEMACS_ELDAP_H_
+#define _XEMACS_ELDAP_H_
+
+#ifndef HAVE_LDAP
+#undef XLDAP
+#undef XSETLDAP
+#define LDAPP(x) 0
+#undef CHECK_LDAP
+
+#else /* HAVE_LDAP */
+
+extern Lisp_Object Qopen, Qclosed;
+
+struct Lisp_LDAP;
+
+DECLARE_LRECORD (ldap, struct Lisp_LDAP);
+#define XLDAP(x) XRECORD (x, ldap, struct Lisp_LDAP)
+#define XSETLDAP(x, p) XSETRECORD (x, p, ldap)
+#define LDAPP(x) RECORDP (x, ldap)
+#define GC_LDAPP(x) GC_RECORDP (x, ldap)
+#define CHECK_LDAP(x) CHECK_RECORD (x, ldap)
+#define LDAP_LIVE_P(x) (EQ (x->status_symbol, Qopen))
+
+#define CHECK_LIVE_LDAP(ldap) do {                                       \
+  CHECK_LDAP (ldap);                                                     \
+  if (!LDAP_LIVE_P (XLDAP (ldap)))                                       \
+    signal_simple_error ("Attempting to access closed LDAP connection",  \
+                         ldap);                                          \
+} while (0)
+  
+  
+
+
+#ifdef emacs
+
+Lisp_Object Fldapp (Lisp_Object object);
+Lisp_Object Fldap_host (Lisp_Object ldap);
+Lisp_Object Fldap_status (Lisp_Object ldap);
+Lisp_Object Fldap_open (Lisp_Object host,
+                        Lisp_Object ldap_plist);
+Lisp_Object Fldap_close (Lisp_Object ldap);
+Lisp_Object Fldap_search_internal (Lisp_Object ldap,
+                                   Lisp_Object filter,
+                                   Lisp_Object base,
+                                   Lisp_Object scope,
+                                   Lisp_Object attrs,
+                                   Lisp_Object attrsonly);
+
+#endif /* emacs */
+
+
+#endif
+
+
+#endif /* _XEMACS_ELDAP_H_ */
--- a/src/emacs.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/emacs.c	Mon Aug 13 10:30:37 2007 +0200
@@ -126,9 +126,9 @@
 Lisp_Object Vinstallation_directory;
 #endif
 
-Lisp_Object Vexec_path, Vconfigure_exec_path;
-Lisp_Object Vexec_directory;
-Lisp_Object Vconfigure_lisp_directory;
+Lisp_Object Vexec_path;
+Lisp_Object Vexec_directory, Vconfigure_exec_directory;
+Lisp_Object Vlisp_directory, Vconfigure_lisp_directory;
 Lisp_Object Vconfigure_package_path;
 Lisp_Object Vdata_directory, Vconfigure_data_directory;
 Lisp_Object Vdoc_directory, Vconfigure_doc_directory;
@@ -137,6 +137,7 @@
 Lisp_Object Vinfo_directory, Vconfigure_info_directory;
 Lisp_Object Vsite_directory, Vconfigure_site_directory;
 Lisp_Object Vconfigure_info_path;
+Lisp_Object Vinternal_error_checking;
 
 /* The default base directory XEmacs is installed under. */
 Lisp_Object Vconfigure_prefix_directory;
@@ -189,14 +190,14 @@
 /* Nonzero means don't perform site-lisp searches at startup */
 int inhibit_site_lisp;
 
-/* Nonzero means don't perform package searches at startup */
-int inhibit_package_init;
-
-/* Nonzero means don't reload changed dumped lisp files at startup */
-int inhibit_update_dumped_lisp;
-
-/* Nonzero means don't reload changed or new auto-autoloads files at startup */
-int inhibit_update_autoloads;
+/* Nonzero means don't respect early packages at startup */
+int inhibit_early_packages;
+
+/* Nonzero means don't load package autoloads at startup */
+int inhibit_autoloads;
+
+/* Nonzero means print debug information about path searching */
+int debug_paths;
 
 /* Save argv and argc.  */
 char **initial_argv;
@@ -671,25 +672,28 @@
   if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
     {
 #if 0 /* I don't think this is correct. */
-      inhibit_update_autoloads = 1;
-      inhibit_update_dumped_lisp = 1;
+      inhibit_autoloads = 1;
 #endif
       noninteractive = 1;
     }
 
-  /* Partially handle -no-autoloads, -no-packages and -vanilla.  Packages */
+  if (argmatch (argv, argc, "-debug-paths", "--debug-paths",
+		11, NULL, &skip_args))
+      debug_paths = 1;
+
+  /* Partially handle -no-autoloads, -no-early-packages and -vanilla.  Packages */
   /* are searched prior to the rest of the command line being parsed in */
   /* startup.el */
-  if (argmatch (argv, argc, "-no-packages", "--no-packages",
+  if (argmatch (argv, argc, "-no-early-packages", "--no-early-packages",
 		6, NULL, &skip_args))
     {
-      inhibit_package_init = 1;
+      inhibit_early_packages = 1;
       skip_args--;
     }
   if (argmatch (argv, argc, "-vanilla", "--vanilla",
 		7, NULL, &skip_args))
     {
-      inhibit_package_init = 1;
+      inhibit_early_packages = 1;
       skip_args--;
     }
 
@@ -697,9 +701,14 @@
 		7, NULL, &skip_args))
     {
       /* Inhibit everything */
-      inhibit_package_init = 1;
-      inhibit_update_autoloads = 1;
-      inhibit_update_dumped_lisp = 1;
+      inhibit_autoloads = 1;
+      skip_args--;
+    }
+
+  if (argmatch (argv, argc, "-debug-paths", "--debug-paths",
+		6, NULL, &skip_args))
+    {
+      debug_paths = 1;
       skip_args--;
     }
 
@@ -967,6 +976,9 @@
 #ifdef HAVE_MENUBARS
       syms_of_menubar_mswindows ();
 #endif
+#ifdef HAVE_SCROLLBARS
+      syms_of_scrollbar_mswindows ();
+#endif
 #ifdef HAVE_MSW_C_DIRED
       syms_of_dired_mswindows ();
 #endif
@@ -1080,6 +1092,9 @@
 #ifdef HAVE_MENUBARS
       console_type_create_menubar_mswindows ();
 #endif
+#ifdef HAVE_TOOLBARS
+      console_type_create_toolbar_mswindows ();
+#endif
 #endif
 
       /* Now initialize the specifier types and associated symbols.
@@ -1147,7 +1162,6 @@
 #ifdef FILE_CODING
       lstream_type_create_mule_coding ();
 #endif
-      lstream_type_create_print ();
 #ifdef HAVE_MS_WINDOWS
       lstream_type_create_mswindows_selectable ();
 #endif
@@ -1672,6 +1686,7 @@
   { "-t", "--terminal", 95, 1 },
   { "-nw", "--no-windows", 90, 0 },
   { "-batch", "--batch", 85, 0 },
+  { "-debug-paths", "--debug-paths", 82, 0 },
   { "-help", "--help", 80, 0 },
   { "-version", "--version", 75, 0 },
   { "-V", 0, 75, 0 },
@@ -1687,10 +1702,11 @@
   { "-vanilla", "--vanilla", 50, 0 },
   { "-no-autoloads", "--no-autoloads", 50, 0 },
   { "-no-site-file", "--no-site-file", 40, 0 },
-  { "-no-packages", "--no-packages", 35, 0 },
+  { "-no-early-packages", "--no-early-packages", 35, 0 },
   { "-u", "--user", 30, 1 },
   { "-user", 0, 30, 1 },
   { "-debug-init", "--debug-init", 20, 0 },
+  { "-debug-paths", "--debug-paths", 20, 0 },
 
   /* Xt options: */
   { "-i", "--icon-type", 15, 0 },
@@ -2450,8 +2466,7 @@
     {
       p = strchr (path, SEPCHAR);
       if (!p) p = path + strlen (path);
-      lpath = Fcons (Ffile_name_as_directory(make_string ((CONST Bufbyte *) path,
-							  p - path)),
+      lpath = Fcons (make_string ((CONST Bufbyte *) path, p - path),
 		     lpath);
       if (*p)
 	path = p + 1;
@@ -2665,8 +2680,16 @@
 Non-nil means XEmacs is running without interactive terminal.
 */ );
 
-  DEFVAR_BOOL ("inhibit-package-init", &inhibit_package_init /*
-Set to non-nil when the package-path should not be searched at startup.
+  DEFVAR_BOOL ("inhibit-early-packages", &inhibit_early_packages /*
+Set to non-nil when the early packages should not be respected at startup.
+*/ );
+
+  DEFVAR_BOOL ("inhibit-autoloads", &inhibit_autoloads /*
+Set to non-nil when autoloads should not be loaded at startup.
+*/ );
+
+  DEFVAR_BOOL ("debug-paths", &debug_paths /*
+Set to non-nil when debug information about paths should be printed.
 */ );
 
   DEFVAR_BOOL ("inhibit-site-lisp", &inhibit_site_lisp /*
@@ -2676,16 +2699,6 @@
   inhibit_site_lisp = 1;
 #endif
 
-  DEFVAR_BOOL ("inhibit-update-dumped-lisp", &inhibit_update_dumped_lisp /*
-Set to non-nil when modified dumped lisp should not be reloaded at startup.
-*/ );
-  inhibit_update_dumped_lisp = 1;
-
-  DEFVAR_BOOL ("inhibit-update-autoloads", &inhibit_update_autoloads /*
-Set to non-nil when modified or new autoloads files should not be reloaded.
-*/ );
-  inhibit_update_autoloads = 0;
-
   DEFVAR_INT ("emacs-priority", &emacs_priority /*
 Priority for XEmacs to run at.
 This value is effective only if set before XEmacs is dumped,
@@ -2696,6 +2709,39 @@
 */ );
   emacs_priority = 0;
 
+  DEFVAR_CONST_LISP ("internal-error-checking", &Vinternal_error_checking /*
+Internal error checking built-in into this instance of XEmacs.
+This is a list of symbols, initialized at build-time.  Legal symbols
+are:
+
+extents		- check extents prior to each extent change;
+typecheck	- check types strictly, aborting in case of error;
+malloc		- check operation of malloc;
+gc		- check garbage collection;
+bufpos		- check buffer positions.
+*/ );
+  Vinternal_error_checking = Qnil;
+#ifdef ERROR_CHECK_EXTENTS
+  Vinternal_error_checking = Fcons (intern ("extents"),
+				    Vinternal_error_checking);
+#endif
+#ifdef ERROR_CHECK_TYPECHECK
+  Vinternal_error_checking = Fcons (intern ("typecheck"),
+				    Vinternal_error_checking);
+#endif
+#ifdef ERROR_CHECK_MALLOC
+  Vinternal_error_checking = Fcons (intern ("malloc"),
+				    Vinternal_error_checking);
+#endif
+#ifdef ERROR_CHECK_GC
+  Vinternal_error_checking = Fcons (intern ("gc"),
+				    Vinternal_error_checking);
+#endif
+#ifdef ERROR_CHECK_BUFPOS
+  Vinternal_error_checking = Fcons (intern ("bufpos"),
+				    Vinternal_error_checking);
+#endif
+  Vinternal_error_checking = Fpurecopy (Vinternal_error_checking);
 }
 
 void
@@ -2707,24 +2753,31 @@
 */ );
   Vexec_path = Qnil;
 
-  DEFVAR_LISP ("configure-exec-path", &Vconfigure_exec_path /*
-For internal use by the build procedure only.
-configure's idea of what EXEC-PATH will be.
-*/ );
-#ifdef PATH_EXEC
-  Vconfigure_exec_path = decode_path (PATH_EXEC);
-#else
-  Vconfigure_exec_path = Qnil;
-#endif
-
   DEFVAR_LISP ("exec-directory", &Vexec_directory /*
 *Directory of architecture-dependent files that come with XEmacs,
 especially executable programs intended for XEmacs to invoke.
 */ );
   Vexec_directory = Qnil;
 
+  DEFVAR_LISP ("configure-exec-directory", &Vconfigure_exec_directory /*
+For internal use by the build procedure only.
+configure's idea of what EXEC-DIRECTORY will be.
+*/ );
+#ifdef PATH_EXEC
+  Vconfigure_exec_directory = Ffile_name_as_directory
+    (build_string ((char *) PATH_EXEC));
+#else
+  Vconfigure_exec_directory = Qnil;
+#endif
+
+  DEFVAR_LISP ("lisp-directory", &Vlisp_directory /*
+*Directory of core Lisp files that come with XEmacs.
+*/ );
+  Vlisp_directory = Qnil;
+
   DEFVAR_LISP ("configure-lisp-directory", &Vconfigure_lisp_directory /*
-Directory of core Lisp files that come with XEmacs.
+For internal use by the build procedure only.
+configure's idea of what LISP-DIRECTORY will be.
 */ );
 #ifdef PATH_LOADSEARCH
   Vconfigure_lisp_directory = Ffile_name_as_directory
@@ -2781,6 +2834,11 @@
 #endif
 #endif /* CLASH_DETECTION */
 
+  DEFVAR_LISP ("site-directory", &Vsite_directory /*
+*Directory of site-specific Lisp files that come with XEmacs.
+*/ );
+  Vsite_directory = Qnil;
+
   DEFVAR_LISP ("configure-site-directory", &Vconfigure_site_directory /*
 For internal use by the build procedure only.
 configure's idea of what SITE-DIRECTORY will be.
--- a/src/event-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/event-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -54,7 +54,7 @@
 #include "systime.h"
 
 #include "events-mod.h"
-
+#include <io.h>
 #include <errno.h>
 
 #ifdef BROKEN_CYGWIN
@@ -141,9 +141,19 @@
 #define NTPIPE_SLURP_STREAM_DATA(stream) \
   LSTREAM_TYPE_DATA (stream, ntpipe_slurp)
 
-struct ntpipe_slurp_stream
+/* This structure is allocated by the main thread, and is deallocated
+   in the thread upon exit.  There are situations when a thread
+   remains blocked for a long time, much longer than the lstream
+   exists. For exmaple, "start notepad" command is issued from the
+   shell, then the shell is closed by C-c C-d. Although the shell
+   process exits, its output pipe will not get closed until the
+   notepad process exits also, because it inherits the pipe form the
+   shell. In this case, we abandon the thread, and let it live until
+   all such processes exit. While struct ntpipe_slurp_stream is
+   deallocated in this case, ntpipe_slurp_stream_shared_data are not. */
+
+struct ntpipe_slurp_stream_shared_data
 {
-  LPARAM user_data;	/* Any user data stored in the stream object	 */
   HANDLE hev_thread;	/* Our thread blocks on this, signaled by caller */
 			/* This is a manual-reset object. 		 */
   HANDLE hev_caller;	/* Caller blocks on this, and we signal it	 */
@@ -151,20 +161,62 @@
   HANDLE hev_unsleep;	/* Pipe read delay is canceled if this is set	 */
 			/* This is a manual-reset object. 		 */
   HANDLE hpipe;		/* Pipe read end handle.			 */
-  HANDLE hthread;	/* Reader thread handle.			 */
-  BYTE   onebyte;	/* One byte buffer read by thread		 */
-  DWORD  die_p;		/* Thread must exit ASAP if non-zero		 */
+  LONG   die_p;		/* Thread must exit ASAP if non-zero		 */
   BOOL   eof_p   : 1;	/* Set when thread saw EOF			 */
   BOOL   error_p : 1;   /* Read error other than EOF/broken pipe	 */
+  BOOL	 inuse_p : 1;	/* this structure is in use			 */
+  LONG   lock_count;    /* Client count of this struct, 0=safe to free   */
+  BYTE   onebyte;	/* One byte buffer read by thread		 */
+};
+
+#define MAX_SLURP_STREAMS 32
+struct ntpipe_slurp_stream_shared_data 
+shared_data_block[MAX_SLURP_STREAMS]={0};
+
+struct ntpipe_slurp_stream
+{
+  LPARAM user_data;	/* Any user data stored in the stream object	 */
+  struct ntpipe_slurp_stream_shared_data* thread_data;
 };
 
 DEFINE_LSTREAM_IMPLEMENTATION ("ntpipe-input", lstream_ntpipe_slurp,
 			       sizeof (struct ntpipe_slurp_stream));
 
+/* This function is thread-safe, and is called from either thread
+   context. It serializes freeing shared dtata structure */
+static void
+slurper_free_shared_data_maybe (struct ntpipe_slurp_stream_shared_data* s)
+{
+  if (InterlockedDecrement (&s->lock_count) == 0)
+    {
+      /* Destroy events */
+      CloseHandle (s->hev_thread);
+      CloseHandle (s->hev_caller);
+      CloseHandle (s->hev_unsleep);
+      s->inuse_p = 0;
+    }
+}
+
+static struct ntpipe_slurp_stream_shared_data*
+slurper_allocate_shared_data()
+{
+  int i=0;
+  for (i=0; i<MAX_SLURP_STREAMS; i++)
+    {
+      if (!shared_data_block[i].inuse_p)
+	{
+	  shared_data_block[i].inuse_p=1;
+	  return &shared_data_block[i];
+	}
+    }
+  return (struct ntpipe_slurp_stream_shared_data*)0;
+}
+
 static DWORD WINAPI
 slurp_thread (LPVOID vparam)
 {
-  struct ntpipe_slurp_stream *s = (struct ntpipe_slurp_stream*)vparam;
+  struct ntpipe_slurp_stream_shared_data *s =
+    (struct ntpipe_slurp_stream_shared_data*)vparam;
 
   for (;;)
     {
@@ -192,7 +244,7 @@
 	 error/eof indication. Before we do, allow internal pipe
 	 buffer to accumulate little bit more data. 
 	 Reader function pulses this event before waiting for
-	 a character, to avoid pipde delay, and to get the byte
+	 a character, to avoid pipe delay, and to get the byte
 	 immediately. */
       if (!s->die_p)
 	WaitForSingleObject (s->hev_unsleep, PIPE_READ_DELAY);
@@ -210,6 +262,8 @@
       WaitForSingleObject (s->hev_thread, INFINITE);
     }
 
+  slurper_free_shared_data_maybe (s);
+
   return 0;
 }
 
@@ -220,35 +274,43 @@
   Lstream *lstr = Lstream_new (lstream_ntpipe_slurp, "r");
   struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA (lstr);
   DWORD thread_id_unused;
+  HANDLE hthread;
 
   /* We deal only with pipes, for we're using PeekNamedPipe api */
   assert (GetFileType (hpipe) == FILE_TYPE_PIPE);
 
-  s->die_p = 0;
-  s->eof_p = FALSE;
-  s->error_p = FALSE;
-  s->hpipe = hpipe;
-  s->user_data = param;
+  s->thread_data = slurper_allocate_shared_data();
 
-  /* Create reader thread. This could fail, so do not 
-     create events until thread is created */
-  s->hthread = CreateThread (NULL, 0, slurp_thread, (LPVOID)s,
-			     CREATE_SUSPENDED, &thread_id_unused);
-  if (s->hthread == NULL)
+  /* Create reader thread. This could fail, so do not create events
+     until thread is created */
+  hthread = CreateThread (NULL, 0, slurp_thread, (LPVOID)s->thread_data,
+			  CREATE_SUSPENDED, &thread_id_unused);
+  if (hthread == NULL)
     {
       Lstream_delete (lstr);
+      s->thread_data->inuse_p=0;
       return Qnil;
     }
 
+  /* Shared data are initially owned by both main and slurper
+     threads. */
+  s->thread_data->lock_count = 2;
+  s->thread_data->die_p = 0;
+  s->thread_data->eof_p = FALSE;
+  s->thread_data->error_p = FALSE;
+  s->thread_data->hpipe = hpipe;
+  s->user_data = param;
+
   /* hev_thread is a manual-reset event, initially signaled */
-  s->hev_thread = CreateEvent (NULL, TRUE, TRUE, NULL);
+  s->thread_data->hev_thread = CreateEvent (NULL, TRUE, TRUE, NULL);
   /* hev_caller is a manual-reset event, initially nonsignaled */
-  s->hev_caller = CreateEvent (NULL, TRUE, FALSE, NULL);
+  s->thread_data->hev_caller = CreateEvent (NULL, TRUE, FALSE, NULL);
   /* hev_unsleep is a manual-reset event, initially nonsignaled */
-  s->hev_unsleep = CreateEvent (NULL, TRUE, FALSE, NULL);
+  s->thread_data->hev_unsleep = CreateEvent (NULL, TRUE, FALSE, NULL);
 
   /* Now let it go */
-  ResumeThread (s->hthread);
+  ResumeThread (hthread);
+  CloseHandle (hthread);
 
   lstr->flags |= LSTREAM_FL_CLOSE_AT_DISKSAVE;
   XSETLSTREAM (obj, lstr);
@@ -266,23 +328,25 @@
 get_ntpipe_input_stream_waitable (Lstream *stream)
 {
   struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA(stream);
-  return s->hev_caller;
+  return s->thread_data->hev_caller;
 }
 
 static int 
 ntpipe_slurp_reader (Lstream *stream, unsigned char *data, size_t size)
 {
   /* This function must be called from the main thread only */
-  struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA(stream);
+  struct ntpipe_slurp_stream_shared_data* s = 
+    NTPIPE_SLURP_STREAM_DATA(stream)->thread_data;
 
   if (!s->die_p)
     {
       DWORD wait_result;
-      /* Disallow pipe read delay for the thread: we need a character ASAP */
+      /* Disallow pipe read delay for the thread: we need a character
+         ASAP */
       SetEvent (s->hev_unsleep);
   
-      /* Check if we have a character ready. Give it a short delay, for
-	 the thread to awake from pipe delay, just ion case*/
+      /* Check if we have a character ready. Give it a short delay,
+	 for the thread to awake from pipe delay, just ion case*/
       wait_result = WaitForSingleObject (s->hev_caller, 2);
 
       /* Revert to the normal sleep behavior. */
@@ -308,59 +372,54 @@
   if (s->error_p || s->die_p)
     return -1;
 
-  /* Ok, there were no error neither eof - we've got a byte from the pipe */
+  /* Ok, there were no error neither eof - we've got a byte from the
+     pipe */
   *(data++) = s->onebyte;
   --size;
 
-  if (size > 0)
-    {
-      DWORD bytes_available, bytes_read;
+  {
+    DWORD bytes_read = 0;
+    if (size > 0)
+      {
+	DWORD bytes_available;
 
-      /* If the api call fails, return at least one byte already read.
-	 ReadFile in thread will return error */
-      if (!PeekNamedPipe (s->hpipe, NULL, 0, NULL, &bytes_available, NULL))
-	return 1;
+	/* If the api call fails, return at least one byte already
+	   read.  ReadFile in thread will return error */
+	if (PeekNamedPipe (s->hpipe, NULL, 0, NULL, &bytes_available, NULL))
+	  {
 
-      /* Fetch available bytes. The same consideration applies, so do
-         not check for errors. ReadFile in the thread will fail if the
-         next call fails. */
-      ReadFile (s->hpipe, data, min (bytes_available, size), &bytes_read, NULL);
-
-      /* Now we can unblock thread, so it attempts to read more */
-      SetEvent (s->hev_thread);
-      return bytes_read + 1;
-    }
-  else
-    {
-      SetEvent (s->hev_thread);
-      return 1;
-    }
+	    /* Fetch available bytes. The same consideration applies,
+	       so do not check for errors. ReadFile in the thread will
+	       fail if the next call fails. */
+	    if (bytes_available)
+	      ReadFile (s->hpipe, data, min (bytes_available, size),
+			&bytes_read, NULL);
+	  }
+      
+	/* Now we can unblock thread, so it attempts to read more */
+	SetEvent (s->hev_thread);
+	return bytes_read + 1;
+      }
+  }
 }
 
 static int 
 ntpipe_slurp_closer (Lstream *stream)
 {
   /* This function must be called from the main thread only */
-  struct ntpipe_slurp_stream* s = NTPIPE_SLURP_STREAM_DATA(stream);
+  struct ntpipe_slurp_stream_shared_data* s = 
+    NTPIPE_SLURP_STREAM_DATA(stream)->thread_data;
 
   /* Force thread to stop */
   InterlockedIncrement (&s->die_p);
 
-  /* Break the pipe, in case the thread still blocked on read */
-  CloseHandle (s->hpipe);
-
-  /* Set events which could possibly block slurper */
+  /* Set events which could possibly block slurper. Let it finish soon
+     or later. */
   SetEvent (s->hev_unsleep);
   SetEvent (s->hev_thread);
 
-  /* Wait while thread terminates */
-  WaitForSingleObject (s->hthread, INFINITE);
-  CloseHandle (s->hthread);
-
-  /* Destroy events */
-  CloseHandle (s->hev_thread);
-  CloseHandle (s->hev_caller);
-  CloseHandle (s->hev_unsleep);
+  /* Unlock and maybe free shared data */
+  slurper_free_shared_data_maybe (s);
 
   return 0;
 }
@@ -381,6 +440,8 @@
 #define NTPIPE_SHOVE_STREAM_DATA(stream) \
   LSTREAM_TYPE_DATA (stream, ntpipe_shove)
 
+#define MAX_SHOVE_BUFFER_SIZE 128
+     
 struct ntpipe_shove_stream
 {
   LPARAM user_data;	/* Any user data stored in the stream object	 */
@@ -388,10 +449,10 @@
 			/* This is an auto-reset object. 		 */
   HANDLE hpipe;		/* Pipe write end handle.			 */
   HANDLE hthread;	/* Reader thread handle.			 */
-  LPVOID buffer;	/* Buffer being written				 */
+  char	 buffer[MAX_SHOVE_BUFFER_SIZE];	/* Buffer being written		 */
   DWORD  size;		/* Number of bytes to write			 */
-  DWORD  die_p;		/* Thread must exit ASAP if non-zero		 */
-  DWORD  idle_p;	/* Non-zero if thread is waiting for job	 */
+  LONG   die_p;		/* Thread must exit ASAP if non-zero		 */
+  LONG   idle_p;	/* Non-zero if thread is waiting for job	 */
   BOOL   error_p : 1;   /* Read error other than EOF/broken pipe	 */
   BOOL   blocking_p : 1;/* Last write attempt would cause blocking	 */
 };
@@ -423,9 +484,6 @@
 	  InterlockedIncrement (&s->die_p);
 	}
 
-      /* free it */
-      LocalFree ((HLOCAL)s->buffer);
-
       if (s->die_p)
 	break;
     }
@@ -486,11 +544,9 @@
   if (s->blocking_p)
     return 0;
 
-  /* Make a copy of data to be written. We intentionally avoid using
-     xalloc/xfree, because gnu malloc is not thread-safe */
-  s->buffer = (LPVOID) LocalAlloc (LMEM_FIXED, size);
-  if (s->buffer == NULL)
-    return -1;
+  if (size>MAX_SHOVE_BUFFER_SIZE)
+    return 0;
+
   memcpy (s->buffer, data, size);
   s->size = size;
 
@@ -577,7 +633,7 @@
 /* 
  * Add an emacs event to the proper dispatch queue
  */
-void
+static void
 mswindows_enqueue_dispatch_event (Lisp_Object event)
 {
   int user_p = mswindows_user_event_p (XEVENT(event));
@@ -587,12 +643,23 @@
 		 user_p ? &mswindows_u_dispatch_event_queue_tail :
 		 	&mswindows_s_dispatch_event_queue_tail);
 
-  /* This one does not go to window procedure, hence does not
-     generate XM_BUMPQUEUE magic event! */
+  /* Avoid blocking on WaitMessage */
   PostMessage (NULL, XM_BUMPQUEUE, 0, 0);
 }
 
 void
+mswindows_bump_queue (void)
+{
+  /* Bump queue, by putting in an empty event */
+  Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
+  struct Lisp_Event* event = XEVENT (emacs_event);
+
+  event->event_type = empty_event;
+
+  mswindows_enqueue_dispatch_event (emacs_event);
+}
+
+static void
 mswindows_enqueue_magic_event (HWND hwnd, UINT message)
 {
   Lisp_Object emacs_event = Fmake_event (Qnil, Qnil);
@@ -915,8 +982,6 @@
   return result;
 }
 
-
-
 static void 
 mswindows_drain_windows_queue ()
 {
@@ -1031,10 +1096,12 @@
 	    /* None. This means that the process handle itself has signaled.
 	       Remove the handle from the wait vector, and make status_ntoify
 	       note the exited process */
-	    CloseHandle (mswindows_waitable_handles[ix]);
 	    mswindows_waitable_handles [ix] =
 	      mswindows_waitable_handles [--mswindows_waitable_count];
 	    kick_status_notify ();
+	    /* Have to return something: there may be no accompanying
+	       process event */
+	    mswindows_bump_queue ();
 	  }
       }
   } /* while */
@@ -1187,7 +1254,7 @@
   case WM_CLOSE:
     fobj = mswindows_find_frame (hwnd);
     enqueue_misc_user_event (fobj, Qeval, list3 (Qdelete_frame, fobj, Qt));
-    mswindows_enqueue_magic_event (hwnd, XM_BUMPQUEUE);
+    mswindows_bump_queue ();
     break;
 
   case WM_KEYDOWN:
@@ -1611,7 +1678,7 @@
     msframe  = FRAME_MSWINDOWS_DATA (XFRAME (mswindows_find_frame (hwnd)));
     msframe->sizing = 0;
     /* Queue noop event */
-    mswindows_enqueue_magic_event (hwnd, XM_BUMPQUEUE);
+    mswindows_bump_queue ();
     return 0;
 
 #ifdef HAVE_SCROLLBARS
@@ -1654,12 +1721,6 @@
       }
     break;
 
-  case WM_EXITMENULOOP:
-    if (UNBOUNDP (mswindows_handle_wm_exitmenuloop (
-			XFRAME (mswindows_find_frame (hwnd)))))
-      SendMessage (hwnd, WM_CANCELMODE, 0, 0);
-    break;
-
 #endif /* HAVE_MENUBARS */
 
   case WM_COMMAND:
@@ -1667,15 +1728,16 @@
       WORD id = LOWORD (wParam);
       frame = XFRAME (mswindows_find_frame (hwnd));
 
+#ifdef HAVE_TOOLBARS
+      if (!NILP (mswindows_handle_toolbar_wm_command (frame, id)))
+	break;
+#endif
+
 #ifdef HAVE_MENUBARS
       if (!NILP (mswindows_handle_wm_command (frame, id)))
 	break;
 #endif
 
-#ifdef HAVE_TOOLBARS
-      /* O Toolbar Implementor, this place may have something for you!;*/
-#endif
-
       /* Bite me - a spurious command. This cannot happen. */
       error ("XEMACS BUG: Cannot decode command message");
     }
@@ -1929,8 +1991,8 @@
       /* We are in progress of frame creation. Return the frame
 	 being created, as it still not remembered in the window
 	 extra storage. */
-      assert (!NILP (mswindows_frame_being_created));
-      return mswindows_frame_being_created;
+      assert (!NILP (Vmswindows_frame_being_created));
+      return Vmswindows_frame_being_created;
     }
   VOID_TO_LISP (f, l);
   return f;
@@ -2039,10 +2101,6 @@
     }
     break;
 
-  case XM_BUMPQUEUE:
-    /* This is a nice event, when we're in need to queue *something* */
-    break;
-
   case XM_MAPFRAME:
   case XM_UNMAPFRAME:
     {
@@ -2074,52 +2132,24 @@
   return get_ntpipe_input_stream_waitable (XLSTREAM (instr));
 }
 
-static HANDLE
-get_process_handle (struct Lisp_Process *p)
-{
-  /* #### The guess is that cygwin uses the same algorithm for
-     computing pids: negate if less than zero, '95 case */
-  Lisp_Object process, pid;
-  XSETPROCESS (process, p);
-  pid = Fprocess_id (process);
-  if (INTP (pid))
-    {
-      HANDLE hproc;
-      int ipid = XINT (pid);
-      if (ipid < 0)
-	ipid = -ipid;
-      hproc = OpenProcess (SYNCHRONIZE, FALSE, ipid);
-      /* #### This is WRONG! The process migh have ended before we got here. */
-      /* assert  (hproc != NULL); */
-      /* Instead, we fake "a signaled hadle", which will trigger
-	 immediately upon entering the message loop */
-      if (hproc = NULL)
-	hproc = CreateEvent (NULL, TRUE, TRUE, NULL);
-      return hproc;
-    }
-  else
-    return NULL;
-}
-
 static void
 emacs_mswindows_select_process (struct Lisp_Process *process)
 {
   HANDLE hev = get_process_input_waitable (process);
-  HANDLE hprocess;
 
   if (!add_waitable_handle (hev))
     error ("Too many active processes");
 
-  hprocess = get_process_handle (process);
-  if (hprocess)
-    {
-      if (!add_waitable_handle (hprocess))
-	{
-	  remove_waitable_handle (hev);
-	  CloseHandle (hprocess);
-	  error ("Too many active processes");
-	}
-    }
+#ifdef HAVE_WIN32_PROCESSES
+  {
+    HANDLE hprocess = get_nt_process_handle (process);
+    if (!add_waitable_handle (hprocess))
+      {
+	remove_waitable_handle (hev);
+	error ("Too many active processes");
+      }
+  }
+#endif
 }
 
 static void
@@ -2144,6 +2174,11 @@
 static void
 emacs_mswindows_quit_p (void)
 {
+  /* Quit cannot happen in modal loop: all program
+     input is dedicated to Windows. */
+  if (mswindows_in_modal_loop)
+    return;
+
   /* Drain windows queue. This sets up number of quit
      characters in in the queue */
   mswindows_drain_windows_queue ();
@@ -2191,8 +2226,10 @@
 #elif defined (HAVE_UNIX_PROCESSES)
   /* We are passed UNIX fds. This must be Cygwin.
      Fetch os handles */
-  hin = inhandle >= 0 ? get_osfhandle ((int)inhandle) : INVALID_HANDLE_VALUE;
-  hout = outhandle >= 0 ? get_sfhandle ((int)outhandle) : INVALID_HANDLE_VALUE;
+  hin = inhandle >= 0 ? (HANDLE)get_osfhandle ((int)inhandle) : INVALID_HANDLE_VALUE;
+  hout = outhandle >= 0 ? (HANDLE)get_osfhandle ((int)outhandle) : INVALID_HANDLE_VALUE;
+  fdi=(int)inhandle;
+  fdo=(int)outhandle;
 #else
 #error "So, WHICH kind of processes do you want?"
 #endif
@@ -2201,9 +2238,25 @@
 	       ? make_ntpipe_input_stream (hin, fdi)
 	       : Qnil);
 
+#ifdef HAVE_WIN32_PROCESSES
   *outstream = (hout != INVALID_HANDLE_VALUE
 		? make_ntpipe_output_stream (hout, fdo)
 		: Qnil);
+#elif defined (HAVE_UNIX_PROCESSES)
+  *outstream = (fdo >= 0
+		? make_filedesc_output_stream (fdo, 0, -1, LSTR_BLOCKED_OK)
+		: Qnil);
+
+#if defined(HAVE_UNIX_PROCESSES) && defined(HAVE_PTYS)
+  /* FLAGS is process->pty_flag for UNIX_PROCESSES */
+  if (flags && fdo >= 0)
+    {
+      Bufbyte eof_char = get_eof_char (fdo);
+      int pty_max_bytes = get_pty_max_bytes (fdo);
+      filedesc_stream_set_pty_flushing (XLSTREAM(*outstream), pty_max_bytes, eof_char);
+    }
+#endif
+#endif
 
   return (NILP (*instream) ? USID_ERROR
 	  : HANDLE_TO_USID (get_ntpipe_input_stream_waitable (XLSTREAM (*instream))));
@@ -2218,7 +2271,7 @@
   int in = (NILP(instream) ? -1
 	    : get_ntpipe_input_stream_param (XLSTREAM (instream)));
   int out = (NILP(outstream) ? -1
-	     : get_ntpipe_output_stream_param (XLSTREAM (outstream)));
+	     : filedesc_stream_fd (XLSTREAM (outstream)));
 
   if (in >= 0)
     close (in);
--- a/src/event-stream.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/event-stream.c	Mon Aug 13 10:30:37 2007 +0200
@@ -1328,7 +1328,7 @@
 extern int poll_for_quit_id;
 #endif
 
-#ifndef SIGCHLD
+#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)
 extern int poll_for_sigchld_id;
 #endif
 
@@ -1337,7 +1337,8 @@
 {
   /* This function can GC */
   Lisp_Object humpty, dumpty;
-#if (!defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT)) || !defined (SIGCHLD)
+#if ((!defined (SIGIO) && !defined (DONT_POLL_FOR_QUIT)) \
+     || defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD))
   int id =
 #endif
     event_stream_resignal_wakeup (interval_id, 1, &humpty, &dumpty);
@@ -1351,7 +1352,7 @@
     }
 #endif
 
-#if !defined (SIGCHLD)
+#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)
   if (id == poll_for_sigchld_id)
     {
       kick_status_notify ();
--- a/src/extents.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/extents.c	Mon Aug 13 10:30:37 2007 +0200
@@ -3231,17 +3231,13 @@
 
   assert (!NILP (obj) || extent_detached_p (extent));
 
-  if (NILP (obj) && (flags & DE_MUST_HAVE_BUFFER))
+  if ((NILP (obj) && (flags & DE_MUST_HAVE_BUFFER))
+      || (extent_detached_p (extent) && (flags & DE_MUST_BE_ATTACHED)))
     {
       signal_simple_error ("extent doesn't belong to a buffer or string",
 			   extent_obj);
     }
 
-  if (extent_detached_p (extent) && (flags & DE_MUST_BE_ATTACHED))
-    {
-      signal_simple_error ("extent cannot be detached", extent_obj);
-    }
-
   return extent;
 }
 
--- a/src/fileio.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/fileio.c	Mon Aug 13 10:30:37 2007 +0200
@@ -111,15 +111,6 @@
 
 Lisp_Object Qfile_name_handler_alist;
 
-/* Syncing with FSF 19.34.6 note: although labelled as NT-specific, these
-   two lisp variables are compiled in even when not defined(DOS_NT).
-   Need to check if we should bracket them between #ifdef's.
-   --marcpa */
-/* On NT, specifies the directory separator character, used (eg.) when
-   expanding file names.  This can be bound to / or \.
-
-   This needs to be initialized statically, because file name functions
-   are called during initialization.  */
 Lisp_Object Vdirectory_sep_char;
 
 /* These variables describe handlers that have "already" had a chance
@@ -533,15 +524,23 @@
 static char *
 file_name_as_directory (char *out, char *in)
 {
-  int size = strlen (in) - 1;
-
-  strcpy (out, in);
-
-  /* For Unix syntax, Append a slash if necessary */
-  if (!IS_ANY_SEP (out[size]))
+  int size = strlen (in);
+
+  if (size == 0)
     {
-      out[size + 1] = DIRECTORY_SEP;
-      out[size + 2] = '\0';
+      out[0] = '.';
+      out[1] = DIRECTORY_SEP;
+      out[2] = '\0';
+    }
+  else
+    {
+      strcpy (out, in);
+      /* Append a slash if necessary */
+      if (!IS_ANY_SEP (out[size-1]))
+	{
+	  out[size] = DIRECTORY_SEP;
+	  out[size + 1] = '\0';
+	}
     }
 #ifdef WINDOWSNT
   CORRECT_DIR_SEPS (out);
@@ -555,7 +554,8 @@
 a directory is different from its name as a file.
 The result can be used as the value of `default-directory'
 or passed as second argument to `expand-file-name'.
-For a Unix-syntax file name, just appends a slash.
+For a Unix-syntax file name, just appends a slash,
+except for (file-name-as-directory \"\") => \"./\".
 */
        (file))
 {
@@ -644,18 +644,11 @@
 
 /* Fmake_temp_name used to be a simple wrapper around mktemp(), but it
    proved too broken for our purposes (it supported only 26 or 62
-   unique names under some implementations).  For instance, the stupid
-   limit broke Gnus Incoming* files generation.
-
-   NB, this implementation is better than what one usually finds in
-   libc.  --hniksic */
-
-#define MTN_RANDOM(x) ((int) (random () % x))
-#define MTN_INC(var, limit) (var = ((var == (limit) - 1) ? 0 : (var + 1)))
-#define MTN_LOOP(var, limit, keep)				\
-for (keep = var = MTN_RANDOM (limit), MTN_INC (var, limit);	\
-     var != keep;						\
-     MTN_INC (var, limit))
+   unique names under some implementations).  For example, this
+   arbitrary limit broke generation of Gnus Incoming* files.
+
+   This implementation is better than what one usually finds in libc.
+   --hniksic */
 
 DEFUN ("make-temp-name", Fmake_temp_name, 1, 1, 0, /*
 Generate temporary file name starting with PREFIX.
@@ -677,13 +670,13 @@
     'g','h','i','j','k','l','m','n',
     'o','p','q','r','s','t','u','v',
     'w','x','y','z','0','1','2','3',
-    '4','5','6','7','8','9','-','_'
-  };
+    '4','5','6','7','8','9','-','_' };
+  static unsigned count, count_initialized_p;
+
   Lisp_Object val;
   Bytecount len;
-  int pid;
-  int i, j, k, keep1, keep2, keep3;
   Bufbyte *p, *data;
+  unsigned pid;
 
   CHECK_STRING (prefix);
 
@@ -698,8 +691,8 @@
      the code that uses (make-temp-name "") instead of
      (make-temp-name "./").
 
-     3) It might yield unexpected results in the presence of EFS and
-     file name handlers.  */
+     3) It might yield unexpected (to stat(2)) results in the presence
+     of EFS and file name handlers.  */
 
   len = XSTRING_LENGTH (prefix);
   val = make_uninit_string (len + 6);
@@ -712,51 +705,46 @@
      three are incremented if the file already exists.  This ensures
      262144 unique file names per PID per PREFIX.  */
 
-  pid = (int)getpid ();
+  pid = (unsigned)getpid ();
   *p++ = tbl[pid & 63], pid >>= 6;
   *p++ = tbl[pid & 63], pid >>= 6;
   *p++ = tbl[pid & 63], pid >>= 6;
 
-  /* Here we employ some trickery to minimize useless stat'ing when
-     this function is invoked many times successively with the same
-     PREFIX.  Instead of looping from 0 to 63, each of the variables
-     is assigned a random number less than 64, and is incremented up
-     to 63 and back to zero, until the initial value is reached again.
-
-     In other words, MTN_LOOP (i, 64, keep1) is equivalent to
-     for (i = 0; i < 64; i++) with the difference that the beginning
-     value needn't be 0 -- all that matters is that i is guaranteed to
-     loop through all the values in the [0, 64) range.  */
-  MTN_LOOP (i, 64, keep1)
+  /* Here we try to minimize useless stat'ing when this function is
+     invoked many times successively with the same PREFIX.  We achieve
+     this by initializing count to a random value, and incrementing it
+     afterwards.  */
+  if (!count_initialized_p)
     {
-      p[0] = tbl[i];
-      MTN_LOOP (j, 64, keep2)
+      count = (unsigned)time (NULL);
+      count_initialized_p = 1;
+    }
+
+  while (1)
+    {
+      struct stat ignored;
+      unsigned num = count++;
+
+      p[0] = tbl[num & 63], num >>= 6;
+      p[1] = tbl[num & 63], num >>= 6;
+      p[2] = tbl[num & 63], num >>= 6;
+
+      if (stat ((const char *) data, &ignored) < 0)
 	{
-	  p[1] = tbl[j];
-	  MTN_LOOP (k, 64, keep3)
-	    {
-	      struct stat ignored;
-	      p[2] = tbl[k];
-	      if (stat (data, &ignored) < 0)
-		{
-		  /* We want to return only if errno is ENOENT.  */
-		  if (errno == ENOENT)
-		    return val;
-		  else
-		    /* The error here is dubious, but there is little
-		       else we can do.  The alternatives are to return
-		       nil, which is as bad as (and in many cases
-		       worse than) throwing the error, or to ignore
-		       the error, which will likely result in looping
-		       through 262144 stat's, which is not only SLOW,
-		       but also useless since it will fallback to the
-		       errow below, anyway.  */
-		    report_file_error
-		      ("Cannot create temporary name for prefix",
-		       list1 (prefix));
-		  /* not reached */
-		}
-	    }
+	  /* We want to return only if errno is ENOENT.  */
+	  if (errno == ENOENT)
+	    return val;
+	  else
+	    /* The error here is dubious, but there is little else we
+	       can do.  The alternatives are to return nil, which is
+	       as bad as (and in many cases worse than) throwing the
+	       error, or to ignore the error, which will likely result
+	       in looping through 262144 stat's, which is not only
+	       dog-slow, but also useless since it will fallback to
+	       the errow below, anyway.  */
+	    report_file_error ("Cannot create temporary name for prefix",
+			       list1 (prefix));
+	  /* not reached */
 	}
     }
   signal_simple_error ("Cannot create temporary name for prefix", prefix);
@@ -1149,7 +1137,7 @@
       /* Get rid of any slash at the end of newdir, unless newdir is
 	 just // (an incomplete UNC name).  */
       length = strlen ((char *) newdir);
-      if (length > 0 && IS_DIRECTORY_SEP (newdir[length - 1])
+      if (length > 1 && IS_DIRECTORY_SEP (newdir[length - 1])
 #ifdef WINDOWSNT
 	  && !(length == 2 && IS_DIRECTORY_SEP (newdir[0]))
 #endif
@@ -3333,7 +3321,7 @@
        but who knows about all the other machines with NFS?)  */
     /* On VMS and APOLLO, must do the stat after the close
        since closing changes the modtime.  */
-#if 0 /* !defined (VMS) && !defined (APOLLO) */
+#if 1 /* !defined (VMS) && !defined (APOLLO) */
     fstat (desc, &st);
 #endif
 
@@ -3352,7 +3340,7 @@
   }
 
 
-#if 1 /* defined (VMS) || defined (APOLLO) */
+#if 0 /* defined (VMS) || defined (APOLLO) */
   stat ((char *) XSTRING_DATA (fn), &st);
 #endif
 
@@ -4313,5 +4301,5 @@
 on other platforms, it is initialized so that Lisp code can find out
 what the normal separator is.
 */ );
-  Vdirectory_sep_char = make_char('/');
+  Vdirectory_sep_char = make_char(DIRECTORY_SEP);
 }
--- a/src/fns.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/fns.c	Mon Aug 13 10:30:37 2007 +0200
@@ -884,7 +884,7 @@
 The resulting subsequence is always the same type as the original
  sequence.
 If SEQ is a string, relevant parts of the string-extent-data are copied
- in the new string.
+ to the new string.
 */
        (seq, from, to))
 {
@@ -900,10 +900,12 @@
     }
 
   len = XINT (Flength (seq));
+
   CHECK_INT (from);
   f = XINT (from);
   if (f < 0)
     f = len + f;
+
   if (NILP (to))
     t = len;
   else
@@ -929,7 +931,7 @@
       return result;
     }
 
-  if (CONSP (seq))
+  if (LISTP (seq))
     {
       Lisp_Object result = Qnil;
       int i;
@@ -3125,7 +3127,7 @@
 	{
 	  /* Found the first cons, which will be our return value.  */
 	  Lisp_Object last = val;
-	  
+
 	  for (argnum++; argnum < nargs; argnum++)
 	    {
 	      Lisp_Object next = args[argnum];
--- a/src/frame-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/frame-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -38,6 +38,7 @@
 #include "faces.h"
 #include "frame.h"
 #include "redisplay.h"
+#include "window.h"
 
 #define MSWINDOWS_FRAME_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_OVERLAPPEDWINDOW)
 #define MSWINDOWS_POPUP_STYLE (WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP \
@@ -68,7 +69,7 @@
 
 /* This does not need to be GC protected, as it holds a
    frame Lisp_Object already protected by Fmake_frame */
-Lisp_Object mswindows_frame_being_created;
+Lisp_Object Vmswindows_frame_being_created;
 
 /* Geometry, in characters, as specified by proplist during frame
    creation. Memebers are set to -1 for unspecified */
@@ -130,8 +131,11 @@
   FRAME_MSWINDOWS_DATA(f)->ignore_next_lbutton_up = 0;
   FRAME_MSWINDOWS_DATA(f)->ignore_next_rbutton_up = 0;
   FRAME_MSWINDOWS_DATA(f)->sizing = 0;
-
   FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
+#ifdef HAVE_TOOLBARS
+  FRAME_MSWINDOWS_TOOLBAR_HASHTABLE(f) = Fmake_hashtable (make_int (50), 
+							  Qequal);
+#endif
 
   /* Will initialize these in WM_SIZE handler. We cannot do it now,
      because we do not know what is CW_USEDEFAULT height and width */
@@ -175,7 +179,7 @@
 
   XSETFRAME (frame_obj, f);
 
-  mswindows_frame_being_created = frame_obj;
+  Vmswindows_frame_being_created = frame_obj;
 
   hwnd = CreateWindowEx (exstyle,
 			 XEMACS_CLASS,
@@ -186,7 +190,7 @@
 			 rect_default.width, rect_default.height,
 			 hwnd_parent, NULL, NULL, NULL);
 
-  mswindows_frame_being_created = Qnil;
+  Vmswindows_frame_being_created = Qnil;
 
   if (hwnd == NULL)
     error ("System call to create frame failed");
@@ -235,6 +239,9 @@
 mswindows_mark_frame (struct frame *f, void (*markobj) (Lisp_Object))
 {
   ((markobj) (FRAME_MSWINDOWS_MENU_HASHTABLE (f)));
+#ifdef HAVE_TOOLBARS
+  ((markobj) (FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f)));
+#endif
 }
 
 static void
@@ -304,6 +311,36 @@
 }
 
 static int
+mswindows_frame_totally_visible_p (struct frame *f)
+{
+  RECT rc_me, rc_other, rc_temp;
+  HWND hwnd = FRAME_MSWINDOWS_HANDLE(f);
+
+  /* We test against not a whole window rectangle, only agaist its
+     client part. So, if non-client are is covered and client area is
+     not, we return true. */
+  GetClientRect (hwnd, &rc_me);
+  MapWindowPoints (hwnd, HWND_DESKTOP, (LPPOINT)&rc_me, 2);
+
+  /* First see if we're off the desktop */
+  GetWindowRect (GetDesktopWindow(), &rc_other);
+  UnionRect(&rc_temp, &rc_me, &rc_other);
+  if (!EqualRect (&rc_temp, &rc_other))
+    return 0;
+  
+  /* Then see if any window above us obscures us */
+  while ((hwnd = GetWindow (hwnd, GW_HWNDPREV)) != NULL)
+    if (IsWindowVisible (hwnd))
+      {
+	GetWindowRect (hwnd, &rc_other);
+	if (IntersectRect(&rc_temp, &rc_me, &rc_other))
+	  return 0;
+      }
+
+  return 1;
+}
+
+static int
 mswindows_frame_visible_p (struct frame *f)
 {
   return IsWindowVisible (FRAME_MSWINDOWS_HANDLE(f))
@@ -333,16 +370,7 @@
     {
       if (!XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon))
 	{
-	  ICONINFO x_icon;
-
-	  x_icon.fIcon=TRUE;
-	  x_icon.xHotspot=XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X (f->icon);
-	  x_icon.yHotspot=XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (f->icon);
-	  x_icon.hbmMask=XIMAGE_INSTANCE_MSWINDOWS_BITMAP (f->icon);
-	  x_icon.hbmColor=XIMAGE_INSTANCE_MSWINDOWS_MASK (f->icon);
-
-	  XIMAGE_INSTANCE_MSWINDOWS_ICON (f->icon)=
-	    CreateIconIndirect (&x_icon);
+	  mswindows_create_icon_from_image(f->icon, f, 16);
 	}
       
       SetClassLong (FRAME_MSWINDOWS_HANDLE (f), GCL_HICON, 
@@ -361,6 +389,59 @@
 #endif
 }
 
+
+static void
+mswindows_set_mouse_position (struct window *w, int x, int y)
+{
+  struct frame *f = XFRAME (w->frame);
+  POINT pt;
+
+  pt.x = w->pixel_left + x;
+  pt.y = w->pixel_top  + y;
+  ClientToScreen (FRAME_MSWINDOWS_HANDLE(f), &pt);
+  SetCursorPos (pt.x, pt.y);
+}
+
+static int
+mswindows_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y)
+{
+  POINT pt;
+  HWND hwnd;
+
+  GetCursorPos (&pt);
+
+  /* What's under cursor? */
+  hwnd = WindowFromPoint (pt);
+  if (hwnd == NULL)
+    return 0;
+
+  /* Get grandest parent of the window */
+  {
+    HWND hwnd_parent;
+    while ((hwnd_parent = GetParent (hwnd)) != NULL)
+      hwnd = hwnd_parent;
+  }
+
+  /* Make sure it belongs to us */
+  if (GetWindowThreadProcessId (hwnd, NULL) != GetCurrentThreadId ())
+    return 0;
+
+  /* And that the window is an XEmacs frame */
+  {
+    char class_name [sizeof(XEMACS_CLASS) + 1];
+    if (!GetClassName (hwnd, class_name, sizeof(XEMACS_CLASS))
+	|| strcmp (class_name, XEMACS_CLASS) != 0)
+      return 0;
+  }
+
+  /* Yippie! */
+  ScreenToClient (hwnd, &pt);
+  VOID_TO_LISP (*frame, GetWindowLong (hwnd, XWL_FRAMEOBJ));
+  *x = pt.x;
+  *y = pt.y;
+  return 1;
+}
+
 static void
 mswindows_raise_frame (struct frame *f)
 {
@@ -589,8 +670,8 @@
   CONSOLE_HAS_METHOD (mswindows, mark_frame);
   CONSOLE_HAS_METHOD (mswindows, focus_on_frame);
   CONSOLE_HAS_METHOD (mswindows, delete_frame);
-/*  CONSOLE_HAS_METHOD (mswindows, get_mouse_position); */
-/*  CONSOLE_HAS_METHOD (mswindows, set_mouse_position); */
+  CONSOLE_HAS_METHOD (mswindows, get_mouse_position);
+  CONSOLE_HAS_METHOD (mswindows, set_mouse_position);
   CONSOLE_HAS_METHOD (mswindows, raise_frame);
   CONSOLE_HAS_METHOD (mswindows, lower_frame);
   CONSOLE_HAS_METHOD (mswindows, make_frame_visible);
@@ -605,7 +686,7 @@
   CONSOLE_HAS_METHOD (mswindows, set_title_from_bufbyte);
 /*  CONSOLE_HAS_METHOD (mswindows, set_icon_name_from_bufbyte); */
   CONSOLE_HAS_METHOD (mswindows, frame_visible_p);
-/*  CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p); */
+  CONSOLE_HAS_METHOD (mswindows, frame_totally_visible_p);
   CONSOLE_HAS_METHOD (mswindows, frame_iconified_p);
   CONSOLE_HAS_METHOD (mswindows, set_frame_pointer); 
   CONSOLE_HAS_METHOD (mswindows, set_frame_icon); 
@@ -621,8 +702,8 @@
 void
 vars_of_frame_mswindows (void)
 {
-  mswindows_frame_being_created = Qnil;
-  staticpro (&mswindows_frame_being_created);
+  /* Needn't staticpro -- see comment above.  */
+  Vmswindows_frame_being_created = Qnil;
 
   DEFVAR_LISP ("default-mswindows-frame-plist", &Vdefault_mswindows_frame_plist /*
 Plist of default frame-creation properties for mswindows frames.
--- a/src/glyphs-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/glyphs-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -38,10 +38,6 @@
 #include "faces.h"
 #include "imgproc.h"
 
-#ifdef HAVE_XPM
-#include <X11/xpm.h>
-#endif
-
 #ifdef FILE_CODING
 #include "file-coding.h"
 #endif
@@ -194,6 +190,7 @@
 locate_pixmap_file (Lisp_Object name)
 {
   /* This function can GC if IN_REDISPLAY is false */
+  Lisp_Object found;
 
   /* Check non-absolute pathnames with a directory component relative to
      the search path; that's the way Xt does it. */
@@ -209,23 +206,17 @@
 	return Qnil;
     }
 
-  if (!NILP (Vmswindows_bitmap_file_path))
-  {
-    Lisp_Object found;
-    if (locate_file (Vmswindows_bitmap_file_path, name, "", &found, R_OK) < 0)
-      {
-	Lisp_Object temp = list1 (Vdata_directory);
-	struct gcpro gcpro1;
+  if (locate_file (Vmswindows_bitmap_file_path, name, "", &found, R_OK) < 0)
+    {
+      Lisp_Object temp = list1 (Vdata_directory);
+      struct gcpro gcpro1;
 
-	GCPRO1 (temp);
-	locate_file (temp, name, "", &found, R_OK);
-	UNGCPRO;
-      }
+      GCPRO1 (temp);
+      locate_file (temp, name, "", &found, R_OK);
+      UNGCPRO;
+    }
     
-    return found;
-  }
-  else
-    return Qnil;
+  return found;
 }
 
 /* If INSTANTIATOR refers to inline data, return Qnil.
@@ -366,19 +357,129 @@
   IMAGE_INSTANCE_PIXMAP_DEPTH (ii) = bmp_info->bmiHeader.biBitCount;
 }
 
+void
+mswindows_create_icon_from_image(Lisp_Object image, struct frame* f, int size)
+{
+  HBITMAP mask, bmp;
+  HDC hcdc = FRAME_MSWINDOWS_CDC (f);
+  HDC hdcDst = CreateCompatibleDC (hcdc);  
+  ICONINFO x_icon;
+  
+  if (size!=16 && size!=32)
+    {
+      signal_simple_error("Icons must be 16x16 or 32x32", image);
+    }
+
+#if 0
+  iIconWidth = GetSystemMetrics(SM_CXICON);
+  iIconHeight = GetSystemMetrics(SM_CYICON);
+#endif
+
+  SelectObject(hcdc, XIMAGE_INSTANCE_MSWINDOWS_BITMAP (image)); 
+
+  bmp = CreateCompatibleBitmap(hcdc, size, size);
+  DeleteObject( SelectObject(hdcDst, bmp) );
+  
+  if (!StretchBlt(hdcDst, 0, 0, size, size,
+		  hcdc, 0, 0, 
+		  XIMAGE_INSTANCE_PIXMAP_WIDTH (image), 
+		  XIMAGE_INSTANCE_PIXMAP_HEIGHT (image), 
+		  SRCCOPY))
+    {
+      printf("StretchBlt failed\n");
+    }
+  
+  if (!(mask = CreateBitmap(size, size, 1, 1, NULL)))
+    {
+      printf("CreateBitmap() failed\n");
+    }
+  if (!SelectObject(hdcDst, mask)
+      ||
+      !SelectObject(hcdc, bmp))
+    {
+      printf("SelectObject() failed\n");
+    }
+  
+  if (!BitBlt(hdcDst, 0, 0, size, size,
+	     hcdc, 0, 0, 
+	     NOTSRCCOPY))
+    {
+      printf("BitBlt failed\n");
+    }
+
+  SelectObject(hdcDst, 0);
+  SelectObject(hcdc, 0);
+  /*   PatBlt(hdcDst, 0, 0, size, size, WHITENESS);*/
+  
+  x_icon.fIcon=TRUE;
+  x_icon.xHotspot=XIMAGE_INSTANCE_PIXMAP_HOTSPOT_X (image);
+  x_icon.yHotspot=XIMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (image);
+  x_icon.hbmMask=mask;
+  x_icon.hbmColor=bmp;
+  
+  XIMAGE_INSTANCE_MSWINDOWS_ICON (image)=
+    CreateIconIndirect (&x_icon);
+  XIMAGE_INSTANCE_MSWINDOWS_MASK (image)=mask;
+  
+  DeleteDC(hdcDst);
+}
+
+int
+mswindows_resize_dibitmap_instance (struct Lisp_Image_Instance* ii,
+				    struct frame* f,
+				    int newx, int newy)
+{
+  HBITMAP newbmp;
+  HDC hcdc = FRAME_MSWINDOWS_CDC (f);
+  HDC hdcDst = CreateCompatibleDC (hcdc);  
+  
+  SelectObject(hcdc, IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii)); 
+  
+  newbmp = CreateCompatibleBitmap(hcdc, newx, newy);
+
+  DeleteObject( SelectObject(hdcDst, newbmp) );
+  
+  if (!StretchBlt(hdcDst, 0, 0, newx, newy,
+		  hcdc, 0, 0, 
+		  IMAGE_INSTANCE_PIXMAP_WIDTH (ii), 
+		  IMAGE_INSTANCE_PIXMAP_HEIGHT (ii), 
+		  SRCCOPY))
+    {
+      return FALSE;
+    }
+  
+  SelectObject(hdcDst, 0);
+  SelectObject(hcdc, 0);
+  
+  if (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii))
+    DeleteObject (IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii));
+  if (IMAGE_INSTANCE_MSWINDOWS_MASK (ii))
+    DeleteObject (IMAGE_INSTANCE_MSWINDOWS_MASK (ii));
+
+  IMAGE_INSTANCE_MSWINDOWS_BITMAP (ii) = newbmp;
+  IMAGE_INSTANCE_MSWINDOWS_MASK (ii) = newbmp;
+  IMAGE_INSTANCE_PIXMAP_WIDTH (ii) = newx;
+  IMAGE_INSTANCE_PIXMAP_HEIGHT (ii) = newy;
+
+  DeleteDC(hdcDst);
+
+  return TRUE;
+}
+
 /**********************************************************************
  *                               XPM                                  *
  **********************************************************************/
 
 #ifdef HAVE_XPM
 static int xpm_to_eimage (Lisp_Object image, CONST Extbyte *buffer,
-			 unsigned char** data,
-			 int* width, int* height,
-			 COLORREF bg)
+			  unsigned char** data,
+			  int* width, int* height,
+			  int* x_hot, int* y_hot,
+			  COLORREF bg)
 {
   XpmImage xpmimage;
   XpmInfo xpminfo;
-  int result, i;
+  int result, i, transp_idx, maskbpline;
   unsigned char* dptr;
   unsigned int* sptr;
   COLORREF color; /* the american spelling virus hits again .. */
@@ -386,7 +487,8 @@
 
   xzero (xpmimage);
   xzero (xpminfo);
-  
+  xpminfo.valuemask=XpmHotspot;
+
   result = XpmCreateXpmImageFromBuffer ((char*)buffer,
 				       &xpmimage,
 				       &xpminfo);
@@ -413,8 +515,11 @@
   
   *width = xpmimage.width;
   *height = xpmimage.height;
+  maskbpline = (int)(~3UL & (unsigned long)
+		     (((~7UL & (unsigned long)(*width + 7)) / 8) + 3));
+  
+  *data = xnew_array_and_zero (unsigned char, *width * *height * 3);
 
-  *data = xnew_array_and_zero (unsigned char, *width * *height * 3);
   if (!*data)
     {
       XpmFreeXpmImage (&xpmimage);
@@ -437,7 +542,8 @@
 				/* pick up transparencies */
       if (!strcmp (xpmimage.colorTable[i].c_color,"None"))
 	{
-	  colortbl[i]=bg;
+	  colortbl[i]=bg; /* PALETTERGB(0,0,0); */
+	  transp_idx=i;
 	}
       else
 	{
@@ -459,12 +565,21 @@
       *dptr++=GetBValue (color); /* blue */
     }
 
+  *x_hot=xpminfo.x_hotspot;
+  *y_hot=xpminfo.y_hotspot;
+
   XpmFreeXpmImage (&xpmimage);
   XpmFreeXpmInfo (&xpminfo);
   xfree (colortbl);
   return TRUE;
 }
 
+Lisp_Object
+mswindows_xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
+{
+  return simple_image_type_normalize (inst, console_type, Qxpm);
+}
+
 void
 mswindows_xpm_instantiate (Lisp_Object image_instance,
 			   Lisp_Object instantiator,
@@ -476,7 +591,7 @@
   CONST Extbyte		*bytes;
   Extcount 		len;
   unsigned char		*eimage;
-  int			width, height;
+  int			width, height, x_hot, y_hot;
   BITMAPINFO*		bmp_info;
   unsigned char*	bmp_data;
   int			bmp_bits;
@@ -498,7 +613,7 @@
 
   /* convert to an eimage to make processing easier */
   if (!xpm_to_eimage (image_instance, bytes, &eimage, &width, &height,
-		     bkcolor))
+		      &x_hot, &y_hot, bkcolor))
     {
       signal_simple_error ("XPM to EImage conversion failed", 
 			   image_instance);
@@ -508,7 +623,6 @@
   if (!(bmp_info=EImage2DIBitmap (device, width, height, eimage,
 				 &bmp_bits, &bmp_data)))
     {
-      xfree (eimage);
       signal_simple_error ("XPM to EImage conversion failed",
 			   image_instance);
     }
@@ -518,6 +632,9 @@
   init_image_instance_from_dibitmap (ii, bmp_info, dest_mask,
 				     bmp_data, bmp_bits, instantiator);
 
+  XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii), x_hot);
+  XSETINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii), y_hot);
+  
   xfree (bmp_info);
   xfree (bmp_data);
 }
@@ -743,4 +860,3 @@
 complex_vars_of_glyphs_mswindows (void)
 {
 }
-
--- a/src/glyphs-x.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 10:30:37 2007 +0200
@@ -35,10 +35,10 @@
    Improved GIF/JPEG support added by Bill Perry for 19.14
    Cleanup/simplification of error handling by Ben Wing for 19.14
    Pointer/icon overhaul, more restructuring by Ben Wing for 19.14
-   GIF support changed to external GIFlib 3.1 by Jareth Hein for 20.5
-   Many changes for color work and optimizations by Jareth Hein for 20.5
-   Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 20.5
-   TIFF code by Jareth Hein for 20.5
+   GIF support changed to external GIFlib 3.1 by Jareth Hein for 21.0
+   Many changes for color work and optimizations by Jareth Hein for 21.0
+   Switch of GIF/JPEG/PNG to new EImage intermediate code by Jareth Hein for 21.0
+   TIFF code by Jareth Hein for 21.0
 
    TODO:
    Convert images.el to C and stick it in here?
@@ -95,13 +95,7 @@
 Lisp_Object Q_foreground, Q_background;
 
 #ifdef HAVE_XPM
-DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
-Lisp_Object Qxpm;
 Lisp_Object Q_color_symbols;
-void mswindows_xpm_instantiate (Lisp_Object image_instance, 
-				Lisp_Object instantiator,
-				Lisp_Object pointer_fg, Lisp_Object pointer_bg,
-				int dest_mask, Lisp_Object domain);
 #endif
 
 #ifdef HAVE_XFACE
@@ -149,19 +143,6 @@
 /************************************************************************/
 /*                      image instance methods                          */
 /************************************************************************/
-static DOESNT_RETURN
-signal_image_error (CONST char *reason, Lisp_Object frob)
-{
-  signal_error (Qimage_conversion_error,
-		list2 (build_translated_string (reason), frob));
-}
-
-static DOESNT_RETURN
-signal_image_error_2 (CONST char *reason, Lisp_Object frob0, Lisp_Object frob1)
-{
-  signal_error (Qimage_conversion_error,
-		list3 (build_translated_string (reason), frob0, frob1));
-}
 
 /************************************************************************/
 /* convert from a series of RGB triples to an XImage formated for the   */
@@ -1335,28 +1316,6 @@
  *                             XPM                                    *
  **********************************************************************/
 
-static void
-check_valid_xpm_color_symbols (Lisp_Object data)
-{
-  Lisp_Object rest;
-
-  for (rest = data; !NILP (rest); rest = XCDR (rest))
-    {
-      if (!CONSP (rest) ||
-	  !CONSP (XCAR (rest)) ||
-	  !STRINGP (XCAR (XCAR (rest))) ||
-	  (!STRINGP (XCDR (XCAR (rest))) &&
-	   !COLOR_SPECIFIERP (XCDR (XCAR (rest)))))
-	signal_simple_error ("Invalid color symbol alist", data);
-    }
-}
-
-static void
-xpm_validate (Lisp_Object instantiator)
-{
-  file_or_data_must_be_present (instantiator);
-}
-
 static Lisp_Object
 pixmap_to_lisp_data (Lisp_Object name, int ok_if_data_invalid)
 {
@@ -1437,42 +1396,8 @@
   return Qnil; /* not reached */
 }
 
-Lisp_Object Vxpm_color_symbols;
-
-static Lisp_Object
-evaluate_xpm_color_symbols (void)
-{
-  Lisp_Object rest, results = Qnil;
-  struct gcpro gcpro1, gcpro2;
-
-  GCPRO2 (rest, results);
-  for (rest = Vxpm_color_symbols; !NILP (rest); rest = XCDR (rest))
-    {
-      Lisp_Object name, value, cons;
-
-      CHECK_CONS (rest);
-      cons = XCAR (rest);
-      CHECK_CONS (cons);
-      name = XCAR (cons);
-      CHECK_STRING (name);
-      value = XCDR (cons);
-      CHECK_CONS (value);
-      value = XCAR (value);
-      value = Feval (value);
-      if (NILP (value))
-	continue;
-      if (!STRINGP (value) && !COLOR_SPECIFIERP (value))
-	signal_simple_error
-	  ("Result from xpm-color-symbols eval must be nil, string, or color",
-	   value);
-      results = Fcons (Fcons (name, value), results);
-    }
-  UNGCPRO;			/* no more evaluation */
-  return results;
-}
-
-static Lisp_Object
-xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
+Lisp_Object
+x_xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
 {
   Lisp_Object file = Qnil;
   Lisp_Object color_symbols;
@@ -1528,15 +1453,6 @@
   }
 }
 
-static int
-xpm_possible_dest_types (void)
-{
-  return
-    IMAGE_MONO_PIXMAP_MASK  |
-    IMAGE_COLOR_PIXMAP_MASK |
-    IMAGE_POINTER_MASK;
-}
-
  /* xpm 3.2g and better has XpmCreatePixmapFromBuffer()...
     There was no version number in xpm.h before 3.3, but this should do.
   */
@@ -1630,15 +1546,15 @@
   XpmFreeAttributes (xpmattrs);
 }
 
-static void
-xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
-		 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
-		 int dest_mask, Lisp_Object domain)
+void
+x_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+				   Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+				   int dest_mask, Lisp_Object domain)
 {
   /* This function can GC */
   struct Lisp_Image_Instance *ii = XIMAGE_INSTANCE (image_instance);
+  Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
   Lisp_Object data = find_keyword_in_vector (instantiator, Q_data);
-  Lisp_Object device = IMAGE_INSTANCE_DEVICE (ii);
   Display *dpy;
   Screen *xs;
   Colormap cmap;
@@ -1653,12 +1569,6 @@
   enum image_instance_type type;
   int force_mono;
   unsigned int w, h;
-#ifdef HAVE_MS_WINDOWS
-  if (DEVICE_MSWINDOWS_P (XDEVICE (device)))
-    return mswindows_xpm_instantiate(image_instance, instantiator, 
-				     pointer_fg, pointer_bg, 
-				     dest_mask, domain);
-#endif
 
   if (!DEVICE_X_P (XDEVICE (device)))
     signal_simple_error ("Not an X device", device);
@@ -4602,10 +4512,6 @@
   defkeyword (&Q_hotspot_y, ":hotspot-y");
   defkeyword (&Q_foreground, ":foreground");
   defkeyword (&Q_background, ":background");
-
-#ifdef HAVE_XPM
-  defkeyword (&Q_color_symbols, ":color-symbols");
-#endif
 }
 
 void
@@ -4709,19 +4615,6 @@
   IIFORMAT_VALID_KEYWORD (tiff, Q_file, check_valid_string);
 #endif
 
-#ifdef HAVE_XPM
-  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
-
-  IIFORMAT_HAS_METHOD (xpm, validate);
-  IIFORMAT_HAS_METHOD (xpm, normalize);
-  IIFORMAT_HAS_METHOD (xpm, possible_dest_types);
-  IIFORMAT_HAS_METHOD (xpm, instantiate);
-
-  IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string);
-  IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string);
-  IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols);
-#endif
-
 #ifdef HAVE_XFACE
   INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xface, "xface");
 
@@ -4768,23 +4661,6 @@
   Fprovide (Qtiff);
 #endif
 
-#ifdef HAVE_XPM
-  Fprovide (Qxpm);
-
-  DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /*
-Definitions of logical color-names used when reading XPM files.
-Elements of this list should be of the form (COLOR-NAME FORM-TO-EVALUATE).
-The COLOR-NAME should be a string, which is the name of the color to define;
-the FORM should evaluate to a `color' specifier object, or a string to be
-passed to `make-color-instance'.  If a loaded XPM file references a symbolic
-color called COLOR-NAME, it will display as the computed color instead.
-
-The default value of this variable defines the logical color names
-\"foreground\" and \"background\" to be the colors of the `default' face.
-*/ );
-  Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
-#endif
-
 #ifdef HAVE_XFACE
   Fprovide (Qxface);
 #endif
--- a/src/glyphs.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/glyphs.c	Mon Aug 13 10:30:37 2007 +0200
@@ -33,11 +33,16 @@
 #include "elhash.h"
 #include "faces.h"
 #include "frame.h"
+#include "insdel.h"
 #include "glyphs.h"
 #include "objects.h"
 #include "redisplay.h"
 #include "window.h"
 
+#ifdef HAVE_XPM
+#include <X11/xpm.h>
+#endif
+
 Lisp_Object Qimage_conversion_error;
 
 Lisp_Object Qglyphp, Qcontrib_p, Qbaseline;
@@ -67,6 +72,22 @@
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (string);
 DEFINE_IMAGE_INSTANTIATOR_FORMAT (formatted_string);
 
+#ifdef HAVE_XPM
+DEFINE_IMAGE_INSTANTIATOR_FORMAT (xpm);
+Lisp_Object Qxpm;
+Lisp_Object Q_color_symbols;
+void x_xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+						Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+						int dest_mask, Lisp_Object domain);
+void mswindows_xpm_instantiate (Lisp_Object image_instance, 
+				Lisp_Object instantiator,
+				Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+				int dest_mask, Lisp_Object domain);
+Lisp_Object x_xpm_normalize (Lisp_Object inst, Lisp_Object console_type);
+Lisp_Object mswindows_xpm_normalize (Lisp_Object inst,
+									 Lisp_Object console_type);
+#endif
+
 typedef struct image_instantiator_format_entry image_instantiator_format_entry;
 struct image_instantiator_format_entry
 {
@@ -586,8 +607,7 @@
 	  write_c_string (" @", printcharfun);
 	  if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)))
 	    {
-	      sprintf (buf, "%ld",
-		       (long) XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)));
+	      long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_X (ii)));
 	      write_c_string (buf, printcharfun);
 	    }
 	  else
@@ -595,8 +615,7 @@
 	  write_c_string (",", printcharfun);
 	  if (!NILP (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)))
 	    {
-	      sprintf (buf, "%ld",
-		       (long) XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)));
+	      long_to_string (buf, XINT (IMAGE_INSTANCE_PIXMAP_HOTSPOT_Y (ii)));
 	      write_c_string (buf, printcharfun);
 	    }
 	  else
@@ -1277,6 +1296,23 @@
 }
 
 
+/************************************************************************/
+/*                              error helpers                           */
+/************************************************************************/
+DOESNT_RETURN
+signal_image_error (CONST char *reason, Lisp_Object frob)
+{
+  signal_error (Qimage_conversion_error,
+		list2 (build_translated_string (reason), frob));
+}
+
+DOESNT_RETURN
+signal_image_error_2 (CONST char *reason, Lisp_Object frob0, Lisp_Object frob1)
+{
+  signal_error (Qimage_conversion_error,
+		list3 (build_translated_string (reason), frob0, frob1));
+}
+
 /****************************************************************************
  *                                  nothing                                 *
  ****************************************************************************/
@@ -1414,6 +1450,126 @@
 }
 
 
+#ifdef HAVE_XPM
+
+/**********************************************************************
+ *                             XPM                                    *
+ **********************************************************************/
+
+static void
+check_valid_xpm_color_symbols (Lisp_Object data)
+{
+  Lisp_Object rest;
+
+  for (rest = data; !NILP (rest); rest = XCDR (rest))
+    {
+      if (!CONSP (rest) ||
+	  !CONSP (XCAR (rest)) ||
+	  !STRINGP (XCAR (XCAR (rest))) ||
+	  (!STRINGP (XCDR (XCAR (rest))) &&
+	   !COLOR_SPECIFIERP (XCDR (XCAR (rest)))))
+	signal_simple_error ("Invalid color symbol alist", data);
+    }
+}
+
+static void
+xpm_validate (Lisp_Object instantiator)
+{
+  file_or_data_must_be_present (instantiator);
+}
+
+Lisp_Object Vxpm_color_symbols;
+
+Lisp_Object
+evaluate_xpm_color_symbols (void)
+{
+  Lisp_Object rest, results = Qnil;
+  struct gcpro gcpro1, gcpro2;
+
+  GCPRO2 (rest, results);
+  for (rest = Vxpm_color_symbols; !NILP (rest); rest = XCDR (rest))
+    {
+      Lisp_Object name, value, cons;
+
+      CHECK_CONS (rest);
+      cons = XCAR (rest);
+      CHECK_CONS (cons);
+      name = XCAR (cons);
+      CHECK_STRING (name);
+      value = XCDR (cons);
+      CHECK_CONS (value);
+      value = XCAR (value);
+      value = Feval (value);
+      if (NILP (value))
+	continue;
+      if (!STRINGP (value) && !COLOR_SPECIFIERP (value))
+	signal_simple_error
+	  ("Result from xpm-color-symbols eval must be nil, string, or color",
+	   value);
+      results = Fcons (Fcons (name, value), results);
+    }
+  UNGCPRO;			/* no more evaluation */
+  return results;
+}
+
+static Lisp_Object
+xpm_normalize (Lisp_Object inst, Lisp_Object console_type)
+{
+#ifdef HAVE_X_WINDOWS
+  if (CONSOLE_TYPESYM_X_P (console_type))
+	return x_xpm_normalize (inst, console_type);
+  else
+#endif
+#ifdef HAVE_MS_WINDOWS
+  if (CONSOLE_TYPESYM_MSWINDOWS_P (console_type))
+	return mswindows_xpm_normalize (inst, console_type);
+  else
+#endif
+	signal_image_error ("Can't display XPM images on this console",
+						console_type);
+}
+
+static int
+xpm_possible_dest_types (void)
+{
+  return
+    IMAGE_MONO_PIXMAP_MASK  |
+    IMAGE_COLOR_PIXMAP_MASK |
+    IMAGE_POINTER_MASK;
+}
+
+static void
+xpm_instantiate (Lisp_Object image_instance, Lisp_Object instantiator,
+		 Lisp_Object pointer_fg, Lisp_Object pointer_bg,
+		 int dest_mask, Lisp_Object domain)
+{
+  Lisp_Object device= IMAGE_INSTANCE_DEVICE (XIMAGE_INSTANCE (image_instance));
+#ifdef HAVE_X_WINDOWS
+  if (DEVICE_X_P (XDEVICE (device)))
+	{
+	  x_xpm_instantiate (image_instance, instantiator, 
+						 pointer_fg, pointer_bg, 
+						 dest_mask, domain);
+	  return;
+	}
+  else
+#endif
+#ifdef HAVE_MS_WINDOWS
+  if (DEVICE_MSWINDOWS_P (XDEVICE (device)))
+	{
+      mswindows_xpm_instantiate (image_instance, instantiator, 
+								 pointer_fg, pointer_bg, 
+								 dest_mask, domain);
+	  return;
+	}
+  else
+#endif
+	signal_image_error ("Can't display XPM images on this device", device);
+}
+
+#endif /* HAVE_XPM */
+
+
 /****************************************************************************
  *                         Image Specifier Object                           *
  ****************************************************************************/
@@ -2653,6 +2809,10 @@
   defkeyword (&Q_data, ":data");
   defkeyword (&Q_face, ":face");
 
+#ifdef HAVE_XPM
+  defkeyword (&Q_color_symbols, ":color-symbols");
+#endif
+
   /* image specifiers */
 
   DEFSUBR (Fimage_specifier_p);
@@ -2783,6 +2943,19 @@
   IIFORMAT_HAS_METHOD (formatted_string, instantiate);
 
   IIFORMAT_VALID_KEYWORD (formatted_string, Q_data, check_valid_string);
+
+#ifdef HAVE_XPM
+  INITIALIZE_IMAGE_INSTANTIATOR_FORMAT (xpm, "xpm");
+
+  IIFORMAT_HAS_METHOD (xpm, validate);
+  IIFORMAT_HAS_METHOD (xpm, normalize);
+  IIFORMAT_HAS_METHOD (xpm, possible_dest_types);
+  IIFORMAT_HAS_METHOD (xpm, instantiate);
+
+  IIFORMAT_VALID_KEYWORD (xpm, Q_data, check_valid_string);
+  IIFORMAT_VALID_KEYWORD (xpm, Q_file, check_valid_string);
+  IIFORMAT_VALID_KEYWORD (xpm, Q_color_symbols, check_valid_xpm_color_symbols);
+#endif
 }
 
 void
@@ -2830,6 +3003,23 @@
 What to display at the beginning of horizontally scrolled lines.
 */);
   Vhscroll_glyph = allocate_glyph (GLYPH_BUFFER, redisplay_glyph_changed);
+
+#ifdef HAVE_XPM
+  Fprovide (Qxpm);
+
+  DEFVAR_LISP ("xpm-color-symbols", &Vxpm_color_symbols /*
+Definitions of logical color-names used when reading XPM files.
+Elements of this list should be of the form (COLOR-NAME FORM-TO-EVALUATE).
+The COLOR-NAME should be a string, which is the name of the color to define;
+the FORM should evaluate to a `color' specifier object, or a string to be
+passed to `make-color-instance'.  If a loaded XPM file references a symbolic
+color called COLOR-NAME, it will display as the computed color instead.
+
+The default value of this variable defines the logical color names
+\"foreground\" and \"background\" to be the colors of the `default' face.
+*/ );
+  Vxpm_color_symbols = Qnil; /* initialized in x-faces.el */
+#endif
 }
 
 void
--- a/src/glyphs.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/glyphs.h	Mon Aug 13 10:30:37 2007 +0200
@@ -26,6 +26,8 @@
 
 #include "specifier.h"
 
+extern Lisp_Object Qxpm;
+
 /************************************************************************/
 /*			Image Instantiators				*/
 /************************************************************************/
--- a/src/indent.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/indent.c	Mon Aug 13 10:30:37 2007 +0200
@@ -649,80 +649,84 @@
   return vmotion_1 (w, orig, vtarget, ret_vpos, NULL);
 }
 
+/* Helper for Fvertical_motion and Fvertical_motion_pixels.
+ * Share as much code as possible so these stay synched.
+ */
+static
+Lisp_Object vertical_motion_1 (Lisp_Object lines, Lisp_Object window,
+                               int pixels)
+{
+  Bufpos bufpos;
+  Bufpos orig;
+  int selected;
+  int *vpos, *vpix;
+  int value=0;
+  struct window *w;
+
+  if (NILP (window))
+    window = Fselected_window (Qnil);
+
+  CHECK_WINDOW (window);
+  CHECK_INT (lines);
+
+  selected = (EQ (window, Fselected_window (Qnil)));
+
+  w = XWINDOW (window);
+
+  orig = selected ? BUF_PT (XBUFFER (w->buffer))
+                  : marker_position (w->pointm[CURRENT_DISP]);
+
+  vpos = pixels ? NULL   : &value;
+  vpix = pixels ? &value : NULL;
+
+  bufpos = vmotion_1 (w, orig, XINT (lines), vpos, vpix);
+
+  /* Note that the buffer's point is set, not the window's point. */
+  if (selected) 
+    BUF_SET_PT (XBUFFER (w->buffer), bufpos);
+  else
+    set_marker_restricted (w->pointm[CURRENT_DISP],
+			   make_int(bufpos),
+			   w->buffer);
+
+  return make_int (value);
+}
+
 DEFUN ("vertical-motion", Fvertical_motion, 1, 2, 0, /*
 Move to start of frame line LINES lines down.
 If LINES is negative, this is moving up.
+Optional second argument is WINDOW to move in,
+the default is the selected window.
 
-The optional second argument WINDOW specifies the window to use for
-parameters such as width, horizontal scrolling, and so on.
-the default is the selected window.
+Sets point to position found; this may be start of line
+or just the start of a continuation line.
+Returns number of lines moved; may be closer to zero than LINES
+if beginning or end of buffer was reached.
+
 Note that `vertical-motion' sets WINDOW's buffer's point, not
 WINDOW's point. (This differs from FSF Emacs, which buggily always
 sets current buffer's point, regardless of WINDOW.)
-
-Sets point to position found; this may be start of line
- or just the start of a continuation line.
-Returns number of lines moved; may be closer to zero than LINES
- if beginning or end of buffer was reached.
-Optional second argument is WINDOW to move in.
 */
        (lines, window))
 {
-  if (NILP (window))
-    window = Fselected_window (Qnil);
-  CHECK_WINDOW (window);
-  {
-    Bufpos bufpos;
-    int vpos;
-    struct window *w  = XWINDOW (window);
-
-    CHECK_INT (lines);
-
-    bufpos = vmotion (XWINDOW (window), BUF_PT (XBUFFER (w->buffer)),
-		      XINT (lines), &vpos);
-
-    /* Note that the buffer's point is set, not the window's point. */
-    BUF_SET_PT (XBUFFER (w->buffer), bufpos);
-
-    return make_int (vpos);
-  }
+  return vertical_motion_1 (lines, window, /* pixels = */ 0);
 }
 
 DEFUN ("vertical-motion-pixels", Fvertical_motion_pixels, 1, 2, 0, /*
 Move to start of frame line LINES lines down.
 If LINES is negative, this is moving up.
+Optional second argument is WINDOW to move in,
+the default is the selected window.
 
 This function is identical in behavior to `vertical-motion'
 except that the vertical pixel height of the motion which
 took place is returned instead of the actual number of lines
 moved.  A motion of zero lines returns the height of the
 current line.
-
-The optional second argument WINDOW specifies the window to use 
-for parameters such as width, horizontal scrolling, and so on.  
-The default is the selected window.  Note that this function
-sets WINDOW's buffer's point, not WINDOW's point.
 */
        (lines, window))
 {
-  if (NILP (window))
-    window = Fselected_window (Qnil);
-  CHECK_WINDOW (window);
-  {
-    Bufpos bufpos;
-    int vpix;
-    struct window *w  = XWINDOW (window);
-
-    CHECK_INT (lines);
-
-    bufpos = vmotion_1 (XWINDOW (window), BUF_PT (XBUFFER (w->buffer)),
-		      XINT (lines), NULL, &vpix);
-
-    /* Note that the buffer's point is set, not the window's point. */
-    BUF_SET_PT (XBUFFER (w->buffer), bufpos);
-
-    return make_int (vpix);
-  }
+  return vertical_motion_1 (lines, window, /* pixels = */ 1);
 }
 
 
--- a/src/lisp.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/lisp.h	Mon Aug 13 10:30:37 2007 +0200
@@ -1311,8 +1311,8 @@
 
 /*********** pure space ***********/
 
-#define CHECK_IMPURE(obj) \
-  do { if (purified (obj)) pure_write_error (); } while (0)
+#define CHECK_IMPURE(obj)					\
+  do { if (purified (obj)) pure_write_error (obj); } while (0)
 
 /*********** structures ***********/
 
@@ -1894,14 +1894,6 @@
 
 #endif /* MEMORY_USAGE_STATS */
 
-/* Some systems (e.g., NT) use a different path separator than Unix,
-   in addition to a device separator.  Default the path separator
-   to '/', and don't test for a device separator in IS_ANY_SEP.  */
-
-#ifdef WINDOWSNT
-extern Lisp_Object Vdirectory_sep_char;
-#endif
-
 #ifndef DIRECTORY_SEP
 #define DIRECTORY_SEP '/'
 #endif
@@ -2005,7 +1997,7 @@
 void stuff_buffered_input (Lisp_Object);
 
 /* Defined in data.c */
-DECLARE_DOESNT_RETURN (pure_write_error (void));
+DECLARE_DOESNT_RETURN (pure_write_error (Lisp_Object));
 DECLARE_DOESNT_RETURN (args_out_of_range (Lisp_Object, Lisp_Object));
 DECLARE_DOESNT_RETURN (args_out_of_range_3 (Lisp_Object, Lisp_Object,
 					    Lisp_Object));
@@ -2359,6 +2351,7 @@
 void print_cons (Lisp_Object, Lisp_Object, int);
 void print_vector (Lisp_Object, Lisp_Object, int);
 void print_string (Lisp_Object, Lisp_Object, int);
+void long_to_string (char *, long);
 void print_internal (Lisp_Object, Lisp_Object, int);
 void print_symbol (Lisp_Object, Lisp_Object, int);
 void print_float (Lisp_Object, Lisp_Object, int);
--- a/src/md5.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/md5.c	Mon Aug 13 10:30:37 2007 +0200
@@ -1,528 +1,621 @@
-/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
- */
-
-/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
-rights reserved.
+/* md5.c - Functions to compute MD5 message digest of files or memory blocks
+   according to the definition of MD5 in RFC 1321 from April 1992.
+   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   NOTE: The canonical source of this file is maintained with the GNU C
+   Library.  Bugs can be reported to bug-glibc@prep.ai.mit.edu.
 
-License to copy and use this software is granted provided that it
-is identified as the "RSA Data Security, Inc. MD5 Message-Digest
-Algorithm" in all material mentioning or referencing this software
-or this function.
+   This program 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.
 
-License is also granted to make and use derivative works provided
-that such works are identified as "derived from the RSA Data
-Security, Inc. MD5 Message-Digest Algorithm" in all material
-mentioning or referencing the derived work.
+   This program is distributed in the hope that it will be useful,
+   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.
 
-RSA Data Security, Inc. makes no representations concerning either
-the merchantability of this software or the suitability of this
-software for any particular purpose. It is provided "as is"
-without express or implied warranty of any kind.
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software Foundation,
+   Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
-These notices must be retained in any copies of any part of this
-documentation and/or software.
- */
+/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.  */
+
+/* XEmacs frontend written by Ben Wing, Jareth Hein and Hrvoje Niksic.  */
 
-/* Synched up with: Not in FSF. */
-/* This file has been Mule-ized. */
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
 
-#include <config.h>
-#include "lisp.h"
+#include <sys/types.h>
 
-#include "buffer.h"
-#include "insdel.h"
-#include "lstream.h"
-#ifdef FILE_CODING
-#include "file-coding.h"
+#include <stdlib.h>
+#include <string.h>
+
+#include <stdio.h>
+
+#if defined HAVE_LIMITS_H || _LIBC
+# include <limits.h>
 #endif
 
-typedef unsigned char *POINTER;/* POINTER defines a generic pointer type */
-typedef unsigned short int UINT2;/* UINT2 defines a two byte word */
-typedef unsigned int UINT4;/* UINT4 defines a four byte word */
-
-#define PROTO_LIST(list) list
-#define MD_CTX MD5_CTX
-#define MDInit MD5Init
-#define MDUpdate MD5Update
-#define MDFinal MD5Final
+/* The following contortions are an attempt to use the C preprocessor
+   to determine an unsigned integral type that is 32 bits wide.  An
+   alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but
+   doing that would require that the configure script compile and *run*
+   the resulting executable.  Locally running cross-compiled executables
+   is usually not possible.  */
 
-/* MD5 context. */
-typedef struct {
-  UINT4 state[4];                                   /* state (ABCD) */
-  UINT4 count[2];        /* number of bits, modulo 2^64 (lsb first) */
-  unsigned char buffer[64];                         /* input buffer */
-} MD5_CTX;
+#ifdef _LIBC
+# include <sys/types.h>
+typedef u_int32_t md5_uint32;
+#else
+# if defined __STDC__ && __STDC__
+#  define UINT_MAX_32_BITS 4294967295U
+# else
+#  define UINT_MAX_32_BITS 0xFFFFFFFF
+# endif
 
-void MD5Init PROTO_LIST ((MD5_CTX *));
-void MD5Update PROTO_LIST
-  ((MD5_CTX *, CONST unsigned char *, unsigned int));
-void MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
+/* If UINT_MAX isn't defined, assume it's a 32-bit type.
+   This should be valid for all systems GNU cares about because
+   that doesn't include 16-bit systems, and only modern systems
+   (that certainly have <limits.h>) have 64+-bit integral types.  */
+
+# ifndef UINT_MAX
+#  define UINT_MAX UINT_MAX_32_BITS
+# endif
 
-/* Constants for MD5Transform routine.
- */
-#define S11 7
-#define S12 12
-#define S13 17
-#define S14 22
-#define S21 5
-#define S22 9
-#define S23 14
-#define S24 20
-#define S31 4
-#define S32 11
-#define S33 16
-#define S34 23
-#define S41 6
-#define S42 10
-#define S43 15
-#define S44 21
+# if UINT_MAX == UINT_MAX_32_BITS
+   typedef unsigned int md5_uint32;
+# else
+#  if USHRT_MAX == UINT_MAX_32_BITS
+    typedef unsigned short md5_uint32;
+#  else
+#   if ULONG_MAX == UINT_MAX_32_BITS
+     typedef unsigned long md5_uint32;
+#   else
+     /* The following line is intended to evoke an error.
+        Using #error is not portable enough.  */
+     "Cannot determine unsigned 32-bit data type."
+#   endif
+#  endif
+# endif
+#endif
 
-static void MD5Transform PROTO_LIST ((UINT4 [4], CONST unsigned char [64]));
-static void Encode PROTO_LIST
-  ((unsigned char *, UINT4 *, unsigned int));
-static void Decode PROTO_LIST
-  ((UINT4 *, CONST unsigned char *, unsigned int));
-static void MD5_memcpy PROTO_LIST ((POINTER, CONST POINTER, unsigned int));
-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
+#include "lisp.h"
+#include "buffer.h"
+#include "lstream.h"
+#ifdef FILE_CODING
+# include "file-coding.h"
+#endif
 
-static unsigned char PADDING[64] = {
-  0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+/* Structure to save state of computation between the single steps.  */
+struct md5_ctx
+{
+  md5_uint32 A;
+  md5_uint32 B;
+  md5_uint32 C;
+  md5_uint32 D;
+
+  md5_uint32 total[2];
+  md5_uint32 buflen;
+  char buffer[128];
 };
 
-/* F, G, H and I are basic MD5 functions.
- */
-#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
-#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
-#define H(x, y, z) ((x) ^ (y) ^ (z))
-#define I(x, y, z) ((y) ^ ((x) | (~z)))
+#ifdef WORDS_BIGENDIAN
+# define SWAP(n)							\
+    (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24))
+#else
+# define SWAP(n) (n)
+#endif
 
-/* ROTATE_LEFT rotates x left n bits.
- */
-#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/* This array contains the bytes used to pad the buffer to the next
+   64-byte boundary.  (RFC 1321, 3.1: Step 1)  */
+static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ...  */ };
+
 
-/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
-Rotation is separate from addition to prevent recomputation.
- */
-#define FF(a, b, c, d, x, s, ac) { \
- (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define GG(a, b, c, d, x, s, ac) { \
- (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define HH(a, b, c, d, x, s, ac) { \
- (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
-#define II(a, b, c, d, x, s, ac) { \
- (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \
- (a) = ROTATE_LEFT ((a), (s)); \
- (a) += (b); \
-  }
+static void md5_process_block (CONST void *, size_t, struct md5_ctx *);
+
 
-/* MD5 initialization. Begins an MD5 operation, writing a new context.
- */
-void
-MD5Init (MD5_CTX *context)
+/* Initialize structure containing state of computation.
+   (RFC 1321, 3.3: Step 3)  */
+static void
+md5_init_ctx (struct md5_ctx *ctx)
 {
-  context->count[0] = context->count[1] = 0;
+  ctx->A = 0x67452301;
+  ctx->B = 0xefcdab89;
+  ctx->C = 0x98badcfe;
+  ctx->D = 0x10325476;
 
-  /* Load magic initialization constants. */
-  context->state[0] = 0x67452301;
-  context->state[1] = 0xefcdab89;
-  context->state[2] = 0x98badcfe;
-  context->state[3] = 0x10325476;
+  ctx->total[0] = ctx->total[1] = 0;
+  ctx->buflen = 0;
 }
 
-/* MD5 block update operation. Continues an MD5 message-digest
-  operation, processing another message block, and updating the
-  context.
- */
-void
-MD5Update (MD5_CTX *context, CONST unsigned char *input, unsigned int inputLen)
-{
-  unsigned int i, indice, partLen;
-
-  /* Compute number of bytes mod 64 */
-  indice = (unsigned int)((context->count[0] >> 3) & 0x3F);
-
-  /* Update number of bits */
-  if ((context->count[0] += ((UINT4)inputLen << 3))
-      < ((UINT4)inputLen << 3))
-    context->count[1]++;
-  context->count[1] += ((UINT4)inputLen >> 29);
+/* Put result from CTX in first 16 bytes following RESBUF.  The result
+   must be in little endian byte order.
 
-  partLen = 64 - indice;
-
-  /* Transform as many times as possible. */
-  if (inputLen >= partLen)
-    {
-      MD5_memcpy ((POINTER)&context->buffer[indice], (CONST POINTER)input,
-		  partLen);
-      MD5Transform (context->state, context->buffer);
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+static void *
+md5_read_ctx (CONST struct md5_ctx *ctx, void *resbuf)
+{
+  ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
+  ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
+  ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C);
+  ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D);
 
-      for (i = partLen; i + 63 < inputLen; i += 64)
-	MD5Transform (context->state, &input[i]);
-
-      indice = 0;
-    }
-  else
-    i = 0;
-
-  /* Buffer remaining input */
-  MD5_memcpy ((POINTER)&context->buffer[indice], (CONST POINTER)&input[i],
-	      inputLen-i);
+  return resbuf;
 }
 
-/* MD5 finalization. Ends an MD5 message-digest operation, writing the
-  message digest and zeroizing the context.  */
-void
-MD5Final (unsigned char digest[16], MD5_CTX *context)
+/* Process the remaining bytes in the internal buffer and the usual
+   prolog according to the standard and write the result to RESBUF.
+
+   IMPORTANT: On some systems it is required that RESBUF is correctly
+   aligned for a 32 bits value.  */
+static void *
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
 {
-  unsigned char bits[8];
-  unsigned int indice, padLen;
-
-  /* Save number of bits */
-  Encode (bits, context->count, 8);
+  /* Take yet unprocessed bytes into account.  */
+  md5_uint32 bytes = ctx->buflen;
+  size_t pad;
 
-  /* Pad out to 56 mod 64.
-*/
-  indice = (unsigned int)((context->count[0] >> 3) & 0x3f);
-  padLen = (indice < 56) ? (56 - indice) : (120 - indice);
-  MD5Update (context, PADDING, padLen);
+  /* Now count remaining bytes.  */
+  ctx->total[0] += bytes;
+  if (ctx->total[0] < bytes)
+    ++ctx->total[1];
+
+  pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes;
+  memcpy (&ctx->buffer[bytes], fillbuf, pad);
 
-  /* Append length (before padding) */
-  MD5Update (context, bits, 8);
-  /* Store state in digest */
-  Encode (digest, context->state, 16);
+  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
+  *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3);
+  *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) |
+							(ctx->total[0] >> 29));
 
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)context, 0, sizeof (*context));
+  /* Process last bytes.  */
+  md5_process_block (ctx->buffer, bytes + pad + 8, ctx);
+
+  return md5_read_ctx (ctx, resbuf);
 }
 
-/* MD5 basic transformation. Transforms state based on block.
- */
-static void
-MD5Transform (UINT4 state[4], CONST unsigned char block[64])
+#ifndef emacs			/* unused in Emacs */
+/* Compute MD5 message digest for bytes read from STREAM.  The
+   resulting message digest number will be written into the 16 bytes
+   beginning at RESBLOCK.  */
+int
+md5_stream (FILE *stream, void *resblock)
 {
-  UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16];
-
-  Decode (x, block, 64);
+  /* Important: BLOCKSIZE must be a multiple of 64.  */
+#define BLOCKSIZE 4096
+  struct md5_ctx ctx;
+  char buffer[BLOCKSIZE + 72];
+  size_t sum;
 
-  /* Round 1 */
-  FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */
-  FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */
-  FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */
-  FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */
-  FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */
-  FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */
-  FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */
-  FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */
-  FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */
-  FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */
-  FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
-  FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
-  FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
-  FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
-  FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
-  FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
+  /* Initialize the computation context.  */
+  md5_init_ctx (&ctx);
 
- /* Round 2 */
-  GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */
-  GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */
-  GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
-  GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */
-  GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */
-  GG (d, a, b, c, x[10], S22,  0x2441453); /* 22 */
-  GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
-  GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */
-  GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */
-  GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
-  GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */
-  GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */
-  GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
-  GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */
-  GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */
-  GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
+  /* Iterate over full file contents.  */
+  while (1)
+    {
+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
+	 computation function processes the whole buffer so that with the
+	 next round of the loop another block can be read.  */
+      size_t n;
+      sum = 0;
 
-  /* Round 3 */
-  HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */
-  HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */
-  HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
-  HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
-  HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */
-  HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */
-  HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */
-  HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
-  HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
-  HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */
-  HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */
-  HH (b, c, d, a, x[ 6], S34,  0x4881d05); /* 44 */
-  HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */
-  HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
-  HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
-  HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */
+      /* Read block.  Take care for partial reads.  */
+      do
+	{
+	  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
+
+	  sum += n;
+	}
+      while (sum < BLOCKSIZE && n != 0);
+      if (n == 0 && ferror (stream))
+        return 1;
 
-  /* Round 4 */
-  II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */
-  II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */
-  II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
-  II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */
-  II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
-  II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */
-  II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
-  II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */
-  II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */
-  II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
-  II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */
-  II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
-  II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */
-  II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
-  II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */
-  II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */
+      /* If end of file is reached, end the loop.  */
+      if (n == 0)
+	break;
 
-  state[0] += a;
-  state[1] += b;
-  state[2] += c;
-  state[3] += d;
+      /* Process buffer with BLOCKSIZE bytes.  Note that
+			BLOCKSIZE % 64 == 0
+       */
+      md5_process_block (buffer, BLOCKSIZE, &ctx);
+    }
 
-  /* Zeroize sensitive information.
-*/
-  MD5_memset ((POINTER)x, 0, sizeof (x));
+  /* Add the last bytes if necessary.  */
+  if (sum > 0)
+    md5_process_bytes (buffer, sum, &ctx);
+
+  /* Construct result in desired memory.  */
+  md5_finish_ctx (&ctx, resblock);
+  return 0;
 }
 
-/* Encodes input (UINT4) into output (unsigned char). Assumes len is
-  a multiple of 4.
- */
+/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The
+   result is always in little endian byte order, so that a byte-wise
+   output yields to the wanted ASCII representation of the message
+   digest.  */
+void *
+md5_buffer (const char *buffer, size_t len, void *resblock)
+{
+  struct md5_ctx ctx;
+
+  /* Initialize the computation context.  */
+  md5_init_ctx (&ctx);
+
+  /* Process whole buffer but last len % 64 bytes.  */
+  md5_process_bytes (buffer, len, &ctx);
+
+  /* Put result in desired memory area.  */
+  return md5_finish_ctx (&ctx, resblock);
+}
+#endif /* not emacs */
+
+
 static void
-Encode (unsigned char *output, UINT4 *input, unsigned int len)
+md5_process_bytes (CONST void *buffer, size_t len, struct md5_ctx *ctx)
 {
-  unsigned int i, j;
-
-  for (i = 0, j = 0; j < len; i++, j += 4)
+  /* When we already have some bits in our internal buffer concatenate
+     both inputs first.  */
+  if (ctx->buflen != 0)
     {
-      output[j] = (unsigned char)(input[i] & 0xff);
-      output[j+1] = (unsigned char)((input[i] >> 8) & 0xff);
-      output[j+2] = (unsigned char)((input[i] >> 16) & 0xff);
-      output[j+3] = (unsigned char)((input[i] >> 24) & 0xff);
+      size_t left_over = ctx->buflen;
+      size_t add = 128 - left_over > len ? len : 128 - left_over;
+
+      memcpy (&ctx->buffer[left_over], buffer, add);
+      ctx->buflen += add;
+
+      if (left_over + add > 64)
+	{
+	  md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx);
+	  /* The regions in the following copy operation cannot overlap.  */
+	  memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63],
+		  (left_over + add) & 63);
+	  ctx->buflen = (left_over + add) & 63;
+	}
+
+      buffer = (const char *) buffer + add;
+      len -= add;
+    }
+
+  /* Process available complete blocks.  */
+  if (len > 64)
+    {
+      md5_process_block (buffer, len & ~63, ctx);
+      buffer = (const char *) buffer + (len & ~63);
+      len &= 63;
+    }
+
+  /* Move remaining bytes in internal buffer.  */
+  if (len > 0)
+    {
+      memcpy (ctx->buffer, buffer, len);
+      ctx->buflen = len;
     }
 }
 
-/* Decodes input (unsigned char) into output (UINT4). Assumes len is
-  a multiple of 4.
- */
-static void
-Decode (UINT4 *output, CONST unsigned char *input, unsigned int len)
-{
-  unsigned int i, j;
 
-  for (i = 0, j = 0; j < len; i++, j += 4)
-    output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) |
-      (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
-}
+/* These are the four functions used in the four steps of the MD5 algorithm
+   and defined in the RFC 1321.  The first function is a little bit optimized
+   (as found in Colin Plumbs public domain implementation).  */
+/* #define FF(b, c, d) ((b & c) | (~b & d)) */
+#define FF(b, c, d) (d ^ (b & (c ^ d)))
+#define FG(b, c, d) FF (d, b, c)
+#define FH(b, c, d) (b ^ c ^ d)
+#define FI(b, c, d) (c ^ (b | ~d))
 
-static void
-MD5_memcpy (POINTER output, CONST POINTER input, unsigned int len)
-{
-  memcpy (output, input, len);
-}
+/* Process LEN bytes of BUFFER, accumulating context into CTX.
+   It is assumed that LEN % 64 == 0.  */
 
 static void
-MD5_memset (POINTER output, int value, unsigned int len)
-{
-  memset (output, value, len);
-}
-
-/* unused */
-#if 0
-static void
-LispMDString (char *string)
+md5_process_block (CONST void *buffer, size_t len, struct md5_ctx *ctx)
 {
-  MD_CTX context;
-  unsigned char digest[16];
-  unsigned int len = strlen(string);
+  md5_uint32 correct_words[16];
+  const md5_uint32 *words = buffer;
+  size_t nwords = len / sizeof (md5_uint32);
+  const md5_uint32 *endp = words + nwords;
+  md5_uint32 A = ctx->A;
+  md5_uint32 B = ctx->B;
+  md5_uint32 C = ctx->C;
+  md5_uint32 D = ctx->D;
+
+  /* First increment the byte count.  RFC 1321 specifies the possible
+     length of the file up to 2^64 bits.  Here we only compute the
+     number of bytes.  Do a double word increment.  */
+  ctx->total[0] += len;
+  if (ctx->total[0] < len)
+    ++ctx->total[1];
+
+  /* Process all bytes in the buffer with 64 bytes in each round of
+     the loop.  */
+  while (words < endp)
+    {
+      md5_uint32 *cwp = correct_words;
+      md5_uint32 A_save = A;
+      md5_uint32 B_save = B;
+      md5_uint32 C_save = C;
+      md5_uint32 D_save = D;
+
+      /* First round: using the given function, the context and a constant
+	 the next context is computed.  Because the algorithms processing
+	 unit is a 32-bit word and it is determined to work on words in
+	 little endian byte order we perhaps have to change the byte order
+	 before the computation.  To reduce the work for the next steps
+	 we store the swapped words in the array CORRECT_WORDS.  */
+
+#define OP(a, b, c, d, s, T)						\
+      do								\
+        {								\
+	  a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T;		\
+	  ++words;							\
+	  CYCLIC (a, s);						\
+	  a += b;							\
+        }								\
+      while (0)
+
+      /* It is unfortunate that C does not provide an operator for
+	 cyclic rotation.  Hope the C compiler is smart enough.  */
+#define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s)))
+
+      /* Before we start, one word to the strange constants.
+	 They are defined in RFC 1321 as
+
+	 T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64
+       */
+
+      /* Round 1.  */
+      OP (A, B, C, D,  7, 0xd76aa478);
+      OP (D, A, B, C, 12, 0xe8c7b756);
+      OP (C, D, A, B, 17, 0x242070db);
+      OP (B, C, D, A, 22, 0xc1bdceee);
+      OP (A, B, C, D,  7, 0xf57c0faf);
+      OP (D, A, B, C, 12, 0x4787c62a);
+      OP (C, D, A, B, 17, 0xa8304613);
+      OP (B, C, D, A, 22, 0xfd469501);
+      OP (A, B, C, D,  7, 0x698098d8);
+      OP (D, A, B, C, 12, 0x8b44f7af);
+      OP (C, D, A, B, 17, 0xffff5bb1);
+      OP (B, C, D, A, 22, 0x895cd7be);
+      OP (A, B, C, D,  7, 0x6b901122);
+      OP (D, A, B, C, 12, 0xfd987193);
+      OP (C, D, A, B, 17, 0xa679438e);
+      OP (B, C, D, A, 22, 0x49b40821);
 
-  MDInit (&context);
-  MDUpdate (&context, string, len);
-  MDFinal (digest, &context);
+      /* For the second to fourth round we have the possibly swapped words
+	 in CORRECT_WORDS.  Redefine the macro to take an additional first
+	 argument specifying the function to use.  */
+#undef OP
+#define OP(f, a, b, c, d, k, s, T)					\
+      do 								\
+	{								\
+	  a += f (b, c, d) + correct_words[k] + T;			\
+	  CYCLIC (a, s);						\
+	  a += b;							\
+	}								\
+      while (0)
+
+      /* Round 2.  */
+      OP (FG, A, B, C, D,  1,  5, 0xf61e2562);
+      OP (FG, D, A, B, C,  6,  9, 0xc040b340);
+      OP (FG, C, D, A, B, 11, 14, 0x265e5a51);
+      OP (FG, B, C, D, A,  0, 20, 0xe9b6c7aa);
+      OP (FG, A, B, C, D,  5,  5, 0xd62f105d);
+      OP (FG, D, A, B, C, 10,  9, 0x02441453);
+      OP (FG, C, D, A, B, 15, 14, 0xd8a1e681);
+      OP (FG, B, C, D, A,  4, 20, 0xe7d3fbc8);
+      OP (FG, A, B, C, D,  9,  5, 0x21e1cde6);
+      OP (FG, D, A, B, C, 14,  9, 0xc33707d6);
+      OP (FG, C, D, A, B,  3, 14, 0xf4d50d87);
+      OP (FG, B, C, D, A,  8, 20, 0x455a14ed);
+      OP (FG, A, B, C, D, 13,  5, 0xa9e3e905);
+      OP (FG, D, A, B, C,  2,  9, 0xfcefa3f8);
+      OP (FG, C, D, A, B,  7, 14, 0x676f02d9);
+      OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a);
+
+      /* Round 3.  */
+      OP (FH, A, B, C, D,  5,  4, 0xfffa3942);
+      OP (FH, D, A, B, C,  8, 11, 0x8771f681);
+      OP (FH, C, D, A, B, 11, 16, 0x6d9d6122);
+      OP (FH, B, C, D, A, 14, 23, 0xfde5380c);
+      OP (FH, A, B, C, D,  1,  4, 0xa4beea44);
+      OP (FH, D, A, B, C,  4, 11, 0x4bdecfa9);
+      OP (FH, C, D, A, B,  7, 16, 0xf6bb4b60);
+      OP (FH, B, C, D, A, 10, 23, 0xbebfbc70);
+      OP (FH, A, B, C, D, 13,  4, 0x289b7ec6);
+      OP (FH, D, A, B, C,  0, 11, 0xeaa127fa);
+      OP (FH, C, D, A, B,  3, 16, 0xd4ef3085);
+      OP (FH, B, C, D, A,  6, 23, 0x04881d05);
+      OP (FH, A, B, C, D,  9,  4, 0xd9d4d039);
+      OP (FH, D, A, B, C, 12, 11, 0xe6db99e5);
+      OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8);
+      OP (FH, B, C, D, A,  2, 23, 0xc4ac5665);
+
+      /* Round 4.  */
+      OP (FI, A, B, C, D,  0,  6, 0xf4292244);
+      OP (FI, D, A, B, C,  7, 10, 0x432aff97);
+      OP (FI, C, D, A, B, 14, 15, 0xab9423a7);
+      OP (FI, B, C, D, A,  5, 21, 0xfc93a039);
+      OP (FI, A, B, C, D, 12,  6, 0x655b59c3);
+      OP (FI, D, A, B, C,  3, 10, 0x8f0ccc92);
+      OP (FI, C, D, A, B, 10, 15, 0xffeff47d);
+      OP (FI, B, C, D, A,  1, 21, 0x85845dd1);
+      OP (FI, A, B, C, D,  8,  6, 0x6fa87e4f);
+      OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0);
+      OP (FI, C, D, A, B,  6, 15, 0xa3014314);
+      OP (FI, B, C, D, A, 13, 21, 0x4e0811a1);
+      OP (FI, A, B, C, D,  4,  6, 0xf7537e82);
+      OP (FI, D, A, B, C, 11, 10, 0xbd3af235);
+      OP (FI, C, D, A, B,  2, 15, 0x2ad7d2bb);
+      OP (FI, B, C, D, A,  9, 21, 0xeb86d391);
+
+      /* Add the starting values of the context.  */
+      A += A_save;
+      B += B_save;
+      C += C_save;
+      D += D_save;
+    }
+
+  /* Put checksum in context given as argument.  */
+  ctx->A = A;
+  ctx->B = B;
+  ctx->C = C;
+  ctx->D = D;
 }
-#endif
 
 
-/* XEmacs interface code. */
-Lisp_Object Qmd5;
-
-DEFUN ("md5", Fmd5, 1, 5, 0, /*
-Return the MD5 (a secure message digest algorithm) of an object.
-OBJECT is either a string or a buffer.
-Optional arguments START and END denote buffer positions for computing the
-hash of a portion of OBJECT.  The optional CODING argument specifies the coding
-system the text is to be represented in while computing the digest.  This only
-has meaning with MULE, and defaults to the current format of the data.
-If ERROR-ME-NOT is nil, report an error if the coding system can't be
-determined.  Else assume binary coding if all else fails.
-*/
-       (object, start, end, coding, error_me_not))
+#ifdef emacs
+#ifdef FILE_CODING
+/* Find out what format the buffer will be saved in, so we can make
+   the digest based on what it will look like on disk.  */
+static Lisp_Object
+md5_coding_system (Lisp_Object object, Lisp_Object coding, Lisp_Object istream,
+		   int error_me_not)
 {
-  /* This function can GC */
-  MD_CTX context;
-  unsigned char digest[16];
-  unsigned char thehash[32];
-  int i;
-
-  MDInit (&context);
+  Lisp_Object coding_system;
 
-  if (NILP (object))
-    {
-      MDUpdate (&context, (CONST unsigned char *) "", 0);
-    }
-  else
+  if (NILP (coding))
     {
-      Lisp_Object instream, outstream;
-      Lstream *istr, *ostr;
-      static Extbyte_dynarr *conversion_out_dynarr;
-      char tempbuf[1024]; /* some random amount */
-      struct gcpro gcpro1, gcpro2;
-#ifdef FILE_CODING
-      Lisp_Object conv_out_stream, coding_system;
-      Lstream *costr;
-      struct gcpro gcpro3;
-#endif
-
-      if (!conversion_out_dynarr)
-	conversion_out_dynarr = Dynarr_new (Extbyte);
-      else
-	Dynarr_reset (conversion_out_dynarr);
-
-      /* set up the in stream */
       if (BUFFERP (object))
 	{
-	  struct buffer *b = decode_buffer (object, 1);
-	  Bufpos begv, endv;
-	  /* Figure out where we need to get info from */
-	  get_buffer_range_char (b, start, end, &begv, &endv, GB_ALLOW_NIL);
-
-	  instream = make_lisp_buffer_input_stream (b, begv, endv, 0);
+	  /* Use the file coding for this buffer by default.  */
+	  coding_system = XBUFFER (object)->buffer_file_coding_system;
 	}
       else
 	{
-	  Bytecount bstart, bend;
-	  CHECK_STRING (object);
-	  get_string_range_byte (object, start, end, &bstart, &bend,
-				 GB_HISTORICAL_STRING_BEHAVIOR);
-	  instream = make_lisp_string_input_stream (object, bstart, bend);
+	  /* Attempt to autodetect the coding of the string.  This is
+             VERY hit-and-miss.  */
+	  enum eol_type eol = EOL_AUTODETECT;
+	  coding_system = Fget_coding_system (Qundecided);
+	  determine_real_coding_system (XLSTREAM (istream),
+					&coding_system, &eol);
 	}
-      istr = XLSTREAM (instream);
-
-#ifdef FILE_CODING
-      /* Find out what format the buffer will be saved in, so we can make
-	 the digest based on what it will look like on disk */
-      if (NILP(coding))
-	{
-	  if (BUFFERP(object)) 
-	    {
-	      /* Use the file coding for this buffer by default */
-	      coding_system = XBUFFER(object)->buffer_file_coding_system;
-	    }
-	  else
-	    {
-	      /* attempt to autodetect the coding of the string.  Note: this VERY hit-and-miss */
-	      enum eol_type eol = EOL_AUTODETECT;
-	      coding_system = Fget_coding_system(Qundecided);
-	      determine_real_coding_system(istr, &coding_system, &eol);
-	    }
-	  if (NILP(coding_system)) 
-	    coding_system = Fget_coding_system(Qbinary);
-	  else
-	    {
-	      coding_system = Ffind_coding_system (coding_system);
-	      if (NILP(coding_system))
-		coding_system = Fget_coding_system(Qbinary);
-	    }
-	}
+      if (NILP (coding_system)) 
+	coding_system = Fget_coding_system (Qbinary);
       else
 	{
-	  coding_system = Ffind_coding_system (coding);
-	  if (NILP(coding_system))
-	    {
-	      if (NILP(error_me_not))
-		signal_simple_error("No such coding system", coding);
-	      else
-		coding_system = Fget_coding_system(Qbinary); /* default to binary */
-	    }
+	  coding_system = Ffind_coding_system (coding_system);
+	  if (NILP (coding_system))
+	    coding_system = Fget_coding_system (Qbinary);
+	}
+    }
+  else
+    {
+      coding_system = Ffind_coding_system (coding);
+      if (NILP (coding_system))
+	{
+	  if (error_me_not)
+	    /* Default to binary.  */
+	    coding_system = Fget_coding_system (Qbinary);
+	  else
+	    signal_simple_error ("No such coding system", coding);
 	}
+    }
+  return coding_system;
+}
+#endif /* FILE_CODING */
+
+
+DEFUN ("md5", Fmd5, 1, 5, 0, /*
+Return the MD5 message digest of OBJECT, a buffer or string.
+
+Optional arguments START and END denote positions for computing the
+digest of a portion of OBJECT.
+
+The optional CODING argument specifies the coding system the text is to be
+represented in while computing the digest.  If unspecified, it defaults
+to the current format of the data, or is guessed.
+
+If NOERROR is non-nil, silently assume binary coding if the guesswork
+fails.  Normally, an error is signaled in such case.
+
+CODING and NOERROR arguments are meaningful only in XEmacsen with
+file-coding or Mule support.  Otherwise, they are ignored.
+*/
+       (object, start, end, coding, noerror))
+{
+  /* This function can GC */
+  /* Can this really GC?  How?  */
+  struct md5_ctx ctx;
+  unsigned char digest[16];
+  unsigned char thehash[33];
+  int i;
+
+  Lisp_Object instream;
+  struct gcpro gcpro1;
+#ifdef FILE_CODING
+  Lisp_Object raw_instream;
+  struct gcpro ngcpro1;
 #endif
 
-      /* setup the out stream */
-      outstream = make_dynarr_output_stream((unsigned_char_dynarr *)conversion_out_dynarr);
-      ostr = XLSTREAM (outstream);
+  /* Set up the input stream.  */
+  if (BUFFERP (object))
+    {
+      struct buffer *b;
+      Bufpos begv, endv;
+      CHECK_LIVE_BUFFER (object);
+      b = XBUFFER (object);
+      /* Figure out where we need to get info from */
+      get_buffer_range_char (b, start, end, &begv, &endv, GB_ALLOW_NIL);
+
+      instream = make_lisp_buffer_input_stream (b, begv, endv, 0);
+    }
+  else
+    {
+      Bytecount bstart, bend;
+      CHECK_STRING (object);
+      get_string_range_byte (object, start, end, &bstart, &bend,
+			     GB_HISTORICAL_STRING_BEHAVIOR);
+      instream = make_lisp_string_input_stream (object, bstart, bend);
+    }
+  GCPRO1 (instream);
+
 #ifdef FILE_CODING
-      /* setup the conversion stream */
-      conv_out_stream = make_encoding_output_stream (ostr, coding_system);
-      costr = XLSTREAM (conv_out_stream);
-      GCPRO3 (instream, outstream, conv_out_stream);
-#else
-      GCPRO2 (instream, outstream);
+  /* Determine the coding and set up the conversion stream.  */
+  coding = md5_coding_system (object, coding, instream, !NILP (noerror));
+  raw_instream = instream;
+  instream = make_encoding_input_stream (XLSTREAM (instream), coding);
+  NGCPRO1 (raw_instream);
 #endif
 
-      /* Get the data while doing the conversion */
-      while (1) {
-	int size_in_bytes = Lstream_read (istr, tempbuf, sizeof (tempbuf));
-	if (!size_in_bytes)
-	  break;
-	/* It does seem the flushes are necessary... */
-#ifdef FILE_CODING
-	Lstream_write (costr, tempbuf, size_in_bytes);
-	Lstream_flush (costr);
-#else
-	Lstream_write (ostr, tempbuf, size_in_bytes);
-#endif
-	Lstream_flush (ostr);
+  /* Initialize MD5 context.  */
+  md5_init_ctx (&ctx);
+
+  /* Get the data while doing the conversion.  */
+  while (1)
+    {
+      Bufbyte tempbuf[1024];	/* some random amount */
+      int size_in_bytes = Lstream_read (XLSTREAM (instream),
+					tempbuf, sizeof (tempbuf));
+      if (!size_in_bytes)
+	break;
 
-	/* Update the digest */
-	
-	MDUpdate (&context, (unsigned char *)Dynarr_atp(conversion_out_dynarr, 0), 
-		  Dynarr_length(conversion_out_dynarr));
-	/* reset the dynarr */
-	Lstream_rewind(ostr);
-      }
-      Lstream_close (istr);
+      /* Process the bytes.  */
+      md5_process_bytes (tempbuf, size_in_bytes, &ctx);
+    }
+  Lstream_delete (XLSTREAM (instream));
 #ifdef FILE_CODING
-      Lstream_close (costr);
+  Lstream_delete (XLSTREAM (raw_instream));
+  NUNGCPRO;
 #endif
-      Lstream_close (ostr);
+  UNGCPRO;
 
-      UNGCPRO;
-      Lstream_delete (istr);
-      Lstream_delete (ostr);
-#ifdef FILE_CODING
-      Lstream_delete (costr);
-#endif
-    }
-
-  MDFinal (digest, &context);
+  md5_finish_ctx (&ctx, digest);
   for (i = 0; i < 16; i++)
     sprintf ((char *) (thehash + (i * 2)), "%02x", digest[i]);
 
-  return (make_string (thehash, 32));
+  return make_string (thehash, 32);
 }
 
 void
 syms_of_md5 (void)
 {
   DEFSUBR (Fmd5);
-  defsymbol (&Qmd5, "md5");
 }
 
 void
 vars_of_md5 (void)
 {
-  Fprovide (Qmd5);
+  Fprovide (intern ("md5"));
 }
+#endif /* emacs */
--- a/src/mem-limits.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/mem-limits.h	Mon Aug 13 10:30:37 2007 +0200
@@ -62,7 +62,10 @@
 #endif
 
 #if defined(__bsdi__) || defined(__NetBSD__) || defined(__linux__)
+#if defined(__linux__) && defined (powerpc)	/*Added by Fukui*/
+#else					/*Added by Fukui*/
 #define BSD4_2
+#endif					/*Added by Fukui*/
 #endif
 
 #ifndef BSD4_2
@@ -70,7 +73,10 @@
 #ifndef MSDOS
 #ifndef WINDOWSNT
 #ifndef __CYGWIN32__
+#if defined(__linux__) && defined(powerpc)	/*Added Kaoru Fukui*/
+#else						/*Added Kaoru Fukui*/
 #include <sys/vlimit.h>
+#endif				/*Added by Fukui*/
 #endif /* not __CYGWIN32__ */
 #endif /* not WINDOWSNT */
 #endif /* not MSDOS */
--- a/src/menubar-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/menubar-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -113,7 +113,7 @@
    (If only toolbars will be implemented as common controls) */
 #define MENU_ITEM_ID_MIN 0x8000
 #define MENU_ITEM_ID_MAX 0xFFFF
-#define MENU_ITEM_ID_BITS(x) ((x) & 0x7FFF | 0x8000)
+#define MENU_ITEM_ID_BITS(x) (((x) & 0x7FFF) | 0x8000)
 static HMENU top_level_menu;
 
 #define MAX_MENUITEM_LENGTH 128
@@ -644,9 +644,8 @@
   /* Needs good bump also, for WM_COMMAND may have been dispatched from
      mswindows_need_event, which will block again despite new command
      event has arrived */
-  mswindows_enqueue_magic_event (FRAME_MSWINDOWS_HANDLE(f),
-				 XM_BUMPQUEUE);
-  
+  mswindows_bump_queue ();
+
   UNGCPRO; /* command */
   return Qt;
 }
@@ -692,14 +691,6 @@
   return Qt;
 }
 
-/* #### This function goes away. Removing it now may
-   interfere with pending patch 980128-jhar */
-Lisp_Object
-mswindows_handle_wm_exitmenuloop (struct frame* f)
-{
-  return Qt;
-}
-
 
 /*------------------------------------------------------------------------*/
 /* Methods                                                                */
--- a/src/menubar-msw.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/menubar-msw.h	Mon Aug 13 10:30:37 2007 +0200
@@ -35,7 +35,6 @@
 /* Message handlers. Called from window procedure */
 Lisp_Object mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm);
 Lisp_Object mswindows_handle_wm_initmenu (HMENU hmenu, struct frame* f);
-Lisp_Object mswindows_handle_wm_exitmenuloop (struct frame* f);
 Lisp_Object mswindows_handle_wm_command (struct frame* f, WORD command);
 
 #endif /* HAVE_MENUBARS */
--- a/src/mule-ccl.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/mule-ccl.c	Mon Aug 13 10:30:37 2007 +0200
@@ -471,7 +471,9 @@
     else				      	      	\
       {					      	      	\
 	Bufbyte work[MAX_EMCHAR_LEN];	      	      	\
-	int len = set_charptr_emchar (work, ch);	\
+	int len = ( ch < 256 ) ?			\
+          simple_set_charptr_emchar (work, ch) :	\
+          non_ascii_set_charptr_emchar (work, ch);	\
 	Dynarr_add_many (destination, work, len);      	\
       }					      	      	\
   } while (0)
--- a/src/objects-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/objects-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -1050,36 +1050,33 @@
     return 0;
   }
 
-  /* Have to apply Font to a GC to get its values.
-   * We'll borrow the desktop window becuase its the only window that we
-   * know about that is guaranteed to exist when this gets called
-   */ 
   {
-    HWND hwnd;
     HDC hdc;
     HFONT holdfont;
     TEXTMETRIC metrics;
 
-    hwnd = GetDesktopWindow();
-    assert(hdc = GetDC(hwnd));	/* XXX FIXME: can this temporarily fail? */
-    holdfont = SelectObject(hdc, f->data);
-    if (!holdfont)
-    {
-      mswindows_finalize_font_instance (f);
-      maybe_signal_simple_error ("Couldn't map font", f->name, Qfont, errb);
-      return 0;
-    }
-    GetTextMetrics(hdc, &metrics);
-    SelectObject(hdc, holdfont);
-    ReleaseDC(hwnd, hdc);
-    f->width = (unsigned short) metrics.tmAveCharWidth;
-    f->height = (unsigned short) metrics.tmHeight;
-    f->ascent = (unsigned short) metrics.tmAscent;
-    f->descent = (unsigned short) metrics.tmDescent;
-    f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
+    hdc = CreateCompatibleDC (NULL);
+    if (hdc)
+      {
+	holdfont = SelectObject(hdc, f->data);
+	if (holdfont)
+	  {
+	    GetTextMetrics (hdc, &metrics);
+	    SelectObject(hdc, holdfont);
+	    DeleteDC (hdc);
+	    f->width = (unsigned short) metrics.tmAveCharWidth;
+	    f->height = (unsigned short) metrics.tmHeight;
+	    f->ascent = (unsigned short) metrics.tmAscent;
+	    f->descent = (unsigned short) metrics.tmDescent;
+	    f->proportional_p = (metrics.tmPitchAndFamily & TMPF_FIXED_PITCH);
+	    return 1;
+	  }
+	DeleteDC (hdc);
+      }
+    mswindows_finalize_font_instance (f);
+    maybe_signal_simple_error ("Couldn't map font", f->name, Qfont, errb);
   }
-
-  return 1;
+  return 0;
 }
 
 #if 0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/paths.h.in	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,87 @@
+/* Hey Emacs, this is -*- C -*- code! */
+
+/* Synched up with: Not synched with FSF. */
+
+/* Think twice before editing this file.  Generated automatically by configure.
+
+ The file startup.el guesses at reasonable values for load-path, exec-path,
+ and lock-directory.  This means that if you move emacs and its associated
+ sub-tree to a different place in the filesystem, or to a different machine,
+ you won't have to do anything for it to work.
+
+ If you define the paths in this file then they will take precedence over
+ any value generated by the heuristic in startup.el.  The hardcoded paths
+ will be checked to see if they are valid, in which case they will be used.
+ Otherwise the editor will attempt to make its normal guess.
+
+ See the NEWS file for a description of the heuristic used to locate the lisp
+ and exec directories at startup time.  If you are looking at this file
+ because you are having trouble, then you would be much better off arranging
+ for those heuristics to succeed than defining the paths in this file.
+
+   **  Let me say that again.  If you're editing this file, you're making
+   **  a mistake.  Re-read the section on installation in ../etc/NEWS.
+
+ If it defines anything, this file should define some subset of the following:
+
+   PATH_PREFIX		The default value of `prefix-directory'.  This is the
+   			default root for everything.
+
+   PATH_LOADSEARCH	The default value of `load-path'.
+
+   PATH_PACKAGEPATH     The default value of `package-path'.
+
+   PATH_SITE            The default location of site-specific Lisp files.
+
+   PATH_EXEC		The default value of `exec-directory' and `exec-path'.
+			(exec-path also contains the value of whatever is in
+			the PATH environment variable.)
+
+   PATH_DATA		The default value of `data-directory'.  This
+			is where architecture-independent files are
+			searched for.
+
+   PATH_LOCK		The name of the directory that contains lock files
+			with which we record what files are being modified in 
+			Emacs.  This directory should be writable by everyone.
+			If this is specified, the string must end with a slash!
+
+   PATH_INFO		This is where the info documentation is installed.
+
+   PATH_INFOPATH	The default value of `Info-directory-list'.
+			These are additional places info files are searched
+			for. */
+
+#define PATH_PREFIX "@prefix@"
+
+#ifdef LISPDIR_USER_DEFINED
+#define  PATH_LOADSEARCH "@LISPDIR@"
+#endif
+
+#ifdef PACKAGE_PATH_USER_DEFINED
+#define PATH_PACKAGEPATH "@PACKAGE_PATH@"
+#endif
+
+#ifdef SITELISPDIR_USER_DEFINED
+#define PATH_SITE "@SITELISPDIR@"
+#endif
+
+#ifdef ARCHLIBDIR_USER_DEFINED
+#define PATH_EXEC "@ARCHLIBDIR@"
+#endif
+
+#ifdef ETCDIR_USER_DEFINED
+#define PATH_DATA "@ETCDIR@"
+#endif
+
+#ifdef LOCKDIR_USER_DEFINED
+#define PATH_LOCK "@LOCKDIR@"
+#endif
+
+#ifdef INFODIR_USER_DEFINED
+#define PATH_INFO "@INFODIR@"
+#endif
+
+#ifdef INFOPATH_USER_DEFINED
+#define PATH_INFOPATH "@INFOPATH@"
+#endif
--- a/src/paths.h.in.in	Mon Aug 13 10:29:43 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/* Hey Emacs, this is -*- C -*- code! */
-
-/* Synched up with: Not synched with FSF. */
-
-/* Think twice before editing this file.  Generated automatically by configure.
-
- The file startup.el guesses at reasonable values for load-path, exec-path,
- and lock-directory.  This means that if you move emacs and its associated
- sub-tree to a different place in the filesystem, or to a different machine,
- you won't have to do anything for it to work.
-
- If you define the paths in this file then they will take precedence over
- any value generated by the heuristic in startup.el.  The hardcoded paths
- will be checked to see if they are valid, in which case they will be used.
- Otherwise the editor will attempt to make its normal guess.
-
- See the NEWS file for a description of the heuristic used to locate the lisp
- and exec directories at startup time.  If you are looking at this file
- because you are having trouble, then you would be much better off arranging
- for those heuristics to succeed than defining the paths in this file.
-
-   **  Let me say that again.  If you're editing this file, you're making
-   **  a mistake.  Re-read the section on installation in ../etc/NEWS.
-
- If it defines anything, this file should define some subset of the following:
-
-   PATH_PREFIX		The default value of `prefix-directory'.  This is the
-   			default root for everything.
-
-   PATH_LOADSEARCH	The default value of `load-path'.
-
-   PATH_PACKAGEPATH     The default value of `package-path'.
-
-   PATH_SITE            The default location of site-specific Lisp files.
-
-   PATH_EXEC		The default value of `exec-directory' and `exec-path'.
-			(exec-path also contains the value of whatever is in
-			the PATH environment variable.)
-
-   PATH_DATA		The default value of `data-directory'.  This
-			is where architecture-independent files are
-			searched for.
-
-   PATH_LOCK		The name of the directory that contains lock files
-			with which we record what files are being modified in 
-			Emacs.  This directory should be writable by everyone.
-			If this is specified, the string must end with a slash!
-
-   PATH_INFO		This is where the info documentation is installed.
-
-   PATH_INFOPATH	The default value of `Info-directory-list'.
-			These are additional places info files are searched
-			for. */
-
-#define PATH_PREFIX "@prefix@"
-
-#undef LISPDIR_USER_DEFINED
-#ifdef LISPDIR_USER_DEFINED
-#define  PATH_LOADSEARCH "@LISPDIR@"
-#endif
-
-#undef PACKAGE_PATH_USER_DEFINED
-#ifdef PACKAGE_PATH_USER_DEFINED
-#define PATH_PACKAGEPATH "@PACKAGE_PATH@"
-#endif
-
-#undef SITELISPDIR_USER_DEFINED
-#ifdef SITELISPDIR_USER_DEFINED
-#define PATH_SITE "@SITELISPDIR@"
-#endif
-
-#undef ARCHLIBDIR_USER_DEFINED
-#ifdef ARCHLIBDIR_USER_DEFINED
-#define PATH_EXEC "@ARCHLIBDIR@"
-#endif
-
-#undef ETCDIR_USER_DEFINED
-#ifdef ETCDIR_USER_DEFINED
-#define PATH_DATA "@ETCDIR@"
-#endif
-
-#undef LOCKDIR_USER_DEFINED
-#ifdef LOCKDIR_USER_DEFINED
-#define PATH_LOCK "@LOCKDIR@"
-#endif
-
-#undef INFODIR_USER_DEFINED
-#ifdef INFODIR_USER_DEFINED
-#define PATH_INFO "@INFODIR@"
-#endif
-
-#undef INFOPATH_USER_DEFINED
-#ifdef INFOPATH_USER_DEFINED
-#define PATH_INFOPATH "@INFOPATH@"
-#endif
--- a/src/ppc.ldscript	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/ppc.ldscript	Mon Aug 13 10:30:37 2007 +0200
@@ -2,21 +2,27 @@
 	      "elf32-powerpc")
 OUTPUT_ARCH(powerpc)
 ENTRY(_start)
-SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/ppc-linux-elf/lib);
+SEARCH_DIR(/lib); SEARCH_DIR(/usr/lib); SEARCH_DIR(/usr/local/lib); SEARCH_DIR(/usr/powerpc-unknown-linux-gnulibc1/lib);
 /* Do we need any of these for elf?
    __DYNAMIC = 0;    */
 PROVIDE (__stack = 0);
 SECTIONS
 {
   /* Read-only sections, merged into text segment: */
-  . = 0x200000 + SIZEOF_HEADERS;
+  . = 0x01800000 + SIZEOF_HEADERS;
   .interp   : { *(.interp) }
   .hash		  : { *(.hash)		}
   .dynsym	  : { *(.dynsym)		}
   .dynstr	  : { *(.dynstr)		}
-  .rela.text	  : { *(.rela.text) 	}
-  .rela.data	  : { *(.rela.data) 	}
-  .rela.rodata	  : { *(.rela.rodata) 	}
+  .gnu.version   : { *(.gnu.version)      }
+  .gnu.version_d   : { *(.gnu.version_d)  }
+  .gnu.version_r   : { *(.gnu.version_r)  }
+  .rela.text     :
+    { *(.rela.text) *(.rela.gnu.linkonce.t*) }
+  .rela.data     :
+    { *(.rela.data) *(.rela.gnu.linkonce.d*) }
+  .rela.rodata   :
+    { *(.rela.rodata) *(.rela.gnu.linkonce.r*) }
   .rela.got	  : { *(.rela.got)	}
   .rela.got1	  : { *(.rela.got1)	}
   .rela.got2	  : { *(.rela.got2)	}
@@ -26,8 +32,8 @@
   .rela.fini	  : { *(.rela.fini)	}
   .rela.bss	  : { *(.rela.bss)	}
   .rela.plt	  : { *(.rela.plt)	}
-  .rela.sdata	  : { *(.rela.sdata2)	}
-  .rela.sbss	  : { *(.rela.sbss2)	}
+  .rela.sdata	  : { *(.rela.sdata)	}
+  .rela.sbss	  : { *(.rela.sbss)	}
   .rela.sdata2	  : { *(.rela.sdata2)	}
   .rela.sbss2	  : { *(.rela.sbss2)	}
   .text      :
@@ -35,10 +41,11 @@
     *(.text)
     /* .gnu.warning sections are handled specially by elf32.em.  */
     *(.gnu.warning)
+    *(.gnu.linkonce.t*)
   } =0
   .init		  : { *(.init)		} =0
   .fini		  : { *(.fini)		} =0
-  .rodata	  : { *(.rodata)  }
+  .rodata	  : { *(.rodata) *(.gnu.linkonce.r*) }
   .rodata1	  : { *(.rodata1) }
   _etext = .;
   PROVIDE (etext = .);
@@ -47,7 +54,7 @@
   /* Adjust the address for the data segment.  We want to adjust up to
      the same address within the page on the next page up.  It would
      be more correct to do this:
-       . = ALIGN(0x40000) + (ALIGN(8) & (0x40000 - 1));
+       . = .;
      The current expression does not correctly handle the case of a
      text segment ending precisely at the end of a page; it causes the
      data segment to skip a page.  The above expression does not have
@@ -58,15 +65,15 @@
      important than losing a page of the virtual address space (note
      that no actual memory is lost; the page which is skipped can not
      be referenced).  */
-  . =  ALIGN(8) + 0x40000;
+  . = .;
   .data    :
   {
     *(.data)
+    *(.gnu.linkonce.d*)
     CONSTRUCTORS
   }
   .data1   : { *(.data1) }
   .got1		  : { *(.got1) }
-  .plt   : { *(.plt) }
   .dynamic	  : { *(.dynamic) }
   /* Put .ctors and .dtors next to the .got2 section, so that the pointers
      get relocated with -mrelocatable. Also put in the .fixup pointers.
@@ -98,11 +105,11 @@
   }
   .bss       :
   {
-    PROVIDE (__sbss_start = .);
+     PROVIDE (__sbss_start = .);
     *(.sbss)
     *(.scommon)
     PROVIDE (__sbss_end = .);
-   PROVIDE (__bss_start = .);
+  PROVIDE (__bss_start = .);
    *(.dynbss)
    *(.bss)
    *(COMMON)
@@ -114,14 +121,29 @@
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
   /* DWARF debug sections.
-     Symbols in the .debug DWARF section are relative to the beginning of the
-     section so we begin .debug at 0.  It's not clear yet what needs to happen
-     for the others.   */
+     Symbols in the DWARF debugging sections are relative to the beginning
+     of the section so we begin them at 0.  */
+  /* DWARF 1 */
   .debug          0 : { *(.debug) }
+  .line           0 : { *(.line) }
+  /* GNU DWARF 1 extensions */
   .debug_srcinfo  0 : { *(.debug_srcinfo) }
+  .debug_sfnames  0 : { *(.debug_sfnames) }
+  /* DWARF 1.1 and DWARF 2 */
   .debug_aranges  0 : { *(.debug_aranges) }
   .debug_pubnames 0 : { *(.debug_pubnames) }
-  .debug_sfnames  0 : { *(.debug_sfnames) }
-  .line           0 : { *(.line) }
+  /* DWARF 2 */
+  .debug_info     0 : { *(.debug_info) }
+  .debug_abbrev   0 : { *(.debug_abbrev) }
+  .debug_line     0 : { *(.debug_line) }
+  .debug_frame    0 : { *(.debug_frame) }
+  .debug_str      0 : { *(.debug_str) }
+  .debug_loc      0 : { *(.debug_loc) }
+  .debug_macinfo  0 : { *(.debug_macinfo) }
+  /* SGI/MIPS DWARF 2 extensions */
+  .debug_weaknames 0 : { *(.debug_weaknames) }
+  .debug_funcnames 0 : { *(.debug_funcnames) }
+  .debug_typenames 0 : { *(.debug_typenames) }
+  .debug_varnames  0 : { *(.debug_varnames) }
   /* These must appear regardless of  .  */
 }
--- a/src/print.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/print.c	Mon Aug 13 10:30:37 2007 +0200
@@ -177,22 +177,28 @@
 
   if (LSTREAMP (function))
     {
-      /* Lstream_write() could easily cause GC inside of it, if the
-	 stream is a print-stream. (It will call output_string()
-	 recursively.) This is probably the fastest way to fix this
-	 problem. (alloca() is very fast on machines that have it
-	 built-in, and you avoid some nasty problems with recursion
-	 that could result from using a static buffer somewhere.)
-
-	 The other possibility is to inhibit GC, but that of course
-	 would require an unwind-protect, which is usually a lot
-	 slower than the small amount of memcpy()ing that happens
-	 here. */
       if (STRINGP (reloc))
 	{
-	  Bufbyte *copied = (Bufbyte *) alloca (len);
-	  memcpy (copied, newnonreloc + offset, len);
-	  Lstream_write (XLSTREAM (function), copied, len);
+	  /* Protect against Lstream_write() causing a GC and
+	     relocating the string.  For small strings, we do it by
+	     alloc'ing the string and using a copy; for large strings,
+	     we inhibit GC.  Now that print_streams are dead, this
+	     case should happen very rarely anyway.  */
+	  if (len < 65536)
+	    {
+	      Bufbyte *copied = alloca_array (Bufbyte, len);
+	      memcpy (copied, newnonreloc + offset, len);
+	      Lstream_write (XLSTREAM (function), copied, len);
+	    }
+	  else
+	    {
+	      int speccount = specpdl_depth ();
+	      record_unwind_protect (restore_gc_inhibit,
+				     make_int (gc_currently_forbidden));
+	      gc_currently_forbidden = 1;
+	      Lstream_write (XLSTREAM (function), newnonreloc + offset, len);
+	      unbind_to (speccount, Qnil);
+	    }
 	}
       else
 	Lstream_write (XLSTREAM (function), newnonreloc + offset, len);
@@ -247,70 +253,6 @@
   UNGCPRO;
 }
 
-struct print_stream
-{
-  FILE *file;
-  Lisp_Object fun;
-};
-
-#define get_print_stream(stream) \
-  ((struct print_stream *) Lstream_data (stream))
-
-DEFINE_LSTREAM_IMPLEMENTATION ("print", lstream_print,
-			       sizeof (struct print_stream));
-
-static Lisp_Object
-make_print_output_stream (FILE *file, Lisp_Object fun)
-{
-  Lstream *str = Lstream_new (lstream_print, "w");
-  struct print_stream *ps = get_print_stream (str);
-  Lisp_Object val;
-
-  Lstream_set_character_mode (str);
-  ps->file = file;
-  ps->fun = fun;
-  XSETLSTREAM (val, str);
-  return val;
-}
-
-/* #### This isn't being used anywhere at the moment.  Is it supposed
-   to be? */
-#if 0
-static void
-reset_print_stream (Lstream *str, FILE *file, Lisp_Object fun)
-{
-  struct print_stream *ps = get_print_stream (str);
-
-  Lstream_reopen (str);
-  ps->file = file;
-  ps->fun = fun;
-}
-#endif
-
-static Lisp_Object
-print_marker (Lisp_Object obj, void (*markobj) (Lisp_Object))
-{
-  return get_print_stream (XLSTREAM (obj))->fun;
-}
-
-static int
-print_writer (Lstream *stream, CONST unsigned char *data, size_t size)
-{
-  struct print_stream *ps = get_print_stream (stream);
-
-  if (ps->file)
-    {
-      write_string_to_stdio_stream (ps->file, 0, data, 0, size,
-				    FORMAT_TERMINAL);
-      /* Make sure it really gets written now. */
-      if (print_unbuffered)
-	fflush (ps->file);
-    }
-  else
-    output_string (ps->fun, data, Qnil, 0, size);
-  return size;
-}
-
 static Lisp_Object
 canonicalize_printcharfun (Lisp_Object printcharfun)
 {
@@ -326,33 +268,21 @@
   return printcharfun;
 }
 
+/* Now that print_streams are dead, I wonder if the following two
+   functions are needed as separate entities.  */
 
 static Lisp_Object
 print_prepare (Lisp_Object printcharfun)
 {
-  FILE *stdio_stream = 0;
-
   /* Emacs won't print whilst GCing, but an external debugger might */
   if (gc_in_progress)
     return Qnil;
 
   printcharfun = canonicalize_printcharfun (printcharfun);
-  if (NILP (printcharfun))
-    {
-      stdio_stream = stdout;
-    }
-#if 0 /* Don't bother */
-  else if (SUBRP (indirect_function (printcharfun, 0))
-           && (XSUBR (indirect_function (printcharfun, 0))
-               == Sexternal_debugging_output))
-    {
-      stdio_stream = stderr;
-    }
-#endif
   if (!CONSP (Vprint_gensym))
     Vprint_gensym_alist = Qnil;
 
-  return make_print_output_stream (stdio_stream, printcharfun);
+  return printcharfun;
 }
 
 static void
@@ -364,8 +294,6 @@
 
   if (!CONSP (Vprint_gensym))
     Vprint_gensym_alist = Qnil;
-
-  Lstream_delete (XLSTREAM (stream));
 }
 
 #if 1 /* Prefer space over "speed" */
@@ -548,12 +476,11 @@
        (object, noescape))
 {
   /* This function can GC */
-  Lisp_Object result = Qnil;
   Lstream *stream;
   struct gcpro gcpro1;
 
   /* We avoid creating a new stream for every invocation of
-     prin1_to_string, for better memory usage.  */
+     prin1_to_string, for better memory usage.  #### Is it necessary?  */
 
   if (NILP (Vprin1_to_string_stream))
     Vprin1_to_string_stream = make_resizing_buffer_output_stream ();
@@ -563,12 +490,15 @@
   /* In case a caller forgot to protect. */
   GCPRO1 (object);
   print_depth = 0;
+  if (!CONSP (Vprint_gensym))
+    Vprint_gensym_alist = Qnil;
   print_internal (object, Vprin1_to_string_stream, NILP (noescape));
+  if (!CONSP (Vprint_gensym))
+    Vprint_gensym_alist = Qnil;
   Lstream_flush (stream);
   UNGCPRO;
-  result = make_string (resizing_buffer_stream_ptr (stream),
-			Lstream_byte_count (stream));
-  return result;
+  return make_string (resizing_buffer_stream_ptr (stream),
+		      Lstream_byte_count (stream));
 }
 
 DEFUN ("princ", Fprinc, 1, 2, 0, /*
@@ -624,9 +554,6 @@
   (data))
 {
   /* This function can GC */
-
-  /* This should maybe use Vprin1_to_string_stream...  However, it's
-     called sufficiently rarely, so I don't think it should matter.  */
   Lisp_Object stream = make_resizing_buffer_output_stream ();
   struct gcpro gcpro1;
   GCPRO1 (stream);
@@ -1003,6 +930,39 @@
   return;
 }
 
+/* Print NUMBER to BUFFER.  The digits are first written in reverse
+   order (the least significant digit first), and are then reversed.
+   This is equivalent to sprintf(buffer, "%ld", number), only much
+   faster.  */
+void
+long_to_string (char *buffer, long number)
+{
+  char *p;
+  int i, l;
+
+  if (number < 0)
+    {
+      *buffer++ = '-';
+      number = -number;
+    }
+  p = buffer;
+  /* Print the digits to the string.  */
+  do
+    {
+      *p++ = number % 10 + '0';
+      number /= 10;
+    }
+  while (number);
+  /* And reverse them.  */
+  l = p - buffer - 1;
+  for (i = l/2; i >= 0; i--)
+    {
+      char c = buffer[i];
+      buffer[i] = buffer[l - i];
+      buffer[l - i] = c;
+    }
+  buffer[l + 1] = '\0';
+}
 
 static void
 default_object_printer (Lisp_Object obj, Lisp_Object printcharfun,
@@ -1087,7 +1047,7 @@
     case Lisp_Type_Int:
 #endif
       {
-	sprintf (buf, "%ld", (long) XINT (obj));
+	long_to_string (buf, XINT (obj));
 	write_c_string (buf, printcharfun);
 	break;
       }
@@ -1718,13 +1678,6 @@
 }
 
 void
-lstream_type_create_print (void)
-{
-  LSTREAM_HAS_METHOD (print, writer);
-  LSTREAM_HAS_METHOD (print, marker);
-}
-
-void
 vars_of_print (void)
 {
   alternate_do_pointer = 0;
--- a/src/process-nt.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/process-nt.c	Mon Aug 13 10:30:37 2007 +0200
@@ -45,8 +45,13 @@
 /* Process helpers							 */
 /*-----------------------------------------------------------------------*/
 
-/* #### Ok, a pretty frame is here, and a nifty text is in. Now,
-   any function around here to be put here? Yahoooo.... */
+/* This one breaks process abstraction. Prototype is in console-msw.h,
+   used by select_process method in event-msw.c */
+HANDLE
+get_nt_process_handle (struct Lisp_Process *p)
+{
+  return (NT_DATA (p)->h_process);
+}
 
 /*-----------------------------------------------------------------------*/
 /* Process methods							 */
--- a/src/redisplay-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/redisplay-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -554,7 +554,9 @@
 			 int cursor_start, int cursor_width, int cursor_height)
 {
   struct frame *f = XFRAME (w->frame);
+#if 0
   HDC hdc = FRAME_MSWINDOWS_DC (f);
+#endif
   struct Lisp_Image_Instance *p = XIMAGE_INSTANCE (image_instance);
   Lisp_Object window;
 
--- a/src/redisplay.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/redisplay.c	Mon Aug 13 10:30:37 2007 +0200
@@ -5479,10 +5479,13 @@
   struct frame *f = XFRAME (w->frame);
   struct device *d = XDEVICE (f->device);
   Lisp_Object old_buffer = w->buffer;
+  Lisp_Object the_buffer = w->buffer;
   struct buffer *b;
   int echo_active = 0;
   int startp = 1;
   int pointm;
+  int old_startp = 1;
+  int old_pointm = 1;
   int selected_in_its_frame;
   int selected_globally;
   int skip_output = 0;
@@ -5526,14 +5529,19 @@
 
   if (MINI_WINDOW_P (w) && echo_area_active (f))
     {
-      w->buffer = Vecho_area_buffer;
+      w->buffer = the_buffer = Vecho_area_buffer;
       echo_active = 1;
     }
 
   b = XBUFFER (w->buffer);
 
   if (echo_active)
-    pointm = 1;
+    {
+      old_pointm = selected_globally
+                   ? BUF_PT (b)
+                   : marker_position (w->pointm[CURRENT_DISP]);
+      pointm = 1;
+    }
   else
     {
       if (selected_globally)
@@ -5550,7 +5558,7 @@
 	    pointm = BUF_ZV (b);
 	}
     }
-  Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), old_buffer);
+  Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm), the_buffer);
 
   /* If the buffer has changed we have to invalid all of our face
      cache elements. */
@@ -5580,7 +5588,10 @@
     }
 
   if (echo_active)
-    startp = 1;
+    {
+      old_startp = marker_position (w->start[CURRENT_DISP]);
+      startp = 1;
+    }
   else
     {
       startp = marker_position (w->start[CURRENT_DISP]);
@@ -5589,7 +5600,7 @@
       else if (startp > BUF_ZV (b))
 	startp = BUF_ZV (b);
     }
-  Fset_marker (w->start[DESIRED_DISP], make_int (startp), old_buffer);
+  Fset_marker (w->start[DESIRED_DISP], make_int (startp), the_buffer);
 
   truncation_changed = (find_window_mirror (w)->truncate_win !=
 			window_truncation_on (w));
@@ -5613,7 +5624,7 @@
 	    BUF_SET_PT (b, pointm);
 
 	  Fset_marker (w->pointm[DESIRED_DISP], make_int (pointm),
-		       old_buffer);
+		       the_buffer);
 
 	  /* #### BUFU amounts of overkil just to get the cursor
              location marked properly.  FIX ME FIX ME FIX ME */
@@ -5779,8 +5790,12 @@
 
   /* Must do this before calling redisplay_output_window because it
      sets some markers on the window. */
-  if (MINI_WINDOW_P (w) && echo_area_active (f))
-    w->buffer = old_buffer;
+  if (echo_active)
+    {
+      w->buffer = old_buffer;
+      Fset_marker (w->pointm[DESIRED_DISP], make_int (old_pointm), old_buffer);
+      Fset_marker (w->start[DESIRED_DISP], make_int (old_startp), old_buffer);
+    }
 
   /* These also have to be set before calling redisplay_output_window
      since it sets the CURRENT_DISP values based on them. */
@@ -6266,7 +6281,7 @@
 
   line = buffer_line_number (b, pos, 1);
 
-  sprintf (window_line_number_buf, "%ld", (long)(line + 1));
+  long_to_string (window_line_number_buf, line + 1);
 
   return window_line_number_buf;
 }
@@ -6316,7 +6331,7 @@
 	  }
 
 	buf = alloca_array (char, size);
-	sprintf (buf, "%d", col);
+	long_to_string (buf, col);
 
 	Dynarr_add_many (mode_spec_bufbyte_string,
 			 (CONST Bufbyte *) buf, strlen (buf));
--- a/src/s/aix3-2-5.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/aix3-2-5.h	Mon Aug 13 10:30:37 2007 +0200
@@ -18,7 +18,3 @@
 
 /* XEmacs: from dkeller@VNET.IBM.COM */
 #define BROKEN_SIGIO
-
-/* Bill Woodward <wpwood@austin.ibm.com> says:
-   libIM *must* precede libXm, to avoid getting aixLoadIM error messages.  */
-#define LIB_MOTIF "-lIM -lXm"
--- a/src/s/aix4-1.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/aix4-1.h	Mon Aug 13 10:30:37 2007 +0200
@@ -4,12 +4,6 @@
 
 #include "aix4.h"
 
-#if 0 /* mrb */
-/* olson@mcs.anl.gov says -li18n is needed by -lXm.  */
-#undef LIB_MOTIF
-#define LIB_MOTIF "-lXm -li18n"
-#endif /* mrb */
-
 #ifdef __GNUC__
 #undef _NO_PROTO
 #endif
--- a/src/s/aix4-2.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/aix4-2.h	Mon Aug 13 10:30:37 2007 +0200
@@ -1,5 +1,1 @@
-/* valdis.kletnieks@vt.edu - tell configure how to auto-detect CDE */
-#define C_SWITCH_X_SYSTEM "-I/usr/dt/include/Tt -I/usr/dt/include"
-
-/* Other than that, treat the same as AIX 4.1 */
 #include "aix4-1.h"
--- a/src/s/bsd386.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/bsd386.h	Mon Aug 13 10:30:37 2007 +0200
@@ -15,7 +15,6 @@
 #define A_TEXT_SEEK(hdr) (N_TXTOFF(hdr) + A_TEXT_OFFSET(hdr))
 
 #define LIBS_DEBUG
-#define LIB_X11_LIB "-L/usr/X11/lib -lX11"
 #define LIBS_SYSTEM "-lutil -lcompat"
 
 #define HAVE_GETLOADAVG
--- a/src/s/bsdos2-1.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/bsdos2-1.h	Mon Aug 13 10:30:37 2007 +0200
@@ -1,8 +1,1 @@
-/* Synched up with: not in FSF. */
-
-/* s/ file for BSDI BSD/OS 2.1 system. */
-
 #include "bsdos2.h"
-
-/* -lX11 needs shmat and shmdt from -lipc. */
-#define LIBX11_SYSTEM "-lipc"
--- a/src/s/dgux.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/dgux.h	Mon Aug 13 10:30:37 2007 +0200
@@ -248,12 +248,6 @@
 
 #endif /* ELF */
 
-/* Extra stuff which probably should be someplace else but is here out
-   of expediency. */
-
-#define LIB_X11_LIB "-lX11"
-#define LIB_MOTIF "-lXm -lgen"
-
 /* Formerly "BSD_PGRPS" */
 
 #define SIGIO_REQUIRES_SEPARATE_PROCESS_GROUP
--- a/src/s/esix.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/esix.h	Mon Aug 13 10:30:37 2007 +0200
@@ -16,8 +16,6 @@
 /* If using Roell's X server, define X11R4 */
 #ifdef X11R4			/* Roell's X server */
 #define select sys_select /* Emacs select() not good enough? */
-#undef LIBX11_SYSTEM
-#define LIBX11_SYSTEM "-lpt"
 #endif /* X11R4 */
 
 /* ESIX does not need <sys/sioctl.h>, but needs <sys/ptem.h> */
--- a/src/s/esix5r4.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/esix5r4.h	Mon Aug 13 10:30:37 2007 +0200
@@ -10,7 +10,6 @@
 # undef LIB_STANDARD
 # define LIB_STANDARD "-lc"
 #else
-# define LIB_X11_LIB "-lsocket -lc -lX11"
 # undef LIB_STANDARD
 # ifdef ORDINARY_LINK
 #   define LIB_STANDARD "-lnsl -lns -lelf /usr/ucblib/libucb.a"
--- a/src/s/hpux8.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/hpux8.h	Mon Aug 13 10:30:37 2007 +0200
@@ -20,23 +20,6 @@
    redefining struct timeval and struct timezone. */
 #define __TIMEVAL__
 
-#if 0 /* RMSmacs */
-/* #### It appears that the FSF version of hpux8.h handles both
-   R4 and R5, while the XEmacs one handles only R4.  Someone
-   fix this up. */
-
-/* dob@inel.gov says HPUX 8.07 needs this.  He was using X11R5, I think.  */
-#define LIBX11_SYSTEM "-lXext"
-
-#define LIB_X11_LIB "-L/usr/lib/X11R5 -L/usr/lib/X11R4 -lX11"
-#define C_SWITCH_X_SYSTEM "-I/usr/include/X11R5 -I/usr/include/X11R4"
-#define LD_SWITCH_X_DEFAULT "-L/usr/lib/X11R5 -L/usr/lib/X11R4"
-#endif
-
-/* XEmacs change -- changed LIBX11_SYSTEM and C_SWITCH_X_SYSTEM */
-#define C_SWITCH_X_SYSTEM "-I/usr/include/X11R4 -I/usr/include/Motif1.1"
-#define LD_SWITCH_X_SYSTEM "-L/usr/lib/X11R4 -L/usr/lib/Motif1.1"
-
 /* Don't use shared libraries.  unexec doesn't handle them.
    Note GCC automatically passes -a archive to ld, and it has its own
    conflicting -a.  */
--- a/src/s/hpux9-shr.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/hpux9-shr.h	Mon Aug 13 10:30:37 2007 +0200
@@ -17,8 +17,6 @@
 #ifdef NOT_C_CODE
 #define START_FILES
 #define LINKER "$(CC)"
-/* now done in hpux8.h */
-/* #define LD_SWITCH_SYSTEM -L/usr/lib/X11R5 -L/usr/lib/Motif1.2 */
 #endif /* THIS IS YMAKEFILE */
 
 /* get call to brk() when rerunning XEmacs */
--- a/src/s/hpux9-x11r4.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/hpux9-x11r4.h	Mon Aug 13 10:30:37 2007 +0200
@@ -1,12 +1,1 @@
-/* Synched up with: FSF 19.31. */
-
-/* System description file for hpux version 9 using X11R4.  */
-
 #include "hpux9.h"
-
-#undef  C_SWITCH_X_SYSTEM
-#define C_SWITCH_X_SYSTEM "-I/usr/include/Motif1.1"
-
-#undef  LD_SWITCH_X_DEFAULT
-#define LD_SWITCH_X_DEFAULT "-L/usr/lib/Motif1.1"
-
--- a/src/s/hpux9.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/hpux9.h	Mon Aug 13 10:30:37 2007 +0200
@@ -42,34 +42,6 @@
 */
 #endif
 
-/* According to ngorelic@speclab.cr.usgs.gov,
-   references to the X11R4 directories in these variables
-   (inherited from hpux8.h)
-   cause the wrong libraries to be found,
-   and the options to specify the X11R5 directories are unnecessary
-   since the R5 files are found without them.  */
-#undef LIB_X11_LIB
-#undef C_SWITCH_X_SYSTEM
-#undef LD_SWITCH_X_SYSTEM
-/* However, HPUX 9 has Motif includes in a strange place.
-   So search that place.  These definitions assume that X11R5 is being
-   used -- if X11R4 is used, "s/hpux9-x11r4.h" gets loaded instead.  */
-/* XEmacs change: Change LD_SWITCH_X_DEFAULT to LD_SWITCH_X_SYSTEM.
-   #### Why do we need to make this change? */
-#define C_SWITCH_X_SYSTEM "-I/usr/include/X11R5 -I/usr/include/Motif1.2"
-#define LD_SWITCH_X_SYSTEM "-L/usr/lib/X11R5 -L/usr/lib/Motif1.2"
-
-#ifndef HAVE_LIBXMU
-/* HP-UX doesn't supply Xmu.  */
-#define LIBXMU
-
-/* Unfortunately without libXmu we cannot support EditRes.  */
-#define NO_EDITRES
-#endif
-
-/* zoo@armadillo.com says we don't need -lXext in HPUX 9.  */
-#undef LIBX11_SYSTEM
-
 /* XEmacs: apparently rint() is totally broken in HPUX 9. */
 #undef HAVE_RINT
 
--- a/src/s/hpux9shxr4.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/hpux9shxr4.h	Mon Aug 13 10:30:37 2007 +0200
@@ -1,10 +1,1 @@
-/* Synched up with: FSF 19.31. */
-
 #include "hpux9-shr.h"
-
-#undef  C_SWITCH_X_SYSTEM
-#define C_SWITCH_X_SYSTEM "-I/usr/include/Motif1.1"
-
-#undef  LD_SWITCH_X_DEFAULT
-#define LD_SWITCH_X_DEFAULT "-L/usr/lib/Motif1.1"
-
--- a/src/s/isc3-0.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/isc3-0.h	Mon Aug 13 10:30:37 2007 +0200
@@ -11,13 +11,6 @@
    so we might as well try getting rid of -traditional.  */
 #undef C_SWITCH_SYSTEM
 
-/* We indirectly #include s/usg5-3.h, which says to use libX11_s and
-   libc_s.  Martin Tomes <mt00@controls.eurotherm.co.uk> says that ISC
-   has no libX11_s, and that linking with libc_s causes sbrk not to work.  */
-#undef LIB_X11_LIB
-#undef LIBX11_SYSTEM
-#define LIBX11_SYSTEM "-lpt -lnls -lnsl_s"
-
 /* TIOCGWINSZ isn't broken; you just have to know where to find it.  */
 #undef BROKEN_TIOCGWINSZ
 #define NEED_SIOCTL
--- a/src/s/isc4-0.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/isc4-0.h	Mon Aug 13 10:30:37 2007 +0200
@@ -6,10 +6,3 @@
 #define LIBS_SYSTEM "-linet -lcposix"
 
 #define ISC4_0
-
-/* fmcphers@csugrad.cs.vt.edu reported this was necessary.
-   He used GCC.  I don't know what is needed with other compilers.  */
-#ifdef __GNUC__
-#undef LIBX11_SYSTEM
-#define LIBX11_SYSTEM "-lpt -lnls -lnsl_s -lcposix -lc"
-#endif
--- a/src/s/linux.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/linux.h	Mon Aug 13 10:30:37 2007 +0200
@@ -85,7 +85,13 @@
 /* Linux has crt0.o in a non-standard place */
 #define START_FILES "pre-crt0.o /usr/lib/crt0.o"
 #else
+/**/
+#if	defined(__linux__) && defined(powerpc)	/*Added by Fukui*/
+#define START_FILES		/*Added by Fukui*/
+#else				/*Added by Fukui*/
+
 #define START_FILES "pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o"
+#endif				/*Added by Fukui*/
 #endif
 
 /* This is needed for sysdep.c */
--- a/src/s/ptx.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/ptx.h	Mon Aug 13 10:30:37 2007 +0200
@@ -30,9 +30,6 @@
 #include "usg5-3.h"
 
 /* Undo these defines because they are incorrect or need to be changed.  */
-#undef LIB_X11_LIB
-#undef LIBX10_SYSTEM
-#undef LIBX11_SYSTEM
 #undef USG_SHARED_LIBRARIES
 
 /* PTX has System V streams.  */
@@ -48,7 +45,6 @@
 
 #ifdef HAVE_X_WINDOWS
 
-#define LIBX11_SYSTEM "-lsocket -linet -lnsl"
 /* This is also defined so that lib-src/profile can link.  */
 #define LIBS_SYSTEM "-lseq"
 
--- a/src/s/sco4.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/sco4.h	Mon Aug 13 10:30:37 2007 +0200
@@ -57,11 +57,6 @@
 #define LINKER "cc"
 #endif
 
-/* This is safe since we already assumed HAVE_SOCKETS
-   if using X windows.  */
-#undef LIBX11_SYSTEM
-#define LIBX11_SYSTEM "-lpt -lnls -lnsl_s -lc_s -lsocket"
-
 #ifdef HAVE_SOCKETS
 #define LIBS_SYSTEM "-lsocket -lPW"
 
--- a/src/s/sco5.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/sco5.h	Mon Aug 13 10:30:37 2007 +0200
@@ -55,12 +55,6 @@
 #define LINKER "gcc"
 #endif
 
-#undef LIBX11_SYSTEM
-#define LIBX11_SYSTEM "-lsocket"
-
-#undef LIB_X11_LIB
-#define LIB_X11_LIB "-lX11 -lgen"
-
 #define LIBS_SYSTEM "-lsocket -lPW -lgen -lcrypt -lmalloc"
 
 #ifndef MAXPATHLEN
--- a/src/s/usg5-3.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/usg5-3.h	Mon Aug 13 10:30:37 2007 +0200
@@ -41,15 +41,6 @@
 
 #define BROKEN_TIOCGETC
 
-/* AT&T SVr3 X wants to be linked with shared libraries */
-
-#define LIB_X11_LIB "-lX11_s"
-
-/* X needs to talk on the network, so search the network library.  */
-
-#define LIBX10_SYSTEM "-lnsl_s"
-#define LIBX11_SYSTEM "-lpt -lnls -lnsl_s -lc_s"
-
 /* Some variants have TIOCGWINSZ, but the structures to go with it
    are not declared.  */
 
--- a/src/s/usg5-4-2.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/usg5-4-2.h	Mon Aug 13 10:30:37 2007 +0200
@@ -8,13 +8,6 @@
 #undef LIBS_SYSTEM
 #define LIBS_SYSTEM "-lsocket -lnsl -lelf -lgen"
 
-/* Use libw.a along with X11R6 Xt.  */
-#define NEED_LIBW
-
-/* ryanr@ellingtn.ftc.nrcs.usda.gov (Richard Anthony Ryan) says -lXimp
-   is needed in UNIX_SV ... 4.2 1.1.2.  */
-#define LIB_MOTIF "-lXm -lXimp"
-
 #define VFORK_RETURN_TYPE pid_t
 
 /* XEmacs change (since getwd is auto-determined) */
--- a/src/s/usg5-4.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/s/usg5-4.h	Mon Aug 13 10:30:37 2007 +0200
@@ -154,17 +154,6 @@
   if (ioctl (xforkin, I_PUSH, "ttcompat") == -1) 	\
     fatal ("ioctl I_PUSH ttcompat: errno %d\n", errno);
 
-/* Undo the SVr3 X11 library definition */
-#undef LIB_X11_LIB
-
-/* The definition of this in s-usg5-3.h is not needed in 5.4.  */
-/* liblnsl_s should never be used.  The _s suffix implies a shared
-   library, as opposed to a DLL.  Share libraries were used in SVR3, and are
-   available only in order to allow SVR3 binaries to run.  They should not be
-   linked in to new binaries. -- caraway!pinkas@caraway.intel.com.  */
-#undef LIBX10_SYSTEM
-#undef LIBX11_SYSTEM
-
 /* Tell x11term.c and keyboard.c we have the system V streams feature.  */
 #define SYSV_STREAMS
 /* On Some SysV System , w3 freeze. If freeze your xemacs , Add below definition */
--- a/src/scrollbar-msw.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/scrollbar-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -27,11 +27,12 @@
 #include "lisp.h"
 
 #include "console-msw.h"
-#include "scrollbar-msw.h"
-
+#include "events.h"
 #include "frame.h"
+#include "scrollbar-msw.h"
+#include "scrollbar.h"
+#include "specifier.h"
 #include "window.h"
-#include "events.h"
 
 /* This has really different semantics in Windows than in Motif.
    There's no corresponding method; we just do not change slider
@@ -255,7 +256,28 @@
 }
 
 #endif /* MEMORY_USAGE_STATS */
+
+/************************************************************************/
+/*          Device-specific ghost specifiers initialization             */
+/************************************************************************/
 
+DEFUN ("mswindows-init-scrollbar-metrics", Fmswindows_init_scrollbar_metrics, 1, 1, 0, /*
+*/
+       (locale))
+{
+  if (DEVICEP (locale))
+    {
+      add_spec_to_ghost_specifier (Vscrollbar_width,
+				   make_int (GetSystemMetrics (SM_CXVSCROLL)),
+				   locale, Qmswindows, Qnil);
+      add_spec_to_ghost_specifier (Vscrollbar_height,
+				   make_int (GetSystemMetrics (SM_CYHSCROLL)),
+				   locale, Qmswindows, Qnil);
+    }
+  return Qnil;
+}
+
+
 /************************************************************************/
 /*                            initialization                            */
 /************************************************************************/
@@ -275,6 +297,12 @@
 }
 
 void
+syms_of_scrollbar_mswindows(void)
+{
+  DEFSUBR (Fmswindows_init_scrollbar_metrics);
+}
+
+void
 vars_of_scrollbar_mswindows(void)
 {
   Fprovide (intern ("mswindows-scrollbars"));
--- a/src/scrollbar.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/scrollbar.c	Mon Aug 13 10:30:37 2007 +0200
@@ -541,11 +541,13 @@
 
   if (HAS_DEVMETH_P (d, create_scrollbar_instance))
     {
+      int depth = reveal_ghost_specifiers_protected ();
       Lisp_Object frame;
       XSETFRAME (frame, f);
       call_critical_lisp_code (XDEVICE (FRAME_DEVICE (f)),
 			       Qinit_scrollbar_from_resources,
 			       frame);
+      unbind_to (depth, Qnil);
     }
 }
 
@@ -554,11 +556,13 @@
 {
   if (HAS_DEVMETH_P (d, create_scrollbar_instance))
     {
+      int depth = reveal_ghost_specifiers_protected ();
       Lisp_Object device;
       XSETDEVICE (device, d);
       call_critical_lisp_code (d,
 			       Qinit_scrollbar_from_resources,
 			       device);
+      unbind_to (depth, Qnil);
     }
 }
 
@@ -567,9 +571,11 @@
 {
   if (HAS_DEVMETH_P (d, create_scrollbar_instance))
     {
+      int depth = reveal_ghost_specifiers_protected ();
       call_critical_lisp_code (d,
 			       Qinit_scrollbar_from_resources,
 			       Qglobal);
+      unbind_to (depth, Qnil);
     }
 }
 
@@ -928,7 +934,7 @@
 *Width of vertical scrollbars.
 This is a specifier; use `set-specifier' to change it.
 */ );
-  Vscrollbar_width = Fmake_specifier (Qnatnum);
+  Vscrollbar_width = make_magic_specifier (Qnatnum);
   set_specifier_fallback
     (Vscrollbar_width,
      list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_WIDTH))));
@@ -944,7 +950,7 @@
 *Height of horizontal scrollbars.
 This is a specifier; use `set-specifier' to change it.
 */ );
-  Vscrollbar_height = Fmake_specifier (Qnatnum);
+  Vscrollbar_height = make_magic_specifier (Qnatnum);
   set_specifier_fallback
     (Vscrollbar_height,
      list1 (Fcons (Qnil, make_int (DEFAULT_SCROLLBAR_HEIGHT))));
--- a/src/signal.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/signal.c	Mon Aug 13 10:30:37 2007 +0200
@@ -63,7 +63,7 @@
 int poll_for_quit_id;
 #endif
 
-#ifndef SIGCHLD
+#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)
 int poll_for_sigchld_id;
 #endif
 
@@ -552,7 +552,7 @@
 #endif /* not SIGIO and not DONT_POLL_FOR_QUIT */
 }
 
-#ifndef SIGCHLD
+#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)
 
 static void
 init_poll_for_sigchld (void)
@@ -640,9 +640,17 @@
       /* Don't catch these signals in batch mode if not initialized.
 	 On some machines, this sets static data that would make
 	 signal fail to work right when the dumped Emacs is run.  */
-      signal (SIGHUP,  fatal_error_signal);
+#ifdef SIGHUP
+      /* If we've been nohup'ed, keep it that way.  */
+      if (signal (SIGHUP,  fatal_error_signal) == SIG_IGN)
+	signal (SIGHUP, SIG_IGN);
+#endif
+#ifdef SIGQUIT
       signal (SIGQUIT, fatal_error_signal);
+#endif
+#ifdef SIGILL
       signal (SIGILL,  fatal_error_signal);
+#endif
 #ifdef SIGTRAP
       signal (SIGTRAP, fatal_error_signal);
 #endif
@@ -770,7 +778,7 @@
 #endif
     }
 
-#ifndef SIGCHLD
+#if defined(HAVE_UNIX_PROCESSES) && !defined(SIGCHLD)
   init_poll_for_sigchld ();
 #endif
 
--- a/src/specifier.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/specifier.c	Mon Aug 13 10:30:37 2007 +0200
@@ -47,7 +47,7 @@
 
 Lisp_Object Qconsole_type, Qdevice_class;
 
-Lisp_Object Vuser_defined_tags;
+static Lisp_Object Vuser_defined_tags;
 
 typedef struct specifier_type_entry specifier_type_entry;
 struct specifier_type_entry
@@ -63,18 +63,20 @@
 
 specifier_type_entry_dynarr *the_specifier_type_entry_dynarr;
 
-Lisp_Object Vspecifier_type_list;
-
-Lisp_Object Vcached_specifiers;
+static Lisp_Object Vspecifier_type_list;
+
+static Lisp_Object Vcached_specifiers;
 /* Do NOT mark through this, or specifiers will never be GC'd. */
-Lisp_Object Vall_specifiers;
+static Lisp_Object Vall_specifiers;
+
+static Lisp_Object Vreveal_ghoste_specifiers;
 
 /* #### The purpose of this is to check for inheritance loops
    in specifiers that can inherit from other specifiers, but it's
    not yet implemented.
 
    #### Look into this for 19.14. */
-Lisp_Object_dynarr current_specifiers;
+static Lisp_Object_dynarr current_specifiers;
 
 static void recompute_cached_specifier_everywhere (Lisp_Object specifier);
 
@@ -184,8 +186,10 @@
   ((markobj) (specifier->frame_specs));
   ((markobj) (specifier->window_specs));
   ((markobj) (specifier->buffer_specs));
+  ((markobj) (specifier->magic_parent));
   ((markobj) (specifier->fallback));
-  MAYBE_SPECMETH (specifier, mark, (obj, markobj));
+  if (!GHOST_SPECIFIER_P (XSPECIFIER (obj)))
+    MAYBE_SPECMETH (specifier, mark, (obj, markobj));
   return Qnil;
 }
 
@@ -219,13 +223,20 @@
     {
       if (! ((*obj_marked_p) (rest)))
 	{
+	  struct Lisp_Specifier* sp = XSPECIFIER (rest);
+	  /* A bit of assertion that we're removing both parts of the
+             magic one altogether */
+	  assert (!GC_MAGIC_SPECIFIER_P(sp)
+		  || (GC_BODILY_SPECIFIER_P(sp) && (*obj_marked_p)(sp->fallback))
+		  || (GC_GHOST_SPECIFIER_P(sp) && (*obj_marked_p)(sp->magic_parent)));
 	  /* This specifier is garbage.  Remove it from the list. */
 	  if (GC_NILP (prev))
-	    Vall_specifiers = XSPECIFIER (rest)->next_specifier;
+	    Vall_specifiers = sp->next_specifier;
 	  else
-	    XSPECIFIER (prev)->next_specifier =
-	      XSPECIFIER (rest)->next_specifier;
+	    XSPECIFIER (prev)->next_specifier = sp->next_specifier;
 	}
+      else
+	prev = rest;
     }
 }
 
@@ -266,7 +277,7 @@
 {
   struct Lisp_Specifier *sp = (struct Lisp_Specifier *) header;
   /* don't be snafued by the disksave finalization. */
-  if (!for_disksave && sp->caching)
+  if (!for_disksave && !GC_GHOST_SPECIFIER_P(sp) && sp->caching)
     {
       xfree (sp->caching);
       sp->caching = 0;
@@ -293,6 +304,7 @@
      internal_equal (s1->frame_specs,  s2->frame_specs,  depth) &&
      internal_equal (s1->window_specs, s2->window_specs, depth) &&
      internal_equal (s1->buffer_specs, s2->buffer_specs, depth));
+  /* #### Why do not compare fallbacks here? */
 
   if (retval && HAS_SPECMETH_P (s1, equal))
     retval = SPECMETH (s1, equal, (o1, o2, depth - 1));
@@ -320,8 +332,13 @@
 static size_t
 sizeof_specifier (CONST void *header)
 {
-  CONST struct Lisp_Specifier *p = (CONST struct Lisp_Specifier *) header;
-  return sizeof (*p) + p->methods->extra_data_size - 1;
+  if (GHOST_SPECIFIER_P ((struct Lisp_Specifier *) header))
+    return sizeof (struct Lisp_Specifier);
+  else
+    {
+      CONST struct Lisp_Specifier *p = (CONST struct Lisp_Specifier *) header;
+      return sizeof (*p) + p->methods->extra_data_size - 1;
+    }
 }
 
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("specifier", specifier,
@@ -389,13 +406,13 @@
 }
 
 static Lisp_Object
-make_specifier (struct specifier_methods *spec_meths)
+make_specifier_internal (struct specifier_methods *spec_meths,
+			 size_t data_size, int call_create_meth)
 {
   Lisp_Object specifier;
-  struct gcpro gcpro1;
   struct Lisp_Specifier *sp = (struct Lisp_Specifier *)
     alloc_lcrecord (sizeof (struct Lisp_Specifier) +
-		    spec_meths->extra_data_size - 1, lrecord_specifier);
+		    data_size - 1, lrecord_specifier);
 
   sp->methods = spec_meths;
   sp->global_specs = Qnil;
@@ -404,16 +421,48 @@
   sp->window_specs = make_weak_list (WEAK_LIST_KEY_ASSOC);
   sp->buffer_specs = Qnil;
   sp->fallback = Qnil;
+  sp->magic_parent = Qnil;
   sp->caching = 0;
   sp->next_specifier = Vall_specifiers;
 
   XSETSPECIFIER (specifier, sp);
   Vall_specifiers = specifier;
 
-  GCPRO1 (specifier);
-  MAYBE_SPECMETH (XSPECIFIER (specifier), create, (specifier));
+  if (call_create_meth)
+    {
+      struct gcpro gcpro1;
+      GCPRO1 (specifier);
+      MAYBE_SPECMETH (XSPECIFIER (specifier), create, (specifier));
+      UNGCPRO;
+    }
+  return specifier;
+}
+
+static Lisp_Object
+make_specifier (struct specifier_methods *meths)
+{
+  return make_specifier_internal (meths, meths->extra_data_size, 1);
+}
+
+Lisp_Object
+make_magic_specifier (Lisp_Object type)
+{
+  /* This function can GC */
+  struct specifier_methods *meths = decode_specifier_type (type, ERROR_ME);
+  Lisp_Object bodily, ghost;
+  struct gcpro gcpro1;
+
+  bodily = make_specifier (meths);
+  GCPRO1 (bodily);
+  ghost  = make_specifier_internal (meths, 0, 0);
   UNGCPRO;
-  return specifier;
+
+  /* Connect guys together */
+  XSPECIFIER(bodily)->magic_parent = Qt;
+  XSPECIFIER(bodily)->fallback = ghost;
+  XSPECIFIER(ghost)->magic_parent = bodily;
+
+  return bodily;
 }
 
 DEFUN ("make-specifier", Fmake_specifier, 1, 1, 0, /*
@@ -1188,6 +1237,49 @@
   return SPEC_PREPEND;		/* not reached */
 }
 
+/* Given a specifier object SPEC, return its bodily specifier for a
+   ghost specifier, otherwise return the object itself
+*/
+static Lisp_Object
+bodily_specifier (Lisp_Object spec)
+{
+  return (GHOST_SPECIFIER_P (XSPECIFIER (spec))
+	  ? XSPECIFIER(spec)->magic_parent : spec);
+}
+
+/* Given a specifier object SPEC, return a specifier to be operated on
+   by external lisp function. This is a ghost specifier for a magic
+   specifier when and only when Vreveal_ghoste_specifiers is non-nil,
+   otherwise SPEC itself.
+*/
+static Lisp_Object
+maybe_ghost_specifier (Lisp_Object spec)
+{
+  return (!NILP (Vreveal_ghoste_specifiers)
+	  && BODILY_SPECIFIER_P (XSPECIFIER (spec))
+	  ? XSPECIFIER(spec)->fallback : spec);
+}
+
+/* Helper function which unwind protects the value of
+   Vreveal_ghoste_specifiers, then sets it to non-nil value */
+
+static Lisp_Object
+restore_reveal_value (Lisp_Object val)
+{
+  Vreveal_ghoste_specifiers = val;
+  return val;
+}
+
+int
+reveal_ghost_specifiers_protected (void)
+{
+  int depth = specpdl_depth ();
+  record_unwind_protect (restore_reveal_value,
+			 Vreveal_ghoste_specifiers);
+  Vreveal_ghoste_specifiers = Qt;
+  return depth;
+}
+
 /* This gets hit so much that the function call overhead had a
    measurable impact (according to Quantify).  #### We should figure
    out the frequency with which this is called with the various types
@@ -1382,7 +1474,8 @@
     }
 
   if (was_removed)
-    MAYBE_SPECMETH (XSPECIFIER (specifier), after_change, (specifier, locale));
+    MAYBE_SPECMETH (XSPECIFIER (specifier), after_change,
+		    (bodily_specifier (specifier), locale));
 }
 
 static void
@@ -1428,7 +1521,7 @@
 
       if (was_removed)
 	MAYBE_SPECMETH (XSPECIFIER (specifier), after_change,
-			(specifier, XCAR (spec)));
+			(bodily_specifier (specifier), XCAR (spec)));
     }
 }
 
@@ -1502,7 +1595,8 @@
       /* call the will-add method; it may GC */
       sub_inst_list = HAS_SPECMETH_P (sp, going_to_add) ?
 	SPECMETH (sp, going_to_add,
-		  (specifier, locale, tag_set, instantiator)) :
+		  (bodily_specifier (specifier), locale,
+		   tag_set, instantiator)) :
 	Qt;
       if (EQ (sub_inst_list, Qt))
 	/* no change here. */
@@ -1576,7 +1670,8 @@
   UNGCPRO;
 
   /* call the after-change method */
-  MAYBE_SPECMETH (sp, after_change, (specifier, locale));
+  MAYBE_SPECMETH (sp, after_change,
+		  (bodily_specifier (specifier), locale));
 }
 
 static void
@@ -1761,7 +1856,8 @@
 
   inst_list = list1 (Fcons (tag_set, instantiator));
   GCPRO1 (inst_list);
-  specifier_add_spec (specifier, locale, inst_list, add_meth);
+  specifier_add_spec (maybe_ghost_specifier (specifier),
+		      locale, inst_list, add_meth);
   recompute_cached_specifier_everywhere (specifier);
   RETURN_UNGCPRO (Qnil);
 }
@@ -1812,12 +1908,24 @@
       Lisp_Object locale    = XCAR (specification);
       Lisp_Object inst_list = XCDR (specification);
 
-      specifier_add_spec (specifier, locale, inst_list, add_meth);
+      specifier_add_spec (maybe_ghost_specifier (specifier),
+			  locale, inst_list, add_meth);
     }
   recompute_cached_specifier_everywhere (specifier);
   return Qnil;
 }
 
+void
+add_spec_to_ghost_specifier (Lisp_Object specifier, Lisp_Object instantiator,
+			     Lisp_Object locale, Lisp_Object tag_set,
+			     Lisp_Object how_to_add)
+{
+  int depth = reveal_ghost_specifiers_protected ();
+  Fadd_spec_to_specifier (specifier, instantiator, locale,
+			  tag_set, how_to_add);
+  unbind_to (depth, Qnil);
+}
+
 struct specifier_spec_list_closure
 {
   Lisp_Object head, tail;
@@ -1905,7 +2013,8 @@
   CHECK_SPECIFIER (specifier);
   cl.head = cl.tail = Qnil;
   GCPRO2 (cl.head, cl.tail);
-  map_specifier (specifier, locale, specifier_spec_list_mapfun,
+  map_specifier (maybe_ghost_specifier (specifier),
+		 locale, specifier_spec_list_mapfun,
 		 tag_set, exact_p, &cl);
   UNGCPRO;
   return cl.head;
@@ -1949,7 +2058,8 @@
       tag_set = decode_specifier_tag_set (tag_set);
       tag_set = canonicalize_tag_set (tag_set);
       RETURN_UNGCPRO
-	(specifier_get_external_inst_list (specifier, locale,
+	(specifier_get_external_inst_list (maybe_ghost_specifier (specifier),
+					   locale,
 					   locale_type_from_locale (locale),
 					   tag_set, !NILP (exact_p),
 					   1, 1));
@@ -1999,12 +2109,21 @@
        (specifier, locale, tag_set, exact_p))
 {
   CHECK_SPECIFIER (specifier);
-  map_specifier (specifier, locale, remove_specifier_mapfun, tag_set,
-		 exact_p, 0);
+  map_specifier (maybe_ghost_specifier (specifier), locale,
+		 remove_specifier_mapfun, tag_set, exact_p, 0);
   recompute_cached_specifier_everywhere (specifier);
   return Qnil;
 }
 
+void
+remove_ghost_specifier (Lisp_Object specifier, Lisp_Object locale,
+			Lisp_Object tag_set, Lisp_Object exact_p)
+{
+  int depth = reveal_ghost_specifiers_protected ();
+  Fremove_specifier (specifier, locale, tag_set, exact_p);
+  unbind_to (depth, Qnil);
+}
+
 struct copy_specifier_closure
 {
   Lisp_Object dest;
@@ -2089,10 +2208,10 @@
 
   cl.dest = dest;
   GCPRO1 (dest);
-  map_specifier (specifier, locale, copy_specifier_mapfun,
-		 tag_set, exact_p, &cl);
+  map_specifier (maybe_ghost_specifier (specifier), locale,
+		 copy_specifier_mapfun, tag_set, exact_p, &cl);
   UNGCPRO;
-  recompute_cached_specifier_everywhere (specifier);
+  recompute_cached_specifier_everywhere (dest);
   return dest;
 }
 
@@ -2185,9 +2304,13 @@
 	  !NILP (Fvalid_inst_list_p (fallback, Fspecifier_type (specifier))));
   if (SPECIFIERP (fallback))
     assert (EQ (Fspecifier_type (specifier), Fspecifier_type (fallback)));
-  sp->fallback = fallback;
+  if (BODILY_SPECIFIER_P (sp))
+    GHOST_SPECIFIER(sp)->fallback = fallback;
+  else
+    sp->fallback = fallback;
   /* call the after-change method */
-  MAYBE_SPECMETH (sp, after_change, (specifier, Qfallback));
+  MAYBE_SPECMETH (sp, after_change,
+		  (bodily_specifier (specifier), Qfallback));
   recompute_cached_specifier_everywhere (specifier);
 }
 
@@ -2458,7 +2581,8 @@
   CHECK_SPECIFIER (specifier);
   domain = decode_domain (domain);
 
-  instance = specifier_instance (specifier, Qunbound, domain, ERROR_ME, 0,
+  instance = specifier_instance (maybe_ghost_specifier (specifier),
+				 Qunbound, domain, ERROR_ME, 0,
 				 !NILP (no_fallback), Qzero);
   return UNBOUNDP (instance) ? default_ : instance;
 }
@@ -2495,8 +2619,9 @@
 				   ERROR_ME);
   domain = decode_domain (domain);
 
-  instance = specifier_instance (specifier, matchspec, domain, ERROR_ME, 0,
-				 !NILP (no_fallback), Qzero);
+  instance = specifier_instance (maybe_ghost_specifier (specifier),
+				 matchspec, domain, ERROR_ME,
+				 0, !NILP (no_fallback), Qzero);
   return UNBOUNDP (instance) ? default_ : instance;
 }
 
@@ -2519,11 +2644,12 @@
   check_valid_domain (domain);
   check_valid_inst_list (inst_list, sp->methods, ERROR_ME);
   GCPRO1 (built_up_list);
-  built_up_list = build_up_processed_list (specifier, domain, inst_list);
+  built_up_list = build_up_processed_list (maybe_ghost_specifier (specifier),
+					   domain, inst_list);
   if (!NILP (built_up_list))
-    val = specifier_instance_from_inst_list (specifier, Qunbound, domain,
-					     built_up_list, ERROR_ME, 0,
-					     Qzero);
+    val = specifier_instance_from_inst_list (maybe_ghost_specifier (specifier),
+					     Qunbound, domain, built_up_list,
+					     ERROR_ME, 0, Qzero);
   UNGCPRO;
   return UNBOUNDP (val) ? default_ : val;
 }
@@ -2553,11 +2679,12 @@
   check_valid_domain (domain);
   check_valid_inst_list (inst_list, sp->methods, ERROR_ME);
   GCPRO1 (built_up_list);
-  built_up_list = build_up_processed_list (specifier, domain, inst_list);
+  built_up_list = build_up_processed_list (maybe_ghost_specifier (specifier),
+					   domain, inst_list);
   if (!NILP (built_up_list))
-    val = specifier_instance_from_inst_list (specifier, matchspec, domain,
-					     built_up_list, ERROR_ME, 0,
-					     Qzero);
+    val = specifier_instance_from_inst_list (maybe_ghost_specifier (specifier),
+					     matchspec, domain, built_up_list,
+					     ERROR_ME, 0, Qzero);
   UNGCPRO;
   return UNBOUNDP (val) ? default_ : val;
 }
@@ -2584,6 +2711,7 @@
 			Lisp_Object oldval))
 {
   struct Lisp_Specifier *sp = XSPECIFIER (specifier);
+  assert (!GHOST_SPECIFIER_P (sp));
 
   if (!sp->caching)
     sp->caching = xnew_and_zero (struct specifier_caching);
@@ -2592,6 +2720,8 @@
   sp->caching->offset_into_struct_frame = struct_frame_offset;
   sp->caching->value_changed_in_frame = value_changed_in_frame;
   Vcached_specifiers = Fcons (specifier, Vcached_specifiers);
+  if (BODILY_SPECIFIER_P (sp))
+    GHOST_SPECIFIER(sp)->caching = sp->caching;
   recompute_cached_specifier_everywhere (specifier);
 }
 
@@ -2602,6 +2732,8 @@
   Lisp_Object window;
   Lisp_Object newval, *location;
 
+  assert (!GHOST_SPECIFIER_P (XSPECIFIER (specifier)));
+
   XSETWINDOW (window, w);
 
   newval = specifier_instance (specifier, Qunbound, window, ERROR_ME_WARN,
@@ -2628,6 +2760,8 @@
   Lisp_Object frame;
   Lisp_Object newval, *location;
 
+  assert (!GHOST_SPECIFIER_P (XSPECIFIER (specifier)));
+
   XSETFRAME (frame, f);
 
   newval = specifier_instance (specifier, Qunbound, frame, ERROR_ME_WARN,
@@ -2689,6 +2823,8 @@
 {
   Lisp_Object frmcons, devcons, concons;
 
+  specifier = bodily_specifier (specifier);
+
   if (!XSPECIFIER (specifier)->caching)
     return;
 
@@ -2993,4 +3129,7 @@
 
   Vuser_defined_tags = Qnil;
   staticpro (&Vuser_defined_tags);
+
+  Vreveal_ghoste_specifiers = Qnil;
+  staticpro (&Vreveal_ghoste_specifiers);
 }
--- a/src/specifier.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/specifier.h	Mon Aug 13 10:30:37 2007 +0200
@@ -24,6 +24,66 @@
 #ifndef _XEMACS_SPECIFIER_H_
 #define _XEMACS_SPECIFIER_H_
 
+/*
+  MAGIC SPECIFIERS
+  ================
+
+  Magic specifiers are used to provide fallback values for window
+  system provided specifications, reflecting user preferences on the
+  window system, such as default fonts, colors, scrollbar thickness
+  etc.
+
+  A magic specifier consists of two specifier objects. The first one
+  behaves like a normal specifier in all sences. The second one, a
+  ghost specifier, is a fallback value for the first one.
+
+  Ghost specifiers have the following properties:
+  - Have back pointers to their parent specifiers.
+  - Do not have instance data. Instead, they share parent's instance
+    data.
+  - Have the same methods structure pointer.
+  - Share parent's caching scheme.
+  - Store fallback value instead of their parent.
+
+  Ghost specifiers normally are not modifiable at the lisp level, and
+  only used to supply fallback instance values. Although, under
+  certain rare conditions, all functions that modify specifiers
+  operate on ghost objects. This behavior is controlled by the global
+  variable Vreveal_ghoste_specifiers. It is not exposed to lisp, and
+  is set during calls to lisp functions which initialize global,
+  device and frame defaults, such as
+  init-{global,frame,device}-{faces,toolbars,etc}.
+
+  Thus, values supplied by resources or other means of a window system 
+  stored in externally unmodifiable ghost objects. Regular lisp code
+  may thus freely modify the normal part of a magic specifier, and
+  removing a specification for a particular domain causes the
+  specification to consider ghost-provided fallback values, or its own 
+  fallback value.
+
+  Rules of conduct for magic specifiers
+  -------------------------------------
+  1. All functions exposed to lisp operate on a ghost specifier when
+     Vreveal_ghoste_specifiers is non-nil. This includes both
+     modifying and non-modifying functions, such as
+     Fspecifier_instance, for symmetry and consistency.
+  2. These functions deal with the above condition internally, passing 
+     mangled specifier pointer to internal functions. The internal
+     functions always work on a specifier passed, and do not regard
+     the value of Vreveal_ghoste_specifiers.
+  3. recompute_*() functions always operate on the whole specifier
+     when passed only a ghost object, by substituting it with their
+     parent bodily object.
+  4. All specifier methods, except for instantiate method, are passed
+     the bodily object of the magic specifier. Instantiate method is
+     passed the specifier being instantiated.
+  5. Only bodily objects are passed to set_specifier_caching function, 
+     and only these may be cached.
+  6. All specifiers are added to Vall_specifiers list, both bodily and 
+     ghost. The pair of objects is always removed from the list at the 
+     same time.
+*/
+
 struct specifier_methods
 {
   CONST char *name;
@@ -31,21 +91,36 @@
 
   /* Implementation specific methods: */
 
-  /* #### Document me */
-  /* Create method */
+  /* Create method: Initialize specifier data. Optional. */
   void (*create_method) (Lisp_Object specifier);
-  /* Mark method */
+
+  /* Mark method: Mark any lisp object within specifier data
+     structure. Not required if no specifier data are Lisp_Objects. */
   void (*mark_method) (Lisp_Object specifier, void (*markobj) (Lisp_Object));
-  /* Equal method */
+
+  /* Equal method: Compare two specifiers. This is called after
+     ensuring that the two specifiers are of the same type, and habe
+     the same specs.  Quit is inhibited during the call so it is safe
+     to call internal_equal().
+
+     If this function is not present, specifiers considered equal when
+     the above conditions are met, i.e. as if the method returned
+     non-zero. */
   int (*equal_method) (Lisp_Object sp1, Lisp_Object sp2, int depth);
-  /* Hash method */
+
+  /* Hash method: Hash specifier instance data. This has to hash only
+    data structure of the specifier, as specs are hashed by the core
+    code.
+
+     If this function is not present, hashing behaves as if it
+     returned zero. */
   unsigned long (*hash_method) (Lisp_Object specifier, int depth);
 
   /* Validate method: Given an instantiator, verify that it's
      valid for this specifier type.  If not, signal an error.
 
-     If this function is not present, all instantiators are
-     considered valid. */
+     If this function is not present, all instantiators are considered
+     valid. */
   void (*validate_method) (Lisp_Object instantiator);
 
   /* Validate-matchspec method: Given a matchspec, verify that it's
@@ -55,15 +130,33 @@
      valid.  Note that this differs from validate_method(). */
   void (*validate_matchspec_method) (Lisp_Object matchspec);
 
-  /* Instantiate method */
+  /* Instantiate method: Return SPECIFIER instance in DOMAIN,
+     specified by INSTANTIATOR.  MATCHSPEC specifies an additional
+     constraints on the instance value (see the docstring for
+     Fspecifier_matching_instance function). MATCHSPEC is passed
+     Qunbound when no matching constraints are imposed. The method is
+     called via call_with_suspended_errors(), so allowed to eval
+     safely.
+
+     DEPTH is a lisp integer denoting current depth of instantiation
+     calls.  #### WTF a method can do with this?
+
+     This method must presume that both INSTANTIATOR and MATCSPEC are
+     already validated by the corresponding validate_* methods, and
+     may abort if they are invalid.
+
+     Return value is an instance, which is returned immediately to the
+     caller, or Qunbound to continue instantiation lookup chain.
+
+     If this function is not present, INSTANTIATOR is used as the
+     specifier instance.  This is the usual case for "simple"
+     specifiers, like integer and boolean. */
   Lisp_Object (*instantiate_method) (Lisp_Object specifier,
 				     Lisp_Object matchspec,
 				     Lisp_Object domain,
 				     Lisp_Object instantiator,
-				     /* always an integer, but encapsulated
-					as a Lisp_Object so it can be called
-					from call_with_suspended_errors() */
 				     Lisp_Object depth);
+
   /* Going-to-add method: Called when an instantiator is about
      to be added to a specifier.  This function can specify
      that different instantiators should be used instead by
@@ -72,13 +165,21 @@
      instantiator has been copied with copy-tree, so feel
      free to reuse parts of it to create a new instantiator.
      The tag-set, however, is not copied and is not canonicalized
-     (that will be done on the result of this function).
-     */
+     (that will be done on the result of this function). */
   Lisp_Object (*going_to_add_method) (Lisp_Object specifier,
 				      Lisp_Object locale,
 				      Lisp_Object tag_set,
 				      Lisp_Object instantiator);
-  /* After-change method */
+
+  /* After-change method: Called when the SPECIFIER has just been
+     changed in LOCALE.  The method is called upon:
+     * Removing and adding specs to/from the specifier;
+     * Changing the specifier fallback.
+
+     #### The method may have called more than once per each specifier
+     change.
+
+     #### Do not still know if this can safely eval. */
   void (*after_change_method) (Lisp_Object specifier,
 			       Lisp_Object locale);
 
@@ -111,7 +212,16 @@
   Lisp_Object buffer_specs;
 
   struct specifier_caching *caching;
+
+  /* This can be either nil, for a plain, non-magic specifier object,
+     t for the normal part of the magic specifier, or #<specifier> for
+     the ghost part of the magic specifier, a pointer to its parent
+     object */
+  Lisp_Object magic_parent;
+  
+  /* Fallback value. For magic specifiers, it is a pointer to the ghost. */
   Lisp_Object fallback;
+
   /* type-specific extra data attached to a specifier */
   char data[1];
 };
@@ -147,6 +257,13 @@
 INLINE struct type##_specifier *					\
 error_check_##type##_specifier_data (struct Lisp_Specifier *sp)		\
 {									\
+  if (SPECIFIERP (sp->magic_parent))					\
+    {									\
+      assert (SPECIFIER_TYPE_P (sp, type));				\
+      sp = XSPECIFIER (sp->magic_parent);				\
+    }									\
+  else									\
+    assert (NILP (sp->magic_parent) || EQ (sp->magic_parent, Qt));	\
   assert (SPECIFIER_TYPE_P (sp, type));					\
   return (struct type##_specifier *) sp->data;				\
 }									\
@@ -183,12 +300,35 @@
 #define SPECIFIER_TYPE_P(sp, type) \
   ((sp)->methods == type##_specifier_methods)
 
+/* Any of the two of the magic spec */
+#define MAGIC_SPECIFIER_P(sp) \
+  (!NILP((sp)->magic_parent))
+/* Normal part of the magic specifier */
+#define BODILY_SPECIFIER_P(sp) \
+  (EQ ((sp)->magic_parent, Qt))
+/* Ghost part of the magic specifier */
+#define GHOST_SPECIFIER_P(sp) \
+  (SPECIFIERP((sp)->magic_parent))
+/* The same three, when used in GC */
+#define GC_MAGIC_SPECIFIER_P(sp) \
+  (!GC_NILP((sp)->magic_parent))
+#define GC_BODILY_SPECIFIER_P(sp) \
+  (GC_EQ ((sp)->magic_parent, Qt))
+#define GC_GHOST_SPECIFIER_P(sp) \
+  (GC_SPECIFIERP((sp)->magic_parent))
+
+#define GHOST_SPECIFIER(sp) \
+  (XSPECIFIER ((sp)->fallback))
+
 #ifdef ERROR_CHECK_TYPECHECK
 # define SPECIFIER_TYPE_DATA(sp, type) \
    error_check_##type##_specifier_data (sp)
 #else
-# define SPECIFIER_TYPE_DATA(sp, type) \
-  ((struct type##_specifier *) (sp)->data)
+# define SPECIFIER_TYPE_DATA(sp, type)		\
+  ((struct type##_specifier *)			\
+    (GHOST_SPECIFIER_P(sp)			\
+     ? XSPECIFIER((sp)->magic_parent)->data	\
+     : (sp)->data))
 #endif
 
 /* #### Need to create ERROR_CHECKING versions of these. */
@@ -250,6 +390,7 @@
 
 extern Lisp_Object Qfallback, Qnatnum;
 
+Lisp_Object make_magic_specifier (Lisp_Object type);
 Lisp_Object decode_locale_list (Lisp_Object locale);
 extern enum spec_add_meth
 decode_how_to_add_specification (Lisp_Object how_to_add);
@@ -271,6 +412,16 @@
 void recompute_all_cached_specifiers_in_window (struct window *w);
 void recompute_all_cached_specifiers_in_frame (struct frame *f);
 
+/* Counterparts of Fadd_spec_to_specifier and Fremove_specifier,
+   which operate directly on ghost objects */
+void add_spec_to_ghost_specifier (Lisp_Object specifier, Lisp_Object instantiator,
+				  Lisp_Object locale, Lisp_Object tag_set,
+				  Lisp_Object how_to_add);
+void remove_ghost_specifier (Lisp_Object specifier, Lisp_Object locale,
+			     Lisp_Object tag_set, Lisp_Object exact_p);
+
+int reveal_ghost_specifiers_protected (void);
+
 void cleanup_specifiers (void);
 void prune_specifiers (int (*obj_marked_p) (Lisp_Object));
 void setup_device_initial_specifier_tags (struct device *d);
--- a/src/symsinit.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/symsinit.h	Mon Aug 13 10:30:37 2007 +0200
@@ -122,6 +122,7 @@
 void syms_of_rangetab (void);
 void syms_of_redisplay (void);
 void syms_of_scrollbar (void);
+void syms_of_scrollbar_mswindows(void);
 void syms_of_search (void);
 void syms_of_select_mswindows (void);
 void syms_of_signal (void);
--- a/src/sysdll.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/sysdll.c	Mon Aug 13 10:30:37 2007 +0200
@@ -44,184 +44,245 @@
 #include <dlfcn.h>
 
 #ifndef RTLD_LAZY
-#define RTLD_LAZY 1
+# define RTLD_LAZY 1
 #endif /* RTLD_LAZY isn't defined under FreeBSD - ick */
 
 #ifndef RTLD_GLOBAL
-#define RTLD_GLOBAL 0
+# define RTLD_GLOBAL 0
 #endif
 
-int dll_init(CONST char *arg) {
-  return(0);
+int
+dll_init (CONST char *arg)
+{
+  return 0;
 }
 
-dll_handle dll_open(CONST char *fname) {
-  return((dll_handle)dlopen(fname,RTLD_LAZY|RTLD_GLOBAL));
+dll_handle
+dll_open (CONST char *fname)
+{
+  return (dll_handle)dlopen (fname, RTLD_LAZY | RTLD_GLOBAL);
 }
 
-int dll_close(dll_handle h) {
-  return(dlclose((void *)h));
+int
+dll_close (dll_handle h)
+{
+  return dlclose((void *)h);
 }
 
-dll_func dll_function(dll_handle h,CONST char *n) {
+dll_func
+dll_function (dll_handle h, CONST char *n)
+{
 #ifdef DLSYM_NEEDS_UNDERSCORE
-    char buf[1024];
-    *buf = '_';
-    (void)strcpy(buf + 1, n);
-    n = buf;
+  char *buf = alloca_array (char, strlen (n) + 2);
+  *buf = '_';
+  (void)strcpy(buf + 1, n);
+  n = buf;
 #endif
-  return((dll_func)dlsym((void *)h,n));
+  return (dll_func)dlsym ((void *)h, n);
 }
 
-dll_var dll_variable(dll_handle h,CONST char *n) {
-  return((dll_var)dlsym((void *)h,n));
+dll_var
+dll_variable (dll_handle h, CONST char *n)
+{
+  return (dll_var)dlsym ((void *)h, n);
 }
 
-CONST char *dll_error(dll_handle h) {
+CONST char *
+dll_error (dll_handle h)
+{
 #ifdef HAVE_DLERROR
-  return((CONST char *)dl_error());
+  return (CONST char *)dlerror ();
 #else
-  return("Shared library error");
+  return "Shared library error";
 #endif
 }
 
 #elif defined(HAVE_SHL_LOAD)
 /* This is the HP/UX version */
 #include <dl.h>
-int dll_init(CONST char *arg) {
-  return(0);
+int
+dll_init (CONST char *arg)
+{
+  return 0;
 }
 
-dll_handle dll_open(CONST char *fname) {
-  shl_t h = shl_load(fname,BIND_DEFERRED,0L);
+dll_handle
+dll_open (CONST char *fname)
+{
+  shl_t h = shl_load (fname, BIND_DEFERRED,0L);
   shl_t *hp = NULL;
 
-  if (h) {
-    hp = (shl_t *)malloc(sizeof(shl_t));
-    if (!hp) {
-      shl_unload(h);
-    } else {
-      *hp = h;
+  if (h)
+    {
+      hp = (shl_t *)malloc (sizeof (shl_t));
+      if (!hp)
+	shl_unload(h);
+      else
+	*hp = h;
     }
-  }
-  return((dll_handle)hp);
+  return (dll_handle)hp;
 }
 
-int dll_close(dll_handle h) {
+int
+dll_close (dll_handle h)
+{
   shl_t hp = *((shl_t *)h);
-  free(hp);
-  return (shl_unload(h));
+  free (hp);
+  return shl_unload(h);
 }
 
-dll_func dll_function(dll_handle h,CONST char *n) {
+dll_func
+dll_function (dll_handle h, CONST char *n)
+{
   long handle = 0L;
 
-  if (shl_findsym((shl_t *)h,n,TYPE_PROCEDURE,&handle))
-    return(NULL);
+  if (shl_findsym ((shl_t *)h, n, TYPE_PROCEDURE, &handle))
+    return NULL;
 
-  return((dll_func)handle);
+  return (dll_func)handle;
 }
 
-dll_var dll_variable(dll_handle h,CONST char *n) {
+dll_var
+dll_variable (dll_handle h, CONST char *n)
+{
   long handle = 0L;
 
-  if (shl_findsym((shl_t *)h,n,TYPE_DATA,&handle))
-    return(NULL);
+  if (shl_findsym ((shl_t *)h, n, TYPE_DATA, &handle))
+    return NULL;
 
-  return((dll_var)handle);
+  return (dll_var)handle;
 }
 
-CONST char *dll_error(dll_handle h) {
-  return("Generic shared library error");
+CONST char *
+dll_error (dll_handle h)
+{
+  /* #### WTF?!  Shouldn't this at least attempt to get strerror or
+     something?  --hniksic */
+  return "Generic shared library error";
 }
 
 #elif defined(HAVE_INIT_DLD)
 #include <dld.h>
-int dll_init(CONST char *arg) {
-  char *real_exe = dld_find_executable(arg);
+int
+dll_init (CONST char *arg)
+{
+  char *real_exe = dld_find_executable (arg);
   int rc;
 
-  rc = dld_init(real_exe);
-  if (rc) {
-    dld_perror (exe);
-    return(-1);
-  }
-  return(0);
+  rc = dld_init (real_exe);
+  if (rc)
+    {
+      dld_perror (exe);
+      return -1;
+    }
+  return 0;
 }
 
-dll_handle dll_open(CONST char *fname) {
-  rc = dld_link(fname);
-  if (rc) {
-    return (NULL);
-  }
-  return((dll_handle)1);
+dll_handle
+dll_open (CONST char *fname)
+{
+  rc = dld_link (fname);
+  if (rc)
+    return NULL;
+
+  return (dll_handle)1;
 }
 
-int dll_close(dll_handle h) {
+int
+dll_close (dll_handle h)
+{
   /* *sigh* DLD is pretty lame and doesn't return a handle that you can use
   ** later on to free the file - you have to remember the filename and
   ** use that as the unlinker.  We should eventually keep a linked list
   ** of loaded modules and then use the node pointer as the unique id
   ** for the shared library.  Wheeee.  But not now.
   */
-  return(1);
+  return 1;
 }
 
-DLL_FUNC dll_function(dll_handle h,CONST char *n) {
-  return (dld_get_func(n));
+DLL_FUNC
+dll_function (dll_handle h, CONST char *n)
+{
+  return dld_get_func(n);
 }
 
-DLL_FUNC dll_variable(dll_handle h,CONST char *n) {
-  return (dld_get_symbol(n));
+DLL_FUNC
+dll_variable (dll_handle h, CONST char *n)
+{
+  return dld_get_symbol(n);
 }
 #elif defined(_WINDOWS) || defined(WIN32)
-int dll_init(CONST char *arg) {
-  return(0);
+int
+dll_init (CONST char *arg)
+{
+  return 0;
 }
 
-dll_handle dll_open(CONST char *fname) {
-  return((dll_handle)LoadLibrary(fname));
+dll_handle
+dll_open (CONST char *fname)
+{
+  return (dll_handle)LoadLibrary (fname);
 }
 
-int dll_close(dll_handle h) {
-  return(FreeLibrary(h));
+int
+dll_close (dll_handle h)
+{
+  return FreeLibrary (h);
 }
 
-dll_func dll_function(dll_handle h,CONST char *n) {
-  return((dll_func)GetProcAddress(h,n));
+dll_func
+dll_function (dll_handle h, CONST char *n)
+{
+  return (dll_func)GetProcAddress (h,n);
 }
 
-dll_func dll_variable(dll_handle h,CONST char *n) {
-  return((dll_func)GetProcAddress(h,n));
+dll_func
+dll_variable (dll_handle h, CONST char *n)
+{
+  return (dll_func)GetProcAddress (h,n);
 }
 
-CONST char *dll_error(dll_handle h) {
-  return("Windows DLL Error");
+CONST char *
+dll_error (dll_handle h)
+{
+  return "Windows DLL Error";
 }
 #else
 /* Catchall if we don't know about this systems method of dynamic loading */
-int dll_init(CONST char *arg) {
-  return(-1);
+int
+dll_init (CONST char *arg)
+{
+  return -1;
 }
 
-dll_handle dll_open(CONST char *fname) {
-  return(NULL);
+dll_handle
+dll_open (CONST char *fname)
+{
+  return NULL;
 }
 
-int dll_close(dll_handle h) {
-  return(0);
+int
+dll_close (dll_handle h)
+{
+  return 0;
 }
 
-dll_func dll_function(dll_handle h,CONST char *n) {
-  return(NULL);
+dll_func
+dll_function (dll_handle h, CONST char *n)
+{
+  return NULL;
 }
 
-dll_func dll_variable(dll_handle h,CONST char *n) {
-  return(NULL);
+dll_func
+dll_variable (dll_handle h, CONST char *n)
+{
+  return NULL;
 }
 
-CONST char *dll_error(dll_handle h) {
-  return("Shared libraries not implemented on this system.");
+CONST char *
+dll_error (dll_handle h)
+{
+  return "Shared libraries not implemented on this system";
 }
 #endif /* System conditionals */
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/toolbar-msw.c	Mon Aug 13 10:30:37 2007 +0200
@@ -0,0 +1,367 @@
+/* toolbar implementation -- mswindows interface.
+   Copyright (C) 1998 Free Software Foundation.
+
+This file is part of XEmacs.
+
+XEmacs 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.
+
+XEmacs is distributed in the hope that it will be useful, 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.
+
+You should have received a copy of the GNU General Public License
+along with XEmacs; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.  */
+
+/* This implementation by Andy Piper <andyp@parallax.co.uk>, with bits
+   borrowed from toolbar-x.c */
+
+/* Synched up with: Not in FSF. */
+
+#include <config.h>
+#include "lisp.h"
+
+#include "faces.h"
+#include "frame.h"
+#include "toolbar.h"
+#include "window.h"
+#include "gui.h"
+#include "console-msw.h"
+#include "glyphs-msw.h"
+#include "objects-msw.h"
+
+/* Why did Kirill choose this range ? */
+#define TOOLBAR_ITEM_ID_MIN 0x4000
+#define TOOLBAR_ITEM_ID_MAX 0x7FFF
+#define TOOLBAR_ITEM_ID_BITS(x) (((x) & 0x3FFF) | 0x4000)
+#ifndef TB_SETIMAGELIST
+#define TB_SETIMAGELIST (WM_USER + 48)
+#define TB_GETIMAGELIST (WM_USER + 49)
+#endif
+
+#define SET_TOOLBAR_WAS_VISIBLE_FLAG(frame, pos, flag)			\
+  do {									\
+    switch (pos)							\
+      {									\
+      case TOP_TOOLBAR:							\
+	(frame)->top_toolbar_was_visible = flag;			\
+	break;								\
+      case BOTTOM_TOOLBAR:						\
+	(frame)->bottom_toolbar_was_visible = flag;			\
+	break;								\
+      case LEFT_TOOLBAR:						\
+	(frame)->left_toolbar_was_visible = flag;			\
+	break;								\
+      case RIGHT_TOOLBAR:						\
+	(frame)->right_toolbar_was_visible = flag;			\
+	break;								\
+      default:								\
+	abort ();							\
+      }									\
+  } while (0)
+
+static int
+allocate_toolbar_item_id (struct frame* f, struct toolbar_button* button)
+{
+  /* hmm what do we generate an id based on */
+  int id = TOOLBAR_ITEM_ID_BITS (internal_hash (button->callback, 0));
+  while (!NILP (Fgethash (make_int (id),
+			  FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f), Qnil)))
+    {
+      id = TOOLBAR_ITEM_ID_BITS (id + 1);
+    }
+  return id;
+}
+
+static void
+mswindows_clear_toolbar (struct frame *f, enum toolbar_pos pos,
+			 int thickness_change)
+{
+  HIMAGELIST ilist=NULL;
+  if (FRAME_MSWINDOWS_TOOLBAR (f))
+    {
+      /* get the image list and delete it */
+      SendMessage (FRAME_MSWINDOWS_TOOLBAR (f), 
+		   TB_GETIMAGELIST, 0, 
+		   (LONG) &ilist);
+      
+      /* destroy the toolbar window */
+      DestroyWindow (FRAME_MSWINDOWS_TOOLBAR (f));
+      FRAME_MSWINDOWS_TOOLBAR (f) = 0;
+      
+      /* finally get rid of the image list assuming it clears up its
+         bitmaps */
+      if (ilist)
+	{
+	  ImageList_Destroy(ilist);
+	}
+    }
+}
+
+static void
+mswindows_output_toolbar (struct frame *f, enum toolbar_pos pos)
+{
+  int x, y, bar_width, bar_height, vert;
+  int width=-1, height=-1, bmwidth=-1, bmheight=-1;
+  int border_width = FRAME_REAL_TOOLBAR_BORDER_WIDTH (f, pos);
+  Lisp_Object button, window, glyph, instance;
+  int nbuttons=0;
+  struct window *w;
+  TBBUTTON* button_tbl, *tbbutton;
+  HIMAGELIST ilist=NULL;
+
+  get_toolbar_coords (f, pos, &x, &y, &bar_width, &bar_height, &vert, 0);
+  window = FRAME_LAST_NONMINIBUF_WINDOW (f);
+  w = XWINDOW (window);
+
+  /* set button sizes based on bar size */
+  if (vert)
+    {
+      width = height = bar_width - border_width * 2;
+      bmwidth = bmheight = width -2;
+    }
+  else
+    {
+      height = width = bar_height - border_width * 2;
+      bmwidth = bmheight = width -2;
+    }
+
+  button = FRAME_TOOLBAR_DATA (f, pos)->toolbar_buttons;
+
+  /* First loop over all of the buttons to determine how many there
+     are. This loop will also make sure that all instances are
+     instantiated so when we actually output them they will come up
+     immediately. */
+  while (!NILP (button))
+    {
+      struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
+      button = tb->next;
+      nbuttons++;
+    }
+
+  /* build up the data required by win32 fns. */
+  button_tbl = xnew_array_and_zero (TBBUTTON, nbuttons);
+  button = FRAME_TOOLBAR_DATA (f, pos)->toolbar_buttons;
+  tbbutton = button_tbl;
+
+  while (!NILP (button))
+    {
+      struct toolbar_button *tb = XTOOLBAR_BUTTON (button);
+
+      tbbutton->idCommand = allocate_toolbar_item_id (f, tb);
+      tbbutton->fsState=tb->enabled ? TBSTATE_ENABLED : TBSTATE_INDETERMINATE;
+      tbbutton->fsStyle=tb->blank ? TBSTYLE_SEP : TBSTYLE_BUTTON;
+      tbbutton->dwData=0; 
+      tbbutton->iString=0;
+      
+      /* mess with the button image */
+      glyph = get_toolbar_button_glyph (w, tb);
+
+      if (GLYPHP (glyph))
+	instance = glyph_image_instance (glyph, window, ERROR_ME_NOT, 1);
+      else
+	instance = Qnil;
+
+      if (IMAGE_INSTANCEP (instance))
+	{
+	  struct Lisp_Image_Instance* p = XIMAGE_INSTANCE (instance);
+
+	  if (IMAGE_INSTANCE_PIXMAP_TYPE_P (p))
+	    {
+	      /* we are going to honour the toolbar settings and
+		 resize the bitmaps accordingly */
+	      
+	      if ((IMAGE_INSTANCE_PIXMAP_WIDTH (p) != bmwidth
+		   ||
+		   IMAGE_INSTANCE_PIXMAP_HEIGHT (p) != bmheight)
+		  &&
+		  !mswindows_resize_dibitmap_instance (p, f, 
+						       bmwidth, bmheight))
+		{
+		  xfree (button_tbl);
+		  if (ilist) ImageList_Destroy (ilist);
+		  signal_simple_error ("couldn't resize pixmap", 
+				       instance);
+		}
+	      
+	      /* need to build an image list for the bitmaps */
+	      if (!ilist)
+		{
+		  if (!(ilist = ImageList_Create 
+			( IMAGE_INSTANCE_PIXMAP_WIDTH (p),
+			  IMAGE_INSTANCE_PIXMAP_HEIGHT (p),
+			  ILC_COLOR24, 	
+			  nbuttons,
+			  nbuttons * 2 )))
+		    {
+		      xfree (button_tbl);
+		      signal_simple_error ("couldn't create image list",
+					   instance);
+		    }
+		}
+  
+	      /* add a bitmap to the list */
+	      if ((tbbutton->iBitmap =
+		   ImageList_Add (ilist, 
+				  IMAGE_INSTANCE_MSWINDOWS_BITMAP (p),
+				  IMAGE_INSTANCE_MSWINDOWS_MASK (p))) < 0)
+		{
+		  xfree (button_tbl);
+		  if (ilist) ImageList_Destroy (ilist);
+		  signal_simple_error ("image list creation failed", 
+				       instance);
+		}
+	    }
+	}
+
+      Fputhash (make_int (tbbutton->idCommand), 
+		tb->callback, FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f));
+      
+      tbbutton++;
+      button = tb->next;
+    }
+
+  button = FRAME_TOOLBAR_DATA (f, pos)->toolbar_buttons;
+
+  /* now create the toolbar ... */
+  if ((FRAME_MSWINDOWS_TOOLBAR (f) =
+       CreateToolbarEx (FRAME_MSWINDOWS_HANDLE (f),
+			TBSTYLE_ALTDRAG | WS_CHILD,
+			NULL,
+			nbuttons, 	
+			0,
+			0, 	
+			button_tbl,
+			nbuttons, 	
+			width, height,
+			bmwidth, bmheight, 	
+			sizeof(TBBUTTON) )) == NULL)
+    {
+      xfree (button_tbl);
+      ImageList_Destroy (ilist);
+      error ("couldn't create toolbar");
+    }
+
+  /* finally populate with images */
+  if (SendMessage (FRAME_MSWINDOWS_TOOLBAR (f), TB_SETIMAGELIST, NULL,
+		   (LPARAM)ilist) == -1) 
+    {
+      mswindows_clear_toolbar (f, pos, 0);
+      error ("couldn't add image list to toolbar");
+    }
+
+  /* now move the window */
+  SetWindowPos (FRAME_MSWINDOWS_TOOLBAR (f), HWND_TOP, x, y, 
+		bar_width, bar_height,
+		SWP_SHOWWINDOW);
+#if 0
+  ShowWindow (FRAME_MSWINDOWS_TOOLBAR (f), SW_SHOWNORMAL);
+#endif
+
+  if (button_tbl) xfree (button_tbl);
+
+  SET_TOOLBAR_WAS_VISIBLE_FLAG (f, pos, 1);
+}
+
+static void
+mswindows_initialize_frame_toolbars (struct frame *f)
+{
+
+}
+
+static void
+mswindows_output_frame_toolbars (struct frame *f)
+{
+  assert (FRAME_MSWINDOWS_P (f));
+
+  if (FRAME_REAL_TOP_TOOLBAR_VISIBLE (f))
+    mswindows_output_toolbar (f, TOP_TOOLBAR);
+  else if (f->top_toolbar_was_visible)
+    mswindows_clear_toolbar (f, TOP_TOOLBAR, 0);
+
+  if (FRAME_REAL_BOTTOM_TOOLBAR_VISIBLE (f))
+    mswindows_output_toolbar (f, BOTTOM_TOOLBAR);
+  else if (f->bottom_toolbar_was_visible)
+    mswindows_clear_toolbar (f, BOTTOM_TOOLBAR, 0);
+
+  if (FRAME_REAL_LEFT_TOOLBAR_VISIBLE (f))
+    mswindows_output_toolbar (f, LEFT_TOOLBAR);
+  else if (f->left_toolbar_was_visible)
+    mswindows_clear_toolbar (f, LEFT_TOOLBAR, 0);
+
+  if (FRAME_REAL_RIGHT_TOOLBAR_VISIBLE (f))
+    mswindows_output_toolbar (f, RIGHT_TOOLBAR);
+  else if (f->right_toolbar_was_visible)
+    mswindows_clear_toolbar (f, RIGHT_TOOLBAR, 0);
+}
+
+static void
+mswindows_free_frame_toolbars (struct frame *f)
+{
+  mswindows_clear_toolbar(f, 0, 0);
+}
+
+/*
+ * Return value is Qt if we have dispatched the command,
+ * or Qnil if id has not been mapped to a callback.
+ * Window procedure may try other targets to route the
+ * command if we return nil
+ */
+Lisp_Object
+mswindows_handle_toolbar_wm_command (struct frame* f, WORD id)
+{
+  /* Try to map the command id through the proper hash table */
+  Lisp_Object command, funcsym, frame;
+  struct gcpro gcpro1;
+
+  command = Fgethash (make_int (id), 
+		      FRAME_MSWINDOWS_TOOLBAR_HASHTABLE (f), Qunbound);
+  if (UNBOUNDP (command))
+    {
+      return Qnil;
+    }
+
+  /* Need to gcpro because the hashtable may get destroyed
+     by menu_cleanup(), and will not gcpro the command
+     any more */
+  GCPRO1 (command);
+  
+  /* Ok, this is our one. Enqueue it. */
+  if (SYMBOLP (command))
+      funcsym = Qcall_interactively;
+  else if (CONSP (command))
+      funcsym = Qeval;
+  else
+    signal_simple_error ("Callback must be either evallable form or a symbol",
+			 command);
+
+  XSETFRAME (frame, f);
+  enqueue_misc_user_event (frame, funcsym, command);
+
+  /* Needs good bump also, for WM_COMMAND may have been dispatched from
+     mswindows_need_event, which will block again despite new command
+     event has arrived */
+  mswindows_bump_queue ();
+  
+  UNGCPRO; /* command */
+  return Qt;
+}
+
+
+/************************************************************************/
+/*                            initialization                            */
+/************************************************************************/
+
+void
+console_type_create_toolbar_mswindows (void)
+{
+  CONSOLE_HAS_METHOD (mswindows, output_frame_toolbars);
+  CONSOLE_HAS_METHOD (mswindows, initialize_frame_toolbars);
+  CONSOLE_HAS_METHOD (mswindows, free_frame_toolbars);
+}
+
--- a/src/toolbar.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/toolbar.c	Mon Aug 13 10:30:37 2007 +0200
@@ -1733,6 +1733,10 @@
 #ifdef HAVE_X_WINDOWS
   fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_HEIGHT)), fb);
 #endif
+#ifdef HAVE_MS_WINDOWS
+  fb = Fcons (Fcons (list1 (Qmswindows), 
+		     make_int (MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT)), fb);
+#endif
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_toolbar_height, fb);
 
@@ -1743,6 +1747,10 @@
 #ifdef HAVE_X_WINDOWS
   fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_WIDTH)), fb);
 #endif
+#ifdef HAVE_MS_WINDOWS
+  fb = Fcons (Fcons (list1 (Qmswindows), 
+		     make_int (MSWINDOWS_DEFAULT_TOOLBAR_WIDTH)), fb);
+#endif
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_toolbar_width, fb);
 
@@ -1854,6 +1862,9 @@
 #ifdef HAVE_X_WINDOWS
   fb = Fcons (Fcons (list1 (Qx), make_int (DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
 #endif
+#ifdef HAVE_MS_WINDOWS
+  fb = Fcons (Fcons (list1 (Qmswindows), make_int (MSWINDOWS_DEFAULT_TOOLBAR_BORDER_WIDTH)), fb);
+#endif
   if (!NILP (fb))
     set_specifier_fallback (Vdefault_toolbar_border_width, fb);
 
--- a/src/toolbar.h	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/toolbar.h	Mon Aug 13 10:30:37 2007 +0200
@@ -112,8 +112,11 @@
 #define CHECK_TOOLBAR_SPECIFIER(x) CHECK_SPECIFIER_TYPE (x, toolbar)
 #define CONCHECK_TOOLBAR_SPECIFIER(x) CONCHECK_SPECIFIER_TYPE (x, toolbar)
 
+#define MSWINDOWS_DEFAULT_TOOLBAR_HEIGHT	37
+#define MSWINDOWS_DEFAULT_TOOLBAR_WIDTH		40
+#define MSWINDOWS_DEFAULT_TOOLBAR_BORDER_WIDTH	6
 #define DEFAULT_TOOLBAR_HEIGHT	37
-#define DEFAULT_TOOLBAR_WIDTH	40
+#define DEFAULT_TOOLBAR_WIDTH		40
 #define DEFAULT_TOOLBAR_BLANK_SIZE	8
 #define DEFAULT_TOOLBAR_BORDER_WIDTH	0
 #define MINIMUM_SHADOW_THICKNESS	1
--- a/src/tooltalk.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/tooltalk.c	Mon Aug 13 10:30:37 2007 +0200
@@ -521,7 +521,7 @@
   int value;
 
   check_status (tt_message_arg_ival (m, n, &value));
-  sprintf (buf, "%d", value);
+  long_to_string (buf, value);
   return build_string (buf);
 }
 
--- a/src/window.c	Mon Aug 13 10:29:43 2007 +0200
+++ b/src/window.c	Mon Aug 13 10:30:37 2007 +0200
@@ -64,7 +64,6 @@
 					       int include_gutters_p);
 static void change_window_height (struct window *w, int delta, int widthflag,
                                   int inpixels);
-static int window_displayed_pixel_height (struct window *);
 
 /* Thickness of shadow border around 3d modelines. */
 Lisp_Object Vmodeline_shadow_thickness;
@@ -1316,14 +1315,16 @@
   return make_int (decode_window (window)->pixel_height);
 }
 
-DEFUN ("window-displayed-pixel-height", Fwindow_displayed_pixel_height, 0, 1, 0, /*
-Return the height in pixels of the buffer-displaying portion of WINDOW.
-Unlike `window-pixel-height', the space occupied by the gutters
-\(modeline, horizontal scrollbar, ...) is not counted.
+DEFUN ("window-text-pixel-height", Fwindow_text_pixel_height, 0, 1, 0, /*
+Return the height in pixels of the text-displaying portion of WINDOW.
+Unlike `window-pixel-height', the space occupied by the modeline and
+horizontal scrollbar, if any, is not counted.
 */
      (window))
 {
-  return make_int (window_displayed_pixel_height (decode_window (window)));
+  struct window *w = decode_window (window);
+
+  return make_int (WINDOW_TEXT_HEIGHT (w));
 }
 
 DEFUN ("window-width", Fwindow_width, 0, 1, 0, /*
@@ -1343,6 +1344,18 @@
   return make_int (decode_window (window)->pixel_width);
 }
 
+DEFUN ("window-text-pixel-width", Fwindow_text_pixel_width, 0, 1, 0, /*
+Return the width in pixels of the text-displaying portion of WINDOW.
+Unlike `window-pixel-width', the space occupied by the vertical
+scrollbar or divider, if any, is not counted.  
+*/
+     (window))
+{
+  struct window *w = decode_window (window);
+
+  return make_int (WINDOW_TEXT_WIDTH (w));
+}
+
 DEFUN ("window-hscroll", Fwindow_hscroll, 0, 1, 0, /*
 Return the number of columns by which WINDOW is scrolled from left margin.
 */
@@ -1408,7 +1421,7 @@
   return ncol;
 }
 
-#if 0 /* bogus crock */
+#if 0 /* bogus FSF crock */
 
 xxDEFUN ("window-redisplay-end-trigger",
 	 Fwindow_redisplay_end_trigger, 0, 1, 0, /*
@@ -1455,6 +1468,26 @@
 		make_int (top + w->pixel_height));
 }
 
+DEFUN ("window-text-pixel-edges", Fwindow_text_pixel_edges, 0, 1, 0, /*
+Return a list of the pixel edge coordinates of the text area of WINDOW.
+Returns the list \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at the
+top left corner of the window.
+*/
+       (window))
+{
+  struct window *w = decode_window (window);
+
+  int left   = window_left_gutter_width (w, /* modeline = */ 0);
+  int top    = window_top_gutter_height (w);
+  int right  = WINDOW_WIDTH (w) - window_right_gutter_width (w, 0);
+  int bottom = WINDOW_HEIGHT (w) - window_bottom_gutter_height (w);
+
+  return list4 (make_int (left),
+		make_int (top),
+		make_int (right),
+		make_int (bottom));
+}
+
 DEFUN ("window-point", Fwindow_point, 0, 1, 0, /*
 Return current value of point in WINDOW.
 For a nonselected window, this is the value point would have
@@ -3583,18 +3616,6 @@
   return num_lines;
 }
 
-/*
- * Return height in pixels of buffer-displaying portion of window w.
- * Does not include the gutters (modeline, scrollbars, ...)
- */
-int
-window_displayed_pixel_height (struct window *w)
-{
-  return (WINDOW_HEIGHT (w)
-          - window_top_gutter_height (w)
-          - window_bottom_gutter_height (w));
-}
-
 static int
 window_pixel_width (Lisp_Object window)
 {
@@ -5497,21 +5518,23 @@
   DEFSUBR (Fwindow_frame);
   DEFSUBR (Fwindow_height);
   DEFSUBR (Fwindow_displayed_height);
-  DEFSUBR (Fwindow_displayed_pixel_height);
   DEFSUBR (Fwindow_width);
   DEFSUBR (Fwindow_pixel_height);
   DEFSUBR (Fwindow_pixel_width);
+  DEFSUBR (Fwindow_text_pixel_height);
+  DEFSUBR (Fwindow_text_pixel_width);
   DEFSUBR (Fwindow_hscroll);
 #ifdef MODELINE_IS_SCROLLABLE
   DEFSUBR (Fmodeline_hscroll);
   DEFSUBR (Fset_modeline_hscroll);
 #endif /* MODELINE_IS_SCROLLABLE */
-#if 0 /* bogus crock */
+#if 0 /* bogus FSF crock */
   DEFSUBR (Fwindow_redisplay_end_trigger);
   DEFSUBR (Fset_window_redisplay_end_trigger);
 #endif
   DEFSUBR (Fset_window_hscroll);
   DEFSUBR (Fwindow_pixel_edges);
+  DEFSUBR (Fwindow_text_pixel_edges);
   DEFSUBR (Fwindow_point);
   DEFSUBR (Fwindow_start);
   DEFSUBR (Fwindow_end);
--- a/version.sh	Mon Aug 13 10:29:43 2007 +0200
+++ b/version.sh	Mon Aug 13 10:30:37 2007 +0200
@@ -1,8 +1,8 @@
 #!/bin/sh
 emacs_major_version=21
 emacs_minor_version=0
-emacs_beta_version=35
-xemacs_codename="Peacock Goat"
+emacs_beta_version=36
+xemacs_codename="Philippine"
 infodock_major_version=3
 infodock_minor_version=90
 infodock_build_version=1