changeset 231:557eaa0339bf r20-5b14

Import from CVS: tag r20-5b14
author cvs
date Mon, 13 Aug 2007 10:13:48 +0200
parents 39ed1d2bdd9d
children aa6545ea0638
files CHANGES-beta ChangeLog PROBLEMS configure configure.in etc/BETA lisp/ChangeLog lisp/dumped-lisp.el lisp/format.el lisp/help.el lisp/x-menubar.el nt/ChangeLog nt/xemacs.mak src/ChangeLog src/Makefile.in.in src/console-msw.h src/dialog-x.c src/elhash.c src/emacs.c src/event-msw.c src/event-msw.h src/events.c src/frame-msw.c src/getloadavg.c src/glyphs-x.c src/gui-x.c src/gui-x.h src/gui.c src/gui.h src/lread.c src/mem-limits.h src/menubar-msw.c src/menubar-msw.h src/menubar-x.c src/msw-proc.c src/objects-msw.c src/opaque.c src/s/cygwin32.h src/scrollbar-msw.h src/select-msw.c src/sysdep.c version.sh
diffstat 42 files changed, 3149 insertions(+), 1206 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 10:13:03 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 10:13:48 2007 +0200
@@ -1,4 +1,11 @@
 							-*- indented-text -*-
+to 20.5 beta14 "Booted Goat"
+-- help.el update courtesy of Jens Petersen
+-- Image error handling courtesy of Jareth Hein
+-- MS Windows menubar support courtesy of Kirill Katsnelson
+-- Compile time/but not run-time support for cygwin courtesy of Andy Piper
+-- Miscellaneous bug fixes
+
 to 20.5 beta13 "Boer"
 -- Run time dependencies on x-win*.el removed.
 -- Total package upgrade
--- a/ChangeLog	Mon Aug 13 10:13:03 2007 +0200
+++ b/ChangeLog	Mon Aug 13 10:13:48 2007 +0200
@@ -1,3 +1,11 @@
+1997-12-27  SL Baur  <steve@altair.xemacs.org>
+
+	* XEmacs 20.5-beta14 is released.
+
+1997-12-23  Andy Piper <andyp@parallax.co.uk>
+
+	* configure.in: support for *-pc-cygwin32 config
+
 1997-12-25  SL Baur  <steve@altair.xemacs.org>
 
 	* XEmacs 20.5-beta13 is released.
--- a/PROBLEMS	Mon Aug 13 10:13:03 2007 +0200
+++ b/PROBLEMS	Mon Aug 13 10:13:48 2007 +0200
@@ -1,4 +1,4 @@
--*- mode:outline; minor-mode:outl-mouse -*-
+-*- 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.
--- a/configure	Mon Aug 13 10:13:03 2007 +0200
+++ b/configure	Mon Aug 13 10:13:48 2007 +0200
@@ -1180,6 +1180,7 @@
       *-386bsd* )	        opsys=386bsd ;;
       *-freebsd* )		opsys=freebsd ;;
       *-nextstep* )		opsys=nextstep ;;
+      *-pc-cygwin32 )		opsys=cygwin32 ;;
           esac
   ;;
 
@@ -1271,7 +1272,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:1275: checking for $ac_word" >&5
+echo "configure:1276: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1297,7 +1298,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:1301: checking for $ac_word" >&5
+echo "configure:1302: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1342,7 +1343,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1346: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1347: 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'
@@ -1354,11 +1355,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1358 "configure"
+#line 1359 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1363: \"$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
@@ -1378,19 +1379,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:1382: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1383: 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:1387: checking whether we are using GNU C" >&5
+echo "configure:1388: 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:1394: \"$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:1395: \"$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
@@ -1404,7 +1405,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1408: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1409: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1433,7 +1434,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:1437: checking for $ac_word" >&5
+echo "configure:1438: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1459,7 +1460,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:1463: checking for $ac_word" >&5
+echo "configure:1464: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1504,7 +1505,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1508: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1509: 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'
@@ -1516,11 +1517,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1520 "configure"
+#line 1521 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1525: \"$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
@@ -1540,19 +1541,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:1544: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1545: 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:1549: checking whether we are using GNU C" >&5
+echo "configure:1550: 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:1556: \"$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:1557: \"$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
@@ -1566,7 +1567,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1570: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1571: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1595,7 +1596,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:1599: checking for $ac_word" >&5
+echo "configure:1600: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1621,7 +1622,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:1625: checking for $ac_word" >&5
+echo "configure:1626: checking for $ac_word" >&5
 
 if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -1666,7 +1667,7 @@
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1670: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1671: 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'
@@ -1678,11 +1679,11 @@
 cross_compiling=no
 
 cat > conftest.$ac_ext <<EOF
-#line 1682 "configure"
+#line 1683 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1687: \"$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
@@ -1702,19 +1703,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:1706: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1707: 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:1711: checking whether we are using GNU C" >&5
+echo "configure:1712: 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:1718: \"$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:1719: \"$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
@@ -1728,7 +1729,7 @@
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1732: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1733: checking whether ${CC-cc} accepts -g" >&5
 
 echo 'void f(){}' > conftest.c
 if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
@@ -1761,7 +1762,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:1765: checking how to run the C preprocessor" >&5
+echo "configure:1766: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1774,13 +1775,13 @@
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1778 "configure"
+#line 1779 "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:1784: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1791,13 +1792,13 @@
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1795 "configure"
+#line 1796 "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:1801: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1820,9 +1821,9 @@
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1824: checking for AIX" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1826 "configure"
+echo "configure:1825: checking for AIX" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1827 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1849,9 +1850,9 @@
 
 
 echo $ac_n "checking whether we are using SunPro C""... $ac_c" 1>&6
-echo "configure:1853: checking whether we are using SunPro C" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1855 "configure"
+echo "configure:1854: checking whether we are using SunPro C" >&5
+cat > conftest.$ac_ext <<EOF
+#line 1856 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -1862,7 +1863,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:1866: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1867: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   __sunpro_c=yes
 else
@@ -2138,7 +2139,7 @@
  fi
 
 echo $ac_n "checking for dynodump""... $ac_c" 1>&6
-echo "configure:2142: checking for dynodump" >&5
+echo "configure:2143: checking for dynodump" >&5
 if test "$unexec" != "unexsol2.o"; then
   echo "$ac_t""no" 1>&6
 else
@@ -2236,19 +2237,19 @@
 
 if test "$add_runtime_path" = "yes"; then
       echo $ac_n "checking "for runtime libraries flag"""... $ac_c" 1>&6
-echo "configure:2240: checking "for runtime libraries flag"" >&5
+echo "configure:2241: 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"
     cat > conftest.$ac_ext <<EOF
-#line 2245 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:2252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 2246 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:2253: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   dash_r="$try_dash_r"
 else
@@ -2346,7 +2347,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:2350: checking for $ac_word" >&5
+echo "configure:2351: checking for $ac_word" >&5
 
 if test -n "$RANLIB"; then
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -2399,7 +2400,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:2403: checking for a BSD compatible install" >&5
+echo "configure:2404: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 
   IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS="${IFS}:"
@@ -2450,7 +2451,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:2454: checking for $ac_word" >&5
+echo "configure:2455: checking for $ac_word" >&5
 
 if test -n "$YACC"; then
   ac_cv_prog_YACC="$YACC" # Let the user override the test.
@@ -2481,15 +2482,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2485: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2488 "configure"
+echo "configure:2486: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2489 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2493: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2522,15 +2523,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2526: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2529 "configure"
+echo "configure:2527: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2530 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2534: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2535: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2563,15 +2564,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2567: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2570 "configure"
+echo "configure:2568: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2571 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2575: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2601,10 +2602,10 @@
 done
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:2605: checking for sys/wait.h that is POSIX.1 compatible" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2608 "configure"
+echo "configure:2606: checking for sys/wait.h that is POSIX.1 compatible" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2609 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -2620,7 +2621,7 @@
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:2624: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2625: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -2644,10 +2645,10 @@
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2648: checking for ANSI C header files" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2651 "configure"
+echo "configure:2649: checking for ANSI C header files" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2652 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2655,7 +2656,7 @@
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2659: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2660: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2672,7 +2673,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 2676 "configure"
+#line 2677 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2690,7 +2691,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 2694 "configure"
+#line 2695 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2708,7 +2709,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 2712 "configure"
+#line 2713 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2719,7 +2720,7 @@
 exit (0); }
 
 EOF
-if { (eval echo configure:2723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:2724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   :
 else
@@ -2744,10 +2745,10 @@
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:2748: checking whether time.h and sys/time.h may both be included" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2751 "configure"
+echo "configure:2749: checking whether time.h and sys/time.h may both be included" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2752 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -2756,7 +2757,7 @@
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:2760: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -2780,10 +2781,10 @@
 fi
 
 echo $ac_n "checking for sys_siglist declaration in signal.h or unistd.h""... $ac_c" 1>&6
-echo "configure:2784: checking for sys_siglist declaration in signal.h or unistd.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2787 "configure"
+echo "configure:2785: checking for sys_siglist declaration in signal.h or unistd.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2788 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2795,7 +2796,7 @@
 char *msg = *(sys_siglist + 1);
 ; return 0; }
 EOF
-if { (eval echo configure:2799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2800: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_decl_sys_siglist=yes
 else
@@ -2820,9 +2821,9 @@
 
 
 echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
-echo "configure:2824: checking for struct utimbuf" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2826 "configure"
+echo "configure:2825: checking for struct utimbuf" >&5
+cat > conftest.$ac_ext <<EOF
+#line 2827 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -2841,7 +2842,7 @@
 static struct utimbuf x; x.actime = x.modtime;
 ; return 0; }
 EOF
-if { (eval echo configure:2845: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2846: \"$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
@@ -2861,10 +2862,10 @@
 rm -f conftest*
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2865: checking return type of signal handlers" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2868 "configure"
+echo "configure:2866: checking return type of signal handlers" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2869 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2881,7 +2882,7 @@
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2885: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2886: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2903,10 +2904,10 @@
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:2907: checking for size_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2910 "configure"
+echo "configure:2908: checking for size_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2911 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2937,10 +2938,10 @@
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:2941: checking for pid_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2944 "configure"
+echo "configure:2942: checking for pid_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2945 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -2971,10 +2972,10 @@
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2975: checking for uid_t in sys/types.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 2978 "configure"
+echo "configure:2976: checking for uid_t in sys/types.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 2979 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -3010,10 +3011,10 @@
 fi
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:3014: checking for mode_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3017 "configure"
+echo "configure:3015: checking for mode_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3018 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3044,10 +3045,10 @@
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:3048: checking for off_t" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3051 "configure"
+echo "configure:3049: checking for off_t" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3052 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3079,9 +3080,9 @@
 
 
 echo $ac_n "checking for struct timeval""... $ac_c" 1>&6
-echo "configure:3083: checking for struct timeval" >&5
-cat > conftest.$ac_ext <<EOF
-#line 3085 "configure"
+echo "configure:3084: checking for struct timeval" >&5
+cat > conftest.$ac_ext <<EOF
+#line 3086 "configure"
 #include "confdefs.h"
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/time.h>
@@ -3097,7 +3098,7 @@
 static struct timeval x; x.tv_sec = x.tv_usec;
 ; return 0; }
 EOF
-if { (eval echo configure:3101: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6
   HAVE_TIMEVAL=yes
@@ -3119,10 +3120,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:3123: checking whether struct tm is in sys/time.h or time.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3126 "configure"
+echo "configure:3124: checking whether struct tm is in sys/time.h or time.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3127 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -3130,7 +3131,7 @@
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:3134: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -3154,10 +3155,10 @@
 fi
 
 echo $ac_n "checking for tm_zone in struct tm""... $ac_c" 1>&6
-echo "configure:3158: checking for tm_zone in struct tm" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3161 "configure"
+echo "configure:3159: checking for tm_zone in struct tm" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3162 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_cv_struct_tm>
@@ -3165,7 +3166,7 @@
 struct tm tm; tm.tm_zone;
 ; return 0; }
 EOF
-if { (eval echo configure:3169: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm_zone=yes
 else
@@ -3188,10 +3189,10 @@
 
 else
   echo $ac_n "checking for tzname""... $ac_c" 1>&6
-echo "configure:3192: checking for tzname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3195 "configure"
+echo "configure:3193: checking for tzname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3196 "configure"
 #include "confdefs.h"
 #include <time.h>
 #ifndef tzname /* For SGI.  */
@@ -3201,7 +3202,7 @@
 atoi(*tzname);
 ; return 0; }
 EOF
-if { (eval echo configure:3205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3206: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_var_tzname=yes
 else
@@ -3227,10 +3228,10 @@
 
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:3231: checking for working const" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3234 "configure"
+echo "configure:3232: checking for working const" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3235 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -3279,7 +3280,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:3283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3284: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -3304,7 +3305,7 @@
 
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:3308: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:3309: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 
 cat > conftestmake <<\EOF
@@ -3329,12 +3330,12 @@
 
 
 echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
-echo "configure:3333: checking whether byte ordering is bigendian" >&5
+echo "configure:3334: 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 3338 "configure"
+#line 3339 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3345,11 +3346,11 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3349: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3350: \"$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 3353 "configure"
+#line 3354 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/param.h>
@@ -3360,7 +3361,7 @@
 #endif
 ; return 0; }
 EOF
-if { (eval echo configure:3364: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3365: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_bigendian=yes
 else
@@ -3377,7 +3378,7 @@
 rm -f conftest*
 if test $ac_cv_c_bigendian = unknown; then
 cat > conftest.$ac_ext <<EOF
-#line 3381 "configure"
+#line 3382 "configure"
 #include "confdefs.h"
 main () {
   /* Are we little or big endian?  From Harbison&Steele.  */
@@ -3390,7 +3391,7 @@
   exit (u.c[sizeof (long) - 1] == 1);
 }
 EOF
-if { (eval echo configure:3394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3395: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_c_bigendian=no
 else
@@ -3416,10 +3417,10 @@
 
 
 echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:3420: checking size of short" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3423 "configure"
+echo "configure:3421: checking size of short" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3424 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3430,7 +3431,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3434: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3435: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_short=`cat conftestval`
 else
@@ -3457,10 +3458,10 @@
   exit 1
 fi
 echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:3461: checking size of int" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3464 "configure"
+echo "configure:3462: checking size of int" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3465 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3471,7 +3472,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_int=`cat conftestval`
 else
@@ -3492,10 +3493,10 @@
 
 
 echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:3496: checking size of long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3499 "configure"
+echo "configure:3497: checking size of long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3500 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3506,7 +3507,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_sizeof_long=`cat conftestval`
 else
@@ -3527,10 +3528,10 @@
 
 
 echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:3531: checking size of long long" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3534 "configure"
+echo "configure:3532: checking size of long long" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3535 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3541,7 +3542,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3546: \"$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
@@ -3562,10 +3563,10 @@
 
 
 echo $ac_n "checking size of void *""... $ac_c" 1>&6
-echo "configure:3566: checking size of void *" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 3569 "configure"
+echo "configure:3567: checking size of void *" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 3570 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 main()
@@ -3576,7 +3577,7 @@
   exit(0);
 }
 EOF
-if { (eval echo configure:3580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:3581: \"$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
@@ -3598,7 +3599,7 @@
 
 
 echo $ac_n "checking for long file names""... $ac_c" 1>&6
-echo "configure:3602: checking for long file names" >&5
+echo "configure:3603: 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:
@@ -3645,12 +3646,12 @@
 
 
 echo $ac_n "checking for sin in -lm""... $ac_c" 1>&6
-echo "configure:3649: checking for sin in -lm" >&5
+echo "configure:3650: 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 3654 "configure"
+#line 3655 "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
@@ -3661,7 +3662,7 @@
 sin()
 ; return 0; }
 EOF
-if { (eval echo configure:3665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3666: \"$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
@@ -3703,7 +3704,7 @@
 
 
 echo "checking type of mail spool file locking" 1>&6
-echo "configure:3707: checking type of mail spool file locking" >&5
+echo "configure:3708: 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
@@ -3727,12 +3728,12 @@
 
 
 echo $ac_n "checking for kstat_open in -lkstat""... $ac_c" 1>&6
-echo "configure:3731: checking for kstat_open in -lkstat" >&5
+echo "configure:3732: 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 3736 "configure"
+#line 3737 "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
@@ -3743,7 +3744,7 @@
 kstat_open()
 ; return 0; }
 EOF
-if { (eval echo configure:3747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3748: \"$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
@@ -3777,12 +3778,12 @@
 
 
 echo $ac_n "checking for kvm_read in -lkvm""... $ac_c" 1>&6
-echo "configure:3781: checking for kvm_read in -lkvm" >&5
+echo "configure:3782: 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 3786 "configure"
+#line 3787 "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
@@ -3793,7 +3794,7 @@
 kvm_read()
 ; return 0; }
 EOF
-if { (eval echo configure:3797: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3798: \"$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
@@ -3827,12 +3828,12 @@
 
 
 echo $ac_n "checking for cma_open in -lpthreads""... $ac_c" 1>&6
-echo "configure:3831: checking for cma_open in -lpthreads" >&5
+echo "configure:3832: 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 3836 "configure"
+#line 3837 "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
@@ -3843,7 +3844,7 @@
 cma_open()
 ; return 0; }
 EOF
-if { (eval echo configure:3847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3848: \"$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
@@ -3879,7 +3880,7 @@
 fi
 
 echo $ac_n "checking whether the -xildoff compiler flag is required""... $ac_c" 1>&6
-echo "configure:3883: checking whether the -xildoff compiler flag is required" >&5
+echo "configure:3884: 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;
@@ -3890,7 +3891,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:3894: checking for \"-z ignore\" linker flag" >&5
+echo "configure:3895: 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 ;;
@@ -3900,7 +3901,7 @@
 
 
 echo "checking "for specified window system"" 1>&6
-echo "configure:3904: checking "for specified window system"" >&5
+echo "configure:3905: checking "for specified window system"" >&5
 
 if test "$with_x11" != "no"; then
     test "$x_includes $x_libraries" != "NONE NONE" && \
@@ -3930,7 +3931,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:3934: checking for X" >&5
+echo "configure:3935: checking for X" >&5
 
 # Check whether --with-x or --without-x was given.
 if test "${with_x+set}" = set; then
@@ -3990,12 +3991,12 @@
 
   # First, try using that file with no special directory specified.
 cat > conftest.$ac_ext <<EOF
-#line 3994 "configure"
+#line 3995 "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:3999: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4000: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4064,14 +4065,14 @@
   ac_save_LIBS="$LIBS"
   LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4068 "configure"
+#line 4069 "configure"
 #include "confdefs.h"
 
 int main() {
 ${x_direct_test_function}()
 ; return 0; }
 EOF
-if { (eval echo configure:4075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4076: \"$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.
@@ -4180,17 +4181,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:4184: checking whether -R must be followed by a space" >&5
+echo "configure:4185: 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 4187 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4188 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_nospace=yes
 else
@@ -4206,14 +4207,14 @@
       else
 	LIBS="$ac_xsave_LIBS -R $x_libraries"
 	cat > conftest.$ac_ext <<EOF
-#line 4210 "configure"
-#include "confdefs.h"
-
-int main() {
-
-; return 0; }
-EOF
-if { (eval echo configure:4217: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+#line 4211 "configure"
+#include "confdefs.h"
+
+int main() {
+
+; return 0; }
+EOF
+if { (eval echo configure:4218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_R_space=yes
 else
@@ -4249,12 +4250,12 @@
 else
 
 echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:4253: checking for dnet_ntoa in -ldnet" >&5
+echo "configure:4254: 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 4258 "configure"
+#line 4259 "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
@@ -4265,7 +4266,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4270: \"$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
@@ -4289,12 +4290,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:4293: checking for dnet_ntoa in -ldnet_stub" >&5
+echo "configure:4294: 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 4298 "configure"
+#line 4299 "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
@@ -4305,7 +4306,7 @@
 dnet_ntoa()
 ; return 0; }
 EOF
-if { (eval echo configure:4309: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4310: \"$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
@@ -4334,10 +4335,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:4338: checking for gethostbyname" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4341 "configure"
+echo "configure:4339: checking for gethostbyname" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4342 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname(); below.  */
@@ -4360,7 +4361,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4364: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4365: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gethostbyname=yes"
 else
@@ -4381,12 +4382,12 @@
     if test $ac_cv_func_gethostbyname = no; then
       
 echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:4385: checking for gethostbyname in -lnsl" >&5
+echo "configure:4386: 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 4390 "configure"
+#line 4391 "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
@@ -4397,7 +4398,7 @@
 gethostbyname()
 ; return 0; }
 EOF
-if { (eval echo configure:4401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4402: \"$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
@@ -4427,10 +4428,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:4431: checking for connect" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4434 "configure"
+echo "configure:4432: checking for connect" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4435 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect(); below.  */
@@ -4453,7 +4454,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4457: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_connect=yes"
 else
@@ -4476,12 +4477,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:4480: checking "$xe_msg_checking"" >&5
+echo "configure:4481: 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 4485 "configure"
+#line 4486 "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
@@ -4492,7 +4493,7 @@
 connect()
 ; return 0; }
 EOF
-if { (eval echo configure:4496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4497: \"$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
@@ -4516,10 +4517,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:4520: checking for remove" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4523 "configure"
+echo "configure:4521: checking for remove" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4524 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove(); below.  */
@@ -4542,7 +4543,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_remove=yes"
 else
@@ -4563,12 +4564,12 @@
     if test $ac_cv_func_remove = no; then
       
 echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:4567: checking for remove in -lposix" >&5
+echo "configure:4568: 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 4572 "configure"
+#line 4573 "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
@@ -4579,7 +4580,7 @@
 remove()
 ; return 0; }
 EOF
-if { (eval echo configure:4583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4584: \"$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
@@ -4603,10 +4604,10 @@
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
     echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:4607: checking for shmat" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4610 "configure"
+echo "configure:4608: checking for shmat" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4611 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat(); below.  */
@@ -4629,7 +4630,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:4633: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_shmat=yes"
 else
@@ -4650,12 +4651,12 @@
     if test $ac_cv_func_shmat = no; then
       
 echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:4654: checking for shmat in -lipc" >&5
+echo "configure:4655: 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 4659 "configure"
+#line 4660 "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
@@ -4666,7 +4667,7 @@
 shmat()
 ; return 0; }
 EOF
-if { (eval echo configure:4670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4671: \"$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
@@ -4700,12 +4701,12 @@
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   
 echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:4704: checking for IceConnectionNumber in -lICE" >&5
+echo "configure:4705: 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 4709 "configure"
+#line 4710 "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
@@ -4716,7 +4717,7 @@
 IceConnectionNumber()
 ; return 0; }
 EOF
-if { (eval echo configure:4720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4721: \"$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
@@ -4751,6 +4752,64 @@
   no  ) window_system=none HAVE_X_WINDOWS=no  ;;
 esac
 
+if test "$window_system" = "none"; then
+  echo "checking for MS-Windows" 1>&6
+echo "configure:4758: checking for MS-Windows" >&5
+  
+echo $ac_n "checking for main in -lgdi32""... $ac_c" 1>&6
+echo "configure:4761: 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 4766 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:4773: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+xe_check_libs=""
+
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes" ; then
+  echo "$ac_t""yes" 1>&6
+  have_msw=yes
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
+  if test "$have_msw" = "yes"; then
+    { test "$extra_verbose" = "yes" && cat << \EOF
+    Defining HAVE_MS_WINDOWS
+EOF
+cat >> confdefs.h <<\EOF
+#define HAVE_MS_WINDOWS 1
+EOF
+}
+
+    window_system=msw
+    with_scrollbars=msw
+    with_dialogs=msw
+    with_menubars=no
+    with_toolbars=no
+    with_tty=no
+    extra_objs="$extra_objs console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o msw-proc.o scrollbar-msw.o" &&  if test "$extra_verbose" = "yes"; then
+   echo "    xemacs will be linked with \"console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o msw-proc.o scrollbar-msw.o\""
+ fi
+  fi
+fi
+
 if test "$with_x11" = "yes"; then
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_X_WINDOWS
@@ -4849,7 +4908,7 @@
   fi
 
     echo "checking for X defines extracted by xmkmf" 1>&6
-echo "configure:4853: checking for X defines extracted by xmkmf" >&5
+echo "configure:4912: checking for X defines extracted by xmkmf" >&5
   rm -fr conftestdir
   if mkdir conftestdir; then
     cd conftestdir
@@ -4881,15 +4940,15 @@
 
     ac_safe=`echo "X11/Intrinsic.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/Intrinsic.h""... $ac_c" 1>&6
-echo "configure:4885: checking for X11/Intrinsic.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 4888 "configure"
+echo "configure:4944: checking for X11/Intrinsic.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 4947 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4952: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4913,12 +4972,12 @@
 
       
 echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6
-echo "configure:4917: checking for XOpenDisplay in -lX11" >&5
+echo "configure:4976: 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 4922 "configure"
+#line 4981 "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
@@ -4929,7 +4988,7 @@
 XOpenDisplay()
 ; return 0; }
 EOF
-if { (eval echo configure:4933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4992: \"$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
@@ -4954,12 +5013,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:4958: checking "$xe_msg_checking"" >&5
+echo "configure:5017: 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 4963 "configure"
+#line 5022 "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
@@ -4970,7 +5029,7 @@
 XGetFontProperty()
 ; return 0; }
 EOF
-if { (eval echo configure:4974: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5033: \"$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
@@ -4997,12 +5056,12 @@
 
     
 echo $ac_n "checking for XShapeSelectInput in -lXext""... $ac_c" 1>&6
-echo "configure:5001: checking for XShapeSelectInput in -lXext" >&5
+echo "configure:5060: 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 5006 "configure"
+#line 5065 "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
@@ -5013,7 +5072,7 @@
 XShapeSelectInput()
 ; return 0; }
 EOF
-if { (eval echo configure:5017: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5076: \"$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 +5095,12 @@
 
     
 echo $ac_n "checking for XtOpenDisplay in -lXt""... $ac_c" 1>&6
-echo "configure:5040: checking for XtOpenDisplay in -lXt" >&5
+echo "configure:5099: 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 5045 "configure"
+#line 5104 "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 +5111,7 @@
 XtOpenDisplay()
 ; 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:5115: \"$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
@@ -5075,14 +5134,14 @@
 
 
   echo $ac_n "checking the version of X11 being used""... $ac_c" 1>&6
-echo "configure:5079: checking the version of X11 being used" >&5
+echo "configure:5138: checking the version of X11 being used" >&5
   cat > conftest.$ac_ext <<EOF
-#line 5081 "configure"
+#line 5140 "configure"
 #include "confdefs.h"
 #include <X11/Intrinsic.h>
     main(int c, char* v[]) { return c>1 ? XlibSpecificationRelease : 0; }
 EOF
-if { (eval echo configure:5086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:5145: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ./conftest foobar; x11_release=$?
 else
@@ -5106,15 +5165,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5110: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5113 "configure"
+echo "configure:5169: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5172 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5177: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5145,7 +5204,7 @@
 
 
     echo $ac_n "checking for XFree86""... $ac_c" 1>&6
-echo "configure:5149: checking for XFree86" >&5
+echo "configure:5208: checking for XFree86" >&5
   if test -d "/usr/X386/include" -o \
           -f "/etc/XF86Config"    -o \
 	  -f "/etc/X11/XF86Config" -o \
@@ -5165,12 +5224,12 @@
 
     test -z "$with_xmu" && { 
 echo $ac_n "checking for XmuReadBitmapDataFromFile in -lXmu""... $ac_c" 1>&6
-echo "configure:5169: checking for XmuReadBitmapDataFromFile in -lXmu" >&5
+echo "configure:5228: 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 5174 "configure"
+#line 5233 "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
@@ -5181,7 +5240,7 @@
 XmuReadBitmapDataFromFile()
 ; return 0; }
 EOF
-if { (eval echo configure:5185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5244: \"$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
@@ -5220,19 +5279,19 @@
 
       
 echo $ac_n "checking for main in -lXbsd""... $ac_c" 1>&6
-echo "configure:5224: checking for main in -lXbsd" >&5
+echo "configure:5283: 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 5229 "configure"
+#line 5288 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:5236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5295: \"$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
@@ -5277,6 +5336,7 @@
 
 case "$window_system" in
   x11  ) HAVE_X_WINDOWS=yes; echo "  Using X11." ;;
+  msw  ) HAVE_X_WINDOWS=no; echo "  Using MS-Windows." ;;
   none ) HAVE_X_WINDOWS=no ; echo "  Using no window system." ;;
 esac
 
@@ -5286,7 +5346,7 @@
 esac
 
 echo "checking for session-management option" 1>&6
-echo "configure:5290: checking for session-management option" >&5;
+echo "configure:5350: checking for session-management option" >&5;
 if test "$with_session" != "no"; then
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_SESSION
@@ -5301,15 +5361,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:5305: checking for X11/Xauth.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5308 "configure"
+echo "configure:5365: checking for X11/Xauth.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5368 "configure"
 #include "confdefs.h"
 #include <X11/Xauth.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5313: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5373: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5332,12 +5392,12 @@
  }
 test -z "$with_xauth" && { 
 echo $ac_n "checking for XauGetAuthByAddr in -lXau""... $ac_c" 1>&6
-echo "configure:5336: checking for XauGetAuthByAddr in -lXau" >&5
+echo "configure:5396: 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 5341 "configure"
+#line 5401 "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
@@ -5348,7 +5408,7 @@
 XauGetAuthByAddr()
 ; return 0; }
 EOF
-if { (eval echo configure:5352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5412: \"$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
@@ -5408,15 +5468,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:5412: checking for ${dir}tt_c.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5415 "configure"
+echo "configure:5472: checking for ${dir}tt_c.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5475 "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:5420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5445,12 +5505,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:5449: checking "$xe_msg_checking"" >&5
+echo "configure:5509: 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 5454 "configure"
+#line 5514 "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
@@ -5461,7 +5521,7 @@
 tt_message_create()
 ; return 0; }
 EOF
-if { (eval echo configure:5465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5525: \"$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
@@ -5510,15 +5570,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:5514: checking for Dt/Dt.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5517 "configure"
+echo "configure:5574: checking for Dt/Dt.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5577 "configure"
 #include "confdefs.h"
 #include <Dt/Dt.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5541,12 +5601,12 @@
  }
 test -z "$with_cde" && { 
 echo $ac_n "checking for DtDndDragStart in -lDtSvc""... $ac_c" 1>&6
-echo "configure:5545: checking for DtDndDragStart in -lDtSvc" >&5
+echo "configure:5605: 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 5550 "configure"
+#line 5610 "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
@@ -5557,7 +5617,7 @@
 DtDndDragStart()
 ; return 0; }
 EOF
-if { (eval echo configure:5561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5621: \"$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
@@ -5597,12 +5657,12 @@
 if test "$with_x11" = "yes"; then
 
   echo "checking for X11 graphics libraries" 1>&6
-echo "configure:5601: checking for X11 graphics libraries" >&5
+echo "configure:5661: checking for X11 graphics libraries" >&5
     echo $ac_n "checking for Xpm - no older than 3.4f""... $ac_c" 1>&6
-echo "configure:5603: checking for Xpm - no older than 3.4f" >&5
+echo "configure:5663: checking for Xpm - no older than 3.4f" >&5
   xe_check_libs=-lXpm
   test -z "$with_xpm" && { cat > conftest.$ac_ext <<EOF
-#line 5606 "configure"
+#line 5666 "configure"
 #include "confdefs.h"
 #include <X11/xpm.h>
   int main(int c, char **v) {
@@ -5612,7 +5672,7 @@
 		  0 ;
   }
 EOF
-if { (eval echo configure:5616: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:5676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ./conftest foobar; xpm_status=$?;
     if test "$xpm_status" = "0"; then with_xpm=yes; else with_xpm=no; fi;
@@ -5650,15 +5710,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:5654: checking for compface.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5657 "configure"
+echo "configure:5714: checking for compface.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5717 "configure"
 #include "confdefs.h"
 #include <compface.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5662: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5722: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5681,12 +5741,12 @@
  }
   test -z "$with_xface" && { 
 echo $ac_n "checking for UnGenFace in -lcompface""... $ac_c" 1>&6
-echo "configure:5685: checking for UnGenFace in -lcompface" >&5
+echo "configure:5745: 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 5690 "configure"
+#line 5750 "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
@@ -5697,7 +5757,7 @@
 UnGenFace()
 ; return 0; }
 EOF
-if { (eval echo configure:5701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5761: \"$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
@@ -5733,15 +5793,15 @@
 
     test "$with_imagick" != "no" && { ac_safe=`echo "magick/magick.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for magick/magick.h""... $ac_c" 1>&6
-echo "configure:5737: checking for magick/magick.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5740 "configure"
+echo "configure:5797: checking for magick/magick.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5800 "configure"
 #include "confdefs.h"
 #include <magick/magick.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5761,15 +5821,15 @@
   echo "$ac_t""no" 1>&6
 ac_safe=`echo "X11/magick/magick.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for X11/magick/magick.h""... $ac_c" 1>&6
-echo "configure:5765: checking for X11/magick/magick.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 5768 "configure"
+echo "configure:5825: checking for X11/magick/magick.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 5828 "configure"
 #include "confdefs.h"
 #include <X11/magick/magick.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5803,12 +5863,12 @@
         imagick_libs=""
     
 echo $ac_n "checking for XDPSPixelsPerPoint in -ldps""... $ac_c" 1>&6
-echo "configure:5807: checking for XDPSPixelsPerPoint in -ldps" >&5
+echo "configure:5867: checking for XDPSPixelsPerPoint in -ldps" >&5
 ac_lib_var=`echo dps'_'XDPSPixelsPerPoint | sed 'y%./+-%__p_%'`
 
 xe_check_libs="-ldpstk -ldps "
 cat > conftest.$ac_ext <<EOF
-#line 5812 "configure"
+#line 5872 "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
@@ -5819,7 +5879,7 @@
 XDPSPixelsPerPoint()
 ; return 0; }
 EOF
-if { (eval echo configure:5823: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5883: \"$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
@@ -5841,12 +5901,12 @@
 
     
 echo $ac_n "checking for FPX_SetToolkitMemoryLimit in -lfpx""... $ac_c" 1>&6
-echo "configure:5845: checking for FPX_SetToolkitMemoryLimit in -lfpx" >&5
+echo "configure:5905: checking for FPX_SetToolkitMemoryLimit in -lfpx" >&5
 ac_lib_var=`echo fpx'_'FPX_SetToolkitMemoryLimit | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lfpx "
 cat > conftest.$ac_ext <<EOF
-#line 5850 "configure"
+#line 5910 "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
@@ -5857,7 +5917,7 @@
 FPX_SetToolkitMemoryLimit()
 ; return 0; }
 EOF
-if { (eval echo configure:5861: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5921: \"$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
@@ -5879,12 +5939,12 @@
 
     
 echo $ac_n "checking for DF24getdims in -ldf""... $ac_c" 1>&6
-echo "configure:5883: checking for DF24getdims in -ldf" >&5
+echo "configure:5943: checking for DF24getdims in -ldf" >&5
 ac_lib_var=`echo df'_'DF24getdims | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ldf "
 cat > conftest.$ac_ext <<EOF
-#line 5888 "configure"
+#line 5948 "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
@@ -5895,7 +5955,7 @@
 DF24getdims()
 ; return 0; }
 EOF
-if { (eval echo configure:5899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5959: \"$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
@@ -5917,12 +5977,12 @@
 
     
 echo $ac_n "checking for jbg_dec_init in -ljbig""... $ac_c" 1>&6
-echo "configure:5921: checking for jbg_dec_init in -ljbig" >&5
+echo "configure:5981: checking for jbg_dec_init in -ljbig" >&5
 ac_lib_var=`echo jbig'_'jbg_dec_init | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ljbig "
 cat > conftest.$ac_ext <<EOF
-#line 5926 "configure"
+#line 5986 "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
@@ -5933,7 +5993,7 @@
 jbg_dec_init()
 ; return 0; }
 EOF
-if { (eval echo configure:5937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5997: \"$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
@@ -5955,12 +6015,12 @@
 
     
 echo $ac_n "checking for jpeg_read_header in -ljpeg""... $ac_c" 1>&6
-echo "configure:5959: checking for jpeg_read_header in -ljpeg" >&5
+echo "configure:6019: checking for jpeg_read_header in -ljpeg" >&5
 ac_lib_var=`echo jpeg'_'jpeg_read_header | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ljpeg "
 cat > conftest.$ac_ext <<EOF
-#line 5964 "configure"
+#line 6024 "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
@@ -5971,7 +6031,7 @@
 jpeg_read_header()
 ; return 0; }
 EOF
-if { (eval echo configure:5975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6035: \"$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
@@ -5993,12 +6053,12 @@
 
     
 echo $ac_n "checking for OpenMPEG in -lmpeg""... $ac_c" 1>&6
-echo "configure:5997: checking for OpenMPEG in -lmpeg" >&5
+echo "configure:6057: checking for OpenMPEG in -lmpeg" >&5
 ac_lib_var=`echo mpeg'_'OpenMPEG | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lmpeg "
 cat > conftest.$ac_ext <<EOF
-#line 6002 "configure"
+#line 6062 "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
@@ -6009,7 +6069,7 @@
 OpenMPEG()
 ; return 0; }
 EOF
-if { (eval echo configure:6013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6073: \"$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
@@ -6031,12 +6091,12 @@
 
     
 echo $ac_n "checking for TT_Init_FreeType in -lttf""... $ac_c" 1>&6
-echo "configure:6035: checking for TT_Init_FreeType in -lttf" >&5
+echo "configure:6095: checking for TT_Init_FreeType in -lttf" >&5
 ac_lib_var=`echo ttf'_'TT_Init_FreeType | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lttf "
 cat > conftest.$ac_ext <<EOF
-#line 6040 "configure"
+#line 6100 "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
@@ -6047,7 +6107,7 @@
 TT_Init_FreeType()
 ; return 0; }
 EOF
-if { (eval echo configure:6051: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6111: \"$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
@@ -6069,12 +6129,12 @@
 
     
 echo $ac_n "checking for png_create_read_struct in -lpng""... $ac_c" 1>&6
-echo "configure:6073: checking for png_create_read_struct in -lpng" >&5
+echo "configure:6133: checking for png_create_read_struct in -lpng" >&5
 ac_lib_var=`echo png'_'png_create_read_struct | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lpng "
 cat > conftest.$ac_ext <<EOF
-#line 6078 "configure"
+#line 6138 "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
@@ -6085,7 +6145,7 @@
 png_create_read_struct()
 ; return 0; }
 EOF
-if { (eval echo configure:6089: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6149: \"$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
@@ -6105,12 +6165,12 @@
 xe_msg_checking="for png_create_read_struct in -lpng"
 test -n "-lz" && xe_msg_checking="$xe_msg_checking using extra libs -lz"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:6109: checking "$xe_msg_checking"" >&5
+echo "configure:6169: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo png'_'png_create_read_struct | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lpng -lz"
 cat > conftest.$ac_ext <<EOF
-#line 6114 "configure"
+#line 6174 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6121,7 +6181,7 @@
 png_create_read_struct()
 ; return 0; }
 EOF
-if { (eval echo configure:6125: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6185: \"$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
@@ -6146,12 +6206,12 @@
 
     
 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6
-echo "configure:6150: checking for TIFFOpen in -ltiff" >&5
+echo "configure:6210: checking for TIFFOpen in -ltiff" >&5
 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltiff "
 cat > conftest.$ac_ext <<EOF
-#line 6155 "configure"
+#line 6215 "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
@@ -6162,7 +6222,7 @@
 TIFFOpen()
 ; return 0; }
 EOF
-if { (eval echo configure:6166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6226: \"$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 +6242,12 @@
 xe_msg_checking="for TIFFOpen in -ltiff"
 test -n "-ljpeg -lz" && xe_msg_checking="$xe_msg_checking using extra libs -ljpeg -lz"
 echo $ac_n "checking "$xe_msg_checking"""... $ac_c" 1>&6
-echo "configure:6186: checking "$xe_msg_checking"" >&5
+echo "configure:6246: checking "$xe_msg_checking"" >&5
 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -ltiff -ljpeg -lz"
 cat > conftest.$ac_ext <<EOF
-#line 6191 "configure"
+#line 6251 "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 +6258,7 @@
 TIFFOpen()
 ; 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:6262: \"$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
@@ -6225,12 +6285,12 @@
   }
   test -z "$with_imagick" && { 
 echo $ac_n "checking for MogrifyImage in -lMagick""... $ac_c" 1>&6
-echo "configure:6229: checking for MogrifyImage in -lMagick" >&5
+echo "configure:6289: checking for MogrifyImage in -lMagick" >&5
 ac_lib_var=`echo Magick'_'MogrifyImage | sed 'y%./+-%__p_%'`
 
 xe_check_libs=" -lMagick "
 cat > conftest.$ac_ext <<EOF
-#line 6234 "configure"
+#line 6294 "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
@@ -6241,7 +6301,7 @@
 MogrifyImage()
 ; return 0; }
 EOF
-if { (eval echo configure:6245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6305: \"$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
@@ -6277,12 +6337,12 @@
 
     
 echo $ac_n "checking for XawScrollbarSetThumb in -lXaw""... $ac_c" 1>&6
-echo "configure:6281: checking for XawScrollbarSetThumb in -lXaw" >&5
+echo "configure:6341: 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 6286 "configure"
+#line 6346 "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
@@ -6293,7 +6353,7 @@
 XawScrollbarSetThumb()
 ; return 0; }
 EOF
-if { (eval echo configure:6297: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6357: \"$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
@@ -6317,15 +6377,15 @@
                     
     ac_safe=`echo "Xm/Xm.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for Xm/Xm.h""... $ac_c" 1>&6
-echo "configure:6321: checking for Xm/Xm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6324 "configure"
+echo "configure:6381: checking for Xm/Xm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6384 "configure"
 #include "confdefs.h"
 #include <Xm/Xm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6329: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6389: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6342,12 +6402,12 @@
   echo "$ac_t""yes" 1>&6
   
 echo $ac_n "checking for XmStringFree in -lXm""... $ac_c" 1>&6
-echo "configure:6346: checking for XmStringFree in -lXm" >&5
+echo "configure:6406: 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 6351 "configure"
+#line 6411 "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
@@ -6358,7 +6418,7 @@
 XmStringFree()
 ; return 0; }
 EOF
-if { (eval echo configure:6362: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6422: \"$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
@@ -6615,7 +6675,7 @@
 
 if test "$with_mule" = "yes" ; then
   echo "checking for Mule-related features" 1>&6
-echo "configure:6619: checking for Mule-related features" >&5
+echo "configure:6679: checking for Mule-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining MULE
 EOF
@@ -6632,15 +6692,15 @@
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:6636: checking for $ac_hdr" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6639 "configure"
+echo "configure:6696: checking for $ac_hdr" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6699 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6704: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6671,12 +6731,12 @@
 
   
 echo $ac_n "checking for strerror in -lintl""... $ac_c" 1>&6
-echo "configure:6675: checking for strerror in -lintl" >&5
+echo "configure:6735: 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 6680 "configure"
+#line 6740 "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
@@ -6687,7 +6747,7 @@
 strerror()
 ; return 0; }
 EOF
-if { (eval echo configure:6691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6751: \"$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
@@ -6720,19 +6780,19 @@
 
 
   echo "checking for Mule input methods" 1>&6
-echo "configure:6724: checking for Mule input methods" >&5
+echo "configure:6784: checking for Mule input methods" >&5
       test -z "$with_xim" -a "$opsys" != "sol2" && with_xim=no
   case "$with_xim" in "" | "yes" )
     echo "checking for XIM" 1>&6
-echo "configure:6728: checking for XIM" >&5
+echo "configure:6788: checking for XIM" >&5
     
 echo $ac_n "checking for XmImMbLookupString in -lXm""... $ac_c" 1>&6
-echo "configure:6731: checking for XmImMbLookupString in -lXm" >&5
+echo "configure:6791: 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 6736 "configure"
+#line 6796 "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
@@ -6743,7 +6803,7 @@
 XmImMbLookupString()
 ; return 0; }
 EOF
-if { (eval echo configure:6747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6807: \"$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
@@ -6808,15 +6868,15 @@
 
     if test "$with_xfs" = "yes" ; then
     echo "checking for XFontSet" 1>&6
-echo "configure:6812: checking for XFontSet" >&5
+echo "configure:6872: checking for XFontSet" >&5
     
 echo $ac_n "checking for XmbDrawString in -lX11""... $ac_c" 1>&6
-echo "configure:6815: checking for XmbDrawString in -lX11" >&5
+echo "configure:6875: 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 6820 "configure"
+#line 6880 "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
@@ -6827,7 +6887,7 @@
 XmbDrawString()
 ; return 0; }
 EOF
-if { (eval echo configure:6831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6891: \"$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
@@ -6867,15 +6927,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:6871: checking for wnn/jllib.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6874 "configure"
+echo "configure:6931: checking for wnn/jllib.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6934 "configure"
 #include "confdefs.h"
 #include <wnn/jllib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:6879: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:6939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -6900,10 +6960,10 @@
     for ac_func in crypt
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6904: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 6907 "configure"
+echo "configure:6964: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 6967 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6926,7 +6986,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:6930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6955,12 +7015,12 @@
 
     test "$ac_cv_func_crypt" != "yes" && { 
 echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:6959: checking for crypt in -lcrypt" >&5
+echo "configure:7019: 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 6964 "configure"
+#line 7024 "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
@@ -6971,7 +7031,7 @@
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:6975: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7035: \"$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
@@ -7005,12 +7065,12 @@
   fi
     test -z "$with_wnn" && { 
 echo $ac_n "checking for jl_dic_list_e in -lwnn""... $ac_c" 1>&6
-echo "configure:7009: checking for jl_dic_list_e in -lwnn" >&5
+echo "configure:7069: 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 7014 "configure"
+#line 7074 "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
@@ -7021,7 +7081,7 @@
 jl_dic_list_e()
 ; return 0; }
 EOF
-if { (eval echo configure:7025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7085: \"$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
@@ -7058,12 +7118,12 @@
  fi
     
 echo $ac_n "checking for jl_fi_dic_list in -lwnn""... $ac_c" 1>&6
-echo "configure:7062: checking for jl_fi_dic_list in -lwnn" >&5
+echo "configure:7122: 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 7067 "configure"
+#line 7127 "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
@@ -7074,7 +7134,7 @@
 jl_fi_dic_list()
 ; return 0; }
 EOF
-if { (eval echo configure:7078: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7138: \"$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
@@ -7106,15 +7166,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:7110: checking for canna/RK.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7113 "configure"
+echo "configure:7170: checking for canna/RK.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7173 "configure"
 #include "confdefs.h"
 #include <canna/RK.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7137,12 +7197,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for RkBgnBun in -lRKC""... $ac_c" 1>&6
-echo "configure:7141: checking for RkBgnBun in -lRKC" >&5
+echo "configure:7201: 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 7146 "configure"
+#line 7206 "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
@@ -7153,7 +7213,7 @@
 RkBgnBun()
 ; return 0; }
 EOF
-if { (eval echo configure:7157: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7217: \"$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
@@ -7176,12 +7236,12 @@
  }
   test -z "$with_canna" && { 
 echo $ac_n "checking for jrKanjiControl in -lcanna""... $ac_c" 1>&6
-echo "configure:7180: checking for jrKanjiControl in -lcanna" >&5
+echo "configure:7240: 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 7185 "configure"
+#line 7245 "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
@@ -7192,7 +7252,7 @@
 jrKanjiControl()
 ; return 0; }
 EOF
-if { (eval echo configure:7196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7256: \"$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
@@ -7241,12 +7301,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:7245: checking for layout_object_getvalue in -li18n" >&5
+echo "configure:7305: 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 7250 "configure"
+#line 7310 "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
@@ -7257,7 +7317,7 @@
 layout_object_getvalue()
 ; return 0; }
 EOF
-if { (eval echo configure:7261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7321: \"$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
@@ -7330,10 +7390,10 @@
 for ac_func in acosh asinh atanh 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 strcasecmp strerror tzset ulimit usleep utimes waitpid
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7334: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7337 "configure"
+echo "configure:7394: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7397 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7356,7 +7416,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7360: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7393,10 +7453,10 @@
     for ac_func in realpath
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:7397: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7400 "configure"
+echo "configure:7457: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7460 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7419,7 +7479,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7483: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7452,16 +7512,16 @@
 esac
 
 echo $ac_n "checking whether netdb declares h_errno""... $ac_c" 1>&6
-echo "configure:7456: checking whether netdb declares h_errno" >&5
-cat > conftest.$ac_ext <<EOF
-#line 7458 "configure"
+echo "configure:7516: checking whether netdb declares h_errno" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7518 "configure"
 #include "confdefs.h"
 #include <netdb.h>
 int main() {
 return h_errno;
 ; return 0; }
 EOF
-if { (eval echo configure:7465: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7525: \"$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
@@ -7481,16 +7541,16 @@
 rm -f conftest*
 
 echo $ac_n "checking for sigsetjmp""... $ac_c" 1>&6
-echo "configure:7485: checking for sigsetjmp" >&5
-cat > conftest.$ac_ext <<EOF
-#line 7487 "configure"
+echo "configure:7545: checking for sigsetjmp" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7547 "configure"
 #include "confdefs.h"
 #include <setjmp.h>
 int main() {
 sigjmp_buf bar; sigsetjmp (bar, 0);
 ; return 0; }
 EOF
-if { (eval echo configure:7494: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7554: \"$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
@@ -7510,11 +7570,11 @@
 rm -f conftest*
 
 echo $ac_n "checking whether localtime caches TZ""... $ac_c" 1>&6
-echo "configure:7514: checking whether localtime caches TZ" >&5
+echo "configure:7574: checking whether localtime caches TZ" >&5
 
 if test "$ac_cv_func_tzset" = "yes"; then
 cat > conftest.$ac_ext <<EOF
-#line 7518 "configure"
+#line 7578 "configure"
 #include "confdefs.h"
 #include <time.h>
 #if STDC_HEADERS
@@ -7549,7 +7609,7 @@
   exit (0);
 }
 EOF
-if { (eval echo configure:7553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:7613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   emacs_cv_localtime_cache=no
 else
@@ -7578,9 +7638,9 @@
 
 if test "$HAVE_TIMEVAL" = "yes"; then
 echo $ac_n "checking whether gettimeofday cannot accept two arguments""... $ac_c" 1>&6
-echo "configure:7582: checking whether gettimeofday cannot accept two arguments" >&5
-cat > conftest.$ac_ext <<EOF
-#line 7584 "configure"
+echo "configure:7642: checking whether gettimeofday cannot accept two arguments" >&5
+cat > conftest.$ac_ext <<EOF
+#line 7644 "configure"
 #include "confdefs.h"
 
 #ifdef TIME_WITH_SYS_TIME
@@ -7602,7 +7662,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""no" 1>&6
 else
@@ -7624,19 +7684,19 @@
 
 
 echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:7628: checking for inline" >&5
+echo "configure:7688: checking for inline" >&5
 
 ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
   cat > conftest.$ac_ext <<EOF
-#line 7633 "configure"
+#line 7693 "configure"
 #include "confdefs.h"
 
 int main() {
 } $ac_kw foo() {
 ; return 0; }
 EOF
-if { (eval echo configure:7640: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:7700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_inline=$ac_kw; break
 else
@@ -7686,17 +7746,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:7690: checking for working alloca.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7693 "configure"
+echo "configure:7750: checking for working alloca.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7753 "configure"
 #include "confdefs.h"
 #include <alloca.h>
 int main() {
 char *p = alloca(2 * sizeof(int));
 ; return 0; }
 EOF
-if { (eval echo configure:7700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_header_alloca_h=yes
 else
@@ -7720,10 +7780,10 @@
 fi
 
 echo $ac_n "checking for alloca""... $ac_c" 1>&6
-echo "configure:7724: checking for alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7727 "configure"
+echo "configure:7784: checking for alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7787 "configure"
 #include "confdefs.h"
 
 #ifdef __GNUC__
@@ -7746,7 +7806,7 @@
 char *p = (char *) alloca(1);
 ; return 0; }
 EOF
-if { (eval echo configure:7750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ac_cv_func_alloca_works=yes
 else
@@ -7785,10 +7845,10 @@
 
 
 echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
-echo "configure:7789: checking whether alloca needs Cray hooks" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7792 "configure"
+echo "configure:7849: checking whether alloca needs Cray hooks" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7852 "configure"
 #include "confdefs.h"
 #if defined(CRAY) && ! defined(CRAY2)
 webecray
@@ -7812,10 +7872,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:7816: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7819 "configure"
+echo "configure:7876: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7879 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -7838,7 +7898,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:7842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:7902: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -7868,10 +7928,10 @@
 fi
 
 echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
-echo "configure:7872: checking stack direction for C alloca" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7875 "configure"
+echo "configure:7932: checking stack direction for C alloca" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7935 "configure"
 #include "confdefs.h"
 find_stack_direction ()
 {
@@ -7890,7 +7950,7 @@
   exit (find_stack_direction() < 0);
 }
 EOF
-if { (eval echo configure:7894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:7954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_c_stack_direction=1
 else
@@ -7918,15 +7978,15 @@
 
 ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for vfork.h""... $ac_c" 1>&6
-echo "configure:7922: checking for vfork.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7925 "configure"
+echo "configure:7982: checking for vfork.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 7985 "configure"
 #include "confdefs.h"
 #include <vfork.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:7930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:7990: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -7954,10 +8014,10 @@
 fi
 
 echo $ac_n "checking for working vfork""... $ac_c" 1>&6
-echo "configure:7958: checking for working vfork" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 7961 "configure"
+echo "configure:8018: checking for working vfork" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8021 "configure"
 #include "confdefs.h"
 /* Thanks to Paul Eggert for this test.  */
 #include <stdio.h>
@@ -8052,7 +8112,7 @@
   }
 }
 EOF
-if { (eval echo configure:8056: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8116: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_vfork_works=yes
 else
@@ -8077,10 +8137,10 @@
 
 
 echo $ac_n "checking for working strcoll""... $ac_c" 1>&6
-echo "configure:8081: checking for working strcoll" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8084 "configure"
+echo "configure:8141: checking for working strcoll" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8144 "configure"
 #include "confdefs.h"
 #include <string.h>
 main ()
@@ -8090,7 +8150,7 @@
 	strcoll ("123", "456") >= 0);
 }
 EOF
-if { (eval echo configure:8094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_strcoll_works=yes
 else
@@ -8117,10 +8177,10 @@
 for ac_func in getpgrp
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:8121: checking for $ac_func" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8124 "configure"
+echo "configure:8181: checking for $ac_func" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8184 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -8143,7 +8203,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8207: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -8171,10 +8231,10 @@
 done
 
 echo $ac_n "checking whether getpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:8175: checking whether getpgrp takes no argument" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8178 "configure"
+echo "configure:8235: checking whether getpgrp takes no argument" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8238 "configure"
 #include "confdefs.h"
 
 /*
@@ -8229,7 +8289,7 @@
 }
 
 EOF
-if { (eval echo configure:8233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   ac_cv_func_getpgrp_void=yes
 else
@@ -8255,10 +8315,10 @@
 
 
 echo $ac_n "checking for working mmap""... $ac_c" 1>&6
-echo "configure:8259: checking for working mmap" >&5
+echo "configure:8319: checking for working mmap" >&5
 case "$opsys" in ultrix* ) have_mmap=no ;; *)
 cat > conftest.$ac_ext <<EOF
-#line 8262 "configure"
+#line 8322 "configure"
 #include "confdefs.h"
 #include <stdio.h>
 #include <unistd.h>
@@ -8291,7 +8351,7 @@
   return 1;
 }
 EOF
-if { (eval echo configure:8295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
+if { (eval echo configure:8355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>&5
 then
   have_mmap=yes
 else
@@ -8325,15 +8385,15 @@
 
 ac_safe=`echo "termios.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for termios.h""... $ac_c" 1>&6
-echo "configure:8329: checking for termios.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8332 "configure"
+echo "configure:8389: checking for termios.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8392 "configure"
 #include "confdefs.h"
 #include <termios.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8337: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8397: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8376,15 +8436,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:8380: checking for termio.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8383 "configure"
+echo "configure:8440: checking for termio.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8443 "configure"
 #include "confdefs.h"
 #include <termio.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8416,10 +8476,10 @@
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:8420: checking for socket" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8423 "configure"
+echo "configure:8480: checking for socket" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8483 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -8442,7 +8502,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8506: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -8457,15 +8517,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:8461: checking for netinet/in.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8464 "configure"
+echo "configure:8521: checking for netinet/in.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8524 "configure"
 #include "confdefs.h"
 #include <netinet/in.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8469: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8529: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8482,15 +8542,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:8486: checking for arpa/inet.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8489 "configure"
+echo "configure:8546: checking for arpa/inet.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8549 "configure"
 #include "confdefs.h"
 #include <arpa/inet.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8515,9 +8575,9 @@
 }
 
       echo $ac_n "checking "for sun_len member in struct sockaddr_un"""... $ac_c" 1>&6
-echo "configure:8519: checking "for sun_len member in struct sockaddr_un"" >&5
+echo "configure:8579: checking "for sun_len member in struct sockaddr_un"" >&5
       cat > conftest.$ac_ext <<EOF
-#line 8521 "configure"
+#line 8581 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -8528,7 +8588,7 @@
 static struct sockaddr_un x; x.sun_len = 1;
 ; return 0; }
 EOF
-if { (eval echo configure:8532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8592: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   echo "$ac_t""yes" 1>&6; { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_SOCKADDR_SUN_LEN
@@ -8559,10 +8619,10 @@
 
 
 echo $ac_n "checking for msgget""... $ac_c" 1>&6
-echo "configure:8563: checking for msgget" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8566 "configure"
+echo "configure:8623: checking for msgget" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8626 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char msgget(); below.  */
@@ -8585,7 +8645,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:8589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_msgget=yes"
 else
@@ -8600,15 +8660,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:8604: checking for sys/ipc.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8607 "configure"
+echo "configure:8664: checking for sys/ipc.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8667 "configure"
 #include "confdefs.h"
 #include <sys/ipc.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8612: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8672: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8625,15 +8685,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:8629: checking for sys/msg.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8632 "configure"
+echo "configure:8689: checking for sys/msg.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8692 "configure"
 #include "confdefs.h"
 #include <sys/msg.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8637: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8697: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8671,15 +8731,15 @@
 
 ac_safe=`echo "dirent.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for dirent.h""... $ac_c" 1>&6
-echo "configure:8675: checking for dirent.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8678 "configure"
+echo "configure:8735: checking for dirent.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8738 "configure"
 #include "confdefs.h"
 #include <dirent.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8683: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8706,15 +8766,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:8710: checking for sys/dir.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8713 "configure"
+echo "configure:8770: checking for sys/dir.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8773 "configure"
 #include "confdefs.h"
 #include <sys/dir.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8718: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8747,15 +8807,15 @@
 
 ac_safe=`echo "nlist.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for nlist.h""... $ac_c" 1>&6
-echo "configure:8751: checking for nlist.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8754 "configure"
+echo "configure:8811: checking for nlist.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8814 "configure"
 #include "confdefs.h"
 #include <nlist.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8759: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8819: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8785,7 +8845,7 @@
 
 
 echo "checking "for sound support"" 1>&6
-echo "configure:8789: checking "for sound support"" >&5
+echo "configure:8849: checking "for sound support"" >&5
 case "$with_sound" in
   native | both ) with_native_sound=yes;;
   nas    | no   ) with_native_sound=no;;
@@ -8796,15 +8856,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:8800: checking for multimedia/audio_device.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8803 "configure"
+echo "configure:8860: checking for multimedia/audio_device.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 8863 "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:8808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:8868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -8852,12 +8912,12 @@
       if test -z "$native_sound_lib"; then
         
 echo $ac_n "checking for ALopenport in -laudio""... $ac_c" 1>&6
-echo "configure:8856: checking for ALopenport in -laudio" >&5
+echo "configure:8916: 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 8861 "configure"
+#line 8921 "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
@@ -8868,7 +8928,7 @@
 ALopenport()
 ; return 0; }
 EOF
-if { (eval echo configure:8872: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8932: \"$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
@@ -8899,12 +8959,12 @@
       if test -z "$native_sound_lib"; then
 	
 echo $ac_n "checking for AOpenAudio in -lAlib""... $ac_c" 1>&6
-echo "configure:8903: checking for AOpenAudio in -lAlib" >&5
+echo "configure:8963: 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 8908 "configure"
+#line 8968 "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
@@ -8915,7 +8975,7 @@
 AOpenAudio()
 ; return 0; }
 EOF
-if { (eval echo configure:8919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:8979: \"$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
@@ -8953,15 +9013,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:8957: checking for ${dir}/soundcard.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 8960 "configure"
+echo "configure:9017: checking for ${dir}/soundcard.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9020 "configure"
 #include "confdefs.h"
 #include <${dir}/soundcard.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:8965: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9025: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9031,7 +9091,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 9035 "configure"
+#line 9095 "configure"
 #include "confdefs.h"
 #include <audio/Xtutil.h>
 EOF
@@ -9058,7 +9118,7 @@
 
 if test "$with_tty" = "yes"  ; then
   echo "checking for TTY-related features" 1>&6
-echo "configure:9062: checking for TTY-related features" >&5
+echo "configure:9122: checking for TTY-related features" >&5
   { test "$extra_verbose" = "yes" && cat << \EOF
     Defining HAVE_TTY
 EOF
@@ -9074,12 +9134,12 @@
     if test -z "$with_ncurses"; then
     
 echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
-echo "configure:9078: checking for tgetent in -lncurses" >&5
+echo "configure:9138: 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 9083 "configure"
+#line 9143 "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
@@ -9090,7 +9150,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:9094: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9154: \"$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
@@ -9123,15 +9183,15 @@
 
     ac_safe=`echo "ncurses/curses.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/curses.h""... $ac_c" 1>&6
-echo "configure:9127: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9130 "configure"
+echo "configure:9187: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9190 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9135: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9195: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9153,15 +9213,15 @@
 
     ac_safe=`echo "ncurses/term.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for ncurses/term.h""... $ac_c" 1>&6
-echo "configure:9157: checking for ncurses/term.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9160 "configure"
+echo "configure:9217: checking for ncurses/term.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9220 "configure"
 #include "confdefs.h"
 #include <ncurses/term.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9165: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9225: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9191,15 +9251,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:9195: checking for ncurses/curses.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9198 "configure"
+echo "configure:9255: checking for ncurses/curses.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9258 "configure"
 #include "confdefs.h"
 #include <ncurses/curses.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9203: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9263: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9234,12 +9294,12 @@
 	for lib in curses termlib termcap; do
 	  
 echo $ac_n "checking for tgetent in -l$lib""... $ac_c" 1>&6
-echo "configure:9238: checking for tgetent in -l$lib" >&5
+echo "configure:9298: 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 9243 "configure"
+#line 9303 "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
@@ -9250,7 +9310,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:9254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9314: \"$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
@@ -9281,12 +9341,12 @@
       else
 	
 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
-echo "configure:9285: checking for tgetent in -lcurses" >&5
+echo "configure:9345: 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 9290 "configure"
+#line 9350 "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
@@ -9297,7 +9357,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:9301: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9361: \"$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
@@ -9315,12 +9375,12 @@
 else
   echo "$ac_t""no" 1>&6
 echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:9319: checking for tgetent in -ltermcap" >&5
+echo "configure:9379: 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 9324 "configure"
+#line 9384 "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
@@ -9331,7 +9391,7 @@
 tgetent()
 ; return 0; }
 EOF
-if { (eval echo configure:9335: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9395: \"$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
@@ -9379,15 +9439,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:9383: checking for gpm.h" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9386 "configure"
+echo "configure:9443: checking for gpm.h" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9446 "configure"
 #include "confdefs.h"
 #include <gpm.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:9391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:9451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -9410,12 +9470,12 @@
  }
   test -z "$with_gpm" && { 
 echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6
-echo "configure:9414: checking for Gpm_Open in -lgpm" >&5
+echo "configure:9474: 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 9419 "configure"
+#line 9479 "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
@@ -9426,7 +9486,7 @@
 Gpm_Open()
 ; return 0; }
 EOF
-if { (eval echo configure:9430: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9490: \"$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
@@ -9475,17 +9535,17 @@
 
 
 echo "checking for database support" 1>&6
-echo "configure:9479: checking for database support" >&5
+echo "configure:9539: checking for database support" >&5
 
 if test "$with_database_gnudbm" != "no"; then
   
 echo $ac_n "checking for dbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:9484: checking for dbm_open in -lgdbm" >&5
+echo "configure:9544: 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 9489 "configure"
+#line 9549 "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
@@ -9496,7 +9556,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:9500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9560: \"$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
@@ -9518,10 +9578,10 @@
 
   if test "$with_database_gnudbm" != "yes"; then
     echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:9522: checking for dbm_open" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9525 "configure"
+echo "configure:9582: checking for dbm_open" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9585 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -9544,7 +9604,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9608: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -9580,10 +9640,10 @@
 
 if test "$with_database_dbm" != "no"; then
   echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:9584: checking for dbm_open" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9587 "configure"
+echo "configure:9644: checking for dbm_open" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9647 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -9606,7 +9666,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -9627,12 +9687,12 @@
   if test "$need_libdbm" != "no"; then
     
 echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:9631: checking for dbm_open in -ldbm" >&5
+echo "configure:9691: 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 9636 "configure"
+#line 9696 "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
@@ -9643,7 +9703,7 @@
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:9647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9707: \"$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
@@ -9680,10 +9740,10 @@
 
 if test "$with_database_berkdb" != "no"; then
   echo $ac_n "checking for dbopen""... $ac_c" 1>&6
-echo "configure:9684: checking for dbopen" >&5
-
-cat > conftest.$ac_ext <<EOF
-#line 9687 "configure"
+echo "configure:9744: checking for dbopen" >&5
+
+cat > conftest.$ac_ext <<EOF
+#line 9747 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbopen(); below.  */
@@ -9706,7 +9766,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9710: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbopen=yes"
 else
@@ -9727,12 +9787,12 @@
   if test "$need_libdb" != "no"; then
     
 echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:9731: checking for dbopen in -ldb" >&5
+echo "configure:9791: 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 9736 "configure"
+#line 9796 "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
@@ -9743,7 +9803,7 @@
 dbopen()
 ; return 0; }
 EOF
-if { (eval echo configure:9747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9807: \"$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
@@ -9767,7 +9827,7 @@
   if test "$with_database_berkdb" = "yes"; then
     for path in "db/db.h" "db.h"; do
 cat > conftest.$ac_ext <<EOF
-#line 9771 "configure"
+#line 9831 "configure"
 #include "confdefs.h"
 #ifdef HAVE_INTTYPES_H
 #define __BIT_TYPES_DEFINED__
@@ -9785,7 +9845,7 @@
 
 ; return 0; }
 EOF
-if { (eval echo configure:9789: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:9849: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   db_h_path="$path"; break
 else
@@ -9837,12 +9897,12 @@
 if test "$with_socks" = "yes"; then
   
 echo $ac_n "checking for SOCKSinit in -lsocks""... $ac_c" 1>&6
-echo "configure:9841: checking for SOCKSinit in -lsocks" >&5
+echo "configure:9901: 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 9846 "configure"
+#line 9906 "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
@@ -9853,7 +9913,7 @@
 SOCKSinit()
 ; return 0; }
 EOF
-if { (eval echo configure:9857: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:9917: \"$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
--- a/configure.in	Mon Aug 13 10:13:03 2007 +0200
+++ b/configure.in	Mon Aug 13 10:13:48 2007 +0200
@@ -1371,6 +1371,7 @@
       *-386bsd* )	        opsys=386bsd ;;
       *-freebsd* )		opsys=freebsd ;;
       *-nextstep* )		opsys=nextstep ;;
+      *-pc-cygwin32 )		opsys=cygwin32 ;;
       dnl Otherwise, we fall through to the generic opsys code at the bottom.
     esac
   ;;
@@ -2085,6 +2086,21 @@
   no  ) window_system=none HAVE_X_WINDOWS=no  ;;
 esac
 
+if test "$window_system" = "none"; then
+  AC_CHECKING(for MS-Windows)
+  AC_CHECK_LIB(gdi32,main,have_msw=yes)
+  if test "$have_msw" = "yes"; then
+    AC_DEFINE(HAVE_MS_WINDOWS)
+    window_system=msw
+    with_scrollbars=msw
+    with_dialogs=msw
+    with_menubars=no
+    with_toolbars=no
+    with_tty=no
+    XE_ADD_OBJS(console-msw.o device-msw.o event-msw.o frame-msw.o objects-msw.o select-msw.o redisplay-msw.o msw-proc.o scrollbar-msw.o)
+  fi
+fi
+
 if test "$with_x11" = "yes"; then
   AC_DEFINE(HAVE_X_WINDOWS)
   XE_APPEND(lwlib, MAKE_SUBDIR)
@@ -2241,6 +2257,7 @@
 
 case "$window_system" in
   x11  ) HAVE_X_WINDOWS=yes; echo "  Using X11." ;;
+  msw  ) HAVE_X_WINDOWS=no; echo "  Using MS-Windows." ;;
   none ) HAVE_X_WINDOWS=no ; echo "  Using no window system." ;;
 esac
 
--- a/etc/BETA	Mon Aug 13 10:13:03 2007 +0200
+++ b/etc/BETA	Mon Aug 13 10:13:48 2007 +0200
@@ -1,4 +1,4 @@
-				-*- mode:outline; minor-mode:outl-mouse -*-
+				-*- mode:outline -*-
 
 * Introduction
 ==============
--- a/lisp/ChangeLog	Mon Aug 13 10:13:03 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 10:13:48 2007 +0200
@@ -1,3 +1,88 @@
+1997-12-27  Jens-Ulrik Holger Petersen  <petersen@kurims.kyoto-u.ac.jp>
+
+	* help.el (help-mode-bury): Now a call to `help-mode-quit' with
+ 	argument.
+	(help-mode-quit): New optional arg to control whether it kills or
+	buries.  Tidied up.
+	(with-displaying-help-buffer): Don't kill buffer initially, even
+	if it exists: it is erased by `with-output-to-temp-buffer' anyway.
+	(help-pretty-print-value): Rename back from
+	`help-maybe-pretty-print-value'!  If `pp-internal' is available
+	use it, otherwise use dumped `cl-prettyprint'.
+	(describe-variable): Use `help-pretty-print-value' again.
+	(find-func): Removed reference to "find-func" at end.
+
+1997-12-26  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* dumped-lisp.el: x-menubar.el dumped along with mswindows native
+	  GUI XEmacs. Rename? x-menubar is rather window system
+	  independant, except for a couple of items.
+
+1997-12-26  SL Baur  <steve@altair.xemacs.org>
+
+	* x-menubar.el (default-menubar): Remove hyperbole and oobr
+	entries as they will no longer be distributed with XEmacs.
+
+	* format.el (format-alist): Fix image/tiff regexps.
+	From P. E. Jareth Hein <jareth@camelot-soft.com>
+
+	* help.el (help-maybe-pretty-print-value): Rename.
+	(describe-variable): Use it.
+	(describe-variable): Add trailing linefeed.
+
+1997-12-26  Jens-Ulrik Holger Petersen  <petersen@kurims.kyoto-u.ac.jp>
+
+	* help.el (describe-function-1): Don't output anything for
+	  arglist of autoload functions.
+
+1997-12-26  Jens-Ulrik Holger Petersen  <petersen@kurims.kyoto-u.ac.jp>
+
+	* help.el (describe-function-1): Don't output anything for
+	  arglist of autoload functions.
+
+1997-12-26  Jens-Ulrik Holger Petersen  <petersen@kurims.kyoto-u.ac.jp>
+
+	* help.el (help-mode-map): New bindings for `help-mode-bury',
+ 	`describe-function-at-point', `describe-variable-at-point',
+ 	`Info-elisp-ref', `customize-variable', `help-next-section' and
+ 	`help-prev-section'.
+	(help-next-section): New function.
+	(help-prev-section): New function.
+	(help-mode-quit): Changed to kill the help buffer.
+	(help-mode-bury): Formerly `help-mode-quit'.  Bury buffer
+ 	correctly.
+	(help-buffer-name): New function to generate the name of help
+ 	buffers.
+	(with-displaying-help-buffer): Is now a macro.  Takes an new first
+ 	argument giving the name of the help buffer.
+	(describe-key): Use `with-displaying-help-buffer' with name.
+	(describe-mode): Ditto.
+	(describe-bindings): Ditto.
+	(describe-prefix-bindings): Ditto.
+	(view-lossage): Ditto.
+	(with-syntax-table): New macro.
+	(function-called-at-point): Use `ignore-errors' and
+ 	`with-syntax-table'.
+	(function-at-point): Ditto.
+	(describe-function): Use `with-displaying-help-buffer' with name.
+	(function-arglist): Extracted from `describe-function-1'.  Returns
+ 	function's arglist as string.
+	(function-documentation): Extracted from `describe-function-1'.
+  	Returns function's docstring.
+	(describe-function-1): Remove all the "stream" garbage, including
+	the stream argument.  Use `function-arglist' and
+	`function-documentation'.
+	(describe-function-arglist): Just use `function-arglist'.
+	(variable-at-point): Use `ignore-errors' and `with-syntax-table'.
+	(help-pretty-print-value): New function to help with
+	pretty-printing variable values.  Knows about `#<...>'.  Needs
+	`pp-internal'.
+	(describe-variable): Use `with-displaying-help-buffer' with name.
+	Formatting improved.  Display file where variable is defined, if
+	known.  Use `help-pretty-print-value'.
+	(describe-syntax): Use `with-displaying-help-buffer' with name.
+	(list-processes): Remove "stream" garbage.
+
 1997-12-25  SL Baur  <steve@altair.xemacs.org>
 
 	* x-init.el (x-initialize-keyboard): Don't load x-win*.el files,
--- a/lisp/dumped-lisp.el	Mon Aug 13 10:13:03 2007 +0200
+++ b/lisp/dumped-lisp.el	Mon Aug 13 10:13:48 2007 +0200
@@ -151,7 +151,7 @@
 	#+window-system "mode-motion"
 	#+window-system "mouse"
 ;; preload the X code, for faster startup.
-	#+(and x menubar) "x-menubar"
+	#+(and (not infodock) (or x mswindows) menubar) "x-menubar"
 	#+x "x-faces"
 	#+x "x-iso8859-1"
 	#+x "x-mouse"
--- a/lisp/format.el	Mon Aug 13 10:13:03 2007 +0200
+++ b/lisp/format.el	Mon Aug 13 10:13:48 2007 +0200
@@ -79,9 +79,9 @@
 		 image-decode-xpm nil t image-mode)
 
     ;; TIFF files have lousy magic
-    (image/tiff "TIFF image" "\111\111\052\000"
+    (image/tiff "TIFF image" "II\\*\000"
 		image-decode-tiff nil t image-mode) ;; TIFF 6.0 big-endian
-    (image/tiff "TIFF image" "\111\111\000\052"
+    (image/tiff "TIFF image" "MM\000\\*"
 		image-decode-tiff nil t image-mode) ;; TIFF 6.0 little-endian
 
     (text/enriched "Extended MIME text/enriched format."
--- a/lisp/help.el	Mon Aug 13 10:13:03 2007 +0200
+++ b/lisp/help.el	Mon Aug 13 10:13:48 2007 +0200
@@ -191,7 +191,16 @@
   )
 
 (define-key help-mode-map "q" 'help-mode-quit)
+(define-key help-mode-map "Q" 'help-mode-bury)
 (define-key help-mode-map "f" 'find-function-at-point)
+(define-key help-mode-map "d" 'describe-function-at-point)
+(define-key help-mode-map "v" 'describe-variable-at-point)
+(define-key help-mode-map "i" 'Info-elisp-ref)
+(define-key help-mode-map "c" 'customize-variable)
+(define-key help-mode-map [tab] 'help-next-symbol)
+(define-key help-mode-map [(shift tab)] 'help-prev-symbol)
+(define-key help-mode-map "n" 'help-next-section)
+(define-key help-mode-map "p" 'help-prev-section)
 
 (defun describe-function-at-point ()
   "Describe directly the function at point in the other window."
@@ -199,29 +208,43 @@
   (let ((symb (function-at-point)))
     (when symb
       (describe-function symb))))
+
 (defun describe-variable-at-point ()
   "Describe directly the variable at point in the other window."
   (interactive)
   (let ((symb (variable-at-point)))
     (when symb
       (describe-variable symb))))
+
 (defun help-next-symbol ()
   "Move point to the next quoted symbol."
   (interactive)
   (search-forward "`" nil t))
+
 (defun help-prev-symbol ()
   "Move point to the previous quoted symbol."
   (interactive)
   (search-backward "'" nil t))
-(define-key help-mode-map "d" 'describe-function-at-point)
-(define-key help-mode-map "v" 'describe-variable-at-point)
-(define-key help-mode-map [tab] 'help-next-symbol)
-(define-key help-mode-map [(shift tab)] 'help-prev-symbol)
+
+(defun help-next-section ()
+  "Move point to the next quoted symbol."
+  (interactive)
+  (search-forward-regexp "^\\w+:" nil t))
 
+(defun help-prev-section ()
+  "Move point to the previous quoted symbol."
+  (interactive)
+  (search-backward-regexp "^\\w+:" nil t))
 
-(defun help-mode-quit ()
+(defun help-mode-bury ()
+  "Buries the buffer, possibly restoring the previous window configuration."
+  (interactive)
+  (help-mode-quit t))
+
+(defun help-mode-quit (&optional bury)
   "Exits from help mode, possibly restoring the previous window configuration.
-Bury the help buffer to the end of the buffer list."
+If the optional argument BURY is non-nil, the help buffer is buried,
+otherwise it is killed."
   (interactive)
   (let ((buf (current-buffer)))
     (cond ((frame-property (selected-frame) 'help-window-config)
@@ -230,7 +253,9 @@
 	   (set-frame-property  (selected-frame) 'help-window-config nil))
 	  ((not (one-window-p))
 	   (delete-window)))
-    (bury-buffer buf)))
+    (if bury
+	(bury-buffer buf)
+      (kill-buffer buf))))
 
 (defun help-quit ()
   (interactive)
@@ -390,80 +415,88 @@
   :type 'boolean
   :group 'help-appearance)
 
+(defun help-buffer-name (name)
+  "Return a name for a Help buffer using string NAME for context."
+  (if (stringp name)
+      (format "*Help: %s*" name)
+    "*Help*"))
+
 ;; Use this function for displaying help when C-h something is pressed
 ;; or in similar situations.  Do *not* use it when you are displaying
 ;; a help message and then prompting for input in the minibuffer --
 ;; this macro usually selects the help buffer, which is not what you
 ;; want in those situations.
-
-;;; ### Should really be a macro (as suggested above) to eliminate the
-;;; requirement of caller to code a lambda form in THUNK -- mrb
-(defun with-displaying-help-buffer (thunk)
-  (let ((winconfig (current-window-configuration))
-        (was-one-window (one-window-p))
-	(help-not-visible
-	 (not (and (windows-of-buffer "*Help*") ;shortcut
-		   (member (selected-frame)
-			   (mapcar 'window-frame
-				   (windows-of-buffer "*Help*")))))))
-    (prog1 (with-output-to-temp-buffer "*Help*"
-             (prog1 (funcall thunk)
-               (save-excursion
-                 (set-buffer standard-output)
-                 (help-mode))))
-      (let ((helpwin (get-buffer-window "*Help*")))
-        (when helpwin
-	  (with-current-buffer (window-buffer helpwin)
-	    ;; If the *Help* buffer is already displayed on this
-	    ;; frame, don't override the previous configuration
-	    (when help-not-visible
-	      (set-frame-property (selected-frame)
-				  'help-window-config winconfig)))
-	  (when help-selects-help-window
-	    (select-window helpwin))
-	  (cond ((eq helpwin (selected-window))
-		 (display-message 'command
-		   (substitute-command-keys "Type \\[help-mode-quit] to remove help window, \\[scroll-up] to scroll the help.")))
-		(was-one-window
-		 (display-message 'command
-		   (substitute-command-keys "Type \\[delete-other-windows] to remove help window, \\[scroll-other-window] to scroll the help.")))
-		(t
-		 (display-message 'command
-		   (substitute-command-keys "Type \\[switch-to-buffer-other-window] to restore the other window, \\[scroll-other-window] to scroll the help.")))))))))
+(defmacro with-displaying-help-buffer (name &rest body)
+  "Form which makes a help buffer with given NAME and evaluates BODY there.
+The actual name of the buffer is generated by the function `help-buffer-name'."
+  `(let* ((winconfig (current-window-configuration))
+	  (was-one-window (one-window-p))
+	  (buffer-name (help-buffer-name ,name))
+	  (help-not-visible
+	   (not (and (windows-of-buffer buffer-name) ;shortcut
+		     (member (selected-frame)
+			     (mapcar 'window-frame
+				     (windows-of-buffer buffer-name)))))))
+     (prog1 (with-output-to-temp-buffer buffer-name
+	      (prog1 ,@body
+		(save-excursion
+		  (set-buffer standard-output)
+		  (help-mode))))
+       (let ((helpwin (get-buffer-window buffer-name)))
+	 (when helpwin
+	   (with-current-buffer (window-buffer helpwin)
+	     ;; If the *Help* buffer is already displayed on this
+	     ;; frame, don't override the previous configuration
+	     (when help-not-visible
+	       (set-frame-property (selected-frame)
+				   'help-window-config winconfig)))
+	   (when help-selects-help-window
+	     (select-window helpwin))
+	   (cond ((eq helpwin (selected-window))
+		  (display-message 'command
+		    (substitute-command-keys "Type \\[help-mode-quit] to remove help window, \\[scroll-up] to scroll the help.")))
+		 (was-one-window
+		  (display-message 'command
+		    (substitute-command-keys "Type \\[delete-other-windows] to remove help window, \\[scroll-other-window] to scroll the help.")))
+		 (t
+		  (display-message 'command
+		    (substitute-command-keys "Type \\[switch-to-buffer-other-window] to restore the other window, \\[scroll-other-window] to scroll the help.")))))))))
+(put 'with-displaying-help-buffer 'lisp-indent-function 1)
+(put 'with-displaying-help-buffer 'edebug-form-spec '(form body))
 
 (defun describe-key (key)
   "Display documentation of the function invoked by KEY.
 KEY is a string, or vector of events.
 When called interactively, KEY may also be a menu selection."
   (interactive "kDescribe key: ")
-  (let ((defn (key-or-menu-binding key)))
+  (let ((defn (key-or-menu-binding key))
+	(key-string (key-description key)))
     (if (or (null defn) (integerp defn))
-        (message "%s is undefined" (key-description key))
-      (with-displaying-help-buffer
-       (lambda ()
-	 (princ (key-description key))
-	 (princ " runs ")
-	 (if (symbolp defn) (princ (format "`%S'" defn))
-	   (prin1 defn))
-	 (princ "\n\n")
-	 (cond ((or (stringp defn) (vectorp defn))
-		(let ((cmd (key-binding defn)))
-		  (if (not cmd)
-		      (princ "a keyboard macro")
-		    (progn
-		      (princ "a keyboard macro which runs the command ")
-		      (prin1 cmd)
-		      (princ ":\n\n")
-		      (if (documentation cmd) (princ (documentation cmd)))))))
-	       ((and (consp defn) (not (eq 'lambda (car-safe defn))))
-		(let ((describe-function-show-arglist nil))
-		  (describe-function-1 (car defn) standard-output)))
-	       ((symbolp defn)
-		(describe-function-1 defn standard-output))
-	       ((documentation defn)
-		(princ (documentation defn)))
-	       (t
-		(princ "not documented"))))))))
+        (message "%s is undefined" key-string)
+      (with-displaying-help-buffer (format "key `%s'" key-string)
+	(princ key-string)
+	(princ " runs ")
+	(if (symbolp defn) (princ (format "`%S'" defn))
+	  (prin1 defn))
+	(princ "\n\n")
+	(cond ((or (stringp defn) (vectorp defn))
+	       (let ((cmd (key-binding defn)))
+		 (if (not cmd)
+		     (princ "a keyboard macro")
+		   (progn
+		     (princ "a keyboard macro which runs the command ")
+		     (prin1 cmd)
+		     (princ ":\n\n")
+		     (if (documentation cmd) (princ (documentation cmd)))))))
+	      ((and (consp defn) (not (eq 'lambda (car-safe defn))))
+	       (let ((describe-function-show-arglist nil))
+		 (describe-function-1 (car defn))))
+	      ((symbolp defn)
+	       (describe-function-1 defn))
+	      ((documentation defn)
+	       (princ (documentation defn)))
+	      (t
+	       (princ "not documented")))))))
 
 (defun describe-mode ()
   "Display documentation of current major mode and minor modes.
@@ -471,39 +504,38 @@
 \(listed in `minor-mode-alist') must also be a function whose documentation
 describes the minor mode."
   (interactive)
-  (with-displaying-help-buffer
-   (lambda ()
-     ;; XEmacs change: print the major-mode documentation before
-     ;; the minor modes.
-     (princ mode-name)
-     (princ " mode:\n")
-     (princ (documentation major-mode))
-     (princ "\n\n----\n\n")
-     (let ((minor-modes minor-mode-alist))
-       (while minor-modes
-	 (let* ((minor-mode (car (car minor-modes)))
-		(indicator (car (cdr (car minor-modes)))))
-	   ;; Document a minor mode if it is listed in minor-mode-alist,
-	   ;; bound locally in this buffer, non-nil, and has a function
-	   ;; definition.
-	   (if (and (boundp minor-mode)
-		    (symbol-value minor-mode)
-		    (fboundp minor-mode))
-	       (let ((pretty-minor-mode minor-mode))
-		 (if (string-match "-mode\\'" (symbol-name minor-mode))
-		     (setq pretty-minor-mode
-			   (capitalize
-			    (substring (symbol-name minor-mode)
-				       0 (match-beginning 0)))))
-		 (while (and (consp indicator) (extentp (car indicator)))
-		   (setq indicator (cdr indicator)))
-		 (while (and indicator (symbolp indicator))
-		   (setq indicator (symbol-value indicator)))
-		 (princ (format "%s minor mode (indicator%s):\n"
-				pretty-minor-mode indicator))
-		 (princ (documentation minor-mode))
-		 (princ "\n\n----\n\n"))))
-	 (setq minor-modes (cdr minor-modes)))))))
+  (with-displaying-help-buffer (format "%s mode" mode-name)
+    ;; XEmacs change: print the major-mode documentation before
+    ;; the minor modes.
+    (princ mode-name)
+    (princ " mode:\n")
+    (princ (documentation major-mode))
+    (princ "\n\n----\n\n")
+    (let ((minor-modes minor-mode-alist))
+      (while minor-modes
+	(let* ((minor-mode (car (car minor-modes)))
+	       (indicator (car (cdr (car minor-modes)))))
+	  ;; Document a minor mode if it is listed in minor-mode-alist,
+	  ;; bound locally in this buffer, non-nil, and has a function
+	  ;; definition.
+	  (if (and (boundp minor-mode)
+		   (symbol-value minor-mode)
+		   (fboundp minor-mode))
+	      (let ((pretty-minor-mode minor-mode))
+		(if (string-match "-mode\\'" (symbol-name minor-mode))
+		    (setq pretty-minor-mode
+			  (capitalize
+			   (substring (symbol-name minor-mode)
+				      0 (match-beginning 0)))))
+		(while (and (consp indicator) (extentp (car indicator)))
+		  (setq indicator (cdr indicator)))
+		(while (and indicator (symbolp indicator))
+		  (setq indicator (symbol-value indicator)))
+		(princ (format "%s minor mode (indicator%s):\n"
+			       pretty-minor-mode indicator))
+		(princ (documentation minor-mode))
+		(princ "\n\n----\n\n"))))
+	(setq minor-modes (cdr minor-modes))))))
 
 ;; So keyboard macro definitions are documented correctly
 (fset 'defining-kbd-macro (symbol-function 'start-kbd-macro))
@@ -556,9 +588,8 @@
 If the second argument (prefix arg, interactively) is non-null
 then only the mouse bindings are displayed."
   (interactive (list nil current-prefix-arg))
-  (with-displaying-help-buffer
-   (lambda ()
-     (describe-bindings-1 prefix mouse-only-p))))
+  (with-displaying-help-buffer (format "bindings for %s" major-mode)
+    (describe-bindings-1 prefix mouse-only-p)))
 
 (defun describe-bindings-1 (&optional prefix mouse-only-p)
   (let ((heading (if mouse-only-p
@@ -592,7 +623,8 @@
                                 nil shadow prefix mouse-only-p)
     (when (and prefix function-key-map (not mouse-only-p))
       (insert "\nFunction key map translations:\n" heading)
-      (describe-bindings-internal function-key-map nil nil prefix mouse-only-p))
+      (describe-bindings-internal function-key-map nil nil
+				  prefix mouse-only-p))
     (set-buffer buffer)))
 
 (defun describe-prefix-bindings ()
@@ -607,12 +639,11 @@
     (while (< i (length prefix))
       (aset prefix i (aref key i))
       (setq i (1+ i)))
-    (with-displaying-help-buffer
-     (lambda ()
-       (princ "Key bindings starting with ")
-       (princ (key-description prefix))
-       (princ ":\n\n")
-       (describe-bindings-1 prefix nil)))))
+    (with-displaying-help-buffer (format "%s prefix" (key-description prefix))
+      (princ "Key bindings starting with ")
+      (princ (key-description prefix))
+      (princ ":\n\n")
+      (describe-bindings-1 prefix nil))))
 
 ;; Make C-h after a prefix, when not specifically bound, 
 ;; run describe-prefix-bindings.
@@ -664,31 +695,30 @@
 The number of keys shown is controlled by `view-lossage-key-count'.
 The number of messages shown is controlled by `view-lossage-message-count'."
   (interactive)
-  (with-displaying-help-buffer
-   (lambda ()
-     (princ (key-description (recent-keys view-lossage-key-count)))
-     (save-excursion
-       (set-buffer standard-output)
-       (goto-char (point-min))
-       (insert "Recent keystrokes:\n\n")
-       (while (progn (move-to-column 50) (not (eobp)))
-	 (search-forward " " nil t)
-	 (insert "\n")))
-     ;; XEmacs addition
-     (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n")
-     (save-excursion
-       (let ((buffer (get-buffer-create " *Message-Log*"))
-	     (count 0)
-	     oldpoint)
-	 (set-buffer buffer)
-	 (goto-char (point-max))
-	 (set-buffer standard-output)
-	 (while (and (> (point buffer) (point-min buffer))
-		     (< count view-lossage-message-count))
-	   (setq oldpoint (point buffer))
-	   (forward-line -1 buffer)
-	   (insert-buffer-substring buffer (point buffer) oldpoint)
-	   (setq count (1+ count))))))))
+  (with-displaying-help-buffer "lossage"
+    (princ (key-description (recent-keys view-lossage-key-count)))
+    (save-excursion
+      (set-buffer standard-output)
+      (goto-char (point-min))
+      (insert "Recent keystrokes:\n\n")
+      (while (progn (move-to-column 50) (not (eobp)))
+	(search-forward " " nil t)
+	(insert "\n")))
+    ;; XEmacs addition
+    (princ "\n\n\nRecent minibuffer messages (most recent first):\n\n")
+    (save-excursion
+      (let ((buffer (get-buffer-create " *Message-Log*"))
+	    (count 0)
+	    oldpoint)
+	(set-buffer buffer)
+	(goto-char (point-max))
+	(set-buffer standard-output)
+	(while (and (> (point buffer) (point-min buffer))
+		    (< count view-lossage-message-count))
+	  (setq oldpoint (point buffer))
+	  (forward-line -1 buffer)
+	  (insert-buffer-substring buffer (point buffer) oldpoint)
+	  (setq count (1+ count)))))))
 
 (define-function 'help 'help-for-help)
 
@@ -731,64 +761,66 @@
 \\[describe-copying]	XEmacs copying permission (General Public License)."
   help-map)
 
+(defmacro with-syntax-table (syntab &rest body)
+  "Evaluate BODY with the syntax-table SYNTAB"
+  `(let ((stab (syntax-table)))
+     (unwind-protect
+	 (progn
+	   (set-syntax-table (copy-syntax-table ,syntab))
+	   ,@body)
+       (set-syntax-table stab))))
+(put 'with-syntax-table 'lisp-indent-function 1)
+(put 'with-syntax-table 'edebug-form-spec '(form body))
+
 (defun function-called-at-point ()
   "Return the function which is called by the list containing point.
 If that gives no function, return the function whose name is around point.
 If that doesn't give a function, return nil."
-  (or (condition-case ()
+  (or (ignore-errors
+	(save-excursion
+	  (save-restriction
+	    (narrow-to-region (max (point-min) (- (point) 1000))
+			      (point-max))
+	    (backward-up-list 1)
+	    (forward-char 1)
+	    (let (obj)
+	      (setq obj (read (current-buffer)))
+	      (and (symbolp obj) (fboundp obj) obj)))))
+      (ignore-errors
+	(with-syntax-table emacs-lisp-mode-syntax-table
 	  (save-excursion
-	    (save-restriction
-	      (narrow-to-region (max (point-min) (- (point) 1000)) (point-max))
-	      (backward-up-list 1)
-	      (forward-char 1)
-	      (let (obj)
-		(setq obj (read (current-buffer)))
-		(and (symbolp obj) (fboundp obj) obj))))
-	(error nil))
-      (condition-case ()
-	  (let ((stab (syntax-table)))
-	    (unwind-protect
-		(save-excursion
-		  (set-syntax-table emacs-lisp-mode-syntax-table)
-		  (or (not (zerop (skip-syntax-backward "_w")))
-		      (eq (char-syntax (char-after (point))) ?w)
-		      (eq (char-syntax (char-after (point))) ?_)
-		      (forward-sexp -1))
-		  (skip-chars-forward "`'")
-		  (let ((obj (read (current-buffer))))
-		    (and (symbolp obj) (fboundp obj) obj)))
-	      (set-syntax-table stab)))
-	(error nil))))
+	    (or (not (zerop (skip-syntax-backward "_w")))
+		(eq (char-syntax (char-after (point))) ?w)
+		(eq (char-syntax (char-after (point))) ?_)
+		(forward-sexp -1))
+	    (skip-chars-forward "`'")
+	    (let ((obj (read (current-buffer))))
+	      (and (symbolp obj) (fboundp obj) obj)))))))
 
 (defun function-at-point ()
   "Return the function whose name is around point.
 If that gives no function, return the function which is called by the
 list containing point.  If that doesn't give a function, return nil."
-  (or (condition-case ()
-	  (let ((stab (syntax-table)))
-	    (unwind-protect
-		(save-excursion
-		  (set-syntax-table emacs-lisp-mode-syntax-table)
-		  (or (not (zerop (skip-syntax-backward "_w")))
-		      (eq (char-syntax (char-after (point))) ?w)
-		      (eq (char-syntax (char-after (point))) ?_)
-		      (forward-sexp -1))
-		  (skip-chars-forward "`'")
-		  (let ((obj (read (current-buffer))))
-		    (and (symbolp obj) (fboundp obj) obj)))
-	      (set-syntax-table stab)))
-	(error nil))
-      (condition-case ()
+  (or (ignore-errors
+	(with-syntax-table emacs-lisp-mode-syntax-table
 	  (save-excursion
-	    (save-restriction
-	      (narrow-to-region (max (point-min) (- (point) 1000))
-				(point-max))
-	      (backward-up-list 1)
-	      (forward-char 1)
-	      (let (obj)
-		(setq obj (read (current-buffer)))
-		(and (symbolp obj) (fboundp obj) obj))))
-	(error nil))))
+	    (or (not (zerop (skip-syntax-backward "_w")))
+		(eq (char-syntax (char-after (point))) ?w)
+		(eq (char-syntax (char-after (point))) ?_)
+		(forward-sexp -1))
+	    (skip-chars-forward "`'")
+	    (let ((obj (read (current-buffer))))
+	      (and (symbolp obj) (fboundp obj) obj)))))
+      (ignore-errors
+	(save-excursion
+	  (save-restriction
+	    (narrow-to-region (max (point-min) (- (point) 1000))
+			      (point-max))
+	    (backward-up-list 1)
+	    (forward-char 1)
+	    (let (obj)
+	      (setq obj (read (current-buffer)))
+	      (and (symbolp obj) (fboundp obj) obj)))))))
 
 ;; Default to nil for the non-hackers?  Not until we find a way to
 ;; distinguish hackers from non-hackers automatically!
@@ -822,11 +854,8 @@
                         (gettext "Describe function: "))
                     obarray 'fboundp t nil 'function-history))))
       (list (if (equal val "") fn (intern val)))))
-  (with-displaying-help-buffer
-   (lambda ()
-     (describe-function-1 function standard-output)
-     ;; Return the text we displayed.
-     (buffer-string nil nil standard-output))))
+  (with-displaying-help-buffer (format "function `%s'" function)
+    (describe-function-1 function)))
 
 (defun function-obsolete-p (function)
   "Return non-nil if FUNCTION is obsolete."
@@ -878,13 +907,56 @@
 ;(gettext "an autoloaded Lisp macro")
 ;(gettext "an interactive autoloaded Lisp macro")
 
-(defun describe-function-1 (function stream &optional nodoc)
-  (princ (format "`%S' is " function) stream)
+;; taken out of `describe-function-1'
+(defun function-arglist (function)
+  "Returns a string giving the argument list of FUNCTION.
+For example:
+
+	(function-arglist 'function-arglist)
+	=> (function-arglist FUNCTION)
+
+This function is used by `describe-function-1' to list function
+arguments in the standard Lisp style."
+  (let* ((fndef (symbol-function function))
+	 (arglist
+	 (cond ((compiled-function-p fndef)
+		(compiled-function-arglist fndef))
+	       ((eq (car-safe fndef) 'lambda)
+		(nth 1 fndef))
+	       ((subrp fndef)
+		(let ((doc (documentation function)))
+		  (if (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'"
+				    doc)
+		      (substring doc (match-beginning 1) (match-end 1)))))
+	       (t t))))
+    (cond ((listp arglist)
+	   (prin1-to-string
+	    (cons function (mapcar (lambda (arg)
+				     (if (memq arg '(&optional &rest))
+					 arg
+				       (intern (upcase (symbol-name arg)))))
+				   arglist))
+	    t))
+	  ((stringp arglist)
+	   (format "(%s %s)" function arglist)))))
+
+(defun function-documentation (function &optional strip-arglist)
+  "Returns a string giving the documentation for FUNCTION if any.  
+If the optional argument STRIP-ARGLIST is non-nil remove the arglist
+part of the documentation of internal subroutines."
+  (let ((doc (condition-case nil
+		 (or (documentation function)
+		     (gettext "not documented"))
+	       (void-function ""))))
+    (if (and strip-arglist
+	     (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc))
+	(setq doc (substring doc 0 (match-beginning 0))))
+    doc))
+
+(defun describe-function-1 (function &optional nodoc)
+  "This function does the work for `describe-function'."
+  (princ (format "`%S' is " function))
   (let* ((def function)
-         (doc (condition-case nil
-		  (or (documentation function)
-		      (gettext "not documented"))
-		(void-function "")))
 	 aliases file-name autoload-file kbd-macro-p fndef macrop)
     (while (and (symbolp def) (fboundp def))
       (when (not (eq def function))
@@ -905,7 +977,7 @@
 			     (compiled-function-annotation (cdr def)))
 	      macrop t)
       (setq fndef def))
-    (if aliases (princ aliases stream))
+    (if aliases (princ aliases))
     (let ((int #'(lambda (string an-p macro-p)
 		   (princ (format
 			   (gettext (concat
@@ -915,10 +987,9 @@
 					   (t "a "))
 				     "%s"
 				     (if macro-p " macro" " function")))
-			   string)
-			  stream))))
+			   string)))))
       (cond ((or (stringp def) (vectorp def))
-             (princ "a keyboard macro." stream)
+             (princ "a keyboard macro.")
 	     (setq kbd-macro-p t))
             ((subrp fndef)
              (funcall int "built-in" nil macrop))
@@ -927,7 +998,7 @@
 ;	     XEmacs -- we handle aliases above.
 ;            ((symbolp fndef)
 ;             (princ (format "alias for `%s'"
-;			    (prin1-to-string def)) stream))
+;			    (prin1-to-string def))))
             ((eq (car-safe fndef) 'lambda)
              (funcall int "Lisp" nil macrop))
             ((eq (car-safe fndef) 'mocklisp)
@@ -936,50 +1007,29 @@
 	     (setq autoload-file (elt def 1))
 	     (funcall int "autoloaded Lisp" t (elt def 4)))
 	    ((and (symbolp def) (not (fboundp def)))
-	     (princ "a symbol with a void (unbound) function definition." stream))
+	     (princ "a symbol with a void (unbound) function definition."))
             (t
              nil)))
-    (princ "\n" stream)
+    (princ "\n")
     (if autoload-file
-	(princ (format "  -- autoloads from \"%s\"\n" autoload-file) stream))
+	(princ (format "  -- autoloads from \"%s\"\n" autoload-file)))
     (or file-name
 	(setq file-name (describe-function-find-file function)))
     (if file-name
-	(princ (format "  -- loaded from \"%s\"\n" file-name)) stream)
-;;     (terpri stream)
+	(princ (format "  -- loaded from \"%s\"\n" file-name)))
+;;     (terpri)
     (if describe-function-show-arglist
-        (let ((arglist
-	       (cond ((compiled-function-p fndef)
-		      (compiled-function-arglist fndef))
-		     ((eq (car-safe fndef) 'lambda)
-		      (nth 1 fndef))
-		     ((and (subrp fndef)
-			   (string-match
-			    "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'"
-			    doc))
-		      (prog1
-			  (substring doc (match-beginning 1) (match-end 1))
-			(setq doc (substring doc 0 (match-beginning 0)))))
-		     (t t))))
-	  (if (listp arglist)
-	      (progn
-;; 		(princ "  ")
-		(princ (cons function
-			     (mapcar (lambda (arg)
-				       (if (memq arg '(&optional &rest))
-					   arg
-					 (intern (upcase (symbol-name arg)))))
-				       arglist)) stream)
-		(terpri stream)))
-	  (if (stringp arglist)
-	      (princ (format "(%s %s)\n" function arglist) stream))))
-    (terpri stream)
+	(let ((arglist (function-arglist function)))
+	  (when arglist
+	    (princ arglist)
+	    (terpri))))
+    (terpri)
     (cond (kbd-macro-p
-	   (princ "These characters are executed:\n\n\t" stream)
-	   (princ (key-description def) stream)
+	   (princ "These characters are executed:\n\n\t")
+	   (princ (key-description def))
 	   (cond ((setq def (key-binding def))
-		  (princ (format "\n\nwhich executes the command %S.\n\n" def) stream)
-		  (describe-function-1 def stream))))
+		  (princ (format "\n\nwhich executes the command %S.\n\n" def))
+		  (describe-function-1 def))))
 	  (nodoc nil)
 	  (t
 	   ;; tell the user about obsoleteness.
@@ -989,56 +1039,42 @@
 	   (let ((obsolete (function-obsoleteness-doc function))
 		 (compatible (function-compatibility-doc function)))
 	     (when obsolete
-	       (princ obsolete stream)
-	       (terpri stream)
-	       (terpri stream))
+	       (princ obsolete)
+	       (terpri)
+	       (terpri))
 	     (when compatible
-	       (princ compatible stream)
-	       (terpri stream)
-	       (terpri stream))
+	       (princ compatible)
+	       (terpri)
+	       (terpri))
 	     (unless (and obsolete aliases)
-	       (princ doc stream)
-	       (unless (or (equal doc "")
-			   (eq ?\n (aref doc (1- (length doc)))))
-		 (terpri stream))))))))
+	       (let ((doc (function-documentation function t)))
+		 (princ "Documentation:\n")
+		 (princ doc)
+		 (unless (or (equal doc "")
+			     (eq ?\n (aref doc (1- (length doc)))))
+		   (terpri)))))))))
 
 
-;;; this doesn't seem to be used for anything
-;;; Wrong!  Obnoxious, whining people who complain very LOUDLY on Usenet
-;;; are binding this to keys.
+;;; [Obnoxious, whining people who complain very LOUDLY on Usenet
+;;; are binding this to keys.]
 (defun describe-function-arglist (function)
   (interactive (list (or (function-at-point)
 			 (error "no function call at point"))))
-  (let ((b nil))
-    (unwind-protect
-	(save-excursion
-	  (set-buffer (setq b (get-buffer-create " *arglist*")))
-	  (buffer-disable-undo b)
-	  (erase-buffer)
-	  (describe-function-1 function b t)
-	  (goto-char (point-min))
-	  (end-of-line)
-	  (or (eobp) (delete-char 1))
-	  (just-one-space)
-	  (end-of-line)
-	  (message (buffer-substring (point-min) (point))))
-      (and b (kill-buffer b)))))
+  (message nil)
+  (message (function-arglist function)))
 
 
 (defun variable-at-point ()
   (ignore-errors
-    (let ((stab (syntax-table)))
-      (unwind-protect
-	  (save-excursion
-	    (set-syntax-table emacs-lisp-mode-syntax-table)
-	    (or (not (zerop (skip-syntax-backward "_w")))
-		(eq (char-syntax (char-after (point))) ?w)
-		(eq (char-syntax (char-after (point))) ?_)
-		(forward-sexp -1))
-	    (skip-chars-forward "'")
-	    (let ((obj (read (current-buffer))))
-	      (and (symbolp obj) (boundp obj) obj)))
-	(set-syntax-table stab)))))
+    (with-syntax-table emacs-lisp-mode-syntax-table
+      (save-excursion
+	(or (not (zerop (skip-syntax-backward "_w")))
+	    (eq (char-syntax (char-after (point))) ?w)
+	    (eq (char-syntax (char-after (point))) ?_)
+	    (forward-sexp -1))
+	(skip-chars-forward "'")
+	(let ((obj (read (current-buffer))))
+	  (and (symbolp obj) (boundp obj) obj))))))
 
 (defun variable-obsolete-p (variable)
   "Return non-nil if VARIABLE is obsolete."
@@ -1087,6 +1123,22 @@
        (if type "an unknown type of built-in variable?"
 	 "a variable declared in Lisp")))))
 
+(defun help-pretty-print-value (object)
+  "Print OBJECT in current buffer.
+Use `pp-internal' if defined, otherwise `cl-prettyprint'"
+  (princ
+   (with-output-to-string
+     (with-syntax-table emacs-lisp-mode-syntax-table
+       ;; print `#<...>' values better
+       (modify-syntax-entry ?< "(>")
+       (modify-syntax-entry ?> ")<")
+       (let ((indent-line-function 'lisp-indent-line))
+	 (if (fboundp 'pp-internal)
+	     (progn
+	       (pp-internal object "\n")
+	       (terpri))
+	   (cl-prettyprint object)))))))
+
 (defun describe-variable (variable)
   "Display the full documentation of VARIABLE (a symbol)."
   (interactive 
@@ -1098,78 +1150,75 @@
                        (gettext "Describe variable: "))
                    obarray 'boundp t nil 'variable-history))))
      (list (if (equal val "") v (intern val)))))
-  (with-displaying-help-buffer
-   (lambda ()
-     (let ((origvar variable)
-	   aliases)
-       (let ((print-escape-newlines t))
-	 (princ (format "`%s' is " (symbol-name variable)))
-	 (while (variable-alias variable)
-	   (let ((newvar (variable-alias variable)))
-	     (if aliases
-		 ;; I18N3 Need gettext due to concat
-		 (setq aliases
-		       (concat aliases 
-			       (format "\n     which is an alias for `%s', "
-				       (symbol-name newvar))))
-	       (setq aliases
-		     (format "an alias for `%s', "
-			     (symbol-name newvar))))
-	     (setq variable newvar)))
-	 (if aliases
-	     (princ (format "%s" aliases)))
-	 (princ (built-in-variable-doc variable))
- 	 (princ ".\n\n")
-	 (princ "Value: ")
-	 (if (not (boundp variable))
-	     (princ "void")
-	   (prin1 (symbol-value variable)))
-	 (terpri)
-	 (cond ((local-variable-p variable (current-buffer))
-		(let* ((void (cons nil nil))
-		       (def (condition-case nil
-				(default-value variable)
-			      (error void))))
-		  (princ "This value is specific to the current buffer.")
-		  (terpri)
-		  (if (local-variable-p variable nil)
-		      (progn
-			(princ "(Its value is local to each buffer.)")
-			(terpri)))
-		  (if (if (eq def void)
-			  (boundp variable)
-			(not (eq (symbol-value variable) def)))
-		      ;; #### I18N3 doesn't localize properly!
-		      (progn (princ "Its default-value is ")
-			     (if (eq def void)
-				 (princ "void.")
-			       (prin1 def))
-			     (terpri)))))
-	       ((local-variable-p variable (current-buffer) t)
-		(princ "Setting it would make its value buffer-local.\n"))))
-       (terpri)
-       (princ "Documentation:")
-       (terpri)
-       (let ((doc (documentation-property variable 'variable-documentation))
-	     (obsolete (variable-obsoleteness-doc origvar))
-	     (compatible (variable-compatibility-doc origvar)))
-	 (when obsolete
-	   (princ obsolete)
-	   (terpri)
-	   (terpri))
-	 (when compatible
-	   (princ compatible)
-	   (terpri)
-	   (terpri))
-	 ;; don't bother to print anything if variable is obsolete and aliased.
-	 (when (or (not obsolete) (not aliases))
-	   (if doc
-	       ;; note: documentation-property calls substitute-command-keys.
-	       (princ doc)
-	     (princ "not documented as a variable."))
-	   (terpri)))
-       ;; Return the text we displayed.
-       (buffer-string nil nil standard-output)))))
+  (with-displaying-help-buffer (format "variable `%s'" variable)
+    (let ((origvar variable)
+	  aliases)
+      (let ((print-escape-newlines t))
+	(princ (format "`%s' is " (symbol-name variable)))
+	(while (variable-alias variable)
+	  (let ((newvar (variable-alias variable)))
+	    (if aliases
+		;; I18N3 Need gettext due to concat
+		(setq aliases
+		      (concat aliases 
+			      (format "\n     which is an alias for `%s',"
+				      (symbol-name newvar))))
+	      (setq aliases
+		    (format "an alias for `%s',"
+			    (symbol-name newvar))))
+	    (setq variable newvar)))
+	(if aliases
+	    (princ (format "%s" aliases)))
+	(princ (built-in-variable-doc variable))
+	(princ ".\n")
+	(let ((file-name (describe-function-find-file variable)))
+	     (if file-name
+		 (princ (format "  -- loaded from \"%s\"\n" file-name))))
+	(princ "\nValue: ")
+	(if (not (boundp variable))
+	    (princ "void\n")
+	  (help-pretty-print-value (symbol-value variable)))
+	(terpri)
+	(cond ((local-variable-p variable (current-buffer))
+	       (let* ((void (cons nil nil))
+		      (def (condition-case nil
+			       (default-value variable)
+			     (error void))))
+		 (princ "This value is specific to the current buffer.\n")
+		 (if (local-variable-p variable nil)
+		     (princ "(Its value is local to each buffer.)\n"))
+		 (terpri)
+		 (if (if (eq def void)
+			 (boundp variable)
+		       (not (eq (symbol-value variable) def)))
+		     ;; #### I18N3 doesn't localize properly!
+		     (progn (princ "Default-value: ")
+			    (if (eq def void)
+				(princ "void\n")
+			      (help-pretty-print-value def))
+			    (terpri)))))
+	      ((local-variable-p variable (current-buffer) t)
+	       (princ "Setting it would make its value buffer-local.\n\n"))))
+      (princ "Documentation:")
+      (terpri)
+      (let ((doc (documentation-property variable 'variable-documentation))
+	    (obsolete (variable-obsoleteness-doc origvar))
+	    (compatible (variable-compatibility-doc origvar)))
+	(when obsolete
+	  (princ obsolete)
+	  (terpri)
+	  (terpri))
+	(when compatible
+	  (princ compatible)
+	  (terpri)
+	  (terpri))
+	;; don't bother to print anything if variable is obsolete and aliased.
+	(when (or (not obsolete) (not aliases))
+	  (if doc
+	      ;; note: documentation-property calls substitute-command-keys.
+	      (princ doc)
+	    (princ "not documented as a variable."))))
+      (terpri))))
 
 (defun sorted-key-descriptions (keys &optional separator)
   "Sort and separate the key descriptions for KEYS.
@@ -1209,10 +1258,9 @@
   "Describe the syntax specifications in the syntax table.
 The descriptions are inserted in a buffer, which is then displayed."
   (interactive)
-  (with-displaying-help-buffer
-   (lambda ()
-     ;; defined in syntax.el
-     (describe-syntax-table (syntax-table) standard-output))))
+  (with-displaying-help-buffer (format "syntax-table for %s" major-mode)
+    ;; defined in syntax.el
+    (describe-syntax-table (syntax-table) standard-output)))
 
 (defun list-processes ()
   "Display a list of all processes.
@@ -1224,57 +1272,54 @@
     (buffer-disable-undo standard-output)
     (make-local-variable 'truncate-lines)
     (setq truncate-lines t)
-    (let ((stream standard-output))
-      ;;      00000000001111111111222222222233333333334444444444
-      ;;      01234567890123456789012345678901234567890123456789
-      ;; rewritten for I18N3.  This one should stay rewritten
-      ;; so that the dashes will line up properly.
-      (princ "Proc         Status   Buffer         Tty         Command\n----         ------   ------         ---         -------\n" stream)
-      (let ((tail (process-list)))
-        (while tail
-          (let* ((p (car tail))
-                 (pid (process-id p))
-                 (s (process-status p)))
-            (setq tail (cdr tail))
-            (princ (format "%-13s" (process-name p)) stream)
-            ;(if (and (eq system-type 'vax-vms)
-            ;         (eq s 'signal)
-            ;         (< (process-exit-status p) NSIG))
-            ;    (princ (aref sys_errlist (process-exit-status p)) stream))
-            (princ s stream)
-            (if (and (eq s 'exit) (/= (process-exit-status p) 0))
-                (princ (format " %d" (process-exit-status p)) stream))
-            (if (memq s '(signal exit closed))
-                ;; Do delete-exited-processes' work
-                (delete-process p))
-            (indent-to 22 1)            ;####
-            (let ((b (process-buffer p)))
-              (cond ((not b)
-                     (princ "(none)" stream))
-                    ((not (buffer-name b))
-                     (princ "(killed)" stream))
-                    (t
-                     (princ (buffer-name b) stream))))
-            (indent-to 37 1)            ;####
-            (let ((tn (process-tty-name p)))
-              (cond ((not tn)
-                     (princ "(none)" stream))
-                    (t
-                     (princ (format "%s" tn) stream))))
-            (indent-to 49 1)            ;####
-            (if (not (integerp pid))
-                (progn
-                  (princ "network stream connection " stream)
-                  (princ (car pid) stream)
-                  (princ "@" stream)
-                  (princ (cdr pid) stream))
-	      (let ((cmd (process-command p)))
-		(while cmd
-		  (princ (car cmd) stream)
-		  (setq cmd (cdr cmd))
-		  (if cmd (princ " " stream)))))
-            (terpri stream)))))))
-
-;; `find-function' et al moved to "find-func.el"
+    ;;      00000000001111111111222222222233333333334444444444
+    ;;      01234567890123456789012345678901234567890123456789
+    ;; rewritten for I18N3.  This one should stay rewritten
+    ;; so that the dashes will line up properly.
+    (princ "Proc         Status   Buffer         Tty         Command\n----         ------   ------         ---         -------\n")
+    (let ((tail (process-list)))
+      (while tail
+	(let* ((p (car tail))
+	       (pid (process-id p))
+	       (s (process-status p)))
+	  (setq tail (cdr tail))
+	  (princ (format "%-13s" (process-name p)))
+	  ;;(if (and (eq system-type 'vax-vms)
+	  ;;         (eq s 'signal)
+	  ;;        (< (process-exit-status p) NSIG))
+	  ;;    (princ (aref sys_errlist (process-exit-status p))))
+	  (princ s)
+	  (if (and (eq s 'exit) (/= (process-exit-status p) 0))
+	      (princ (format " %d" (process-exit-status p))))
+	  (if (memq s '(signal exit closed))
+	      ;; Do delete-exited-processes' work
+	      (delete-process p))
+	  (indent-to 22 1)		;####
+	  (let ((b (process-buffer p)))
+	    (cond ((not b)
+		   (princ "(none)"))
+		  ((not (buffer-name b))
+		   (princ "(killed)"))
+		  (t
+		   (princ (buffer-name b)))))
+	  (indent-to 37 1)		;####
+	  (let ((tn (process-tty-name p)))
+	    (cond ((not tn)
+		   (princ "(none)"))
+		  (t
+		   (princ (format "%s" tn)))))
+	  (indent-to 49 1)		;####
+	  (if (not (integerp pid))
+	      (progn
+		(princ "network stream connection ")
+		(princ (car pid))
+		(princ "@")
+		(princ (cdr pid)))
+	    (let ((cmd (process-command p)))
+	      (while cmd
+		(princ (car cmd))
+		(setq cmd (cdr cmd))
+		(if cmd (princ " ")))))
+	  (terpri))))))
 
 ;;; help.el ends here
--- a/lisp/x-menubar.el	Mon Aug 13 10:13:03 2007 +0200
+++ b/lisp/x-menubar.el	Mon Aug 13 10:13:48 2007 +0200
@@ -137,8 +137,6 @@
        :active (fboundp 'w3)]
       ["Gopher" gopher
        :active (fboundp 'gopher)]
-      ["Hyperbole..." hyperbole
-       :active (fboundp 'hmail:compose)]
       "----"
       ["Spell-Check Buffer" ispell-buffer
        :active (fboundp 'ispell-buffer)]
@@ -715,8 +713,6 @@
       ["Debug (DBX)..." dbx
        :active (fboundp 'dbx)]
       "-----"
-      ["OO-Browser..." oobr
-       :active (fboundp 'oobr)]
       ("Tags"
        ["Find Tag..."		find-tag		t]
        ["Find Other Window..."	find-tag-other-window	t]
--- a/nt/ChangeLog	Mon Aug 13 10:13:03 2007 +0200
+++ b/nt/ChangeLog	Mon Aug 13 10:13:48 2007 +0200
@@ -1,3 +1,15 @@
+1997-12-26  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* xemacs.mak: added menubar-msw.c, menubar.c
+
+	* xemacs.mak: scrollabrs and menubars are rearranged properly
+	  under different ifdef'd secions, so for example menubar.obj goes
+	  to always compiled section, and menubar-msw.obj is built only when
+	  HAVE_MSW.
+
+	* xemacs.mak: Compiler warning flag definition moved to a macro
+	  CPP_WARN_FLAGS. Redefined from -w to -W3 (Doh!).
+
 1997-12-11  David Hobley <davidh@wr.com.au>
 
         * Added support for auto generation of puresize-adjust.h
--- a/nt/xemacs.mak	Mon Aug 13 10:13:03 2007 +0200
+++ b/nt/xemacs.mak	Mon Aug 13 10:13:48 2007 +0200
@@ -15,6 +15,8 @@
 OPT=-O2 -G5 -Zi
 !endif
 
+WARN_CPP_FLAGS = -W3
+
 #------------------------------------------------------------------------------
 
 !if $(HAVE_X)
@@ -34,7 +36,7 @@
 !endif
 
 !if $(HAVE_MSW)
-MSW_DEFINES=-DHAVE_MS_WINDOWS -DHAVE_SCROLLBARS
+MSW_DEFINES=-DHAVE_MS_WINDOWS -DHAVE_SCROLLBARS -DHAVE_MENUBARS
 !endif
 
 !if $(HAVE_MULE)
@@ -92,7 +94,7 @@
 
 LASTFILE=$(OUTDIR)\lastfile.lib
 LASTFILE_SRC=$(XEMACS)\src
-LASTFILE_FLAGS=-nologo -w $(OPT) $(INCLUDES) -Fo$@ -c
+LASTFILE_FLAGS=-nologo $(WARN_CPP_FLAGS) $(OPT) $(INCLUDES) -Fo$@ -c
 LASTFILE_OBJS= \
 	$(OUTDIR)\lastfile.obj
 
@@ -110,7 +112,7 @@
 
 LWLIB=$(OUTDIR)\lwlib.lib
 LWLIB_SRC=$(XEMACS)\lwlib
-LWLIB_FLAGS=-nologo -w $(OPT) $(INCLUDES) $(DEFINES) \
+LWLIB_FLAGS=-nologo $(WARN_CPP_FLAGS) $(OPT) $(INCLUDES) $(DEFINES) \
  -DNEED_ATHENA -DNEED_LUCID \
  -D_WINDOWS -DMENUBARS_LUCID -DSCROLLBARS_LUCID -DDIALOGS_ATHENA \
  -Fo$@ -c
@@ -222,6 +224,7 @@
  $(XEMACS)\src\marker.c
 DOC_SRC4=\
  $(XEMACS)\src\md5.c \
+ $(XEMACS)\src\menubar.c \
  $(XEMACS)\src\minibuf.c \
  $(XEMACS)\src\nt.c \
  $(XEMACS)\src\ntheap.c \
@@ -287,8 +290,10 @@
  $(XEMACS)\src\device-msw.c  \
  $(XEMACS)\src\event-msw.c  \
  $(XEMACS)\src\frame-msw.c \
+ $(XEMACS)\src\menubar-msw.c \
  $(XEMACS)\src\objects-msw.c \
  $(XEMACS)\src\redisplay-msw.c \
+ $(XEMACS)\src\scrollbar-msw.c \
  $(XEMACS)\src\select-msw.c \
  $(XEMACS)\src\msw-proc.c
 !endif
@@ -324,7 +329,7 @@
 	advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib libc.lib
 
 $(OUTDIR)\runemacs.obj:	$(XEMACS)\nt\runemacs.c
-	$(CC) -nologo -ML -w $(OPT) -c \
+	$(CC) -nologo -ML $(WARN_CPP_FLAGS) $(OPT) -c \
 	-D_DEBUG -DWIN32 -D_WIN32 -DWIN32_LEAN_AND_MEAN \
 	-D_X86_ -Demacs -DHAVE_CONFIG_H \
 	$** -Fo$@
@@ -346,7 +351,7 @@
  -stack:0x800000 -entry:_start -subsystem:console\
  -pdb:$(TEMACS_DIR)\temacs.pdb -map:$(TEMACS_DIR)\temacs.map \
  -heap:0x00100000 -out:$@
-TEMACS_CPP_FLAGS= $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \
+TEMACS_CPP_FLAGS= $(WARN_CPP_FLAGS) $(INCLUDES) $(DEFINES) $(DEBUG_DEFINES) \
  -DEMACS_MAJOR_VERSION=$(emacs_major_version) \
  -DEMACS_MINOR_VERSION=$(emacs_minor_version) \
  -DEMACS_BETA_VERSION=$(emacs_beta_version) \
@@ -354,7 +359,7 @@
  -DPATH_PREFIX=\"$(XEMACS)\" \
  -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
 
-TEMACS_FLAGS=-nologo -ML -w $(OPT) -c $(TEMACS_CPP_FLAGS)
+TEMACS_FLAGS=-nologo -ML $(WARN_CPP_FALGS) $(OPT) -c $(TEMACS_CPP_FLAGS)
 
 !if $(HAVE_X)
 TEMACS_X_OBJS=\
@@ -372,7 +377,6 @@
 	$(OUTDIR)\frame-x.obj \
 	$(OUTDIR)\glyphs-x.obj \
 	$(OUTDIR)\gui-x.obj \
-	$(OUTDIR)\menubar.obj \
 	$(OUTDIR)\menubar-x.obj \
 	$(OUTDIR)\objects-x.obj \
 	$(OUTDIR)\redisplay-x.obj \
@@ -389,8 +393,10 @@
 	$(OUTDIR)\device-msw.obj \
 	$(OUTDIR)\event-msw.obj \
 	$(OUTDIR)\frame-msw.obj \
+	$(OUTDIR)\menubar-msw.obj \
 	$(OUTDIR)\objects-msw.obj \
 	$(OUTDIR)\redisplay-msw.obj \
+	$(OUTDIR)\scrollbar-msw.obj \
 	$(OUTDIR)\select-msw.obj \
 	$(OUTDIR)\msw-proc.obj
 !endif
@@ -469,6 +475,7 @@
 	$(OUTDIR)\lread.obj \
 	$(OUTDIR)\lstream.obj \
 	$(OUTDIR)\macros.obj \
+	$(OUTDIR)\menubar.obj \
 	$(OUTDIR)\marker.obj \
 	$(OUTDIR)\md5.obj \
 	$(OUTDIR)\minibuf.obj \
@@ -487,7 +494,6 @@
 	$(OUTDIR)\redisplay.obj \
 	$(OUTDIR)\regex.obj \
 	$(OUTDIR)\scrollbar.obj \
-	$(OUTDIR)\scrollbar-msw.obj \
 	$(OUTDIR)\search.obj \
 	$(OUTDIR)\signal.obj \
 	$(OUTDIR)\sound.obj \
@@ -582,6 +588,8 @@
 all: $(LASTFILE) $(LWLIB) $(SUPPORT_PROGS) $(TEMACS) $(TEMACS_BROWSE) $(DOC) dump-xemacs
 	-del rebuild
 
+temacs:  $(TEMACS)
+
 # use this rule to install the system
 install:
 
--- a/src/ChangeLog	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 10:13:48 2007 +0200
@@ -1,3 +1,64 @@
+1997-12-23  Andy Piper <andyp@parallax.co.uk>
+
+	* Conditionals to enable XEmacs to compile (not run!) under
+	  CygWin32. Files touched:
+	  events.c
+	  getloadavg.c
+	  mem-limits.h
+	  objects-msw.c
+	  select-msw.c
+	  sysdep.c
+	* s/cygwin.h: New file.
+
+1997-12-26  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* menubar-msw.c, menubar-msw.h: New files. Menus support.
+	
+	* console-msw.h: Added frame menu hashtable variable.
+
+	* gui.c: popup_up_p variable and Fpopup_up_p and
+	  separator_string_p functions are moved from gui-x.c
+
+	* gui.h: New file declaring the above. It is #included into the
+	  following files:
+	  dialog-x.c
+	  gui-x.c
+	  menubar-x.c
+
+	* emacs.c: Added calls to *_of_menubar_mswindows()
+
+	* event-msw.c: Generalization of modal pump interface so it may be
+	  used bu menubars also. Some functions and vars renamed, to
+	  reflect more general approach (event_pump -> modal_loop)
+
+	* frame-msw.c: Initialization and marking of menu hashtable.
+
+	* msw-proc.c: Added handling for menu window messages.
+
+	* opaque.c: opaque objects given hash and equal methods, so they
+	  can be compared with 'equal. Menubar uses opaque pointers as
+	  hash keys in an 'equal style hastable.
+
+	* Most of the above touched files: Eliminated compiler warnings. 
+
+1997-12-18  Hrvoje Niksic  <hniksic@srce.hr>
+
+	* elhash.c (print_hashtable): Use `%u' for fullness.
+	(hashtable_equal): New function.
+	(hashtable_equal_mapper): Ditto.
+
+	* lread.c (vars_of_lread): Initialize Vread_buffer_stream here
+	instead of in init_lread.
+
+1997-12-26  P. E. Jareth Hein  <jareth@camelot-soft.com>
+
+	* glyphs-x.c (imagick_instantiate): Add in error and 
+	warning handling for ImageMagick files
+
+1997-12-26  SL Baur  <steve@altair.xemacs.org>
+
+	* Makefile.in.in (distclean): Remove `xemacs.*'.
+
 1997-12-22  SL Baur  <steve@altair.xemacs.org>
 
 	* device.c (vars_of_device): Provide `devices' feature so W3's
--- a/src/Makefile.in.in	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/Makefile.in.in	Mon Aug 13 10:13:48 2007 +0200
@@ -613,7 +613,7 @@
 ## Do not use it on development directories!
 distclean: clean
 	$(RM) config.h paths.h puresize-adjust.h Emacs.ad.h \
-	  Makefile Makefile.in TAGS
+	  Makefile Makefile.in TAGS xemacs.*
 realclean: distclean
 versionclean:
 	$(RM) xemacs ${libsrc}DOC
--- a/src/console-msw.h	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/console-msw.h	Mon Aug 13 10:13:48 2007 +0200
@@ -77,6 +77,9 @@
   /* Coordinates of last click event, screen-relative */
   POINTS last_click_point;
 
+  /* Menu hashtable. See menubar-msw.h */
+  Lisp_Object hash_table;
+
   /* Misc flags */
   int button2_need_lbutton : 1;
   int button2_need_rbutton : 1;
@@ -90,7 +93,7 @@
 
 #define FRAME_MSWINDOWS_HANDLE(f)	(FRAME_MSWINDOWS_DATA (f)->hwnd)
 #define FRAME_MSWINDOWS_DC(f)		(FRAME_MSWINDOWS_DATA (f)->hdc)
-
+#define FRAME_MSWINDOWS_MENU_HASHTABLE(f) (FRAME_MSWINDOWS_DATA (f)->hash_table)
 
 /*
  * Redisplay functions
--- a/src/dialog-x.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/dialog-x.c	Mon Aug 13 10:13:48 2007 +0200
@@ -34,6 +34,7 @@
 #include "commands.h"           /* zmacs_regions */
 #include "events.h"
 #include "frame.h"
+#include "gui.h"
 #include "opaque.h"
 #include "window.h"
 
--- a/src/elhash.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/elhash.c	Mon Aug 13 10:13:48 2007 +0200
@@ -50,9 +50,10 @@
 
 static Lisp_Object mark_hashtable (Lisp_Object, void (*) (Lisp_Object));
 static void print_hashtable (Lisp_Object, Lisp_Object, int);
+static int hashtable_equal (Lisp_Object t1, Lisp_Object t2, int depth);
 DEFINE_LRECORD_IMPLEMENTATION ("hashtable", hashtable,
-                               mark_hashtable, print_hashtable, 0, 0, 0,
-			       struct hashtable);
+                               mark_hashtable, print_hashtable, 0,
+			       hashtable_equal, 0, struct hashtable);
 
 static Lisp_Object
 mark_hashtable (Lisp_Object obj, void (*markobj) (Lisp_Object))
@@ -72,6 +73,72 @@
   return table->harray;
 }
 
+/* Equality of hashtables.  Two hashtables are equal when they are of
+   the same type and test function, they have the same number of
+   elements, and for each key in hashtable, the values are `equal'.
+
+   This is similar to Common Lisp `equalp' of hashtables, with the
+   difference that CL requires the keys to be compared using the
+   `:test' function, which we don't do.  Doing that would require
+   consing, and consing is bad idea in `equal'.  Anyway, our method
+   should provide the same result -- if the keys are not equal
+   according to `:test', then Fgethash() in hashtable_equal_mapper()
+   will fail.  */
+struct hashtable_equal_closure
+{
+  int depth;
+  int equal_so_far;
+  Lisp_Object other_table;
+};
+
+static void
+hashtable_equal_mapper (void *key, void *contents, void *arg)
+{
+  struct hashtable_equal_closure *closure =
+    (struct hashtable_equal_closure *)arg;
+  Lisp_Object keytem, valuetem;
+
+  /* It would be beautiful if maphash() allowed us to bail out when C
+     function returns non-zero, a la map_extents() et al.  #### Make
+     it so!  */
+  if (closure->equal_so_far)
+    {
+      Lisp_Object value_in_other;
+      CVOID_TO_LISP (keytem, key);
+      CVOID_TO_LISP (valuetem, contents);
+      /* Look up the key in the other hashtable, and compare the
+         values.  */
+      value_in_other = Fgethash (keytem, closure->other_table, Qunbound);
+      if (UNBOUNDP (value_in_other)
+	  || !internal_equal (valuetem, value_in_other, closure->depth))
+	closure->equal_so_far = 0;
+      /* return 1; */
+    }
+  /* return 0; */
+}
+
+static int
+hashtable_equal (Lisp_Object t1, Lisp_Object t2, int depth)
+{
+  struct hashtable_equal_closure closure;
+  struct hashtable *table1 = XHASHTABLE (t1);
+  struct hashtable *table2 = XHASHTABLE (t2);
+
+  /* The objects are `equal' if they are of the same type, so return 0
+     if types or test functions are not the same.  Obviously, the
+     number of elements must be equal, too.  */
+  if ((table1->test_function != table2->test_function)
+      || (table1->type != table2->type)
+      || (table1->fullness != table2->fullness))
+    return 0;
+
+  closure.depth = depth + 1;
+  closure.equal_so_far = 1;
+  closure.other_table = t2;
+  elisp_maphash (hashtable_equal_mapper, t1, &closure);
+  return closure.equal_so_far;
+}
+
 /* Printing hashtables.
 
    This is non-trivial, because we use a readable structure-style
@@ -92,11 +159,12 @@
    The data is truncated to four pairs, and the rest is shown with
    `...'.  The actual printer is non-consing.  */
 
-struct print_mapper_arg {
-  EMACS_INT count;		/* Used to implement the truncation
-				   for non-readable printing, as well
-				   as to avoid the unnecessary space
-				   at the beginning.  */
+struct print_hashtable_data_closure
+{
+  EMACS_INT count;		/* Used to implement truncation for
+				   non-readable printing, as well as
+				   to avoid the unnecessary space at
+				   the beginning.  */
   Lisp_Object printcharfun;
 };
 
@@ -104,7 +172,8 @@
 print_hashtable_data_mapper (void *key, void *contents, void *arg)
 {
   Lisp_Object keytem, valuetem;
-  struct print_mapper_arg *closure = (struct print_mapper_arg *)arg;
+  struct print_hashtable_data_closure *closure =
+    (struct print_hashtable_data_closure *)arg;
 
   if (closure->count < 4 || print_readably)
     {
@@ -126,7 +195,7 @@
 static void
 print_hashtable_data (Lisp_Object hashtable, Lisp_Object printcharfun)
 {
-  struct print_mapper_arg closure;
+  struct print_hashtable_data_closure closure;
   closure.count = 0;
   closure.printcharfun = printcharfun;
 
@@ -163,13 +232,13 @@
   else if (table->test_function == lisp_object_equal_equal)
     write_c_string (" test equal", printcharfun);
   else if (table->test_function == lisp_object_eql_equal)
-      ;
+    DO_NOTHING;
   else
     abort ();
   if (table->fullness || !print_readably)
     {
       if (print_readably)
-	sprintf (buf, " size %d", table->fullness);
+	sprintf (buf, " size %u", table->fullness);
       else
 	sprintf (buf, " size %u/%ld", table->fullness,
 		 XVECTOR_LENGTH (table->harray) / LISP_OBJECTS_PER_HENTRY);
@@ -559,7 +628,7 @@
   if (EQ (sym, Qequal)) return HASHTABLE_EQUAL;
   if (EQ (sym, Qeql))   return HASHTABLE_EQL;
 
-  signal_simple_error ("Invalid hashtable test fun", sym);
+  signal_simple_error ("Invalid hashtable test function", sym);
   return HASHTABLE_EQ; /* not reached */
 }
 
--- a/src/emacs.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/emacs.c	Mon Aug 13 10:13:48 2007 +0200
@@ -887,6 +887,9 @@
       syms_of_frame_mswindows ();
       syms_of_objects_mswindows ();
       syms_of_select_mswindows ();
+#ifdef HAVE_MENUBARS
+      syms_of_menubar_mswindows ();
+#endif
 #endif
 
 #ifdef MULE
@@ -981,6 +984,9 @@
 # ifdef HAVE_SCROLLBARS
       console_type_create_scrollbar_mswindows ();
 # endif
+#ifdef HAVE_MENUBARS
+      console_type_create_menubar_mswindows ();
+#endif
 #endif
 
       /* Now initialize the specifier types and associated symbols.
@@ -1220,6 +1226,9 @@
 #ifdef HAVE_SCROLLBARS
       vars_of_scrollbar_mswindows ();
 #endif
+#ifdef HAVE_MENUBARS
+      vars_of_menubar_mswindows ();
+#endif
 #endif
 
 #ifdef MULE
--- a/src/event-msw.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/event-msw.c	Mon Aug 13 10:13:48 2007 +0200
@@ -85,8 +85,8 @@
 
 /* This is the event signaled by the event pump.
    See mswindows_pump_outstanding_events for comments */
-static Lisp_Object mswindows_error_caught_by_event_pump;
-static int mswindows_in_event_pump;
+static Lisp_Object mswindows_error_caught_in_modal_loop;
+static int mswindows_in_modal_loop;
 
 /* Count of wound timers */
 static int mswindows_pending_timers_count;
@@ -203,6 +203,43 @@
     }
 }
 
+static Lisp_Object
+mswindows_modal_loop_error_handler (Lisp_Object cons_sig_data,
+				    Lisp_Object u_n_u_s_e_d)
+{
+  mswindows_error_caught_in_modal_loop = cons_sig_data;
+  return Qunbound;
+}
+
+Lisp_Object
+mswindows_protect_modal_loop (Lisp_Object (*bfun) (Lisp_Object barg),
+			      Lisp_Object barg)
+{
+  Lisp_Object tmp;
+
+  ++mswindows_in_modal_loop; 
+  tmp = condition_case_1 (Qt,
+			  bfun, barg,
+			  mswindows_modal_loop_error_handler, Qnil);
+  --mswindows_in_modal_loop;
+
+  return tmp;
+}
+
+void
+mswindows_unmodalize_signal_maybe (void)
+{
+  if (!NILP (mswindows_error_caught_in_modal_loop))
+    {
+      /* Got an error while messages were pumped while
+	 in window procedure - have to resignal */
+      Lisp_Object sym = XCAR (mswindows_error_caught_in_modal_loop);
+      Lisp_Object data = XCDR (mswindows_error_caught_in_modal_loop);
+      mswindows_error_caught_in_modal_loop = Qnil;
+      Fsignal (sym, data);
+    }
+}
+
 /*
  * This is an unsafe part of event pump, guarded by 
  * condition_case. See mswindows_pump_outstanding_events
@@ -234,15 +271,6 @@
   return Qt;
 }
 
-/* See mswindows_pump_outstanding_events */
-static Lisp_Object
-mswindows_event_pump_error_handler (Lisp_Object cons_sig_data,
-				    Lisp_Object u_n_u_s_e_d)
-{
-  mswindows_error_caught_by_event_pump = cons_sig_data;
-  return Qnil;
-}
-
 /*
  * This function pumps emacs events, while available, by using
  * next_message/dispatch_message loop. Errors are trapped around
@@ -252,22 +280,22 @@
  * neither are waitable handles checked. The function pumps
  * thus only dispatch events already queued, as well as those
  * resulted in dispatching thereof. This is done by setting
- * module local variable mswidows_in_event_pump to nonzero.
+ * module local variable mswidows_in_modal_loop to nonzero.
  *
- * Return value is Qt if no errors was trapped, or Qnil if
+ * Return value is Qt if no errors was trapped, or Qunbound if
  * there was an error.
  *
  * In case of error, a cons representing the error, in the
  * form (SIGNAL . DATA), is stored in the module local variable
- * mswindows_error_caught_by_event_pump. This error is signaled
+ * mswindows_error_caught_in_modal_loop. This error is signaled
  * again when DispatchMessage returns. Thus, Windows internal
  * modal loops are protected against throws, which are proven
  * to corrupt internal Windows structures.
  *
- * In case of success, mswindows_error_caught_by_event_pump is
+ * In case of success, mswindows_error_caught_in_modal_loop is
  * assigned Qnil.
  *
- * If the value of mswindows_error_caught_by_event_pump is not
+ * If the value of mswindows_error_caught_in_modal_loop is not
  * nil already upon entry, the function just returns non-nil.
  * This situation means that a new event has been queued while
  * cancleng mode. The event will be dequeued on the next regular
@@ -284,17 +312,8 @@
 
   Lisp_Object result = Qt;
 
-  if (NILP(mswindows_error_caught_by_event_pump))
-    {
-
-      mswindows_in_event_pump = 1;
-
-      result = condition_case_1 (Qt,
-				 mswindows_unsafe_pump_events, Qnil,
-				 mswindows_event_pump_error_handler, Qnil);
-
-      mswindows_in_event_pump = 0; 
-    }
+  if (NILP(mswindows_error_caught_in_modal_loop))
+      result = mswindows_protect_modal_loop (mswindows_unsafe_pump_events, Qnil);
   return result;
 }
 
@@ -328,7 +347,9 @@
     /* Can only have one waitable for the dispatch queue, and it's the first one */
     assert (mswindows_waitable_count++ == 0);
     waitable=0;
-//    InitializeCriticalSection(&mswindows_dispatch_crit);
+#if 0
+    InitializeCriticalSection(&mswindows_dispatch_crit);
+#endif
     assert (mswindows_waitable[0] = CreateSemaphore (NULL, 0, 0x7fffffff, NULL));
     return mswindows_waitable_info+0;
 
@@ -388,15 +409,7 @@
   while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
     {
       DispatchMessage (&msg);
-      if (!NILP (mswindows_error_caught_by_event_pump))
-	{
-	  /* Got an error while messages were pumped while
-	     in window procedure - have to resignal */
-	  Lisp_Object sym = XCAR (mswindows_error_caught_by_event_pump);
-	  Lisp_Object data = XCDR (mswindows_error_caught_by_event_pump);
-	  mswindows_error_caught_by_event_pump = Qnil;
-	  Fsignal (sym, data);
-	}
+      mswindows_unmodalize_signal_maybe ();
     }
 }
 
@@ -416,7 +429,7 @@
  * The implementation does not honor user_p by design.
  */
 static void
-mswindows_need_event_in_event_pump (int user_p, int badly_p)
+mswindows_need_event_in_modal_loop (int user_p, int badly_p)
 {
   MSG msg;
 
@@ -463,9 +476,9 @@
 {
   int active;
 
-  if (mswindows_in_event_pump)
+  if (mswindows_in_modal_loop)
     {
-      mswindows_need_event_in_event_pump (user_p, badly_p);
+      mswindows_need_event_in_modal_loop (user_p, badly_p);
       return;
     }
 
@@ -739,9 +752,9 @@
   staticpro (&mswindows_s_dispatch_event_queue);
   mswindows_s_dispatch_event_queue_tail = Qnil;
 
-  mswindows_error_caught_by_event_pump = Qnil;
-  staticpro (&mswindows_error_caught_by_event_pump);
-  mswindows_in_event_pump = 0;
+  mswindows_error_caught_in_modal_loop = Qnil;
+  staticpro (&mswindows_error_caught_in_modal_loop);
+  mswindows_in_modal_loop = 0;
   mswindows_pending_timers_count = 0;
 
   mswindows_event_stream = xnew (struct event_stream);
--- a/src/event-msw.h	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/event-msw.h	Mon Aug 13 10:13:48 2007 +0200
@@ -54,8 +54,14 @@
 #define MSW_TIMEOUT_MAX	32
 
 /* Random globals */
-extern LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-extern Lisp_Object mswindows_pump_outstanding_events (void);
+LRESULT WINAPI mswindows_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+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);
+void mswindows_enqueue_dispatch_event (Lisp_Object event);
+
+
 extern int mswindows_quit_chars_count;
 
 /* These are Lisp integer variables */
--- a/src/events.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/events.c	Mon Aug 13 10:13:48 2007 +0200
@@ -381,7 +381,7 @@
 		       e->event.magic.underlying_mswindows_event.data[0],
 		       e->event.magic.underlying_mswindows_event.data[1],
 		       e->event.magic.underlying_mswindows_event.data[2],
-		       e->event.magic.underlying_mswindows_event.data[3],
+		       e->event.magic.underlying_mswindows_event.data[3]
 		       );
 #endif
       }
--- a/src/frame-msw.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/frame-msw.c	Mon Aug 13 10:13:48 2007 +0200
@@ -35,6 +35,7 @@
 #include "event-msw.h"
 
 #include "buffer.h"
+#include "faces.h"
 #include "frame.h"
 #include "events.h"
 
@@ -60,13 +61,11 @@
 {
   Lisp_Object device = FRAME_DEVICE (f);
   struct device *d = XDEVICE (device);
-  Lisp_Object lisp_window_id, initially_unmapped;
+  Lisp_Object initially_unmapped;
   Lisp_Object name, height, width, popup, top, left;
   Lisp_Object frame_obj;
-  int pixel_width, pixel_height;
   RECT rect;
   DWORD style, exstyle;
-  HWND hwnd;
 
   initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil);
   name = Fplist_get (props, Qname, Qnil);
@@ -101,6 +100,8 @@
   FRAME_MSWINDOWS_DATA(f)->ignore_next_rbutton_up = 0;
   FRAME_MSWINDOWS_DATA(f)->sizing = 0;
 
+  FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
+
   AdjustWindowRectEx(&rect, style, ADJR_MENUFLAG, exstyle);
 
   FRAME_MSWINDOWS_HANDLE(f) =
@@ -135,6 +136,12 @@
 }
 
 static void
+mswindows_mark_frame (struct frame *f, void (*markobj) (Lisp_Object))
+{
+  ((markobj) (FRAME_MSWINDOWS_MENU_HASHTABLE (f)));
+}
+
+static void
 mswindows_focus_on_frame (struct frame *f)
 {
     SetForegroundWindow (FRAME_MSWINDOWS_HANDLE(f));
@@ -340,7 +347,7 @@
   CONSOLE_HAS_METHOD (mswindows, init_frame_1);
   CONSOLE_HAS_METHOD (mswindows, init_frame_2);
   CONSOLE_HAS_METHOD (mswindows, init_frame_3);
-/*  CONSOLE_HAS_METHOD (mswindows, mark_frame); */
+  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); */
--- a/src/getloadavg.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/getloadavg.c	Mon Aug 13 10:13:48 2007 +0200
@@ -19,6 +19,7 @@
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 Boston, MA 02111-1307, USA.  */
 
+#ifndef __CYGWIN32__
 
 /* Compile-time symbols that this file uses:
 
@@ -986,3 +987,22 @@
   exit (0);
 }
 #endif /* TEST */
+
+#else
+
+/* Emulate getloadavg.  */
+int
+getloadavg (double loadavg[], int nelem)
+{
+  int i;
+
+  /* A faithful emulation is going to have to be saved for a rainy day.  */
+  for (i = 0; i < nelem; i++) 
+    {
+      loadavg[i] = 0.0;
+    }
+  return i;
+}
+
+#endif /*__GNUWIN32__*/
+
--- a/src/glyphs-x.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/glyphs-x.c	Mon Aug 13 10:13:48 2007 +0200
@@ -42,6 +42,7 @@
  */
 
 #include <config.h>
+#include <setjmp.h>
 #include "lisp.h"
 
 #include "console-x.h"
@@ -1678,12 +1679,38 @@
 /**********************************************************************
  *                             ImageMagick                            *
  **********************************************************************/
+JMP_BUF imagick_jump;
+Lisp_Object imagick_err; /* slightly hackish way to return a proper error message */
+
 static void
 imagick_validate (Lisp_Object instantiator)
 {
 	file_or_data_must_be_present (instantiator);
 }
 
+static void
+imagick_error_handler (const char *message,const char *qualifier)
+{
+  /* ImageMagick defaults to exiting on errors, which is an anti-thing.
+   * Dump the info into imagick_err, and jmp back */
+  if (qualifier != NULL)
+    imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s (%s)"),
+					Qnil, -1, message, qualifier);
+  else
+    imagick_err = emacs_doprnt_string_c((CONST Bufbyte *) GETTEXT ("ImageMagick error: %s"),
+					Qnil, -1, message);
+  LONGJMP(imagick_jump,1);
+}
+
+static void
+imagick_warning_handler (const char *message,const char *qualifier)
+{
+  if (qualifier != NULL)
+    warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s (%s)",message,qualifier);
+  else
+    warn_when_safe(Qimagick, Qwarning, "ImageMagick warning: %s",message);
+}
+
 static Lisp_Object
 imagick_normalize (Lisp_Object inst, Lisp_Object console_type)
 {
@@ -1776,6 +1803,16 @@
   speccount = specpdl_depth();
   record_unwind_protect(imagick_instantiate_unwind,make_opaque_ptr(&unwind));
 
+  /* Set up error handlers */
+  if (SETJMP(imagick_jump)) 
+    {
+      /* signal error GCPROs it's arguments */
+      signal_error(Qerror, list2(imagick_err, instantiator));
+    }
+  
+  SetErrorHandler(imagick_error_handler);
+  SetWarningHandler(imagick_warning_handler);
+
   /* Write out to a temp file - not sure if ImageMagick supports the
   ** notion of an abstract 'data source' right now.
   ** JH: It doesn't as of 3.9.3
--- a/src/gui-x.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/gui-x.c	Mon Aug 13 10:13:48 2007 +0200
@@ -33,12 +33,10 @@
 #include "buffer.h"
 #include "device.h"
 #include "frame.h"
+#include "gui.h"
 #include "opaque.h"
 
 #ifdef HAVE_POPUPS
-/* count of menus/dboxes currently up */
-int popup_up_p;
-
 Lisp_Object Qmenu_no_selection_hook;
 #endif
 
@@ -221,15 +219,6 @@
   free_widget_value (wv);
 }
 
-DEFUN ("popup-up-p", Fpopup_up_p, 0, 0, 0, /*
-Return t if a popup menu or dialog box is up, nil otherwise.
-See `popup-menu' and `popup-dialog-box'.
-*/
-       ())
-{
-  return popup_up_p ? Qt : Qnil;
-}
-
 /* The following is actually called from somewhere within XtDispatchEvent(),
    called from XtAppProcessEvent() in event-Xt.c */
 
@@ -315,24 +304,6 @@
       slot = (!NILP ((form)))
 #endif
 
-Boolean
-separator_string_p (CONST char *s)
-{
-  CONST char *p;
-  char first;
-
-  if (!s || s[0] == '\0')
-    return False;
-  first = s[0];
-  if (first != '-' && first != '=')
-    return False;
-  for (p = s; *p == first; p++);
-
-  if (*p == '!' || *p == ':' || *p == '\0')
-    return True;
-  return False;
-}
-
 char *
 menu_separator_style (CONST char *s)
 {
@@ -633,7 +604,6 @@
 syms_of_gui_x (void)
 {
 #ifdef HAVE_POPUPS
-  DEFSUBR (Fpopup_up_p);
   defsymbol (&Qmenu_no_selection_hook, "menu-no-selection-hook");
 #endif
 }
--- a/src/gui-x.h	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/gui-x.h	Mon Aug 13 10:13:48 2007 +0200
@@ -32,8 +32,6 @@
 
 #ifdef HAVE_POPUPS
 
-extern int popup_up_p;
-
 /* Each frame has one of these, and they are also contained in
    Vpopup_callbacks.
    It doesn't really need to be an lrecord (it's not lisp-accessible)
@@ -76,7 +74,6 @@
 int button_item_to_widget_value (Lisp_Object desc, widget_value *wv,
 				 int allow_text_field_p, int no_keys_p);
 Lisp_Object menu_name_to_accelerator (char *name);
-Boolean separator_string_p (CONST char *s);
 char *menu_separator_style (CONST char *s);
 Lisp_Object widget_value_unwind (Lisp_Object closure);
 
--- a/src/gui.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/gui.c	Mon Aug 13 10:13:48 2007 +0200
@@ -23,6 +23,7 @@
 /* Synched up with: Not in FSF. */
 
 #include <config.h>
+#include "gui.h"
 #include "lisp.h"
 
 Lisp_Object Q_active, Q_suffix, Q_keys, Q_style, Q_selected;
@@ -30,6 +31,40 @@
 Lisp_Object Q_accelerator;
 Lisp_Object Qtoggle, Qradio;
 
+#ifdef HAVE_POPUPS
+
+/* count of menus/dboxes currently up */
+int popup_up_p;
+
+DEFUN ("popup-up-p", Fpopup_up_p, 0, 0, 0, /*
+Return t if a popup menu or dialog box is up, nil otherwise.
+See `popup-menu' and `popup-dialog-box'.
+*/
+       ())
+{
+  return popup_up_p ? Qt : Qnil;
+}
+
+int
+separator_string_p (CONST char *s)
+{
+  CONST char *p;
+  char first;
+
+  if (!s || s[0] == '\0')
+    return 0;
+  first = s[0];
+  if (first != '-' && first != '=')
+    return 0;
+  for (p = s; *p == first; p++);
+
+  if (*p == '!' || *p == ':' || *p == '\0')
+    return 1;
+  return 0;
+}
+
+#endif /* HAVE_POPUPS */
+
 void
 syms_of_gui (void)
 {
@@ -45,6 +80,10 @@
 
   defsymbol (&Qtoggle, "toggle");
   defsymbol (&Qradio, "radio");
+
+#ifdef HAVE_POPUPS
+  DEFSUBR (Fpopup_up_p);
+#endif
 }
 
 void
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gui.h	Mon Aug 13 10:13:48 2007 +0200
@@ -0,0 +1,35 @@
+/* Generic GUI code. (menubars, scrollbars, toolbars, dialogs)
+   Copyright (C) 1995 Board of Trustees, University of Illinois.
+   Copyright (C) 1995, 1996 Ben Wing.
+   Copyright (C) 1995 Sun Microsystems, 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.  */
+
+/* Synched up with: Not in FSF. */
+
+/* Written by kkm on 12/24/97 */
+
+#ifndef _XEMACS_GUI_H_
+#define _XEMACS_GUI_H_
+
+#ifdef HAVE_POPUPS
+int separator_string_p (CONST char *s);
+extern int popup_up_p;
+#endif /* HAVE_POPUPS */
+
+#endif /* _XEMACS_GUI_H_ */
--- a/src/lread.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/lread.c	Mon Aug 13 10:13:48 2007 +0200
@@ -636,7 +636,6 @@
       else if (load_warn_when_source_newer &&
 	       !memcmp (".elc", foundstr + foundlen - 4, 4))
 	{
-/*	  struct stat s1, s2;*/
 	  if (! fstat (fd, &s1))	/* can't fail, right? */
 	    {
 	      int result;
@@ -2981,7 +2980,15 @@
 
   Vload_descriptor_list = Qnil;
 
-  Vread_buffer_stream = make_resizing_buffer_output_stream ();
+  /* This used to get initialized in init_lread because all streams
+     got closed when dumping occurs.  This is no longer true --
+     Vread_buffer_stream is a resizing output stream, and there is no
+     reason to close it at dump-time.
+
+     Vread_buffer_stream is set to Qnil in vars_of_lread, and this
+     will initialize it only once, at dump-time.  */
+  if (NILP (Vread_buffer_stream))
+    Vread_buffer_stream = make_resizing_buffer_output_stream ();
 
   Vload_force_doc_string_list = Qnil;
 }
@@ -3143,8 +3150,7 @@
      with values saved when the image is dumped. */
   staticpro (&Vload_descriptor_list);
 
-  /* This gets initialized in init_lread because all streams get closed
-     when dumping occurs */
+  Vread_buffer_stream = Qnil;
   staticpro (&Vread_buffer_stream);
 
   /* Initialized in init_lread. */
@@ -3169,8 +3175,8 @@
   Fprovide(intern("xemacs"));
 #ifdef INFODOCK
   Fprovide(intern("infodock"));
-#endif
-#endif
+#endif /* INFODOCK */
+#endif /* FEATUREP_SYNTAX */
 
 #ifdef LISP_BACKQUOTES
   old_backquote_flag = new_backquote_flag = 0;
--- a/src/mem-limits.h	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/mem-limits.h	Mon Aug 13 10:13:48 2007 +0200
@@ -62,7 +62,9 @@
 #ifndef USG
 #ifndef MSDOS
 #ifndef WINDOWSNT
+#ifndef __CYGWIN32__
 #include <sys/vlimit.h>
+#endif /* not __CYGWIN32__ */
 #endif /* not WINDOWSNT */
 #endif /* not MSDOS */
 #endif /* not USG */
@@ -81,7 +83,9 @@
 typedef char *POINTER;
 #endif
 
+#ifndef __CYGWIN32__
 typedef unsigned long SIZE;
+#endif
 
 #ifdef NULL
 #undef NULL
@@ -148,7 +152,7 @@
 }
 
 #else /* not USG */
-#ifdef WINDOWSNT
+#if defined( WINDOWSNT ) || defined (__CYGWIN32__)
 
 static void
 get_lim_data (void)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/menubar-msw.c	Mon Aug 13 10:13:48 2007 +0200
@@ -0,0 +1,1045 @@
+/* Implements an elisp-programmable menubar -- Win32
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
+   Copyright (C) 1997 Kirill M. Katsnelson <kkm@kis.ru>
+
+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.  */
+
+/* Synched up with: Not in FSF. */
+
+/* Autorship:
+   Initially written by kkm 12/24/97,
+   peeking into and copying stuff from menubar-x.c
+   */
+
+/* Algotirhm for handling menus is as follows. When window's menubar
+ * is created, current-menubar is not traversed in depth. Rather, only
+ * top level items, both items and pulldowns, are added to the
+ * menubar. Each pulldown is initially empty. When a pulldown is
+ * selected and about to open, corresponding element of
+ * current-menubar is found, and the newly open pulldown is
+ * populated. This is made again in the same non-recursive manner.
+ *
+ * This algorithm uses hash tables to find out element of the menu
+ * descriptor list given menu handle. The key is an opaque ptr data
+ * type, keeping menu handle, and the value is a list of strings
+ * representing the path from the root of the menu to the item
+ * descriptor. Each frame has an associated hashtable.
+ *
+ * Leaf items are assigned a unique id based on item's hash. When an
+ * item is selected, Windows sends back the id. Unfortunately, only
+ * low 16 bit of the ID are sent, and there's no way to get the 32-bit
+ * value. Yes, Win32 is just a different set of bugs than X! Aside
+ * from this blame, another hasing mechanism is required to map menu
+ * ids to commands (which are actually Lisp_Object's). This mapping is
+ * performed in the same hashtable, as the lifetime of both maps is
+ * exactly the same. This is unabmigous, as menu handles are
+ * represented by lisp opaques, while command ids are by lisp
+ * integers. The additional advantage for this is that command forms
+ * are automatically GC-protected, which is important because these
+ * may be transient forms generated by :filter functions.
+ *
+ * The hashtable is not allowed to grow too much; it is pruned
+ * whenever this is safe to do. This is done by re-creating the menu
+ * bar, and clearing and refilling the hash table from scratch.
+ *
+ * Popup menus are handled identially to pulldowns. A static hash
+ * table is used for popup menus, and lookup is made not in
+ * current-menubar but in a lisp form supplied to the `popup'
+ * function.
+ *
+ * Another Windows weirdness is that there's no way to tell that a
+ * popup has been dismissed without making selection. We need to know
+ * that to cleanup the popup menu hashtable, but this is not honestly
+ * doable using *documented* sequence of messages. Sticking to
+ * particular knowledge is bad because this may break in Windows NT
+ * 5.0, or Windows 98, or other future version. Instead, I allow the
+ * hashtables to hang around, and not clear them, unless WM_COMMAND is
+ * received. This is worthy some memory but more safe. Hacks welcome,
+ * anyways!
+ *
+ */
+
+#include <config.h>
+#include "lisp.h"
+
+#include "buffer.h"
+#include "commands.h"
+#include "console-msw.h"
+#include "emacsfns.h"
+#include "elhash.h"
+#include "event-msw.h"
+#include "events.h"
+#include "frame.h"
+#include "gui.h"
+#include "lisp.h"
+#include "menubar.h"
+#include "menubar-msw.h"
+#include "opaque.h"
+#include "window.h"
+
+#define EMPTY_ITEM_ID ((UINT)LISP_TO_VOID (Qunbound))
+#define EMPTY_ITEM_NAME "(empty)"
+
+/* Qnil when there's no popup being tracked, or a descriptor
+   for the popup. gcpro'ed */
+static Lisp_Object current_tracking_popup;
+
+/* Current popup has table. Qnil when no popup. gcpro'ed */
+static Lisp_Object current_popup_hash_table;
+
+/* Bound by menubar.el */
+static Lisp_Object Qfind_menu_item;
+
+/* This is used to allocate unique ids to menu items.
+   Items ids are in MENU_ITEM_ID_MIN to MENU_ITEM_ID_MAX.
+   Allocation checks that the item is not already in
+   the TOP_LEVEL_MENU */
+/* #### defines go to gui-msw.h */
+#define MENU_ITEM_ID_MIN 0x8000
+#define MENU_ITEM_ID_MAX 0xFFFF
+#define MENU_ITEM_ID_BITS(x) ((x) & 0x7FFF | 0x8000)
+static HMENU top_level_menu;
+
+/* ============= THIS STUFF MIGHT GO SOMEWHERE ELSE ================= */
+
+/* All these functions are windows sys independent, and are candidates
+   to go to lisp code instead */
+
+/*
+ * DESCRIPTOR is a list in the form ({:keyword value}+ rest...).
+ * This function extracts all the key-value pairs into the newly
+ * created plist, and returns pointer to REST. Original list is not
+ * modified (heaven save!)
+ */
+Lisp_Object
+gui_parse_menu_keywords (Lisp_Object descriptor, Lisp_Object *plist)
+{
+  Lisp_Object pair, key, val;
+  *plist = Qnil;
+  LIST_LOOP (pair, descriptor)
+    {
+      if (!CONSP(pair))
+	signal_simple_error ("Mailformed gui entity descriptor", descriptor);
+      key = XCAR(pair);
+      if (!KEYWORDP (key))
+	return pair;
+      pair = XCDR (pair);
+      if (!CONSP(pair))
+	signal_simple_error ("Mailformed gui entity descriptor", descriptor);
+      val = XCAR (pair);
+      internal_plist_put (plist, key, val);
+    }
+  return pair;
+}
+
+/*
+ * DESC is a vector describing a menu item. The function returns menu
+ * item name in NAME, callback form in CALLBACK, and all key-values
+ * pairs in PLIST. For old-style vectors, the plist is faked.
+ */
+void
+gui_parse_button_descriptor (Lisp_Object desc, Lisp_Object *name, 
+			     Lisp_Object *callback, Lisp_Object *plist)
+{
+  int length = XVECTOR_LENGTH (desc);
+  Lisp_Object *contents = XVECTOR_DATA (desc);
+  int plist_p;
+
+  *name = Qnil;
+  *callback = Qnil;
+  *plist = Qnil;
+
+  if (length < 3)
+    signal_simple_error ("button descriptors must be at least 3 long", desc);
+
+  /* length 3:		[ "name" callback active-p ]
+     length 4:		[ "name" callback active-p suffix ]
+     		   or	[ "name" callback keyword  value  ]
+     length 5+:		[ "name" callback [ keyword value ]+ ]
+   */
+  plist_p = (length >= 5 || KEYWORDP (contents [2]));
+
+  *name = contents [0];
+  *callback = contents [1];
+
+  if (!plist_p)
+    /* the old way */
+    {
+      internal_plist_put (plist, Q_active, contents [2]);
+      if (length == 4)
+	internal_plist_put (plist, Q_suffix, contents [3]);
+    }
+  else
+    /* the new way */
+    {
+      int i;
+      if (length & 1)
+	signal_simple_error (
+		"button descriptor has an odd number of keywords and values",
+			     desc);
+
+      for (i = 2; i < length;)
+	{
+	  Lisp_Object key = contents [i++];
+	  Lisp_Object val = contents [i++];
+	  if (!KEYWORDP (key))
+	    signal_simple_error_2 ("not a keyword", key, desc);
+	  internal_plist_put (plist, key, val);
+	}
+    }    
+}
+
+/*
+ * Given PLIST of key-value pairs for a menu item or button, consult
+ * :included and :config properties (the latter against
+ * CONFLIST). Return value is non-zero when item should *not* appear.
+ */
+int
+gui_plist_says_item_excluded (Lisp_Object plist, Lisp_Object conflist)
+{
+  Lisp_Object tem;
+  /* This function can call lisp */
+
+  /* Evaluate :included first */
+  tem = internal_plist_get (plist, Q_included);
+  if (!UNBOUNDP (tem))
+    {
+      tem = Feval (tem);
+      if (NILP (tem))
+	return 1;
+    }
+
+  /* Do :config if conflist is given */
+  if (!NILP (conflist))
+    {
+      tem = internal_plist_get (plist, Q_config);
+      if (!UNBOUNDP (tem))
+	{
+	  tem = Fmemq (tem, conflist);
+	  if (NILP (tem))
+	    return 1;
+	}
+    }
+
+  return 0;
+}
+    
+/*
+ * Given PLIST of key-value pairs for a menu item or button, consult
+ * :active property. Return non-zero if the item is *inactive*
+ */
+int
+gui_plist_says_item_inactive (Lisp_Object plist)
+{
+  Lisp_Object tem;
+  /* This function can call lisp */
+
+  tem = internal_plist_get (plist, Q_active);
+  if (!UNBOUNDP (tem))
+    {
+      tem = Feval (tem);
+      if (NILP (tem))
+	return 1;
+    }
+
+  return 0;
+}
+
+/*
+ * Given PLIST of key-value pairs for a menu item or button, evaluate
+ * the form which is the value of :filter property. Filter function
+ * given DESC as argument. If there's no :filter property, DESC is
+ * returned, otherwise the value returned by the filter function is
+ * returned. 
+ */
+Lisp_Object
+gui_plist_apply_filter (Lisp_Object plist, Lisp_Object desc)
+{
+  Lisp_Object tem;
+  /* This function can call lisp */
+
+  tem = internal_plist_get (plist, Q_filter);
+  if (UNBOUNDP (tem))
+    return desc;
+  else
+    return call1 (tem, desc);
+}
+
+/*
+ * This is tricky because there's no menu item styles in Windows, only
+ * states: Each item may be given no checkmark, radio or check
+ * mark. This function returns required mark style as determined by
+ * PLIST. Return value is the value of :style property if the item is
+ * :seleted, or nil otherwise
+ */
+Lisp_Object
+gui_plist_get_current_style (Lisp_Object plist)
+{
+  Lisp_Object style, selected;
+  style = internal_plist_get (plist, Q_style);
+  if (UNBOUNDP (style) || NILP(style))
+    return Qnil;
+
+  selected = internal_plist_get (plist, Q_selected);
+  if (UNBOUNDP (selected) || NILP(Feval(selected)))
+    return Qnil;
+
+  return style;
+}
+
+Lisp_Object
+current_frame_menubar (CONST struct frame* f)
+{
+  struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
+  return symbol_value_in_buffer (Qcurrent_menubar, w->buffer);
+}
+
+/* ============ END IF STUFF THAT MIGHT GO SOMEWHERE ELSE =============== */
+
+/* Change these together */
+#define MAX_MENUITEM_LENGTH 128
+#define DISPLAYABLE_MAX_MENUITEM_LENGTH "128"
+
+static void 
+signal_item_too_long (Lisp_Object name)
+{
+    signal_simple_error ("Menu item is longer than "
+			 DISPLAYABLE_MAX_MENUITEM_LENGTH
+			 " characters", name);
+}
+
+/* #### If this function returned (FLUSHLEFT . FLUSHRIGHT) it also
+   could be moved above that line - it becomes window system
+   independant */
+/*
+ * This returns Windows-style menu item string:
+ * "Left Flush\tRight Flush"
+ */
+static CONST char*
+plist_get_menu_item_name (Lisp_Object name, Lisp_Object callback, Lisp_Object plist)
+{
+  /* We construct the name in a static buffer. That's fine, beause
+     menu items longer than 128 chars are probably programming errors,
+     and better be caught than displayed! */
+  
+  static char buf[MAX_MENUITEM_LENGTH];
+  char* p = buf;
+  int buf_left = MAX_MENUITEM_LENGTH - 1;
+  Lisp_Object tem;
+
+  /* Get name first */
+  buf_left -= XSTRING_LENGTH (name);
+  if (buf_left < 0)
+    signal_item_too_long (name);
+  strcpy (p, XSTRING_DATA (name));
+  p += XSTRING_LENGTH (name);
+
+  /* Have suffix? */
+  tem = internal_plist_get (plist, Q_suffix);
+  if (!UNBOUNDP (tem))
+    {
+      if (!STRINGP (tem))
+	signal_simple_error (":suffix must be a string", tem);
+      buf_left -= XSTRING_LENGTH (tem) + 1;
+      if (buf_left < 0)
+	signal_item_too_long (name);
+      *p++ = ' ';
+      strcpy (p, XSTRING_DATA (tem));
+      p += XSTRING_LENGTH (tem);
+    }
+
+  /* Have keys? */
+  if (menubar_show_keybindings)
+    {
+      static char buf2 [1024];
+      buf2[0] = 0;
+
+      tem = internal_plist_get (plist, Q_keys);
+      if (!UNBOUNDP (tem))
+	{
+	  if (!STRINGP (tem))
+	    signal_simple_error (":keys must be a string", tem);
+	  if (XSTRING_LENGTH (tem) > sizeof (buf2) - 1)
+	    signal_item_too_long (name);
+	  strcpy (buf2, XSTRING_DATA (tem));
+	}
+      else if (SYMBOLP (callback))
+	{
+	  /* #### Warning, dependency here on current_buffer and point */
+	  /* #### I've borrowed this warning along with this code from
+	     menubar-x.c. What does that mean? -- kkm */
+	  where_is_to_char (callback, buf2);
+	}
+
+      if (buf2 [0])
+	{
+	  int n = strlen (buf2) + 1;
+	  buf_left -= n;
+	  if (buf_left < 0)
+	    signal_item_too_long (name);
+	  *p++ = '\t';
+	  strcpy (p, buf2);
+	  p += n-1;
+	}
+    }
+  
+  *p = 0;
+  return buf;
+}
+
+/*
+ * hmenu_to_lisp_object() returns an opaque ptr given menu handle.
+ */
+static Lisp_Object
+hmenu_to_lisp_object (HMENU hmenu)
+{
+  return make_opaque_ptr (hmenu);
+}
+
+/*
+ * Allocation tries a hash based on item's path and name first. This
+ * almost guarantees that the same item will override its old value in
+ * the hashtable rather than abandon it.
+ */
+static Lisp_Object
+allocate_menu_item_id (Lisp_Object path, Lisp_Object name)
+{
+  UINT id = MENU_ITEM_ID_BITS (HASH2 (internal_hash (path, 0),
+				      internal_hash (name, 0)));
+  do {
+      id = MENU_ITEM_ID_BITS (id + 1);
+  } while (GetMenuState (top_level_menu, id, MF_BYCOMMAND) != 0xFFFFFFFF);
+  return make_int (id);
+}
+
+static HMENU
+create_empty_popup_menu (void)
+{
+  HMENU submenu = CreatePopupMenu ();
+  /* #### It seems that really we do not need "(empty)" at this stage */
+#if 0
+  AppendMenu (submenu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
+#endif
+  return submenu;
+}
+
+static void
+empty_menu (HMENU menu, int add_empty_p)
+{
+  while (DeleteMenu (menu, 0, MF_BYPOSITION));
+  if (add_empty_p)
+    AppendMenu (menu, MF_STRING | MF_GRAYED, EMPTY_ITEM_ID, EMPTY_ITEM_NAME);
+}
+
+static void
+populate_menu_add_item (HMENU menu, Lisp_Object path,
+			Lisp_Object hash_tab, Lisp_Object item, int flush_right)
+{
+  MENUITEMINFO item_info;
+  struct gcpro gcpro1, gcpro2;
+
+  item_info.cbSize = sizeof (item_info);
+  item_info.fMask = MIIM_TYPE | MIIM_STATE | MIIM_ID;
+  item_info.fState = 0;
+  item_info.wID = 0;
+  item_info.fType = 0;
+
+  if (STRINGP (item))
+    {
+      /* Separator or unselectable text */
+      if (separator_string_p (XSTRING_DATA (item)))
+	item_info.fType = MFT_SEPARATOR;
+      else
+	{
+	  item_info.fType = MFT_STRING;
+	  item_info.fState = MFS_DISABLED;
+	  item_info.dwTypeData = XSTRING_DATA (item);
+	}
+    }
+  else if (CONSP (item))
+    {
+      /* Submenu */
+      Lisp_Object subname = XCAR (item);
+      Lisp_Object plist;
+      HMENU submenu;
+	
+      if (!STRINGP (subname))
+	signal_simple_error ("menu name (first element) must be a string", item);
+
+      item = gui_parse_menu_keywords (XCDR (item), &plist);
+      GCPRO1 (plist);
+
+      if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
+	return;
+
+      if (gui_plist_says_item_inactive (plist))
+	item_info.fState = MFS_GRAYED;
+      /* Temptation is to put 'else' right here. Although, the
+	 displayed item won't have an arrow indicating that it is a
+	 popup.  So we go ahead a little bit more and create a popup */
+      submenu = create_empty_popup_menu();
+
+      item_info.fMask |= MIIM_SUBMENU;
+      item_info.dwTypeData = plist_get_menu_item_name (subname, Qnil, plist);
+      item_info.hSubMenu = submenu;
+
+      UNGCPRO; /* plist */
+
+      if (!(item_info.fState & MFS_GRAYED))
+	{
+	  /* Now add the full submenu path as a value to the hash table,
+	     keyed by menu handle */
+	  if (NILP(path))
+	    path = list1 (subname);
+	  else {
+	    Lisp_Object arg[2];
+	    arg[0] = path;
+	    arg[1] = list1 (subname);
+	    GCPRO1 (arg[1]);
+	    path = Fappend (2, arg);
+	    UNGCPRO; /* arg[1] */
+	  }
+
+	  GCPRO1 (path);
+	  Fputhash (hmenu_to_lisp_object (submenu), path, hash_tab);
+	  UNGCPRO; /* path */
+	}
+    } 
+  else if (VECTORP (item))
+    {
+      /* An ordinary item */
+      Lisp_Object plist, name, callback, style, id;
+      
+      gui_parse_button_descriptor (item, &name, &callback, &plist);
+      GCPRO2 (plist, callback);
+
+      if (gui_plist_says_item_excluded (plist, Vmenubar_configuration))
+	return;
+
+      if (gui_plist_says_item_inactive (plist))
+	item_info.fState |= MFS_GRAYED;
+
+      style = gui_plist_get_current_style (plist);
+      if (EQ (style, Qradio))
+	{
+	  item_info.fType |= MFT_RADIOCHECK;
+	  item_info.fState |= MFS_CHECKED;
+	}
+      else if (EQ (style, Qtoggle))
+	{
+	  item_info.fState |= MFS_CHECKED;
+	}
+
+      id = allocate_menu_item_id (path, name);
+      Fputhash (id, callback, hash_tab);
+      
+      UNGCPRO; /* plist, callback */
+
+      item_info.wID = (UINT) XINT(id);
+      item_info.fType |= MFT_STRING;
+      item_info.dwTypeData = plist_get_menu_item_name (name, callback, plist);
+    }
+  else
+    {
+      signal_simple_error ("ill-constructed menu descriptor", item);
+    }
+
+  if (flush_right)
+    item_info.fType |= MFT_RIGHTJUSTIFY;
+
+  InsertMenuItem (menu, UINT_MAX, TRUE, &item_info);
+}  
+
+static void
+populate_menu (HMENU menu, Lisp_Object path, Lisp_Object descriptor,
+	       Lisp_Object hash_tab, int bar_p)
+{
+  Lisp_Object menu_name, plist, item_desc;
+  int deep_p, flush_right;
+  struct gcpro gcpro1;
+
+  /* Will initially contain only "(empty)" */
+  empty_menu (menu, 1);
+
+  /* PATH set to nil indicates top-level popup or menubar */
+  deep_p = !NILP (path);
+
+  if (!deep_p)
+    top_level_menu = menu;
+
+  if (!CONSP(descriptor))
+    signal_simple_error ("menu descriptor must be a list", descriptor);
+
+  if (STRINGP (XCAR (descriptor)))
+    {
+      menu_name = XCAR (descriptor);
+      descriptor = XCDR (descriptor);
+    }
+  else
+    {
+      menu_name = Qnil;
+      if (deep_p) /* Not a popup or bar */
+	signal_simple_error ("menu must have a name", descriptor);
+    }
+
+  /* Fetch keywords prepending the item list */
+  descriptor = gui_parse_menu_keywords (descriptor, &plist);
+  GCPRO1 (plist);
+  descriptor = gui_plist_apply_filter (plist, descriptor);
+  UNGCPRO; /* plist */
+  
+  /* Loop thru the descriptor's CDR and add items for each entry */
+  flush_right = 0;
+  EXTERNAL_LIST_LOOP (item_desc, descriptor)
+    {
+      if (NILP (XCAR (item_desc)))
+	{
+	  if (bar_p)
+	    flush_right = 1;
+	}
+      else
+	populate_menu_add_item (menu, path, hash_tab,
+				XCAR (item_desc), flush_right);
+    }
+  
+  /* Remove the "(empty)" item, if there are other ones */
+  if (GetMenuItemCount (menu) > 1)
+    RemoveMenu (menu, EMPTY_ITEM_ID, MF_BYCOMMAND);
+
+  /* Add the header to the popup, if told so. The same as in X - an
+     insensitive item, and a separator (Seems to me, there were
+     two separators in X... In Windows this looks ugly, anywats. */
+  if (!bar_p && !deep_p && popup_menu_titles && !NILP(menu_name))
+    {
+      InsertMenu (menu, 0, MF_BYPOSITION | MF_STRING | MF_DISABLED,
+		  0, XSTRING_DATA(menu_name));
+      InsertMenu (menu, 1, MF_BYPOSITION | MF_SEPARATOR, 0, NULL);
+      SetMenuDefaultItem (menu, 0, MF_BYPOSITION);
+    }
+}
+
+static Lisp_Object
+find_menu (Lisp_Object desc, Lisp_Object path)
+{
+  /* #### find-menu-item is not what's required here. 
+     Need to write this in C, or improve lisp */
+  if (!NILP (path))
+    {
+      desc = call2 (Qfind_menu_item, desc, path);
+      /* desc is (supposed to be) (ITEM . PARENT). Supposed
+         to signal but sometimes manages to return nil */
+      if (!NILP(desc))
+	{
+	  CHECK_CONS (desc);
+	  desc = XCAR (desc);
+	}
+    }
+  return desc;
+}
+
+static void
+update_frame_menubar_maybe (struct frame* f)
+{
+  HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
+  struct window *w = XWINDOW (FRAME_LAST_NONMINIBUF_WINDOW (f));
+  Lisp_Object desc = (!NILP (w->menubar_visible_p)
+		      ? symbol_value_in_buffer (Qcurrent_menubar, w->buffer)
+		      : Qnil);
+
+  if (NILP (desc) && menubar != NULL)
+    {
+      /* Menubar has gone */
+      FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
+      DestroyMenu (menubar);
+      DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
+      return;
+    }
+
+  if (!NILP (desc) && menubar == NULL)
+    {
+      /* Menubar has appeared */
+      menubar = CreateMenu ();
+      goto populate;
+    }
+
+  if (NILP (desc))
+    {
+      /* We did not have the bar and are not going to */
+      return;
+    }
+
+  /* Now we have to check if the menubar has really changed */
+  /* #### For now we do not though */
+
+  /* We cannot re-create the menu, cause WM_INITMENU does not like that.
+     We'll clear it instead. */
+  empty_menu (menubar, 0);
+
+populate:
+  /* Come with empty hash table */
+  if (NILP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)))
+    FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Fmake_hashtable (make_int (50), Qequal);
+  else
+    Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
+
+  Fputhash (hmenu_to_lisp_object (menubar), Qnil,
+	    FRAME_MSWINDOWS_MENU_HASHTABLE(f));
+  populate_menu (menubar, Qnil, desc,
+		 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
+  SetMenu (FRAME_MSWINDOWS_HANDLE (f), menubar);
+  DrawMenuBar (FRAME_MSWINDOWS_HANDLE (f));
+}
+
+static void
+prune_menubar (struct frame *f)
+{
+  HMENU menubar = GetMenu (FRAME_MSWINDOWS_HANDLE (f));
+  Lisp_Object desc = current_frame_menubar (f);
+  if (menubar == NULL)
+    return;
+
+  /* #### If a filter function has set desc to Qnil, this abort()
+     triggers. To resolve, we must prevent explicitely filters from
+     mangling with te active menu. In apply_filter probably?
+     Is copy-tree on the whole menu too expensive? */
+  if (NILP(desc))
+    /* abort(); */
+    return;
+
+  /* We do the trick by removing all items and re-populating top level */
+  empty_menu (menubar, 0);
+
+  assert (HASHTABLEP (FRAME_MSWINDOWS_MENU_HASHTABLE(f)));
+  Fclrhash (FRAME_MSWINDOWS_MENU_HASHTABLE(f));
+
+  Fputhash (hmenu_to_lisp_object (menubar), Qnil,
+	    FRAME_MSWINDOWS_MENU_HASHTABLE(f));
+  populate_menu (menubar, Qnil, desc, 
+		 FRAME_MSWINDOWS_MENU_HASHTABLE(f), 1);
+}
+
+/*
+ * This is called when cleanup is possible. It is better not to
+ * clean things up at all than do it too earaly!
+ */
+static void
+menu_cleanup (struct frame *f)
+{
+  /* This function can GC */
+  if (!NILP (current_tracking_popup))
+    {
+      current_tracking_popup = Qnil;
+      current_popup_hash_table = Qnil;
+    }
+  else
+    prune_menubar (f);
+}
+  
+
+/*------------------------------------------------------------------------*/
+/* Message handlers                                                       */
+/*------------------------------------------------------------------------*/
+static Lisp_Object
+unsafe_handle_wm_initmenupopup_1 (HMENU menu, struct frame* f)
+{
+  /* This function can call lisp, beat dogs and stick chewing gum to
+     everything! */
+
+  Lisp_Object path, desc, hash_tab;
+  struct gcpro gcpro1;
+
+  if (!NILP (current_tracking_popup))
+    {
+      desc = current_tracking_popup;
+      hash_tab = current_popup_hash_table;
+    }
+  else
+    {
+      desc = current_frame_menubar (f);
+      hash_tab = FRAME_MSWINDOWS_MENU_HASHTABLE(f);
+    }
+
+  /* Find which guy is going to explode */
+  path = Fgethash (hmenu_to_lisp_object (menu), hash_tab, Qunbound);
+  assert (!UNBOUNDP (path));
+
+  /* Now find a desc chunk for it. If none, then probably menu open
+     hook has played too much games around stuff */
+  if (!NILP (path))
+    {
+      desc = find_menu (desc, path);
+      if (NILP (desc))
+	signal_simple_error ("this menu does not exist any more", path);
+    }
+
+  /* Now, stuff it */
+  /* DESC may be generated by filter, so we have to gcpro it */
+  GCPRO1 (desc);
+  populate_menu (menu, path, desc, hash_tab, 0);
+  UNGCPRO;
+  return Qt;
+}
+
+static Lisp_Object
+unsafe_handle_wm_initmenu_1 (struct frame* f)
+{
+  /* This function can call lisp */
+  /* #### - this menubar update mechanism is expensively anti-social and
+     the activate-menubar-hook is now mostly obsolete. */
+
+  /* We simply ignore return value. In any case, we construct the bar
+     on the fly */
+  run_hook (Vactivate_menubar_hook);
+  
+  update_frame_menubar_maybe (f);
+  return Qt;
+}
+
+
+#ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
+
+/* #### This may become wrong in future Windows */
+
+static Lisp_Object
+unsafe_handle_wm_exitmenuloop_1 (struct frame* f)
+{
+  if (!NILP (current_tracking_popup))
+    prune_menubar (f);
+  return Qt;
+}
+
+#endif
+
+/*
+ * 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_wm_command (struct frame* f, WORD id)
+{
+  /* Try to map the command id through the proper hash table */
+  Lisp_Object hash_tab, command, funcsym, frame;
+  struct gcpro gcpro1;
+
+  if (!NILP (current_tracking_popup))
+    hash_tab = current_popup_hash_table;
+  else
+    hash_tab = FRAME_MSWINDOWS_MENU_HASHTABLE(f);
+
+  command = Fgethash (make_int (id), hash_tab, Qunbound);
+  if (UNBOUNDP (command))
+    {
+      menu_cleanup (f);
+      return Qnil;
+    }
+
+  /* Need to gcpro because the hashtable may get destroyed
+     by menu_cleanup(), and will not gcpro the command
+     any more */
+  GCPRO1 (command);
+  menu_cleanup (f);
+
+  /* Ok, this is our one. Enqueue it. */
+#if 0
+  if (SYMBOLP (command))
+    Fcall_interactively (command, Qnil, Qnil);
+  else if (CONSP (command))
+    Feval (command);
+  else
+    signal_simple_error ("illegal callback", command);
+#endif
+  if (SYMBOLP (command))
+      funcsym = Qcall_interactively;
+  else if (CONSP (command))
+      funcsym = Qeval;
+  else
+    signal_simple_error ("illegal callback", command);
+
+  XSETFRAME (frame, f);
+  enqueue_misc_user_event (frame, funcsym, command);
+  
+  UNGCPRO; /* command */
+  return Qt;
+}
+
+
+/*------------------------------------------------------------------------*/
+/* Message handling proxies                                               */
+/*------------------------------------------------------------------------*/
+
+static HMENU wm_initmenu_menu;
+static struct frame* wm_initmenu_frame;
+
+static Lisp_Object
+unsafe_handle_wm_initmenupopup (Lisp_Object u_n_u_s_e_d)
+{
+  return unsafe_handle_wm_initmenupopup_1 (wm_initmenu_menu, wm_initmenu_frame);
+}
+
+static Lisp_Object
+unsafe_handle_wm_initmenu (Lisp_Object u_n_u_s_e_d)
+{
+  return unsafe_handle_wm_initmenu_1 (wm_initmenu_frame);
+}
+
+#ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
+static Lisp_Object
+unsafe_handle_wm_exitmenuloop (Lisp_Object u_n_u_s_e_d)
+{
+  return unsafe_handle_wm_exitmenuloop_1 (wm_initmenu_frame);
+}
+#endif
+
+Lisp_Object
+mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm)
+{
+  /* We cannot pass hmenu as a lisp object. Use static var */
+  wm_initmenu_menu = hmenu;
+  wm_initmenu_frame = frm;
+  return mswindows_protect_modal_loop (unsafe_handle_wm_initmenupopup, Qnil);
+}
+
+Lisp_Object
+mswindows_handle_wm_initmenu (struct frame* f)
+{
+  wm_initmenu_frame = f;
+  return mswindows_protect_modal_loop (unsafe_handle_wm_initmenu, Qnil);
+}
+
+Lisp_Object
+mswindows_handle_wm_exitmenuloop (struct frame* f)
+{
+#ifdef KKM_DOES_NOT_LIKE_UNDOCS_SOMETIMES
+  wm_initmenu_frame = f;
+  return mswindows_protect_modal_loop (unsafe_handle_wm_exitmenuloop, Qnil);
+#else
+  return Qt;
+#endif
+}
+
+
+/*------------------------------------------------------------------------*/
+/* Methods                                                                */
+/*------------------------------------------------------------------------*/
+
+static void
+mswindows_update_frame_menubars (struct frame* f)
+{
+  update_frame_menubar_maybe (f);
+}
+
+static void
+mswindows_free_frame_menubars (struct frame* f)
+{
+  FRAME_MSWINDOWS_MENU_HASHTABLE(f) = Qnil;
+}
+
+static void
+mswindows_popup_menu (Lisp_Object menu_desc, Lisp_Object event)
+{
+  struct frame *f = selected_frame ();
+  struct Lisp_Event *eev = NULL;
+  HMENU menu;
+  POINT pt;
+  int ok;
+
+  if (!NILP (event))
+    {
+      CHECK_LIVE_EVENT (event);
+      eev = XEVENT (event);
+      if (eev->event_type != button_press_event
+	  && eev->event_type != button_release_event)
+	wrong_type_argument (Qmouse_event_p, event);
+    }
+  else if (!NILP (Vthis_command_keys))
+    {
+      /* if an event wasn't passed, use the last event of the event sequence
+	 currently being executed, if that event is a mouse event */
+      eev = XEVENT (Vthis_command_keys); /* last event first */
+      if (eev->event_type != button_press_event
+	  && eev->event_type != button_release_event)
+	eev = NULL;
+    }
+
+  /* Default is to put the menu at the point (10, 10) in frame */
+  if (eev)
+    {
+      pt.x = eev->event.button.x;
+      pt.y = eev->event.button.y;
+      ClientToScreen (FRAME_MSWINDOWS_HANDLE (f), &pt);
+    }
+  else
+    pt.x = pt.y = 10;
+
+  if (SYMBOLP (menu_desc))
+    menu_desc = Fsymbol_value (menu_desc);
+
+  current_tracking_popup = menu_desc;
+  current_popup_hash_table = Fmake_hashtable (make_int(10), Qequal);
+  menu = create_empty_popup_menu();
+  Fputhash (hmenu_to_lisp_object (menu), Qnil, current_popup_hash_table);
+  
+  ok = TrackPopupMenu (menu, TPM_LEFTALIGN | TPM_LEFTBUTTON,
+		       pt.x, pt.y, 0,
+		       FRAME_MSWINDOWS_HANDLE (f), NULL);
+
+  DestroyMenu (menu);
+
+  /* Signal a signal if caught by Track...() modal loop */
+  mswindows_unmodalize_signal_maybe ();
+
+  /* This is probably the only real reason for failure */
+  if (!ok) {
+    menu_cleanup (f);
+    signal_simple_error ("cannot track popup menu while in menu",
+			 menu_desc);
+  }
+}
+
+
+/*------------------------------------------------------------------------*/
+/* Initialization                                                         */
+/*------------------------------------------------------------------------*/
+void
+syms_of_menubar_mswindows (void)
+{
+  defsymbol (&Qfind_menu_item, "find-menu-item");
+}
+
+void
+console_type_create_menubar_mswindows (void)
+{
+  CONSOLE_HAS_METHOD (mswindows, update_frame_menubars);
+  CONSOLE_HAS_METHOD (mswindows, free_frame_menubars);
+  CONSOLE_HAS_METHOD (mswindows, popup_menu);
+}
+
+void
+vars_of_menubar_mswindows (void)
+{
+  current_tracking_popup = Qnil;
+  current_popup_hash_table = Qnil;
+
+  staticpro (&current_tracking_popup);
+  staticpro (&current_popup_hash_table);
+
+  Fprovide (intern ("mswindows-menubars"));
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/menubar-msw.h	Mon Aug 13 10:13:48 2007 +0200
@@ -0,0 +1,44 @@
+/* Implements an elisp-programmable menubar -- Win32
+   Copyright (C) 1993, 1994 Free Software Foundation, Inc.
+   Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
+   Copyright (C) 1997 Kirill M. Katsnelson <kkm@kis.ru>
+
+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.  */
+
+/* Synched up with: Not in FSF. */
+
+/* Autorship:
+   Initially written by kkm 12/24/97,
+   */
+
+#ifndef _XEMACS_MENUBAR_MSW_H_
+#define _XEMACS_MENUBAR_MSW_H_
+
+
+#ifdef HAVE_MENUBARS
+
+/* Message handlers. Called from window procedure */
+Lisp_Object mswindows_handle_wm_initmenupopup (HMENU hmenu, struct frame* frm);
+Lisp_Object mswindows_handle_wm_initmenu (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 */
+
+#endif /* _XEMACS_MENUBAR_MSW_H_ */
+
--- a/src/menubar-x.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/menubar-x.c	Mon Aug 13 10:13:48 2007 +0200
@@ -34,6 +34,7 @@
 
 #include "buffer.h"
 #include "commands.h"           /* zmacs_regions */
+#include "gui.h"
 #include "events.h"
 #include "frame.h"
 #include "opaque.h"
--- a/src/msw-proc.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/msw-proc.c	Mon Aug 13 10:13:48 2007 +0200
@@ -35,6 +35,14 @@
 #include "event-msw.h"
 #include "redisplay.h"
 
+#ifdef HAVE_SCROLLBARS
+# include "scrollbar-msw.h"
+#endif
+
+#ifdef HAVE_MENUBARS
+# include "menubar-msw.h"
+#endif
+
 #ifdef DEBUG_XEMACS
 # include "opaque.h"	/* For the debug functions at the end of this file */
 # undef DEBUG_MESSAGES
@@ -51,6 +59,7 @@
 #define BUTTON_2_TIMER_ID 1
 
 static Lisp_Object mswindows_find_frame (HWND hwnd);
+static Lisp_Object mswindows_find_console (HWND hwnd);
 static Lisp_Object mswindows_key_to_emacs_keysym(int mswindows_key, int mods);
 static int mswindows_modifier_state (BYTE* keymap, int has_AltGr);
 static int mswindows_enqueue_timeout (int milliseconds);
@@ -178,12 +187,12 @@
   HKL current_hkl = GetKeyboardLayout (0);
   if (current_hkl != last_hkl)
     {
-      int c;
+      TCHAR c;
       last_hkl_has_AltGr = 0;
       /* In this loop, we query whether a character requires
 	 AltGr to be down to generate it. If at least such one
 	 found, this means that the layout does regard AltGr */
-      for (c = ' '; c <= 0xFF && !last_hkl_has_AltGr; ++c)
+      for (c = ' '; c <= 0xFFU && c != 0 && !last_hkl_has_AltGr; ++c)
 	if (HIBYTE (VkKeyScan (c)) == 6)
 	  last_hkl_has_AltGr = 1;
       last_hkl = current_hkl;
@@ -204,7 +213,7 @@
   Lisp_Object fobj;
   struct frame *frame;
   struct mswindows_frame* msframe;
-  
+
   switch (message)
   {
   case WM_ERASEBKGND:
@@ -225,7 +234,7 @@
     {
       BYTE keymap[256];
       int has_AltGr = mswindows_current_layout_has_AltGr ();
-      int mods, ch;
+      int mods;
       Lisp_Object keysym;
 
       GetKeyboardState (keymap);
@@ -236,7 +245,6 @@
 	mswindows_enqueue_keypress_event (hwnd, keysym, mods);
       else
 	{
-	  int ch;
 	  int quit_ch = CONSOLE_QUIT_CHAR (XCONSOLE (mswindows_find_console (hwnd)));
 	  BYTE keymap_orig[256];
 	  MSG msg = { hwnd, message, wParam, lParam, GetMessageTime(), GetMessagePos() };
@@ -245,12 +253,13 @@
 	  /* Clear control and alt modifiers out of the keymap */
 	  keymap [VK_RCONTROL] = 0;
 	  keymap [VK_LMENU] = 0;
-	  if (!has_AltGr || !(keymap [VK_LCONTROL] & 0x80) || !(keymap [VK_RMENU] & 0x80)) {
-	    keymap [VK_LCONTROL] = 0;
-	    keymap [VK_CONTROL] = 0;
-	    keymap [VK_RMENU] = 0;
-	    keymap [VK_MENU] = 0;
-	  }
+	  if (!has_AltGr || !(keymap [VK_LCONTROL] & 0x80) || !(keymap [VK_RMENU] & 0x80))
+	    {
+	      keymap [VK_LCONTROL] = 0;
+	      keymap [VK_CONTROL] = 0;
+	      keymap [VK_RMENU] = 0;
+	      keymap [VK_MENU] = 0;
+	    }
 	  SetKeyboardState (keymap);
 
 	  /* Have some WM_[SYS]CHARS in the queue */
@@ -259,7 +268,7 @@
 	  while (PeekMessage (&msg, hwnd, WM_CHAR, WM_CHAR, PM_REMOVE)
 		 ||PeekMessage (&msg, hwnd, WM_SYSCHAR, WM_SYSCHAR, PM_REMOVE))
 	    {
-	      ch = msg.wParam;
+	      int ch = msg.wParam;
 	      /* CH is a character code for the key: 
 		 'C' for Shift+C and Ctrl+Shift+C
 		 'c' for c and Ctrl+c */
@@ -595,6 +604,7 @@
     mswindows_enqueue_magic_event (hwnd, XM_BUMPQUEUE);
     return 0;
 
+#ifdef HAVE_SCROLLBARS
   case WM_VSCROLL:
   case WM_HSCROLL:
     {
@@ -604,7 +614,7 @@
       HWND hwndScrollBar = (HWND) lParam;
       mswindows_handle_scrollbar_event (hwndScrollBar, code,  pos);
 
-      if (NILP(mswindows_pump_outstanding_events()))
+      if (UNBOUNDP(mswindows_pump_outstanding_events()))
 	{
 	  /* Error during event pumping - cancel scroll */
 	  SendMessage (hwndScrollBar, WM_CANCELMODE, 0, 0);
@@ -612,6 +622,53 @@
 
       break;     
     }
+#endif
+
+#ifdef HAVE_MENUBARS
+  case WM_INITMENU:
+    if (UNBOUNDP (mswindows_handle_wm_initmenu (
+			XFRAME (mswindows_find_frame (hwnd)))))
+      SendMessage (hwnd, WM_CANCELMODE, 0, 0);
+    break;
+
+  case WM_INITMENUPOPUP:
+    if (!HIWORD(lParam))
+      {
+	if (UNBOUNDP (mswindows_handle_wm_initmenupopup (
+			(HMENU) wParam,
+			 XFRAME (mswindows_find_frame (hwnd)))))
+	  SendMessage (hwnd, WM_CANCELMODE, 0, 0);
+      }
+    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:
+    {
+      WORD id = LOWORD (wParam);
+      frame = XFRAME (mswindows_find_frame (hwnd));
+
+#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. No abort(), for safety */
+      /* #### Perhaps, this message should be changed */
+      error ("Cannot decode command. Tell kkm he's a parallelogramm, if you know"
+	     " what does that mean!");
+    }
+  break;
 
   defproc:
   default:
@@ -757,7 +814,7 @@
   return (LRECORDP (obj)) ? XRECORD_LHEADER (obj) : NULL;
 }
 
-int DOPAQUE_DATA (Lisp_Object obj)
+int *DOPAQUE_DATA (Lisp_Object obj)
 {
   return (OPAQUEP (obj)) ? OPAQUE_DATA (XOPAQUE (obj)) : NULL;
 }
@@ -782,7 +839,7 @@
   return (CONSP (obj)) ? XCDR (obj) : 0;
 }
 
-Lisp_Object DCONSCDR(Lisp_Object obj)
+struct Lisp_Cons *DCONSCDR(Lisp_Object obj)
 {
   return ((CONSP (obj)) && (CONSP (XCDR (obj)))) ? XCONS (XCDR (obj)) : 0;
 }
--- a/src/objects-msw.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/objects-msw.c	Mon Aug 13 10:13:48 2007 +0200
@@ -49,6 +49,9 @@
 #include "insdel.h"
 
 #include "windows.h"
+#ifdef __CYGWIN32__
+#define stricmp strcasecmp
+#endif
 
 typedef struct colormap_t 
 {
--- a/src/opaque.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/opaque.c	Mon Aug 13 10:13:48 2007 +0200
@@ -56,8 +56,12 @@
 static unsigned int sizeof_opaque (CONST void *header);
 static void print_opaque (Lisp_Object obj, Lisp_Object printcharfun,
 			  int escapeflag);
+static int equal_opaque (Lisp_Object obj1, Lisp_Object obj2, int depth);
+static unsigned long hash_opaque (Lisp_Object obj, int depth);
+
 DEFINE_LRECORD_SEQUENCE_IMPLEMENTATION ("opaque", opaque,
-					mark_opaque, print_opaque, 0, 0, 0,
+					mark_opaque, print_opaque, 0, 
+					equal_opaque, hash_opaque,
 					sizeof_opaque, struct Lisp_Opaque);
 
 static Lisp_Object
@@ -121,6 +125,39 @@
   return val;
 }
 
+/* This will not work correctly for opaques with subobjects! */
+
+static int
+equal_opaque (Lisp_Object obj1, Lisp_Object obj2, int depth)
+{
+#ifdef DEBUG_XEMACS
+  assert (!XOPAQUE_MARKFUN (obj1) && !XOPAQUE_MARKFUN (obj2));
+  assert (INTP (XOPAQUE(obj1)->size_or_chain));
+  assert (INTP (XOPAQUE(obj2)->size_or_chain));
+#endif
+  if (XOPAQUE_SIZE(obj1) != XOPAQUE_SIZE(obj2))
+    return 0;
+  return (XOPAQUE_SIZE(obj1) == sizeof(*XOPAQUE_DATA(obj1))
+	  ? *XOPAQUE_DATA(obj1) == *XOPAQUE_DATA(obj2)
+	  : memcmp (XOPAQUE_DATA(obj1), XOPAQUE_DATA(obj2),
+		    XOPAQUE_SIZE(obj1)) == 0);
+}
+
+/* This will not work correctly for opaques with subobjects! */
+
+static unsigned long
+hash_opaque (Lisp_Object obj, int depth)
+{
+#ifdef DEBUG_XEMACS
+  assert (!XOPAQUE_MARKFUN (obj));
+  assert (INTP (XOPAQUE(obj)->size_or_chain));
+#endif
+  if (XOPAQUE_SIZE(obj) == sizeof (unsigned long))
+    return (unsigned int) *XOPAQUE_DATA(obj);
+  else
+    return memory_hash (XOPAQUE_DATA(obj), XOPAQUE_SIZE(obj));
+}
+
 static Lisp_Object mark_opaque_list (Lisp_Object, void (*) (Lisp_Object));
 DEFINE_LRECORD_IMPLEMENTATION ("opaque-list", opaque_list,
 			       mark_opaque_list, internal_object_printer,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/s/cygwin32.h	Mon Aug 13 10:13:48 2007 +0200
@@ -0,0 +1,237 @@
+/* System description file for Windows NT.
+   Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs 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.
+
+GNU Emacs 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.  */
+
+/* Synched up with: FSF 19.31. */
+
+/*
+#ifndef WINDOWSNT
+#define WINDOWSNT
+#endif
+
+#ifndef DOS_NT
+#define DOS_NT 
+#endif
+*/
+
+/* Need the win32 api */
+#ifndef NOT_C_CODE
+#ifdef CONST
+#undef CONST
+#endif
+
+/* Start and end of text and data.  */
+extern void* _data_start__;
+extern void* _data_end__;
+
+#include <windows.h>
+#endif
+
+#ifndef HAVE_MS_WINDOWS
+#define HAVE_MS_WINDOWS
+#endif
+
+/*#ifndef HAVE_SCROLLBARS
+#define HAVE_SCROLLBARS
+#endif*/
+
+#ifndef HAVE_NTGUI
+#define HAVE_NTGUI
+#endif
+
+#ifndef ORDINARY_LINK
+#define ORDINARY_LINK
+#endif
+
+#undef MOD_ALT
+#undef MOD_CONTROL
+#undef MOD_SHIFT
+
+#define SIF_TRACKPOS	0x0010
+#define FW_BLACK	FW_HEAVY
+#define FW_ULTRABOLD	FW_EXTRABOLD
+#define FW_ULTRALIGHT	FW_EXTRALIGHT
+#define TMPF_FIXED_PITCH	0x01
+#define VK_APPS			0x5D
+#define SIGPROF	0
+#define NO_LIM_DATA
+#define HAVE_TEXT_START
+
+#define LIBS_SYSTEM "-luser32 -lgdi32"
+
+#undef MAIL_USE_SYSTEM_LOCK
+
+/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
+ * group of arguments and treat it as an array of the arguments.  */
+
+#define NO_ARG_ARRAY
+
+/* Define WORD_MACHINE if addresses and such have
+ * to be corrected before they can be used as byte counts.  */
+
+#define WORD_MACHINE
+
+/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
+   the 24-bit bit field into an int.  In other words, if bit fields
+   are always unsigned.
+
+   If you use NO_UNION_TYPE, this flag does not matter.  */
+
+#define EXPLICIT_SIGN_EXTEND
+
+/* Data type of load average, as read out of kmem.  */
+
+#define LOAD_AVE_TYPE long
+
+/* Convert that into an integer that is 100 for a load average of 1.0  */
+
+#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
+
+/* Define CANNOT_DUMP on machines where unexec does not work.
+   Then the function dump-emacs will not be defined
+   and temacs will do (load "loadup") automatically unless told otherwise.  */
+
+#define CANNOT_DUMP	1
+#define	CANNOT_UNEXEC	1
+#define UNEXEC /* unexnt.o */
+
+#define DATA_START 	_data_start__
+#define DATA_END 	_data_end__
+
+/* Define VIRT_ADDR_VARIES if the virtual addresses of
+   pure and impure space as loaded can vary, and even their
+   relative order cannot be relied on.
+
+   Otherwise Emacs assumes that text space precedes data space,
+   numerically.  */
+
+/* Text does precede data space, but this is never a safe assumption.  */
+#define VIRT_ADDR_VARIES
+
+/* If you are compiling with a non-C calling convention but need to
+   declare vararg routines differently, put it here */
+#define _VARARGS_ __cdecl
+
+/* If you are providing a function to something that will call the
+   function back (like a signal handler and signal, or main) its calling
+   convention must be whatever standard the libraries expect */
+#define _CALLBACK_ __cdecl
+
+/* SYSTEM_TYPE should indicate the kind of system you are using.
+ It sets the Lisp variable system-type.  */
+
+#define SYSTEM_TYPE "cygwin32"
+
+#define NO_MATHERR
+
+/* NOMULTIPLEJOBS should be defined if your system's shell
+ does not have "job control" (the ability to stop a program,
+ run some other program, then continue the first one).  */
+
+#define NOMULTIPLEJOBS
+
+/* Letter to use in finding device name of first pty,
+  if system supports pty's.  'a' means it is /dev/ptya0  */
+
+#define FIRST_PTY_LETTER 'a'
+
+/*
+ *      Define HAVE_PTYS if the system supports pty devices.
+ */
+
+/* #define HAVE_PTYS */
+
+/* If your system uses COFF (Common Object File Format) then define the
+   preprocessor symbol "COFF". */
+
+#define COFF
+
+/* NT supports Winsock which is close enough (with some hacks) */
+
+#define HAVE_SOCKETS
+
+/* define MAIL_USE_FLOCK if the mailer uses flock
+   to interlock access to /usr/spool/mail/$USER.
+   The alternative is that a lock file named
+   /usr/spool/mail/$USER.lock.  */
+
+/* If the character used to separate elements of the executable path
+   is not ':', #define this to be the appropriate character constant.  */
+#define SEPCHAR ';'
+
+/* ============================================================ */
+
+/* Here, add any special hacks needed
+   to make Emacs work on this system.  For example,
+   you might define certain system call names that don't
+   exist on your system, or that do different things on
+   your system and must be used only through an encapsulation
+   (Which you should place, by convention, in sysdep.c).  */
+
+/* Define this to be the separator between path elements */
+/* #define DIRECTORY_SEP XINT (Vdirectory_sep_char) */
+
+/* Define this to be the separator between devices and paths */
+#define DEVICE_SEP ':'
+
+#define SIGWINCH NSIG
+
+/* We'll support either convention on NT.  */
+#define IS_DIRECTORY_SEP(_c_) ((_c_) == '/' || (_c_) == '\\')
+#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_) || IS_DEVICE_SEP (_c_))
+
+/* The null device on Windows NT. */
+#define NULL_DEVICE     "NUL:"
+#define EXEC_SUFFIXES   ".exe:.com:.bat:.cmd:"
+
+#if 0
+#define HAVE_RENAME
+
+#define HAVE_TZNAME
+
+#define HAVE_LONG_FILE_NAMES
+
+#define HAVE_BCOPY
+#define HAVE_BCMP
+
+#define HAVE_MOUSE
+#endif
+
+#define HAVE_WINDOW_SYSTEM
+#define HAVE_FACES
+
+#define MODE_LINE_BINARY_TEXT(_b_) (NILP ((_b_)->buffer_file_type) ? "T" : "B")
+
+/* For integration with MSDOS support.  
+#define getdisk()               (_getdrive () - 1)
+#define getdefdir(_drv, _buf)   _getdcwd (_drv, _buf, MAXPATHLEN)
+*/
+
+/* Define this so that winsock.h definitions don't get included when windows.h
+   is...  I don't know if they do the right thing for emacs.  For this to
+   have proper effect, config.h must always be included before windows.h.  
+#define _WINSOCKAPI_    1
+*/
+
+/* Defines size_t and alloca ().  */
+
+/* We need a little extra space, see ../../lisp/loadup.el */
+#define SYSTEM_PURESIZE_EXTRA 15000
+
+/* ============================================================ */
--- a/src/scrollbar-msw.h	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/scrollbar-msw.h	Mon Aug 13 10:13:48 2007 +0200
@@ -55,5 +55,8 @@
 extern void mswindows_set_scrollbar_pointer (struct frame *f, Lisp_Object cursor);
 extern EMACS_INT mswindows_window_is_scrollbar (struct frame *f, Window win);
      */
+
+void mswindows_handle_scrollbar_event (HWND hwnd, int code, int pos);
+
 #endif /* HAVE_MS_WINDOWS and HAVE_SCROLLBARS */
 #endif /* _XEMACS_SCROLLBAR_MSW_H_ */
--- a/src/select-msw.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/select-msw.c	Mon Aug 13 10:13:48 2007 +0200
@@ -41,7 +41,7 @@
   unsigned char *src, *dst, *next;
   HGLOBAL h = NULL;
 
-  CHECK_STRING (string, 0);
+  CHECK_STRING (string);
 
   /* Calculate size with LFs converted to CRLFs because
    * CF_TEXT format uses CRLF delimited ASCIIZ */
--- a/src/sysdep.c	Mon Aug 13 10:13:03 2007 +0200
+++ b/src/sysdep.c	Mon Aug 13 10:13:48 2007 +0200
@@ -63,13 +63,14 @@
 #include "syswait.h"
 #include "sysdir.h"
 #include "systime.h"
-#if defined(WINDOWSNT)
+#if defined(WINDOWSNT) || defined(__CYGWIN32__)
 #include "syssignal.h"
-#else
+#endif
+#ifndef WINDOWSNT
 #include <sys/times.h>
 #endif
 
-#ifdef WINDOWSNT
+#if defined(WINDOWSNT)
 #include <direct.h>
 /* In process.h which conflicts with the local copy.  */
 #define _P_WAIT 0
@@ -2195,7 +2196,7 @@
       hostname_size <<= 1;
       hostname = (char *) alloca (hostname_size);
     }
-# ifdef HAVE_SOCKETS
+# if defined( HAVE_SOCKETS) && !defined(__CYGWIN32__)
   /* Turn the hostname into the official, fully-qualified hostname.
      Don't do this if we're going to dump; this can confuse system
      libraries on some machines and make the dumped emacs core dump. */
@@ -3245,8 +3246,8 @@
 
 #if !defined (SYS_SIGLIST_DECLARED) && !defined (HAVE_SYS_SIGLIST)
 
-#ifdef WINDOWSNT
-char *sys_siglist[] =
+#if defined(WINDOWSNT) || defined(__CYGWIN32__)
+CONST char *sys_siglist[] =
   {
     "bum signal!!",
     "hangup",
--- a/version.sh	Mon Aug 13 10:13:03 2007 +0200
+++ b/version.sh	Mon Aug 13 10:13:48 2007 +0200
@@ -1,5 +1,5 @@
 #!/bin/sh
 emacs_major_version=20
 emacs_minor_version=5
-emacs_beta_version=13
-xemacs_codename="Boer"
+emacs_beta_version=14
+xemacs_codename="Booted Goat"