changes from H.G. Muller; version 4.3.15 v4.3.15
authorH.G. Muller <h.g.muller@hccnet.nl>
Sat, 2 May 2009 17:50:10 +0000 (10:50 -0700)
committerArun Persaud <arun@nubati.net>
Sat, 2 May 2009 17:50:10 +0000 (10:50 -0700)
61 files changed:
Makefile.am [new file with mode: 0644]
Makefile.in
README [new file with mode: 0644]
acconfig.h
aclocal.m4 [new file with mode: 0644]
backend.c
backend.h
bitmaps/dopkbm.sh [changed mode: 0755->0644]
bitmaps/dopkbm1.sh [changed mode: 0755->0644]
bitmaps/unsigned.sh [changed mode: 0755->0644]
book.c [new file with mode: 0644]
common.h
config.guess [changed mode: 0755->0644]
config.h.in
config.sub [changed mode: 0755->0644]
configure [changed mode: 0755->0644]
configure.in
copyright.texi
engine-intf.html
install-sh [changed mode: 0755->0644]
manual.html [new file with mode: 0644]
mkinstalldirs [changed mode: 0755->0644]
moves.c
moves.h
pg_key.c [new file with mode: 0644]
pg_show.c [new file with mode: 0644]
pixmaps/ANALYZING_14.xpm [new file with mode: 0644]
pixmaps/BLACK_14.xpm [new file with mode: 0644]
pixmaps/CLEAR_14.xpm [new file with mode: 0644]
pixmaps/PONDER_14.xpm [new file with mode: 0644]
pixmaps/THINKING_14.xpm [new file with mode: 0644]
pixmaps/UNKNOWN_14.xpm [new file with mode: 0644]
pixmaps/WHITE_14.xpm [new file with mode: 0644]
pixmaps/kdd49.xpm
pixmaps/kdl49.xpm
pixmaps/mdd33.xpm
pixmaps/mdl33.xpm
pixmaps/pixmaps.h
pxboard [changed mode: 0755->0644]
texi2man [changed mode: 0755->0644]
uci.c
winboard/config.h
winboard/cygwin.mak
winboard/readme.txt
winboard/resource.h
winboard/shogibitmaps/bamazon.bmp [new file with mode: 0644]
winboard/shogibitmaps/king.bmp [new file with mode: 0644]
winboard/shogibitmaps/largeking.bmp [new file with mode: 0644]
winboard/wengineo.c [new file with mode: 0644]
winboard/winboard.c
winboard/winboard.h
winboard/winboard.ini
winboard/winboard.rc
winboard/woptions.c
xboard.c
xboard.h
xboard.texi
xengineoutput.c [new file with mode: 0644]
xhistory.c
xoptions.c [new file with mode: 0644]
zippy.c

diff --git a/Makefile.am b/Makefile.am
new file mode 100644 (file)
index 0000000..cb1a1e5
--- /dev/null
@@ -0,0 +1,10 @@
+AM_CPPFLAGS=-DINFODIR='"$(infodir)"'
+AM_LDFLAGS=-lXt -lm @XAW_LIBS@
+bin_PROGRAMS = xboard
+xboard_SOURCES = backend.c lists.c pgntags.c xedittags.c xhistory.c zippy.c childio.c moves.c uci.c xengineoutput.c xoptions.c gamelist.c parser.c xboard.c xgamelist.c 
+info_TEXINFOS = copyright.texi xboard.texi
+man6_MANS = xboard.man 
+
+xboard.man: xboard.texinfo xboard.texi copyright.texi gpl.texinfo
+       $(srcdir)/texi2man xboard.texinfo > xboard.man || (rm -f xboard.man ; false)
+
index bb8ec86..663db0b 100644 (file)
@@ -49,14 +49,15 @@ DISTSOURCE = acconfig.h AUTHORS backend.c backend.h backendz.h bitmaps      \
   parser.l pgntags.c pixmaps pxboard READ_ME shiphtml sounds texi2man  \
   ToDo winboard xboard.c xboard.h xboard.texi xboard.texinfo.in                \
   xedittags.c xedittags.h xgamelist.c xgamelist.h xhistory.c xhistory.h        \
-  zic2xpm.c zic2xpm.man zippy.c zippy.h zippy.lines zippy.README
+  zic2xpm.c zic2xpm.man zippy.c zippy.h zippy.lines zippy.README book.c
 
 PSEUDOSOURCE = parser.c xboard.man xboard.info xboard.txt zic2xpm.txt FAQ
 
 DISTDIR = @PRODUCT@-@VERSION@.@PATCHLEVEL@
 
 XBOARDOBJ = parser.o xboard.o backend.o moves.o childio.o gamelist.o \
-       lists.o pgntags.o xgamelist.o xedittags.o xhistory.o @ZIPPY_O@
+       lists.o pgntags.o xgamelist.o xedittags.o xhistory.o uci.o \
+       xengineoutput.o xoptions.o book.o @ZIPPY_O@
 
 default: xboard zic2xpm
 
@@ -182,6 +183,8 @@ backend.o: backend.h lists.h
 backend.o: parser.h
 backend.o: moves.h
 backend.o: zippy.h
+book.o: common.h
+book.o: backend.h
 childio.o: config.h
 childio.o: common.h
 childio.o: frontend.h
@@ -239,6 +242,15 @@ xhistory.o: backend.h
 xhistory.o: xboard.h
 xhistory.o: xhistory.h
 xhistory.o: lists.h
+xengineoutput.o: common.h
+xengineoutput.o: frontend.h
+xengineoutput.o: backend.h
+xengineoutput.o: xboard.h
+xoptions.o: common.h
+xoptions.o: backend.h
+xoptions.o: xboard.h
+uci.o: common.h
+uci.o: backend.h
 zippy.o: backend.h
 zippy.o: backendz.h
 zippy.o: config.h
diff --git a/README b/README
new file mode 100644 (file)
index 0000000..a27021b
--- /dev/null
+++ b/README
@@ -0,0 +1,135 @@
+\r
+What is XBoard?\r
+===============\r
+XBoard is a graphical chessboard for the X Window System.  It can\r
+serve as a user interface for chess engines such as GNU Chess, for the\r
+Internet Chess Server, or for electronic mail correspondence chess.\r
+XBoard can also be used by itself.  See the manual page xboard.txt for\r
+further details.\r
+\r
+XBoard is free software, copyrighted by the Free Software Foundation\r
+and released under the GNU General Public License (GPL).  See the file\r
+COPYING for details.\r
+\r
+You can build xboard on most systems with the following commands.\r
+\r
+       ./configure\r
+       make\r
+\r
+See the file INSTALL for more detailed instructions.\r
+\r
+See the file FAQ.html for answers to frequently asked questions.\r
+\r
+\r
+What is WinBoard?\r
+=================\r
+WinBoard is a port of XBoard to run natively on Windows.  It is part\r
+of the XBoard project and is released under the same terms as XBoard.\r
+\r
+You can build WinBoard using the free Cygwin toolchain from\r
+www.cygnus.com with the following commands.\r
+\r
+       cd winboard\r
+       make -f cygwin.mak\r
+\r
+You can build WinBoard using Microsoft Visual C with the following\r
+commands, or by opening the project in Visual Studio and clicking the\r
+build button.\r
+\r
+       cd winboard\r
+       nmake -f msvc.mak\r
+\r
+There is also a contributed .mak file for Borland C.  It's not\r
+maintained and thus may need updating if you want to use it.\r
+\r
+\r
+Reporting problems\r
+==================\r
+\r
+Report bugs and problems with XBoard and WinBoard to\r
+<bug-xboard@gnu.org>.  With XBoard, please use the "script" program\r
+to start a typescript, run XBoard with the -debug command line option,\r
+and include the typescript output in your message.  With WinBoard,\r
+please use the /debug command line option and include the contents of\r
+the file WinBoard.debug.  Also tell us what kind of machine and what\r
+operating system version you are using.  On Unix, the command "uname\r
+-a" will tell you this.  On Windows, right-click on My Computer and\r
+select Properties.\r
+\r
+Here is a sample of approximately what you should type (on Unix):\r
+\r
+    script\r
+    uname -a\r
+    ./configure\r
+    make\r
+    ./xboard -debug\r
+    exit\r
+    mail bug-xboard@gnu.org\r
+    Subject: Your short description of the problem\r
+    Your detailed description of the problem\r
+    ~r typescript\r
+    .\r
+\r
+If you improve XBoard, please send a message about your changes, and\r
+we will get in touch with you about merging them in to the main line\r
+of development.\r
+\r
+Version 4.3.14\r
+==============\r
+\r
+This relaese was not made by the GNU xboard team, but by H.G.Muller.\r
+It mainly contains developments on WinBoard. Nevertheless, an attempt\r
+has been started to back-port the enormous number of improvements that\r
+have been made to WinBoard since the Linux and Windows developments branched\r
+to xboard. This is reflected by the source tree now having the same format\r
+as that of xboard 4.2.7, including all the xboard sources. \r
+\r
+An enormous amount of work still has to be done to make the xboard version\r
+fully equivalent to WinBoard, especially on user-interface side. As a modest\r
+beginning, the xboard source files have been patched to allow their compilation\r
+with the newer back-end files from WinBoard. To this end, the number of piece\r
+types in xboard has been increased from 6 to 22, and the WinBoard bitmaps\r
+have been converted to xboard source format (.bm) and are included in the\r
+xboard bitmaps directory. Other quick patches include the coloring of the\r
+board squares (for xiangqi and holdings), and some code in the user-move\r
+handling to suppress all moves into or out of the area between board and\r
+holdings in crazyhouse, and the treatment of king-captures-own-piece\r
+as a possibly valid move (for FRC castling). This should make it possible \r
+to run xboard with the new back-end files without too much inconvenience.\r
+\r
+New xboard command-line options have been added to make the added back-end \r
+features available. The include the new variants (as argument of the old\r
+-variant option), -boardWidth, -boardHeight and -holdingsSize. Be sure\r
+to call xboard with "-boardSize middling" or "-boardSize bulky" if you\r
+want to play with fairy pieces, or xboard might crash due to unavailability\r
+of bitmaps. Other added xboard options are:\r
+\r
+ADJUDICATION OPTIONS:\r
+-checkMates\r
+-testClaims\r
+-materialDraws\r
+-trivialDraws\r
+-ruleMoves\r
+-repeatsToDraw\r
+-adjudicateLossThreshold\r
+-firstScoreAbsolute\r
+-secondScoreAbsolute\r
+\r
+TIME-CONTROL OPTIONS\r
+-firstTimeOdds\r
+-secondTimeOdds\r
+-timeOddsMode\r
+-firstNPS\r
+-secondNPS\r
+\r
+GENERAL OPTIONS\r
+-matchPause\r
+-engineDebugOutput\r
+-userName\r
+-pgnExtendedInfo\r
+-pgnEventHeader\r
+-hideThinkingFromHuman\r
+\r
+This is all completely untested, but as the options merely switch on well-tested\r
+code in the back-end, there should not be too many problems with them.\r
+Bugs can be reported in the WinBoard forum.
\ No newline at end of file
index ceb3f58..8957afb 100644 (file)
@@ -52,3 +52,6 @@
 #define HAVE_USLEEP 0
 
 #undef USE_XAW3D
+
+#define X_LOCALE
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644 (file)
index 0000000..eb3b99a
--- /dev/null
@@ -0,0 +1,868 @@
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008  Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.61],,
+[m4_warning([this file was generated for autoconf 2.61.
+You have another version of autoconf.  It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version.  Point them to the right macro.
+m4_if([$1], [1.10.1], [],
+      [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too.  Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+  [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+
+# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL                                            -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], UPC,  [depcc="$UPC"  am_compiler_list=],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_$1_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking.              -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake.                             -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 13
+
+# This macro actually does too much.  Some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names.  We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+  fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+  [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+                            [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+                  [_AM_DEPENDENCIES(OBJC)],
+                  [define([AC_PROG_OBJC],
+                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot.  For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes.                 -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p.  We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+  [[\\/$]]* | ?:[[\\/]]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling.                     -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane.    -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball.                            -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+#     tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+#     $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+     [m4_case([$1], [ustar],, [pax],,
+              [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+  case $_am_tool in
+  gnutar)
+    for _am_tar in tar gnutar gtar;
+    do
+      AM_RUN_LOG([$_am_tar --version]) && break
+    done
+    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+    am__untar="$_am_tar -xf -"
+    ;;
+  plaintar)
+    # Must skip GNU tar: if it does not support --format= it doesn't create
+    # ustar tarball either.
+    (tar --version) >/dev/null 2>&1 && continue
+    am__tar='tar chf - "$$tardir"'
+    am__tar_='tar chf - "$tardir"'
+    am__untar='tar xf -'
+    ;;
+  pax)
+    am__tar='pax -L -x $1 -w "$$tardir"'
+    am__tar_='pax -L -x $1 -w "$tardir"'
+    am__untar='pax -r'
+    ;;
+  cpio)
+    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+    am__untar='cpio -i -H $1 -d'
+    ;;
+  none)
+    am__tar=false
+    am__tar_=false
+    am__untar=false
+    ;;
+  esac
+
+  # If the value was cached, stop now.  We just wanted to have am__tar
+  # and am__untar set.
+  test -n "${am_cv_prog_tar_$1}" && break
+
+  # tar/untar a dummy directory, and stop if the command works
+  rm -rf conftest.dir
+  mkdir conftest.dir
+  echo GrepMe > conftest.dir/file
+  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+  rm -rf conftest.dir
+  if test -s conftest.tar; then
+    AM_RUN_LOG([$am__untar <conftest.tar])
+    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+  fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
index 859a47f..5496797 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -56,7 +56,6 @@
 #else\r
 \r
 #define DoSleep( n )\r
-typedef int BOOL;\r
 \r
 #endif\r
 \r
@@ -165,7 +164,7 @@ void ApplyMove P((int fromX, int fromY, int toX, int toY, int promoChar,
                  Board board));\r
 void MakeMove P((int fromX, int fromY, int toX, int toY, int promoChar));\r
 void ShowMove P((int fromX, int fromY, int toX, int toY));\r
-void FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY,\r
+int FinishMove P((ChessMove moveType, int fromX, int fromY, int toX, int toY,\r
                   /*char*/int promoChar));\r
 void BackwardInner P((int target));\r
 void ForwardInner P((int target));\r
@@ -216,8 +215,13 @@ void ParseFeatures P((char* args, ChessProgramState *cps));
 void InitBackEnd3 P((void));\r
 void FeatureDone P((ChessProgramState* cps, int val));\r
 void InitChessProgram P((ChessProgramState *cps, int setup));\r
+ChessProgramState *WhitePlayer();\r
 \r
 char *GetInfoFromComment( int, char * ); // [HGM] PV time: returns stripped comment\r
+void InitEngineUCI( const char * iniDir, ChessProgramState * cps ); // [HGM] moved here from winboard.c\r
+char *ProbeBook P((int moveNr, char *book)); // [HGM] book: returns a book move\r
+char *SendMoveToBookUser P((int nr, ChessProgramState *cps, int initial)); // [HGM] book\r
+extern char installDir[MSG_SIZ];\r
 \r
 extern int tinyLayout, smallLayout;\r
 static ChessProgramStats programStats;\r
@@ -228,6 +232,7 @@ int startedFromPositionFile = FALSE; Board filePosition;       /* [HGM] loadPos
 char endingGame = 0;    /* [HGM] crash: flag to prevent recursion of GameEnds() */\r
 int whiteNPS, blackNPS; /* [HGM] nps: for easily making clocks aware of NPS     */\r
 VariantClass currentlyInitializedVariant; /* [HGM] variantswitch */\r
+int lastIndex = 0;      /* [HGM] autoinc: last game/position used in match mode */\r
 \r
 /* States for ics_getting_history */\r
 #define H_FALSE 0\r
@@ -575,6 +580,8 @@ InitBackEnd1()
 {\r
     int matched, min, sec;\r
 \r
+    ShowThinkingEvent(); // [HGM] thinking: make sure post/nopost state is set according to options\r
+\r
     GetTimeMark(&programStartTime);\r
 \r
     ClearProgramStats();\r
@@ -776,15 +783,22 @@ InitBackEnd1()
                                        + strlen(PATCHLEVEL));\r
        sprintf(programVersion, "%s %s.%s", PRODUCT, VERSION, PATCHLEVEL);\r
     } else {\r
+#if 0\r
        char *p, *q;\r
        q = first.program;\r
        while (*q != ' ' && *q != NULLCHAR) q++;\r
        p = q;\r
-       while (p > first.program && *(p-1) != '/') p--;\r
+       while (p > first.program && *(p-1) != '/' && *(p-1) != '\\') p--; /* [HGM] bckslash added */\r
        programVersion = (char*) malloc(8 + strlen(PRODUCT) + strlen(VERSION)\r
                                        + strlen(PATCHLEVEL) + (q - p));\r
        sprintf(programVersion, "%s %s.%s + ", PRODUCT, VERSION, PATCHLEVEL);\r
        strncat(programVersion, p, q - p);\r
+#else\r
+       /* [HGM] tidy: use tidy name, in stead of full pathname (which was probably a bug due to / vs \ ) */\r
+       programVersion = (char*) malloc(8 + strlen(PRODUCT) + strlen(VERSION)\r
+                                       + strlen(PATCHLEVEL) + strlen(first.tidy));\r
+       sprintf(programVersion, "%s %s.%s + %s", PRODUCT, VERSION, PATCHLEVEL, first.tidy);\r
+#endif\r
     }\r
 \r
     if (!appData.icsActive) {\r
@@ -844,9 +858,14 @@ InitBackEnd1()
       case VariantShatranj:   /* should work except for all win conditions */\r
       case VariantBerolina:   /* might work if TestLegality is off */\r
       case VariantCapaRandom: /* should work */\r
+      case VariantJanus:      /* should work */\r
+      case VariantSuper:      /* experimental */\r
        break;\r
       }\r
     }\r
+\r
+    InitEngineUCI( installDir, &first );  // [HGM] moved here from winboard.c, to make available in xboard\r
+    InitEngineUCI( installDir, &second );\r
 }\r
 \r
 int NextIntegerFromString( char ** str, long * value )\r
@@ -1023,6 +1042,12 @@ InitBackEnd2()
     } else if (appData.matchMode) {\r
        appData.matchGames = 1;\r
     }\r
+    if(appData.matchMode && appData.sameColorGames > 0) /* [HGM] alternate: overrule matchGames */\r
+       appData.matchGames = appData.sameColorGames;\r
+    if(appData.rewindIndex > 1) { /* [HGM] autoinc: rewind implies auto-increment and overrules given index */\r
+       if(appData.loadPositionIndex >= 0) appData.loadPositionIndex = -1;\r
+       if(appData.loadGameIndex >= 0) appData.loadGameIndex = -1;\r
+    }\r
     Reset(TRUE, FALSE);\r
     if (appData.noChessProgram || first.protocolVersion == 1) {\r
       InitBackEnd3();\r
@@ -1110,15 +1135,19 @@ InitBackEnd3 P((void))
        matchMode = TRUE;\r
        matchGame = 1;\r
        if (*appData.loadGameFile != NULLCHAR) {\r
+           int index = appData.loadGameIndex; // [HGM] autoinc\r
+           if(index<0) lastIndex = index = 1;\r
            if (!LoadGameFromFile(appData.loadGameFile,\r
-                                 appData.loadGameIndex,\r
+                                 index,\r
                                  appData.loadGameFile, FALSE)) {\r
                DisplayFatalError("Bad game file", 0, 1);\r
                return;\r
            }\r
        } else if (*appData.loadPositionFile != NULLCHAR) {\r
+           int index = appData.loadPositionIndex; // [HGM] autoinc\r
+           if(index<0) lastIndex = index = 1;\r
            if (!LoadPositionFromFile(appData.loadPositionFile,\r
-                                     appData.loadPositionIndex,\r
+                                     index,\r
                                      appData.loadPositionFile)) {\r
                DisplayFatalError("Bad position file", 0, 1);\r
                return;\r
@@ -1169,7 +1198,8 @@ InitBackEnd3 P((void))
          }\r
          AnalyzeModeEvent();\r
        } else if (initialMode == AnalyzeFile) {\r
-         ShowThinkingEvent(TRUE);\r
+         appData.showThinking = TRUE; // [HGM] thinking: moved out of ShowThinkingEvent\r
+         ShowThinkingEvent();\r
          AnalyzeFileEvent();\r
          AnalysisPeriodicEvent(1);\r
        } else if (initialMode == MachinePlaysWhite) {\r
@@ -1640,6 +1670,9 @@ StringToVariant(e)
         case 48:\r
           v = VariantJanus;\r
          break;\r
+        case 49:\r
+          v = VariantSuper;\r
+         break;\r
        case -1:\r
          /* Found "wild" or "w" in the string but no number;\r
             must assume it's normal chess. */\r
@@ -2023,6 +2056,9 @@ read_from_ics(isr, closure, data, count, error)
        for (i = 0; i < count; i++) {\r
            if (data[i] != NULLCHAR && data[i] != '\r')\r
              buf[buf_len++] = data[i];\r
+           if(buf_len >= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' && \r
+                               buf[buf_len-3]==' '  && buf[buf_len-2]==' '  && buf[buf_len-1]==' ') \r
+               buf_len -= 5; // [HGM] ICS: join continuation line of Lasker 2.2.3 server with previous\r
        }\r
 \r
        buf[buf_len] = NULLCHAR;\r
@@ -3113,7 +3149,7 @@ read_from_ics(isr, closure, data, count, error)
  * Additional trailing fields may be added in the future.  \r
  */\r
 \r
-#define PATTERN "%72c%c%d%d%d%d%d%d%d%s%s%d%d%d%d%d%d%d%d%s%s%s%d%d"\r
+#define PATTERN "%c%d%d%d%d%d%d%d%s%s%d%d%d%d%d%d%d%d%s%s%s%d%d"\r
 \r
 #define RELATION_OBSERVING_PLAYED    0\r
 #define RELATION_OBSERVING_STATIC   -2   /* examined, oldmoves, or smoves */\r
@@ -3131,7 +3167,7 @@ ParseBoard12(string)
     int gamenum, newGame, newMove, relation, basetime, increment, ics_flip = 0;\r
     int j, k, n, moveNum, white_stren, black_stren, white_time, black_time;\r
     int double_push, castle_ws, castle_wl, castle_bs, castle_bl, irrev_count;\r
-    char to_play, board_chars[72];\r
+    char to_play, board_chars[200];\r
     char move_str[500], str[500], elapsed_time[500];\r
     char black[32], white[32];\r
     Board board;\r
@@ -3140,6 +3176,8 @@ ParseBoard12(string)
     ChessMove moveType;\r
     int fromX, fromY, toX, toY;\r
     char promoChar;\r
+    int ranks=1, files=0; /* [HGM] ICS80: allow variable board size */\r
+    char *bookHit = NULL; // [HGM] book\r
 \r
     fromX = fromY = toX = toY = -1;\r
     \r
@@ -3150,14 +3188,25 @@ ParseBoard12(string)
 \r
     move_str[0] = NULLCHAR;\r
     elapsed_time[0] = NULLCHAR;\r
-    n = sscanf(string, PATTERN, board_chars, &to_play, &double_push,\r
+    {   /* [HGM] figure out how many ranks and files the board has, for ICS extension used by Capablanca server */\r
+        int  i = 0, j;\r
+        while(i < 199 && (string[i] != ' ' || string[i+2] != ' ')) {\r
+           if(string[i] == ' ') { ranks++; files = 0; }\r
+            else files++;\r
+           i++;\r
+       }\r
+       for(j = 0; j <i; j++) board_chars[j] = string[j];\r
+        board_chars[i] = '\0';\r
+       string += i + 1;\r
+    }\r
+    n = sscanf(string, PATTERN, &to_play, &double_push,\r
               &castle_ws, &castle_wl, &castle_bs, &castle_bl, &irrev_count,\r
               &gamenum, white, black, &relation, &basetime, &increment,\r
               &white_stren, &black_stren, &white_time, &black_time,\r
               &moveNum, str, elapsed_time, move_str, &ics_flip,\r
               &ticking);\r
 \r
-    if (n < 22) {\r
+    if (n < 21) {\r
        sprintf(str, "Failed to parse board string:\n\"%s\"", string);\r
        DisplayError(str, 0);\r
        return;\r
@@ -3352,10 +3401,13 @@ ParseBoard12(string)
        }\r
     }\r
     \r
+  if (appData.debugMode) {\r
+    fprintf(debugFP, "load %dx%d board\n", files, ranks);\r
+  }\r
     /* Parse the board */\r
-    for (k = 0; k < 8; k++) {\r
-      for (j = 0; j < 8; j++)\r
-        board[k][j+gameInfo.holdingsWidth] = CharToPiece(board_chars[(7-k)*9 + j]);\r
+    for (k = 0; k < ranks; k++) {\r
+      for (j = 0; j < files; j++)\r
+        board[k][j+gameInfo.holdingsWidth] = CharToPiece(board_chars[(ranks-1-k)*(files+1) + j]);\r
       if(gameInfo.holdingsWidth > 1) {\r
            board[k][0] = board[k][BOARD_WIDTH-1] = EmptySquare;\r
            board[k][1] = board[k][BOARD_WIDTH-2] = (ChessSquare) 0;;\r
@@ -3380,7 +3432,7 @@ ParseBoard12(string)
        but in ICS mode that is not its job anyway.\r
     */\r
     if(moveNum == 0 || gameInfo.variant != VariantFischeRandom)\r
-    { int i, j;\r
+    { int i, j; ChessSquare wKing = WhiteKing, bKing = BlackKing;\r
 \r
         for(i=BOARD_LEFT, j= -1; i<BOARD_RGHT; i++)\r
             if(board[0][i] == WhiteRook) j = i;\r
@@ -3395,10 +3447,11 @@ ParseBoard12(string)
             if(board[BOARD_HEIGHT-1][i] == BlackRook) j = i;\r
         initialRights[4] = castlingRights[moveNum][4] = (castle_bl == 0 && gameInfo.variant != VariantFischeRandom ? -1 : j);\r
 \r
+       if(gameInfo.variant == VariantKnightmate) { wKing = WhiteUnicorn; bKing = BlackUnicorn; }\r
         for(k=BOARD_LEFT; k<BOARD_RGHT; k++)\r
-            if(board[0][k] == WhiteKing) initialRights[2] = castlingRights[moveNum][2] = k;\r
+            if(board[0][k] == wKing) initialRights[2] = castlingRights[moveNum][2] = k;\r
         for(k=BOARD_LEFT; k<BOARD_RGHT; k++)\r
-            if(board[BOARD_HEIGHT-1][k] == BlackKing)\r
+            if(board[BOARD_HEIGHT-1][k] == bKing)\r
                 initialRights[5] = castlingRights[moveNum][5] = k;\r
     } else { int r;\r
         r = castlingRights[moveNum][0] = initialRights[0];\r
@@ -3566,8 +3619,8 @@ ParseBoard12(string)
                    if (first.sendTime) {\r
                        SendTimeRemaining(&first, gameMode == IcsPlayingWhite);\r
                    }\r
-                   SendMoveToProgram(moveNum - 1, &first);\r
-                   if (firstMove) {\r
+                   bookHit = SendMoveToBookUser(moveNum - 1, &first, FALSE); // [HGM] book\r
+                   if (firstMove && !bookHit) {\r
                        firstMove = FALSE;\r
                        if (first.useColors) {\r
                          SendToProgram(gameMode == IcsPlayingWhite ?\r
@@ -3665,6 +3718,19 @@ ParseBoard12(string)
     }\r
 \r
     HistorySet(parseList, backwardMostMove, forwardMostMove, currentMove-1);\r
+#if ZIPPY\r
+    if(bookHit) { // [HGM] book: simulate book reply\r
+       static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+       programStats.depth = programStats.nodes = programStats.time = \r
+       programStats.score = programStats.got_only_move = 0;\r
+       sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+       strcpy(bookMove, "move ");\r
+       strcat(bookMove, bookHit);\r
+       HandleMachineMove(bookMove, &first);\r
+    }\r
+#endif\r
 }\r
 \r
 void\r
@@ -3718,14 +3784,16 @@ SendMoveToProgram(moveNum, cps)
       }\r
       SendToProgram(buf, cps);\r
     } else {\r
+      if(cps->alphaRank) { /* [HGM] shogi: temporarily convert to shogi coordinates before sending */\r
+       AlphaRank(moveList[moveNum], 4);\r
+       SendToProgram(moveList[moveNum], cps);\r
+       AlphaRank(moveList[moveNum], 4); // and back\r
+      } else\r
       /* Added by Tord: Send castle moves in "O-O" in FRC games if required by\r
        * the engine. It would be nice to have a better way to identify castle \r
        * moves here. */\r
       if((gameInfo.variant == VariantFischeRandom || gameInfo.variant == VariantCapaRandom)\r
                                                                         && cps->useOOCastle) {\r
-  if (appData.debugMode) {\r
-    fprintf(debugFP, "Tord's FRC castling code\n");\r
-  }\r
         int fromX = moveList[moveNum][0] - AAA; \r
         int fromY = moveList[moveNum][1] - ONE;\r
         int toX = moveList[moveNum][2] - AAA; \r
@@ -3850,7 +3918,6 @@ CoordsToComputerAlgebraic(rf, ff, rt, ft, promoChar, move)
                     AAA + ff, ONE + rf, AAA + ft, ONE + rt, promoChar);\r
        }\r
     }\r
-    AlphaRank(move, 4);\r
 }\r
 \r
 void\r
@@ -3873,8 +3940,6 @@ AlphaRank(char *move, int n)
 {\r
     char *p = move, c; int x, y;\r
 \r
-    if( !appData.alphaRank ) return;\r
-\r
     if (appData.debugMode) {\r
         fprintf(debugFP, "alphaRank(%s,%d)\n", move, n);\r
     }\r
@@ -3882,6 +3947,7 @@ AlphaRank(char *move, int n)
     if(move[1]=='*' && \r
        move[2]>='0' && move[2]<='9' &&\r
        move[3]>='a' && move[3]<='x'    ) {\r
+        move[1] = '@';\r
         move[2] = BOARD_RGHT  -1 - (move[2]-'1') + AAA;\r
         move[3] = BOARD_HEIGHT-1 - (move[3]-'a') + ONE;\r
     } else\r
@@ -4126,6 +4192,19 @@ int squaresLeft[4];
 int piecesLeft[(int)BlackPawn];\r
 long long int seed, nrOfShuffles;\r
 \r
+void GetPositionNumber()\r
+{      // sets global variable seed\r
+       int i;\r
+\r
+       seed = appData.defaultFrcPosition;\r
+       if(seed < 0) { // randomize based on time for negative FRC position numbers\r
+               srandom(time(0)); \r
+               for(i=0; i<50; i++) seed += random();\r
+               seed = random() ^ random() >> 8 ^ random() << 8;\r
+               if(seed<0) seed = -seed;\r
+       }\r
+}\r
+\r
 int put(Board board, int pieceType, int rank, int n, int shade)\r
 // put the piece on the (n-1)-th empty squares of the given shade\r
 {\r
@@ -4174,12 +4253,7 @@ void SetUpShuffle(Board board, int number)
 {\r
        int i, p, first=1;\r
 \r
-       seed = number, nrOfShuffles = 1;\r
-       if(number < 0) { \r
-               srand(time(0)); \r
-               for(i=0; i<50; i++) seed += rand();\r
-               seed = rand() ^ rand()<<16; \r
-       }\r
+       GetPositionNumber(); nrOfShuffles = 1;\r
 \r
        squaresLeft[DARK] = (BOARD_RGHT - BOARD_LEFT + 1)/2;\r
        squaresLeft[ANY]  = BOARD_RGHT - BOARD_LEFT;\r
@@ -4265,11 +4339,11 @@ void SetUpShuffle(Board board, int number)
 \r
 #endif\r
 \r
-BOOL SetCharTable( char *table, const char * map )\r
+int SetCharTable( char *table, const char * map )\r
 /* [HGM] moved here from winboard.c because of its general usefulness */\r
 /*       Basically a safe strcpy that uses the last character as King */\r
 {\r
-    BOOL result = FALSE; int NrPieces;\r
+    int result = FALSE; int NrPieces;\r
 \r
     if( map != NULL && (NrPieces=strlen(map)) <= (int) EmptySquare \r
                     && NrPieces >= 12 && !(NrPieces&1)) {\r
@@ -4289,6 +4363,42 @@ BOOL SetCharTable( char *table, const char * map )
     return result;\r
 }\r
 \r
+void Prelude(Board board)\r
+{      // [HGM] superchess: random selection of exo-pieces\r
+       int i, j, k; ChessSquare p; \r
+       static ChessSquare exoPieces[4] = { WhiteAngel, WhiteMarshall, WhiteSilver, WhiteLance };\r
+\r
+       GetPositionNumber(); // use FRC position number\r
+\r
+       if(appData.pieceToCharTable != NULL) { // select pieces to participate from given char table\r
+           SetCharTable(pieceToChar, appData.pieceToCharTable);\r
+           for(i=(int)WhiteQueen+1, j=0; i<(int)WhiteKing && j<4; i++) \r
+               if(PieceToChar((ChessSquare)i) != '.') exoPieces[j++] = (ChessSquare) i;\r
+       }\r
+\r
+       j = seed%4;                 seed /= 4; \r
+       p = board[0][BOARD_LEFT+j];   board[0][BOARD_LEFT+j] = EmptySquare; k = PieceToNumber(p);\r
+       board[k][BOARD_WIDTH-1] = p;  board[k][BOARD_WIDTH-2]++;\r
+       board[BOARD_HEIGHT-1-k][0] = WHITE_TO_BLACK p;  board[BOARD_HEIGHT-1-k][1]++;\r
+       j = seed%3 + (seed%3 >= j); seed /= 3; \r
+       p = board[0][BOARD_LEFT+j];   board[0][BOARD_LEFT+j] = EmptySquare; k = PieceToNumber(p);\r
+       board[k][BOARD_WIDTH-1] = p;  board[k][BOARD_WIDTH-2]++;\r
+       board[BOARD_HEIGHT-1-k][0] = WHITE_TO_BLACK p;  board[BOARD_HEIGHT-1-k][1]++;\r
+       j = seed%3;                 seed /= 3; \r
+       p = board[0][BOARD_LEFT+j+5]; board[0][BOARD_LEFT+j+5] = EmptySquare; k = PieceToNumber(p);\r
+       board[k][BOARD_WIDTH-1] = p;  board[k][BOARD_WIDTH-2]++;\r
+       board[BOARD_HEIGHT-1-k][0] = WHITE_TO_BLACK p;  board[BOARD_HEIGHT-1-k][1]++;\r
+       j = seed%2 + (seed%2 >= j); seed /= 2; \r
+       p = board[0][BOARD_LEFT+j+5]; board[0][BOARD_LEFT+j+5] = EmptySquare; k = PieceToNumber(p);\r
+       board[k][BOARD_WIDTH-1] = p;  board[k][BOARD_WIDTH-2]++;\r
+       board[BOARD_HEIGHT-1-k][0] = WHITE_TO_BLACK p;  board[BOARD_HEIGHT-1-k][1]++;\r
+       j = seed%4; seed /= 4; put(board, exoPieces[3],    0, j, ANY);\r
+       j = seed%3; seed /= 3; put(board, exoPieces[2],   0, j, ANY);\r
+       j = seed%2; seed /= 2; put(board, exoPieces[1], 0, j, ANY);\r
+       put(board, exoPieces[0],    0, 0, ANY);\r
+       for(i=BOARD_LEFT; i<BOARD_RGHT; i++) board[BOARD_HEIGHT-1][i] = WHITE_TO_BLACK board[0][i];\r
+}\r
+\r
 void\r
 InitPosition(redraw)\r
      int redraw;\r
@@ -4411,6 +4521,12 @@ InitPosition(redraw)
       pieces = fairyArray;\r
       SetCharTable(pieceToChar, "PNBRQFEACWMOHIJGDVSLUKpnbrqfeacwmohijgdvsluk"); \r
       break;\r
+    case VariantSuper:\r
+      pieces = FIDEArray;\r
+      SetCharTable(pieceToChar, "PNBRQ..SE.......V.AKpnbrq..se.......v.ak");\r
+      gameInfo.holdingsSize = 8;\r
+      startedFromSetupPosition = TRUE;\r
+      break;\r
     case VariantCrazyhouse:\r
     case VariantBughouse:\r
       pieces = FIDEArray;\r
@@ -4502,6 +4618,7 @@ InitPosition(redraw)
         castlingRights[0][5] = initialRights[5] = BOARD_WIDTH>>1;\r
      }\r
 \r
+     if(gameInfo.variant == VariantSuper) Prelude(initialPosition);\r
 #if 0\r
     if(gameInfo.variant == VariantFischeRandom) {\r
       if( appData.defaultFrcPosition < 0 ) {\r
@@ -4583,7 +4700,7 @@ SendBoard(cps, moveNum)
                         PieceToChar((ChessSquare)(DEMOTED *bp)),\r
                         AAA + j, ONE + i);\r
             }\r
-            if(appData.alphaRank) {\r
+            if(cps->alphaRank) { /* [HGM] shogi: translate coords */\r
                 message[1] = BOARD_RGHT   - 1 - j + '1';\r
                 message[2] = BOARD_HEIGHT - 1 - i + 'a';\r
             }\r
@@ -4605,7 +4722,7 @@ SendBoard(cps, moveNum)
                         PieceToChar((ChessSquare)(DEMOTED *bp)),\r
                         AAA + j, ONE + i);\r
             }\r
-            if(appData.alphaRank) {\r
+            if(cps->alphaRank) { /* [HGM] shogi: translate coords */\r
                 message[1] = BOARD_RGHT   - 1 - j + '1';\r
                 message[2] = BOARD_HEIGHT - 1 - i + 'a';\r
             }\r
@@ -4922,11 +5039,11 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
           click-click move is possible */\r
        if (toX == -2 || toY == -2) {\r
            boards[0][fromY][fromX] = EmptySquare;\r
-           DrawPosition(FALSE, boards[currentMove]);\r
+           return AmbiguousMove;\r
        } else if (toX >= 0 && toY >= 0) {\r
            boards[0][toY][toX] = boards[0][fromY][fromX];\r
            boards[0][fromY][fromX] = EmptySquare;\r
-           DrawPosition(FALSE, boards[currentMove]);\r
+           return AmbiguousMove;\r
        }\r
         return ImpossibleMove;\r
     }\r
@@ -4972,15 +5089,27 @@ UserMoveTest(fromX, fromY, toX, toY, promoChar)
 }\r
 \r
 /* Common tail of UserMoveEvent and DropMenuEvent */\r
-void\r
+int\r
 FinishMove(moveType, fromX, fromY, toX, toY, promoChar)\r
      ChessMove moveType;\r
      int fromX, fromY, toX, toY;\r
      /*char*/int promoChar;\r
 {\r
-    /* [HGM] <popupFix> kludge to avoid having know the exact promotion\r
+    char *bookHit = 0;\r
+\r
+    if(gameInfo.variant == VariantSuper && promoChar != NULLCHAR) { \r
+       // [HGM] superchess: suppress promotions to non-available piece\r
+       int k = PieceToNumber(CharToPiece(ToUpper(promoChar)));\r
+       if(WhiteOnMove(currentMove)) {\r
+           if(!boards[currentMove][k][BOARD_WIDTH-2]) return 0;\r
+       } else {\r
+           if(!boards[currentMove][BOARD_HEIGHT-1-k][1]) return 0;\r
+       }\r
+    }\r
+\r
+    /* [HGM] <popupFix> kludge to avoid having to know the exact promotion\r
        move type in caller when we know the move is a legal promotion */\r
-    if(moveType == NormalMove)\r
+    if(moveType == NormalMove && promoChar)\r
         moveType = PromoCharToMoveType(WhiteOnMove(currentMove), promoChar);\r
 \r
     /* [HGM] convert drag-and-drop piece drops to standard form */\r
@@ -5026,7 +5155,7 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
       } else {\r
        DisplayError("Incorrect move", 0);\r
       }\r
-      return;\r
+      return 1;\r
     }\r
 \r
   /* Ok, now we know that the move is good, so we can kill\r
@@ -5046,6 +5175,18 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
 \r
   MakeMove(fromX, fromY, toX, toY, promoChar); /*updates forwardMostMove*/\r
 \r
+    if(gameInfo.variant == VariantSuper && promoChar != NULLCHAR && gameInfo.holdingsSize) { \r
+       // [HGM] superchess: take promotion piece out of holdings\r
+       int k = PieceToNumber(CharToPiece(ToUpper(promoChar)));\r
+       if(WhiteOnMove(forwardMostMove-1)) {\r
+           if(!--boards[forwardMostMove][k][BOARD_WIDTH-2])\r
+               boards[forwardMostMove][k][BOARD_WIDTH-1] = EmptySquare;\r
+       } else {\r
+           if(!--boards[forwardMostMove][BOARD_HEIGHT-1-k][1])\r
+               boards[forwardMostMove][BOARD_HEIGHT-1-k][0] = EmptySquare;\r
+       }\r
+    }\r
+\r
   if (gameMode == BeginningOfGame) {\r
     if (appData.noChessProgram) {\r
       gameMode = EditGame;\r
@@ -5053,6 +5194,7 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
     } else {\r
       char buf[MSG_SIZ];\r
       gameMode = MachinePlaysBlack;\r
+      StartClocks();\r
       SetGameInfo();\r
       sprintf(buf, "%s vs. %s", gameInfo.white, gameInfo.black);\r
       DisplayTitle(buf);\r
@@ -5078,10 +5220,11 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
                           gameMode == MachinePlaysBlack)) {\r
       SendTimeRemaining(&first, gameMode != MachinePlaysBlack);\r
     }\r
-    SendMoveToProgram(forwardMostMove-1, &first);\r
     if (gameMode != EditGame && gameMode != PlayFromGameFile) {\r
-      first.maybeThinking = TRUE;\r
-    }\r
+        // [HGM] book: if program might be playing, let it use book\r
+       bookHit = SendMoveToBookUser(forwardMostMove-1, &first, FALSE);\r
+       first.maybeThinking = TRUE;\r
+    } else SendMoveToProgram(forwardMostMove-1, &first);\r
     if (currentMove == cmailOldMove + 1) {\r
       cmailMoveType[lastLoadGameNumber - 1] = CMAIL_MOVE;\r
     }\r
@@ -5118,6 +5261,19 @@ FinishMove(moveType, fromX, fromY, toX, toY, promoChar)
   default:\r
     break;\r
   }\r
+\r
+  if(bookHit) { // [HGM] book: simulate book reply\r
+       static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+       programStats.depth = programStats.nodes = programStats.time = \r
+       programStats.score = programStats.got_only_move = 0;\r
+       sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+       strcpy(bookMove, "move ");\r
+       strcat(bookMove, bookHit);\r
+       HandleMachineMove(bookMove, &first);\r
+  }\r
+  return 1;\r
 }\r
 \r
 void\r
@@ -5164,6 +5320,50 @@ void SendProgramStatsToFrontend( ChessProgramState * cps, ChessProgramStats * cp
     SetProgramStats( &stats );\r
 }\r
 \r
+char *SendMoveToBookUser(int moveNr, ChessProgramState *cps, int initial)\r
+{   // [HGM] book: this routine intercepts moves to simulate book replies\r
+    char *bookHit = NULL;\r
+\r
+    //first determine if the incoming move brings opponent into his book\r
+    if(appData.usePolyglotBook && (cps == &first ? !appData.firstHasOwnBookUCI : !appData.secondHasOwnBookUCI))\r
+       bookHit = ProbeBook(moveNr+1, appData.polyglotBook); // returns move\r
+    if(appData.debugMode && bookHit) fprintf(debugFP, "book hit = %s\n", bookHit);\r
+    if(bookHit != NULL && !cps->bookSuspend) {\r
+       // make sure opponent is not going to reply after receiving move to book position\r
+       SendToProgram("force\n", cps);\r
+       cps->bookSuspend = TRUE; // flag indicating it has to be restarted\r
+    }\r
+    if(!initial) SendMoveToProgram(moveNr, cps); // with hit on initial position there is no move\r
+    // now arrange restart after book miss\r
+    if(bookHit) {\r
+       // after a book hit we never send 'go', and the code after the call to this routine\r
+       // has '&& !bookHit' added to suppress potential sending there (based on 'firstMove').\r
+       char buf[MSG_SIZ];\r
+       if (cps->useUsermove) sprintf(buf, "usermove "); // sorry, no SAN yet :(\r
+       sprintf(buf, "%s\n", bookHit); // force book move into program supposed to play it\r
+       SendToProgram(buf, cps);\r
+       if(!initial) firstMove = FALSE; // normally we would clear the firstMove condition after return & sending 'go'\r
+    } else if(initial) { // 'go' was needed irrespective of firstMove, and it has to be done in this routine\r
+       SendToProgram("go\n", cps);\r
+       cps->bookSuspend = FALSE; // after a 'go' we are never suspended\r
+    } else { // 'go' might be sent based on 'firstMove' after this routine returns\r
+       if(cps->bookSuspend && !firstMove) // 'go' needed, and it will not be done after we return\r
+           SendToProgram("go\n", cps); \r
+       cps->bookSuspend = FALSE; // anyhow, we will not be suspended after a miss\r
+    }\r
+    return bookHit; // notify caller of hit, so it can take action to send move to opponent\r
+}\r
+\r
+char *savedMessage;\r
+ChessProgramState *savedState;\r
+void DeferredBookMove(void)\r
+{\r
+       if(savedState->lastPing != savedState->lastPong)\r
+                   ScheduleDelayedEvent(DeferredBookMove, 10);\r
+       else\r
+       HandleMachineMove(savedMessage, savedState);\r
+}\r
+\r
 void\r
 HandleMachineMove(message, cps)\r
      char *message;\r
@@ -5176,7 +5376,9 @@ HandleMachineMove(message, cps)
     char promoChar;\r
     char *p;\r
     int machineWhite;\r
+    char *bookHit;\r
 \r
+FakeBookMove: // [HGM] book: we jump here to simulate machine moves after book hit\r
     /*\r
      * Kludge to ignore BEL characters\r
      */\r
@@ -5283,7 +5485,7 @@ HandleMachineMove(message, cps)
         fprintf(debugFP, "machine move %d, castling = %d %d %d %d %d %d\n", f,\r
                 castlingRights[f][0],castlingRights[f][1],castlingRights[f][2],castlingRights[f][3],castlingRights[f][4],castlingRights[f][5]);\r
     }\r
-        AlphaRank(machineMove, 4);\r
+        if(cps->alphaRank) AlphaRank(machineMove, 4);\r
         if (!ParseOneMove(machineMove, forwardMostMove, &moveType,\r
                               &fromX, &fromY, &toX, &toY, &promoChar)) {\r
            /* Machine move could not be parsed; ignore it. */\r
@@ -5409,12 +5611,12 @@ HandleMachineMove(message, cps)
             }\r
         }\r
 \r
-#ifdef ADJUDICATE // [HGM] some adjudications useful with buggy engines\r
+       if( gameMode == TwoMachinesPlay ) {\r
+         // [HGM] some adjudications useful with buggy engines\r
+            int k, count = 0, epFile = epStatus[forwardMostMove]; static int bare = 1;\r
+         if(gameInfo.holdingsSize == 0 || gameInfo.variant == VariantSuper) {\r
 \r
-        if( gameMode == TwoMachinesPlay && gameInfo.holdingsSize == 0) {\r
-            int count = 0, epFile = epStatus[forwardMostMove];\r
-\r
-            if(appData.testLegality && appData.checkMates) \r
+            if(appData.testLegality)\r
             // don't wait for engine to announce game end if we can judge ourselves\r
             switch (MateTest(boards[forwardMostMove],\r
                                  PosFlags(forwardMostMove), epFile,\r
@@ -5424,32 +5626,38 @@ HandleMachineMove(message, cps)
              default:\r
                break;\r
              case MT_STALEMATE:\r
-                ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
-                GameEnds( GameIsDrawn, "Xboard adjudication: Stalemate",\r
-                    GE_XBOARD );\r
+               epStatus[forwardMostMove] = EP_STALEMATE;\r
+                if(appData.checkMates) {\r
+                   ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
+                   GameEnds( GameIsDrawn, "Xboard adjudication: Stalemate",\r
+                       GE_XBOARD );\r
+               }\r
                break;\r
              case MT_CHECKMATE:\r
-                ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
-                GameEnds( WhiteOnMove(forwardMostMove) ? BlackWins : WhiteWins, \r
-                    "Xboard adjudication: Checkmate", \r
-                    GE_XBOARD );\r
+               epStatus[forwardMostMove] = EP_CHECKMATE;\r
+                if(appData.checkMates) {\r
+                   ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
+                   GameEnds( WhiteOnMove(forwardMostMove) ? BlackWins : WhiteWins, \r
+                   "Xboard adjudication: Checkmate", \r
+                   GE_XBOARD );\r
+               }\r
                break;\r
            }\r
 \r
-            if( appData.testLegality )\r
-            {   /* [HGM] Some more adjudications for obstinate engines */\r
-                int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,\r
-                    NrWQ=0, NrBQ=0, bishopsColor = 0,\r
+           if( appData.testLegality )\r
+           {   /* [HGM] Some more adjudications for obstinate engines */\r
+               int NrWN=0, NrBN=0, NrWB=0, NrBB=0, NrWR=0, NrBR=0,\r
+                    NrWQ=0, NrBQ=0, NrW=0, bishopsColor = 0,\r
                     NrPieces=0, NrPawns=0, PawnAdvance=0, i, j, k;\r
-                static int moveCount;\r
+               static int moveCount = 6;\r
 \r
                 /* First absolutely insufficient mating material. Count what is on board. */\r
-                for(i=0; i<BOARD_HEIGHT; i++) for(j=BOARD_LEFT; j<BOARD_RGHT; j++)\r
-                {   ChessSquare p = boards[forwardMostMove][i][j];\r
-                    int m=i;\r
+               for(i=0; i<BOARD_HEIGHT; i++) for(j=BOARD_LEFT; j<BOARD_RGHT; j++)\r
+               {   ChessSquare p = boards[forwardMostMove][i][j];\r
+                   int m=i;\r
 \r
-                    switch((int) p)\r
-                    {   /* count B,N,R and other of each side */\r
+                   switch((int) p)\r
+                   {   /* count B,N,R and other of each side */\r
                         case WhiteKnight:\r
                              NrWN++; break;\r
                         case WhiteBishop:\r
@@ -5476,10 +5684,11 @@ HandleMachineMove(message, cps)
                              PawnAdvance += m; NrPawns++;\r
                     }\r
                     NrPieces += (p != EmptySquare);\r
+                    NrW += ((int)p < (int)BlackPawn);\r
                 }\r
 \r
                 if( NrPieces == 3 && NrWN+NrBN+NrWB+NrBB == 1 || NrPieces == 2\r
-                 || NrPieces == 4 && NrBB+NrWB==2 && bishopsColor != 3)\r
+                 || NrPieces == 4 && NrBB+NrWB == NrPieces-2 && bishopsColor != 3)\r
                 {    /* KBK, KNK, KK of KBKB with like Bishops */\r
 \r
                      /* always flag draws, for judging claims */\r
@@ -5500,7 +5709,7 @@ HandleMachineMove(message, cps)
                      if(--bare < 0 && appData.checkMates) {\r
                          /* but only adjudicate them if adjudication enabled */\r
                          ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
-                         GameEnds( NrW > 1 ? WhiteWins : NrPiece - NrW > 1 ? BlackWins : GameIsDrawn, \r
+                         GameEnds( NrW > 1 ? WhiteWins : NrPieces - NrW > 1 ? BlackWins : GameIsDrawn, \r
                                                        "Xboard adjudication: Bare king", GE_XBOARD );\r
                          return;\r
                      }\r
@@ -5520,7 +5729,9 @@ HandleMachineMove(message, cps)
                           return;\r
                      }\r
                 } else moveCount = 6;\r
-#if 0\r
+           }\r
+         }\r
+#if 1\r
     if (appData.debugMode) { int i;\r
       fprintf(debugFP, "repeat test fmm=%d bmm=%d ep=%d, reps=%d\n",\r
               forwardMostMove, backwardMostMove, epStatus[backwardMostMove],\r
@@ -5626,11 +5837,9 @@ HandleMachineMove(message, cps)
                          }\r
                 }\r
 \r
-            }\r
-\r
 \r
         }\r
-#endif\r
+\r
         if( appData.adjudicateDrawMoves > 0 && forwardMostMove > (2*appData.adjudicateDrawMoves) ) {\r
            ShowMove(fromX, fromY, toX, toY); /*updates currentMove*/\r
 \r
@@ -5639,6 +5848,7 @@ HandleMachineMove(message, cps)
             return;\r
         }\r
 \r
+       bookHit = NULL;\r
        if (gameMode == TwoMachinesPlay) {\r
             /* [HGM] relaying draw offers moved to after reception of move */\r
             /* and interpreting offer as claim if it brings draw condition */\r
@@ -5649,8 +5859,8 @@ HandleMachineMove(message, cps)
                SendTimeRemaining(cps->other,\r
                                  cps->other->twoMachinesColor[0] == 'w');\r
            }\r
-           SendMoveToProgram(forwardMostMove-1, cps->other);\r
-           if (firstMove) {\r
+           bookHit = SendMoveToBookUser(forwardMostMove-1, cps->other, FALSE);\r
+           if (firstMove && !bookHit) {\r
                firstMove = FALSE;\r
                if (cps->other->useColors) {\r
                  SendToProgram(cps->other->twoMachinesColor, cps->other);\r
@@ -5673,6 +5883,29 @@ HandleMachineMove(message, cps)
        if (gameMode != TwoMachinesPlay)\r
            SetUserThinkingEnables();\r
 \r
+       // [HGM] book: after book hit opponent has received move and is now in force mode\r
+       // force the book reply into it, and then fake that it outputted this move by jumping\r
+       // back to the beginning of HandleMachineMove, with cps toggled and message set to this move\r
+       if(bookHit) {\r
+               static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+               strcpy(bookMove, "move ");\r
+               strcat(bookMove, bookHit);\r
+               message = bookMove;\r
+               cps = cps->other;\r
+               programStats.depth = programStats.nodes = programStats.time = \r
+               programStats.score = programStats.got_only_move = 0;\r
+               sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+               if(cps->lastPing != cps->lastPong) {\r
+                   savedMessage = message; // args for deferred call\r
+                   savedState = cps;\r
+                   ScheduleDelayedEvent(DeferredBookMove, 10);\r
+                   return;\r
+               }\r
+               goto FakeBookMove;\r
+       }\r
+\r
        return;\r
     }\r
 \r
@@ -6132,7 +6365,9 @@ HandleMachineMove(message, cps)
     /*\r
      * Look for thinking output\r
      */\r
-    if ( appData.showThinking) {\r
+    if ( appData.showThinking // [HGM] thinking: test all options that cause this output\r
+         || !appData.hideThinkingFromHuman || appData.adjudicateLossThreshold != 0 || EngineOutputIsUp()\r
+                               ) {\r
        int plylev, mvleft, mvtot, curscore, time;\r
        char mvname[MOVE_LEN];\r
        unsigned long nodes;\r
@@ -6815,7 +7050,11 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board)
       }\r
       if (captured != EmptySquare && gameInfo.holdingsSize > 0\r
           && gameInfo.variant != VariantBughouse        ) {\r
-        /* Add to holdings, if holdings exist */\r
+        /* [HGM] holdings: Add to holdings, if holdings exist */\r
+       if(gameInfo.variant == VariantSuper) { \r
+               // [HGM] superchess: suppress flipping color of captured pieces by reverse pre-flip\r
+               captured = (int) captured >= (int) BlackPawn ? BLACK_TO_WHITE captured : WHITE_TO_BLACK captured;\r
+       }\r
         p = (int) captured;\r
         if (p >= (int) BlackPawn) {\r
           p -= (int)BlackPawn;\r
@@ -6827,8 +7066,7 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board)
           p = PieceToNumber((ChessSquare)p);\r
           if(p >= gameInfo.holdingsSize) { p = 0; captured = BlackPawn; }\r
           board[p][BOARD_WIDTH-2]++;\r
-          board[p][BOARD_WIDTH-1] =\r
-                                   BLACK_TO_WHITE captured;\r
+          board[p][BOARD_WIDTH-1] = BLACK_TO_WHITE captured;\r
        } else {\r
           p -= (int)WhitePawn;\r
           if(gameInfo.variant == VariantShogi && DEMOTED p >= 0) {\r
@@ -6838,8 +7076,7 @@ ApplyMove(fromX, fromY, toX, toY, promoChar, board)
           p = PieceToNumber((ChessSquare)p);\r
           if(p >= gameInfo.holdingsSize) { p = 0; captured = WhitePawn; }\r
           board[BOARD_HEIGHT-1-p][1]++;\r
-          board[BOARD_HEIGHT-1-p][0] =\r
-                                  WHITE_TO_BLACK captured;\r
+          board[BOARD_HEIGHT-1-p][0] = WHITE_TO_BLACK captured;\r
        }\r
       }\r
 \r
@@ -6987,6 +7224,38 @@ ShowMove(fromX, fromY, toX, toY)
     HistorySet(parseList,backwardMostMove,forwardMostMove,currentMove-1);\r
 }\r
 \r
+void SendEgtPath(ChessProgramState *cps)\r
+{       /* [HGM] EGT: match formats given in feature with those given by user, and send info for each match */\r
+       char buf[MSG_SIZ], name[MSG_SIZ], *p;\r
+\r
+       if((p = cps->egtFormats) == NULL || appData.egtFormats == NULL) return;\r
+\r
+       while(*p) {\r
+           char c, *q = name+1, *r, *s;\r
+\r
+           name[0] = ','; // extract next format name from feature and copy with prefixed ','\r
+           while(*p && *p != ',') *q++ = *p++;\r
+           *q++ = ':'; *q = 0;\r
+           if( appData.defaultPathEGTB && appData.defaultPathEGTB[0] && \r
+               strcmp(name, ",nalimov:") == 0 ) {\r
+               // take nalimov path from the menu-changeable option first, if it is defined\r
+               sprintf(buf, "egtpath nalimov %s\n", appData.defaultPathEGTB);\r
+               SendToProgram(buf,cps);     // send egtbpath command for nalimov\r
+           } else\r
+           if( (s = StrStr(appData.egtFormats, name+1)) == appData.egtFormats ||\r
+               (s = StrStr(appData.egtFormats, name)) != NULL) {\r
+               // format name occurs amongst user-supplied formats, at beginning or immediately after comma\r
+               s = r = StrStr(s, ":") + 1; // beginning of path info\r
+               while(*r && *r != ',') r++; // path info is everything upto next ';' or end of string\r
+               c = *r; *r = 0;             // temporarily null-terminate path info\r
+                   *--q = 0;               // strip of trailig ':' from name\r
+                   sprintf(buf, "egtbpath %s %s\n", name+1, s);\r
+               *r = c;\r
+               SendToProgram(buf,cps);     // send egtbpath command for this format\r
+           }\r
+           if(*p == ',') p++; // read away comma to position for next format name\r
+       }\r
+}\r
 \r
 void\r
 InitChessProgram(cps, setup)\r
@@ -6997,6 +7266,19 @@ InitChessProgram(cps, setup)
     if (appData.noChessProgram) return;\r
     hintRequested = FALSE;\r
     bookRequested = FALSE;\r
+\r
+    /* [HGM] some new WB protocol commands to configure engine are sent now, if engine supports them */\r
+    /*       moved to before sending initstring in 4.3.15, so Polyglot can delay UCI 'isready' to recepton of 'new' */\r
+    if(cps->memSize) { /* [HGM] memory */\r
+       sprintf(buf, "memory %d\n", appData.defaultHashSize + appData.defaultCacheSizeEGTB);\r
+       SendToProgram(buf, cps);\r
+    }\r
+    SendEgtPath(cps); /* [HGM] EGT */\r
+    if(cps->maxCores) { /* [HGM] SMP: (protocol specified must be last settings command before new!) */\r
+       sprintf(buf, "cores %d\n", appData.smpCores);\r
+       SendToProgram(buf, cps);\r
+    }\r
+\r
     SendToProgram(cps->initString, cps);\r
     if (gameInfo.variant != VariantNormal &&\r
        gameInfo.variant != VariantLoadable\r
@@ -7024,6 +7306,8 @@ InitChessProgram(cps, setup)
            overruled = gameInfo.boardWidth != 10 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 0;\r
       if( gameInfo.variant == VariantCourier )\r
            overruled = gameInfo.boardWidth != 12 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 0;\r
+      if( gameInfo.variant == VariantSuper )\r
+           overruled = gameInfo.boardWidth != 8 || gameInfo.boardHeight != 8 || gameInfo.holdingsSize != 8;\r
 \r
       if(overruled) {\r
            sprintf(b, "%dx%d+%d_%s", gameInfo.boardWidth, gameInfo.boardHeight, \r
@@ -7066,7 +7350,10 @@ InitChessProgram(cps, setup)
                        timeIncrement, appData.searchDepth,\r
                        searchTime);\r
     }\r
-    if (appData.showThinking) {\r
+    if (appData.showThinking \r
+       // [HGM] thinking: four options require thinking output to be sent\r
+       || !appData.hideThinkingFromHuman || appData.adjudicateLossThreshold != 0 || EngineOutputIsUp()\r
+                               ) {\r
        SendToProgram("post\n", cps);\r
     }\r
     SendToProgram("hard\n", cps);\r
@@ -7148,14 +7435,25 @@ TwoMachinesEventIfReady P((void))
 void\r
 NextMatchGame P((void))\r
 {\r
+    int index; /* [HGM] autoinc: step lod index during match */\r
     Reset(FALSE, TRUE);\r
     if (*appData.loadGameFile != NULLCHAR) {\r
+       index = appData.loadGameIndex;\r
+       if(index < 0) { // [HGM] autoinc\r
+           lastIndex = index = (index == -2 && first.twoMachinesColor[0] == 'b') ? lastIndex : lastIndex+1;\r
+           if(appData.rewindIndex > 0 && index > appData.rewindIndex) lastIndex = index = 1;\r
+       } \r
        LoadGameFromFile(appData.loadGameFile,\r
-                        appData.loadGameIndex,\r
+                        index,\r
                         appData.loadGameFile, FALSE);\r
     } else if (*appData.loadPositionFile != NULLCHAR) {\r
+       index = appData.loadPositionIndex;\r
+       if(index < 0) { // [HGM] autoinc\r
+           lastIndex = index = (index == -2 && first.twoMachinesColor[0] == 'b') ? lastIndex : lastIndex+1;\r
+           if(appData.rewindIndex > 0 && index > appData.rewindIndex) lastIndex = index = 1;\r
+       } \r
        LoadPositionFromFile(appData.loadPositionFile,\r
-                            appData.loadPositionIndex,\r
+                            index,\r
                             appData.loadPositionFile);\r
     }\r
     TwoMachinesEventIfReady();\r
@@ -7236,57 +7534,71 @@ GameEnds(result, resultDetails, whosays)
     if (!isIcsGame || whosays == GE_ICS) {\r
        /* OK -- not an ICS game, or ICS said it was done */\r
        StopClocks();\r
-    if (appData.debugMode) {\r
-      fprintf(debugFP, "GameEnds(%d, %s, %d) clock stopped\n",\r
-             result, resultDetails ? resultDetails : "(null)", whosays);\r
-    }\r
        if (!isIcsGame && !appData.noChessProgram) \r
          SetUserThinkingEnables();\r
     \r
         /* [HGM] if a machine claims the game end we verify this claim */\r
-        if( appData.testLegality && gameMode == TwoMachinesPlay &&\r
-            appData.testClaims && whosays >= GE_ENGINE1 ) {\r
+        if(gameMode == TwoMachinesPlay && appData.testClaims) {\r
+           if(appData.testLegality && whosays >= GE_ENGINE1 ) {\r
                 char claimer;\r
 \r
-    if (appData.debugMode) {\r
-      fprintf(debugFP, "GameEnds(%d, %s, %d) test claims\n",\r
-             result, resultDetails ? resultDetails : "(null)", whosays);\r
-    }\r
                 claimer = whosays == GE_ENGINE1 ?      /* color of claimer */\r
                                             first.twoMachinesColor[0] :\r
                                             second.twoMachinesColor[0] ;\r
-                if( gameInfo.holdingsWidth == 0 &&\r
+                if( (gameInfo.holdingsWidth == 0 || gameInfo.variant == VariantSuper) &&\r
                     (result == WhiteWins && claimer == 'w' ||\r
                      result == BlackWins && claimer == 'b'   ) ) {\r
-                      /* Xboard immediately adjudicates all mates, so win claims must be false */\r
-                      sprintf(buf, "False win claim: '%s'", resultDetails);\r
-                      result = claimer == 'w' ? BlackWins : WhiteWins;\r
-                      resultDetails = buf;\r
+               if (appData.debugMode) {\r
+                    fprintf(debugFP, "result=%d sp=%d move=%d\n",\r
+                       result, epStatus[forwardMostMove], forwardMostMove);\r
+               }\r
+                      /* [HGM] verify: engine mate claims accepted if they were flagged */\r
+                     if(epStatus[forwardMostMove] != EP_CHECKMATE &&\r
+                        result != (WhiteOnMove(forwardMostMove) ? WhiteWins : BlackWins)) {\r
+                             sprintf(buf, "False win claim: '%s'", resultDetails);\r
+                             result = claimer == 'w' ? BlackWins : WhiteWins;\r
+                             resultDetails = buf;\r
+                     }\r
                 } else\r
                 if( result == GameIsDrawn && epStatus[forwardMostMove] > EP_DRAWS\r
                     && (forwardMostMove <= backwardMostMove ||\r
                         epStatus[forwardMostMove-1] > EP_DRAWS ||\r
                         (claimer=='b')==(forwardMostMove&1))\r
                                                                                   ) {\r
-                      /* Draw that was not flagged by Xboard is false */\r
+                      /* [HGM] verify: draws that were not flagged are false claims */\r
                       sprintf(buf, "False draw claim: '%s'", resultDetails);\r
                       result = claimer == 'w' ? BlackWins : WhiteWins;\r
                       resultDetails = buf;\r
                 }\r
                 /* (Claiming a loss is accepted no questions asked!) */\r
+           }\r
+           /* [HGM] bare: don't allow bare King to win */\r
+           if((gameInfo.holdingsWidth == 0 || gameInfo.variant == VariantSuper) && result != GameIsDrawn)\r
+           {   int i, j, k=0, color = (result==WhiteWins ? (int)WhitePawn : (int)BlackPawn);\r
+               for(j=BOARD_LEFT; j<BOARD_RGHT; j++) for(i=0; i<BOARD_HEIGHT; i++) {\r
+                       int p = (int)boards[forwardMostMove][i][j] - color;\r
+                       if(p >= 0 && p <= (int)WhiteKing) k++;\r
+               }\r
+               if (appData.debugMode) {\r
+                    fprintf(debugFP, "GE(%d, %s, %d) bare king k=%d color=%d\n",\r
+                       result, resultDetails ? resultDetails : "(null)", whosays, k, color);\r
+               }\r
+               if(k <= 1) {\r
+                       result = GameIsDrawn;\r
+                       sprintf(buf, "%s but bare king", resultDetails);\r
+                       resultDetails = buf;\r
+               }\r
+           }\r
         }\r
 \r
+\r
         if(serverMoves != NULL && !loadFlag) { char c = '=';\r
             if(result==WhiteWins) c = '+';\r
             if(result==BlackWins) c = '-';\r
             if(resultDetails != NULL)\r
                 fprintf(serverMoves, ";%c;%s\n", c, resultDetails);\r
         }\r
-    if (appData.debugMode) {\r
-      fprintf(debugFP, "GameEnds(%d, %s, %d) after test\n",\r
-             result, resultDetails ? resultDetails : "(null)", whosays);\r
-    }\r
-       if (resultDetails != NULL) {\r
+       if (resultDetails != NULL) {\r
            gameInfo.result = result;\r
            gameInfo.resultDetails = StrSave(resultDetails);\r
 \r
@@ -7470,9 +7782,11 @@ GameEnds(result, resultDetails, whosays)
        }\r
        if (matchGame < appData.matchGames) {\r
            char *tmp;\r
-           tmp = first.twoMachinesColor;\r
-           first.twoMachinesColor = second.twoMachinesColor;\r
-           second.twoMachinesColor = tmp;\r
+           if(appData.sameColorGames <= 1) { /* [HGM] alternate: suppress color swap */\r
+               tmp = first.twoMachinesColor;\r
+               first.twoMachinesColor = second.twoMachinesColor;\r
+               second.twoMachinesColor = tmp;\r
+           }\r
            gameMode = nextGameMode;\r
            matchGame++;\r
             if(appData.matchPause>10000 || appData.matchPause<10)\r
@@ -7580,6 +7894,8 @@ Reset(redraw, init)
     hintRequested = bookRequested = FALSE;\r
     first.maybeThinking = FALSE;\r
     second.maybeThinking = FALSE;\r
+    first.bookSuspend = FALSE; // [HGM] book\r
+    second.bookSuspend = FALSE;\r
     thinkOutput[0] = NULLCHAR;\r
     lastHint[0] = NULLCHAR;\r
     ClearGameInfo(&gameInfo);\r
@@ -7750,6 +8066,8 @@ LoadGameOneMove(readAhead)
       case BlackPromotionChancellor:\r
       case WhitePromotionArchbishop:\r
       case BlackPromotionArchbishop:\r
+      case WhitePromotionCentaur:\r
+      case BlackPromotionCentaur:\r
       case WhitePromotionQueen:\r
       case BlackPromotionQueen:\r
       case WhitePromotionRook:\r
@@ -7922,7 +8240,7 @@ LoadGameOneMove(readAhead)
       default:\r
       case ImpossibleMove:\r
        if (appData.debugMode)\r
-         fprintf(debugFP, "Parsed ImpossibleMove: %s\n", yy_text);\r
+         fprintf(debugFP, "Parsed ImpossibleMove (type = %d): %s\n", moveType, yy_text);\r
        sprintf(move, "Illegal move: %d.%s%s",\r
                (forwardMostMove / 2) + 1,\r
                WhiteOnMove(forwardMostMove) ? " " : ".. ", yy_text);\r
@@ -8373,13 +8691,6 @@ LoadGame(f, gameNumber, title, useList)
            return FALSE;\r
          }\r
          CopyBoard(boards[0], initial_position);\r
-          /* [HGM] copy FEN attributes as well */\r
-          {   int i;\r
-              initialRulePlies = FENrulePlies;\r
-              epStatus[0] = FENepStatus;\r
-              for( i=0; i< nrCastlingRights; i++ )\r
-                  initialRights[i] = castlingRights[0][i] = FENcastlingRights[i];\r
-          }\r
          if (blackPlaysFirst) {\r
            currentMove = forwardMostMove = backwardMostMove = 1;\r
            CopyBoard(boards[1], initial_position);\r
@@ -8394,6 +8705,13 @@ LoadGame(f, gameNumber, title, useList)
          } else {\r
            currentMove = forwardMostMove = backwardMostMove = 0;\r
          }\r
+          /* [HGM] copy FEN attributes as well. Bugfix 4.3.14m and 4.3.15e: moved to after 'blackPlaysFirst' */\r
+          {   int i;\r
+              initialRulePlies = FENrulePlies;\r
+              epStatus[forwardMostMove] = FENepStatus;\r
+              for( i=0; i< nrCastlingRights; i++ )\r
+                  initialRights[i] = castlingRights[forwardMostMove][i] = FENcastlingRights[i];\r
+          }\r
          yyboardindex = forwardMostMove;\r
          free(gameInfo.fen);\r
          gameInfo.fen = NULL;\r
@@ -8710,7 +9028,7 @@ LoadPosition(f, positionNumber, title)
     if (pn >= 2) {\r
        if (fenMode || line[0] == '#') pn--;\r
        while (pn > 0) {\r
-           /* skip postions before number pn */\r
+           /* skip positions before number pn */\r
            if (fgets(line, MSG_SIZ, f) == NULL) {\r
                Reset(TRUE, TRUE);\r
                DisplayError("Position not found in file", 0);\r
@@ -8749,13 +9067,6 @@ LoadPosition(f, positionNumber, title)
     \r
     SendToProgram("force\n", &first);\r
     CopyBoard(boards[0], initial_position);\r
-          /* [HGM] copy FEN attributes as well */\r
-          {   int i;\r
-              initialRulePlies = FENrulePlies;\r
-              epStatus[0] = FENepStatus;\r
-              for( i=0; i< nrCastlingRights; i++ )\r
-                  castlingRights[0][i] = FENcastlingRights[i];\r
-          }\r
     if (blackPlaysFirst) {\r
        currentMove = forwardMostMove = backwardMostMove = 1;\r
        strcpy(moveList[0], "");\r
@@ -8766,8 +9077,18 @@ LoadPosition(f, positionNumber, title)
        currentMove = forwardMostMove = backwardMostMove = 0;\r
        DisplayMessage("", "White to play");\r
     }\r
+          /* [HGM] copy FEN attributes as well */\r
+          {   int i;\r
+              initialRulePlies = FENrulePlies;\r
+              epStatus[forwardMostMove] = FENepStatus;\r
+              for( i=0; i< nrCastlingRights; i++ )\r
+                  castlingRights[forwardMostMove][i] = FENcastlingRights[i];\r
+          }\r
     SendBoard(&first, forwardMostMove);\r
     if (appData.debugMode) {\r
+int i, j;\r
+  for(i=0;i<2;i++){for(j=0;j<6;j++)fprintf(debugFP, " %d", castlingRights[i][j]);fprintf(debugFP,"\n");}\r
+  for(j=0;j<6;j++)fprintf(debugFP, " %d", initialRights[j]);fprintf(debugFP,"\n");\r
         fprintf(debugFP, "Load Position\n");\r
     }\r
 \r
@@ -9019,7 +9340,21 @@ SaveGamePGN(f)
        linelen += numlen;\r
 \r
        /* Get move */\r
-       movetext = SavePart(parseList[i]);\r
+       movelen = strlen(parseList[i]); /* [HGM] pgn: line-break point before move */\r
+\r
+       /* Print move */\r
+       blank = linelen > 0 && movelen > 0;\r
+       if (linelen + (blank ? 1 : 0) + movelen > PGN_MAX_LINE) {\r
+           fprintf(f, "\n");\r
+           linelen = 0;\r
+           blank = 0;\r
+       }\r
+       if (blank) {\r
+           fprintf(f, " ");\r
+           linelen++;\r
+       }\r
+       fprintf(f, parseList[i]);\r
+       linelen += movelen;\r
 \r
         /* [AS] Add PV info if present */\r
         if( i >= 0 && appData.saveExtendedInfoInPGN && pvInfoList[i].depth > 0 ) {\r
@@ -9028,49 +9363,53 @@ SaveGamePGN(f)
 \r
 #if 0\r
             if(i >= backwardMostMove) {\r
-                /* take the time that changed */\r
-                seconds = timeRemaining[0][i] - timeRemaining[0][i+1];\r
-              if(seconds <= 0)\r
-                    seconds = timeRemaining[1][i] - timeRemaining[1][i+1];\r
+               if(WhiteOnMove(i))\r
+                       seconds = timeRemaining[0][i] - timeRemaining[0][i+1]\r
+                                 + GetTimeQuota(i/2) / WhitePlayer()->timeOdds;\r
+               else\r
+                       seconds = timeRemaining[1][i] - timeRemaining[1][i+1]\r
+                                  + GetTimeQuota(i/2) / WhitePlayer()->other->timeOdds;\r
             }\r
-            seconds /= 1000;\r
+            seconds = (seconds+50)/100; // deci-seconds, rounded to nearest\r
+#else\r
+            seconds = (pvInfoList[i].time + 5)/10; // [HGM] PVtime: use engine time\r
 #endif\r
-            seconds = pvInfoList[i].time/100; // [HGM] PVtime: use engine time\r
-    if (appData.debugMode) {\r
+    if (appData.debugMode,0) {\r
         fprintf(debugFP, "times = %d %d %d %d, seconds=%d\n",\r
                 timeRemaining[0][i+1], timeRemaining[0][i],\r
                      timeRemaining[1][i+1], timeRemaining[1][i], seconds\r
         );\r
     }\r
 \r
-            if( seconds < 0 ) buf[0] = 0; else\r
-            if( seconds < 60 ) sprintf(buf, " %d%c", seconds, 0);\r
-            else    sprintf(buf, " %d:%02d%c", seconds/60, seconds%60, 0);\r
+            if( seconds <= 0) buf[0] = 0; else\r
+            if( seconds < 30 ) sprintf(buf, " %3.1f%c", seconds/10., 0); else {\r
+               seconds = (seconds + 4)/10; // round to full seconds\r
+               if( seconds < 60 ) sprintf(buf, " %d%c", seconds, 0); else\r
+                                  sprintf(buf, " %d:%02d%c", seconds/60, seconds%60, 0);\r
+           }\r
 \r
-            sprintf( move_buffer, "%s {%s%.2f/%d%s}", \r
-                movetext, \r
+            sprintf( move_buffer, "{%s%.2f/%d%s}", \r
                 pvInfoList[i].score >= 0 ? "+" : "",\r
                 pvInfoList[i].score / 100.0,\r
                 pvInfoList[i].depth,\r
-                buf );\r
-            movetext = move_buffer;\r
-        }\r
+               buf );\r
 \r
-       movelen = strlen(movetext);\r
+           movelen = strlen(move_buffer); /* [HGM] pgn: line-break point after move */\r
 \r
-       /* Print move */\r
-       blank = linelen > 0 && movelen > 0;\r
-       if (linelen + (blank ? 1 : 0) + movelen > PGN_MAX_LINE) {\r
-           fprintf(f, "\n");\r
-           linelen = 0;\r
-           blank = 0;\r
-       }\r
-       if (blank) {\r
-           fprintf(f, " ");\r
-           linelen++;\r
-       }\r
-       fprintf(f, movetext);\r
-       linelen += movelen;\r
+           /* Print score/depth */\r
+           blank = linelen > 0 && movelen > 0;\r
+           if (linelen + (blank ? 1 : 0) + movelen > PGN_MAX_LINE) {\r
+               fprintf(f, "\n");\r
+               linelen = 0;\r
+               blank = 0;\r
+           }\r
+           if (blank) {\r
+               fprintf(f, " ");\r
+               linelen++;\r
+           }\r
+           fprintf(f, move_buffer);\r
+           linelen += movelen;\r
+        }\r
 \r
        i++;\r
     }\r
@@ -9601,7 +9940,7 @@ ExitEvent(status)
     GameEnds((ChessMove) 0, NULL, GE_PLAYER);\r
 #else\r
     /* [HGM] crash: leave writing PGN and position entirely to GameEnds() */\r
-    GameEnds(gameInfo.result, gameInfo.resultDetails==NULL ? "aborted" : gameInfo.resultDetails, GE_PLAYER);\r
+    GameEnds(gameInfo.result, gameInfo.resultDetails==NULL ? "xboard exit" : gameInfo.resultDetails, GE_PLAYER);\r
 #endif\r
     /* [HGM] crash: the above GameEnds() is a dud if another one was running */\r
     /* make sure this other one finishes before killing it!                  */\r
@@ -9785,6 +10124,7 @@ void
 MachineWhiteEvent()\r
 {\r
     char buf[MSG_SIZ];\r
+    char *bookHit = NULL;\r
 \r
     if (appData.noChessProgram || (gameMode == MachinePlaysWhite))\r
       return;\r
@@ -9813,6 +10153,10 @@ MachineWhiteEvent()
        TruncateGame();\r
 \r
     ResurrectChessProgram();   /* in case it isn't running */\r
+    if(gameMode == BeginningOfGame) { /* [HGM] time odds: to get right odds in human mode */\r
+       gameMode = MachinePlaysWhite;\r
+       ResetClocks();\r
+    } else\r
     gameMode = MachinePlaysWhite;\r
     pausing = FALSE;\r
     ModeHighlight();\r
@@ -9830,10 +10174,9 @@ MachineWhiteEvent()
       SendTimeRemaining(&first, TRUE);\r
     }\r
     if (first.useColors) {\r
-      SendToProgram("white\ngo\n", &first);\r
-    } else {\r
-      SendToProgram("go\n", &first);\r
+      SendToProgram("white\n", &first); // [HGM] book: send 'go' separately\r
     }\r
+    bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move\r
     SetMachineThinkingEnables();\r
     first.maybeThinking = TRUE;\r
     StartClocks();\r
@@ -9842,12 +10185,25 @@ MachineWhiteEvent()
       flipView = !flipView;\r
       DrawPosition(FALSE, NULL);\r
     }\r
+\r
+    if(bookHit) { // [HGM] book: simulate book reply\r
+       static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+       programStats.depth = programStats.nodes = programStats.time = \r
+       programStats.score = programStats.got_only_move = 0;\r
+       sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+       strcpy(bookMove, "move ");\r
+       strcat(bookMove, bookHit);\r
+       HandleMachineMove(bookMove, &first);\r
+    }\r
 }\r
 \r
 void\r
 MachineBlackEvent()\r
 {\r
     char buf[MSG_SIZ];\r
+   char *bookHit = NULL;\r
 \r
     if (appData.noChessProgram || (gameMode == MachinePlaysBlack))\r
        return;\r
@@ -9893,10 +10249,9 @@ MachineBlackEvent()
       SendTimeRemaining(&first, FALSE);\r
     }\r
     if (first.useColors) {\r
-      SendToProgram("black\ngo\n", &first);\r
-    } else {\r
-      SendToProgram("go\n", &first);\r
+      SendToProgram("black\n", &first); // [HGM] book: 'go' sent separately\r
     }\r
+    bookHit = SendMoveToBookUser(forwardMostMove-1, &first, TRUE); // [HGM] book: send go or retrieve book move\r
     SetMachineThinkingEnables();\r
     first.maybeThinking = TRUE;\r
     StartClocks();\r
@@ -9905,6 +10260,17 @@ MachineBlackEvent()
       flipView = !flipView;\r
       DrawPosition(FALSE, NULL);\r
     }\r
+    if(bookHit) { // [HGM] book: simulate book reply\r
+       static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+       programStats.depth = programStats.nodes = programStats.time = \r
+       programStats.score = programStats.got_only_move = 0;\r
+       sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+       strcpy(bookMove, "move ");\r
+       strcat(bookMove, bookHit);\r
+       HandleMachineMove(bookMove, &first);\r
+    }\r
 }\r
 \r
 \r
@@ -9936,6 +10302,7 @@ TwoMachinesEvent P((void))
     int i;\r
     char buf[MSG_SIZ];\r
     ChessProgramState *onmove;\r
+    char *bookHit = NULL;\r
     \r
     if (appData.noChessProgram) return;\r
 \r
@@ -10018,8 +10385,8 @@ TwoMachinesEvent P((void))
       SendToProgram(buf, &second);\r
     }\r
 \r
+    ResetClocks();\r
     if (!first.sendTime || !second.sendTime) {\r
-       ResetClocks();\r
        timeRemaining[0][forwardMostMove] = whiteTimeRemaining;\r
        timeRemaining[1][forwardMostMove] = blackTimeRemaining;\r
     }\r
@@ -10032,11 +10399,24 @@ TwoMachinesEvent P((void))
     if (onmove->useColors) {\r
       SendToProgram(onmove->twoMachinesColor, onmove);\r
     }\r
-    SendToProgram("go\n", onmove);\r
+    bookHit = SendMoveToBookUser(forwardMostMove-1, onmove, TRUE); // [HGM] book: send go or retrieve book move\r
+//    SendToProgram("go\n", onmove);\r
     onmove->maybeThinking = TRUE;\r
     SetMachineThinkingEnables();\r
 \r
     StartClocks();\r
+\r
+    if(bookHit) { // [HGM] book: simulate book reply\r
+       static char bookMove[MSG_SIZ]; // a bit generous?\r
+\r
+       programStats.depth = programStats.nodes = programStats.time = \r
+       programStats.score = programStats.got_only_move = 0;\r
+       sprintf(programStats.movelist, "%s (xbook)", bookMove);\r
+\r
+       strcpy(bookMove, "move ");\r
+       strcat(bookMove, bookHit);\r
+       HandleMachineMove(bookMove, &first);\r
+    }\r
 }\r
 \r
 void\r
@@ -10232,6 +10612,11 @@ EditPositionDone()
        strcpy(parseList[0], "");\r
        currentMove = forwardMostMove = backwardMostMove = 1;\r
        CopyBoard(boards[1], boards[0]);\r
+       /* [HGM] copy rights as well, as this code is also used after pasting a FEN */\r
+       { int i;\r
+         epStatus[1] = epStatus[0];\r
+         for(i=0; i<nrCastlingRights; i++) castlingRights[1][i] = castlingRights[0][i];\r
+       }\r
     } else {\r
        currentMove = forwardMostMove = backwardMostMove = 0;\r
     }\r
@@ -10334,7 +10719,8 @@ EditPositionMenuEvent(selection, x, y)
            SendToICS(ics_prefix);\r
            SendToICS("clearboard\n");\r
        } else {\r
-            for (x = 0; x < BOARD_WIDTH; x++) {\r
+            for (x = 0; x < BOARD_WIDTH; x++) { ChessSquare p = EmptySquare;\r
+               if(x == BOARD_LEFT-1 || x == BOARD_RGHT) p = (ChessSquare) 0; /* [HGM] holdings */\r
                 for (y = 0; y < BOARD_HEIGHT; y++) {\r
                    if (gameMode == IcsExamining) {\r
                        if (boards[currentMove][y][x] != EmptySquare) {\r
@@ -10343,7 +10729,7 @@ EditPositionMenuEvent(selection, x, y)
                            SendToICS(buf);\r
                        }\r
                    } else {\r
-                       boards[0][y][x] = EmptySquare;\r
+                       boards[0][y][x] = p;\r
                    }\r
                }\r
            }\r
@@ -11332,7 +11718,7 @@ char *GetInfoFromComment( int index, char * text )
     if( text != NULL && index > 0 ) {\r
         int score = 0;\r
         int depth = 0;\r
-        int time = -1, sec = 0;\r
+        int time = -1, sec = 0, deci;\r
         char * s_eval = FindStr( text, "[%eval " );\r
         char * s_emt = FindStr( text, "[%emt " );\r
 \r
@@ -11362,8 +11748,9 @@ char *GetInfoFromComment( int index, char * text )
                 return text;\r
             }\r
 \r
-            time = -1; sec = -1;\r
+            time = -1; sec = -1; deci = -1;\r
             if( sscanf( text, "%d.%d/%d %d:%d", &score, &score_lo, &depth, &time, &sec ) != 5 &&\r
+               sscanf( text, "%d.%d/%d %d.%d", &score, &score_lo, &depth, &time, &deci ) != 5 &&\r
                 sscanf( text, "%d.%d/%d %d", &score, &score_lo, &depth, &time ) != 4 &&\r
                 sscanf( text, "%d.%d/%d", &score, &score_lo, &depth ) != 3   ) {\r
                 return text;\r
@@ -11373,7 +11760,9 @@ char *GetInfoFromComment( int index, char * text )
                 return text;\r
             }\r
 \r
-            if(sec >= 0) time = 60*time + sec;\r
+            if(sec >= 0) time = 600*time + 10*sec; else\r
+            if(deci >= 0) time = 10*time + deci; else time *= 10; // deci-sec\r
+\r
             score = score >= 0 ? score*100 + score_lo : score*100 - score_lo;\r
 \r
             /* [HGM] PV time: now locate end of PV info */\r
@@ -11382,6 +11771,8 @@ char *GetInfoFromComment( int index, char * text )
             while( *++sep >= '0' && *sep <= '9'); // strip time\r
             if(sec >= 0)\r
             while( *++sep >= '0' && *sep <= '9'); // strip seconds\r
+            if(deci >= 0)\r
+            while( *++sep >= '0' && *sep <= '9'); // strip fractional seconds\r
             while(*sep == ' ') sep++;\r
         }\r
 \r
@@ -11395,7 +11786,7 @@ char *GetInfoFromComment( int index, char * text )
 \r
         pvInfoList[index-1].depth = depth;\r
         pvInfoList[index-1].score = score;\r
-        pvInfoList[index-1].time  = time;\r
+        pvInfoList[index-1].time  = 10*time; // centi-sec\r
     }\r
     return sep;\r
 }\r
@@ -11500,8 +11891,7 @@ ReceiveFromProgram(isr, closure, message, count, error)
                   sscanf(message, "resign%c", &c)!=1 && sscanf(message, "feature %c", &c)!=1 &&\r
                   sscanf(message, "error %c", &c)!=1 && sscanf(message, "illegal %c", &c)!=1 &&\r
                   sscanf(message, "tell%c", &c)!=1   && sscanf(message, "0-1 %c", &c)!=1 &&\r
-                  sscanf(message, "askuser%c", &c)!=1 && sscanf(message, "1-0 %c", &c)!=1 && \r
-                  sscanf(message, "1/2-1/2 %c", &c)!=1 && start != '#')\r
+                  sscanf(message, "1-0 %c", &c)!=1   && sscanf(message, "1/2-1/2 %c", &c)!=1 && start != '#')\r
                        { quote = "# "; print = (appData.engineComments == 2); }\r
                message[0] = start; // restore original message\r
        }\r
@@ -11587,7 +11977,8 @@ SendTimeControl(cps, mps, tc, inc, sd, st)
 ChessProgramState *WhitePlayer()\r
 /* [HGM] return pointer to 'first' or 'second', depending on who plays white */\r
 {\r
-    if(gameMode == TwoMachinesPlay && first.twoMachinesColor[0] == 'b')\r
+    if(gameMode == TwoMachinesPlay && first.twoMachinesColor[0] == 'b' || \r
+       gameMode == BeginningOfGame || gameMode == MachinePlaysBlack)\r
         return &second;\r
     return &first;\r
 }\r
@@ -11748,9 +12139,6 @@ ParseFeatures(args, cps)
     if (BoolFeature(&p, "ics", &cps->sendICS, cps)) continue;\r
     if (BoolFeature(&p, "name", &cps->sendName, cps)) continue;\r
     if (BoolFeature(&p, "pause", &val, cps)) continue; /* unused at present */\r
-    if (BoolFeature(&p, "debug", &cps->debug, cps)) continue;\r
-    if (BoolFeature(&p, "nps", &cps->supportsNPS, cps)) continue;\r
-    if (IntFeature(&p, "level", &cps->maxNrOfSessions, cps)) continue;\r
     if (IntFeature(&p, "done", &val, cps)) {\r
       FeatureDone(cps, val);\r
       continue;\r
@@ -11760,6 +12148,15 @@ ParseFeatures(args, cps)
     if (BoolFeature(&p, "oocastle", &cps->useOOCastle, cps)) continue;\r
     /* End of additions by Tord */\r
 \r
+    /* [HGM] added features: */\r
+    if (BoolFeature(&p, "debug", &cps->debug, cps)) continue;\r
+    if (BoolFeature(&p, "nps", &cps->supportsNPS, cps)) continue;\r
+    if (IntFeature(&p, "level", &cps->maxNrOfSessions, cps)) continue;\r
+    if (BoolFeature(&p, "memory", &cps->memSize, cps)) continue;\r
+    if (BoolFeature(&p, "smp", &cps->maxCores, cps)) continue;\r
+    if (StringFeature(&p, "egt", &cps->egtFormats, cps)) continue;\r
+    /* End of additions by HGM */\r
+\r
     /* unknown feature: complain and skip */\r
     q = p;\r
     while (*q && *q != '=') q++;\r
@@ -11821,12 +12218,33 @@ PonderNextMoveEvent(newState)
 }\r
 \r
 void\r
-ShowThinkingEvent(newState)\r
-     int newState;\r
+NewSettingEvent(option, command, value)\r
+     char *command;\r
+     int option, value;\r
 {\r
-    if (newState == appData.showThinking) return;\r
+    char buf[MSG_SIZ];\r
+\r
     if (gameMode == EditPosition) EditPositionDone();\r
-    if (newState) {\r
+    sprintf(buf, "%s%s %d\n", (option ? "option ": ""), command, value);\r
+    SendToProgram(buf, &first);\r
+    if (gameMode == TwoMachinesPlay) {\r
+       SendToProgram(buf, &second);\r
+    }\r
+}\r
+\r
+void\r
+ShowThinkingEvent()\r
+// [HGM] thinking: this routine is now also called from "Options -> Engine..." popup\r
+{\r
+    static int oldState = 2; // kludge alert! Neither true nor fals, so first time oldState is always updated\r
+    int newState = appData.showThinking\r
+       // [HGM] thinking: other features now need thinking output as well\r
+       || !appData.hideThinkingFromHuman || appData.adjudicateLossThreshold != 0 || EngineOutputIsUp();\r
+    \r
+    if (oldState == newState) return;\r
+    oldState = newState;\r
+    if (gameMode == EditPosition) EditPositionDone();\r
+    if (oldState) {\r
        SendToProgram("post\n", &first);\r
        if (gameMode == TwoMachinesPlay) {\r
            SendToProgram("post\n", &second);\r
@@ -11838,7 +12256,7 @@ ShowThinkingEvent(newState)
            SendToProgram("nopost\n", &second);\r
        }\r
     }\r
-    appData.showThinking = newState;\r
+//    appData.showThinking = newState; // [HGM] thinking: responsible option should already have be changed when calling this routine!\r
 }\r
 \r
 void\r
@@ -12015,7 +12433,7 @@ DisplayComment(moveNumber, text)
         if(text == NULL) text = "";                                           \r
         score = pvInfoList[moveNumber].score;\r
         sprintf(buf, "%s%.2f/%d %d\n%s", score>0 ? "+" : "", score/100.,\r
-                              depth, pvInfoList[moveNumber].time, text);\r
+                              depth, (pvInfoList[moveNumber].time+50)/100, text);\r
         CommentPopUp(title, buf);\r
     } else\r
     if (text != NULL)\r
@@ -12113,7 +12531,7 @@ CheckTimeControl()
        gameMode == PlayFromGameFile || forwardMostMove == 0) return;\r
 \r
     /*\r
-     * add time to clocks when time control is achieved ([HGM] now also used fot increment)\r
+     * add time to clocks when time control is achieved ([HGM] now also used for increment)\r
      */\r
     if ( !WhiteOnMove(forwardMostMove) )\r
        /* White made time control */\r
@@ -12326,14 +12744,14 @@ SwitchClocks()
            if(blackNPS >= 0) lastTickLength = 0;\r
            blackTimeRemaining -= lastTickLength;\r
            /* [HGM] PGNtime: save time for PGN file if engine did not give it */\r
-            if(pvInfoList[forwardMostMove-1].time == -1)\r
-                 pvInfoList[forwardMostMove-1].time = \r
+//         if(pvInfoList[forwardMostMove-1].time == -1)\r
+                 pvInfoList[forwardMostMove-1].time =               // use GUI time\r
                       (timeRemaining[1][forwardMostMove-1] - blackTimeRemaining)/10;\r
        } else {\r
           if(whiteNPS >= 0) lastTickLength = 0;\r
           whiteTimeRemaining -= lastTickLength;\r
            /* [HGM] PGNtime: save time for PGN file if engine did not give it */\r
-            if(pvInfoList[forwardMostMove-1].time == -1)\r
+//         if(pvInfoList[forwardMostMove-1].time == -1)\r
                  pvInfoList[forwardMostMove-1].time = \r
                       (timeRemaining[0][forwardMostMove-1] - whiteTimeRemaining)/10;\r
        }\r
@@ -12817,12 +13235,14 @@ ParseFEN(board, blackPlaysFirst, fen)
                 *p++;\r
                 if((int) piece >= (int) BlackPawn ) {\r
                     i = (int)piece - (int)BlackPawn;\r
-                    if( i >= BOARD_HEIGHT ) return FALSE;\r
+                   i = PieceToNumber((ChessSquare)i);\r
+                    if( i >= gameInfo.holdingsSize ) return FALSE;\r
                     board[BOARD_HEIGHT-1-i][0] = piece; /* black holdings */\r
                     board[BOARD_HEIGHT-1-i][1]++;       /* black counts   */\r
                 } else {\r
                     i = (int)piece - (int)WhitePawn;\r
-                    if( i >= BOARD_HEIGHT ) return FALSE;\r
+                   i = PieceToNumber((ChessSquare)i);\r
+                    if( i >= gameInfo.holdingsSize ) return FALSE;\r
                     board[i][BOARD_WIDTH-1] = piece;    /* white holdings */\r
                     board[i][BOARD_WIDTH-2]++;          /* black holdings */\r
                 }\r
index 217aa94..995890d 100644 (file)
--- a/backend.h
+++ b/backend.h
@@ -119,7 +119,8 @@ void UserAdjudicationEvent P((int result));
 void StopObservingEvent P((void));\r
 void StopExaminingEvent P((void));\r
 void PonderNextMoveEvent P((int newState));\r
-void ShowThinkingEvent P((int newState));\r
+void NewSettingeEvent P((int option, char *command, int value));\r
+void ShowThinkingEvent P(());\r
 void PeriodicUpdatesEvent P((int newState));\r
 void HintEvent P((void));\r
 void BookEvent P((void));\r
@@ -259,6 +260,11 @@ typedef struct _CPS {
     int accumulateTC; /* [HGM] secondary TC: how to handle extra sessions   */\r
     int nps;          /* [HGM] nps: factor for node count to replace time   */\r
     int supportsNPS;\r
+    int alphaRank;    /* [HGM] shogi: engine uses shogi-type coordinates    */\r
+    int maxCores;     /* [HGM] SMP: engine understands cores command        */\r
+    int memSize;      /* [HGM] memsize: engine understands memory command   */\r
+    char egtFormats[MSG_SIZ];     /* [HGM] EGT: supported tablebase formats */
+    int bookSuspend;  /* HGM book: go was deferred bcause of book hit       */\r
 } ChessProgramState;\r
 \r
 extern ChessProgramState first, second;\r
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/book.c b/book.c
new file mode 100644 (file)
index 0000000..7e59a7f
--- /dev/null
+++ b/book.c
@@ -0,0 +1,472 @@
+/*\r
+ * book.c -- code for probing P0lyglot opening books\r
+ *\r
+ * This code was first released in the public domain by Michel Van den Bergh.
+ * The array Random64 is taken from the Polyglot source code. 
+ * I am pretty sure that a table of random numbers is never protected
+ * by copyright.
+ *
+ * It s adapted by H.G. Muller for working with xboard / Winboard
+ *\r
+ * The following terms apply to the enhanced version of XBoard distributed\r
+ * by the Free Software Foundation:\r
+ * ------------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * ------------------------------------------------------------------------\r
+ */\r
+\r
+#include <stdio.h>
+#include <string.h>
+
+#include "common.h"
+#include "backend.h"
+
+#ifdef _MSC_VER
+  typedef unsigned __int64 uint64;
+#else
+  typedef unsigned long long int uint64;
+#endif
+
+
+#ifdef _MSC_VER
+#  define U64(u) (u##ui64)
+#else
+#  define U64(u) (u##ULL)
+#endif
+
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
+
+typedef struct {
+    uint64 key;        
+    uint16 move;
+    uint16 weight;
+    uint32 learn;
+} entry_t;
+
+entry_t entry_none = {
+    0, 0, 0, 0
+};
+
+char *promote_pieces=" nbrq";
+extern char castlingRights[][BOARD_SIZE];
+extern char epStatus[];
+
+uint64 Random64[781] = {
+   U64(0x9D39247E33776D41), U64(0x2AF7398005AAA5C7), U64(0x44DB015024623547), U64(0x9C15F73E62A76AE2),
+   U64(0x75834465489C0C89), U64(0x3290AC3A203001BF), U64(0x0FBBAD1F61042279), U64(0xE83A908FF2FB60CA),
+   U64(0x0D7E765D58755C10), U64(0x1A083822CEAFE02D), U64(0x9605D5F0E25EC3B0), U64(0xD021FF5CD13A2ED5),
+   U64(0x40BDF15D4A672E32), U64(0x011355146FD56395), U64(0x5DB4832046F3D9E5), U64(0x239F8B2D7FF719CC),
+   U64(0x05D1A1AE85B49AA1), U64(0x679F848F6E8FC971), U64(0x7449BBFF801FED0B), U64(0x7D11CDB1C3B7ADF0),
+   U64(0x82C7709E781EB7CC), U64(0xF3218F1C9510786C), U64(0x331478F3AF51BBE6), U64(0x4BB38DE5E7219443),
+   U64(0xAA649C6EBCFD50FC), U64(0x8DBD98A352AFD40B), U64(0x87D2074B81D79217), U64(0x19F3C751D3E92AE1),
+   U64(0xB4AB30F062B19ABF), U64(0x7B0500AC42047AC4), U64(0xC9452CA81A09D85D), U64(0x24AA6C514DA27500),
+   U64(0x4C9F34427501B447), U64(0x14A68FD73C910841), U64(0xA71B9B83461CBD93), U64(0x03488B95B0F1850F),
+   U64(0x637B2B34FF93C040), U64(0x09D1BC9A3DD90A94), U64(0x3575668334A1DD3B), U64(0x735E2B97A4C45A23),
+   U64(0x18727070F1BD400B), U64(0x1FCBACD259BF02E7), U64(0xD310A7C2CE9B6555), U64(0xBF983FE0FE5D8244),
+   U64(0x9F74D14F7454A824), U64(0x51EBDC4AB9BA3035), U64(0x5C82C505DB9AB0FA), U64(0xFCF7FE8A3430B241),
+   U64(0x3253A729B9BA3DDE), U64(0x8C74C368081B3075), U64(0xB9BC6C87167C33E7), U64(0x7EF48F2B83024E20),
+   U64(0x11D505D4C351BD7F), U64(0x6568FCA92C76A243), U64(0x4DE0B0F40F32A7B8), U64(0x96D693460CC37E5D),
+   U64(0x42E240CB63689F2F), U64(0x6D2BDCDAE2919661), U64(0x42880B0236E4D951), U64(0x5F0F4A5898171BB6),
+   U64(0x39F890F579F92F88), U64(0x93C5B5F47356388B), U64(0x63DC359D8D231B78), U64(0xEC16CA8AEA98AD76),
+   U64(0x5355F900C2A82DC7), U64(0x07FB9F855A997142), U64(0x5093417AA8A7ED5E), U64(0x7BCBC38DA25A7F3C),
+   U64(0x19FC8A768CF4B6D4), U64(0x637A7780DECFC0D9), U64(0x8249A47AEE0E41F7), U64(0x79AD695501E7D1E8),
+   U64(0x14ACBAF4777D5776), U64(0xF145B6BECCDEA195), U64(0xDABF2AC8201752FC), U64(0x24C3C94DF9C8D3F6),
+   U64(0xBB6E2924F03912EA), U64(0x0CE26C0B95C980D9), U64(0xA49CD132BFBF7CC4), U64(0xE99D662AF4243939),
+   U64(0x27E6AD7891165C3F), U64(0x8535F040B9744FF1), U64(0x54B3F4FA5F40D873), U64(0x72B12C32127FED2B),
+   U64(0xEE954D3C7B411F47), U64(0x9A85AC909A24EAA1), U64(0x70AC4CD9F04F21F5), U64(0xF9B89D3E99A075C2),
+   U64(0x87B3E2B2B5C907B1), U64(0xA366E5B8C54F48B8), U64(0xAE4A9346CC3F7CF2), U64(0x1920C04D47267BBD),
+   U64(0x87BF02C6B49E2AE9), U64(0x092237AC237F3859), U64(0xFF07F64EF8ED14D0), U64(0x8DE8DCA9F03CC54E),
+   U64(0x9C1633264DB49C89), U64(0xB3F22C3D0B0B38ED), U64(0x390E5FB44D01144B), U64(0x5BFEA5B4712768E9),
+   U64(0x1E1032911FA78984), U64(0x9A74ACB964E78CB3), U64(0x4F80F7A035DAFB04), U64(0x6304D09A0B3738C4),
+   U64(0x2171E64683023A08), U64(0x5B9B63EB9CEFF80C), U64(0x506AACF489889342), U64(0x1881AFC9A3A701D6),
+   U64(0x6503080440750644), U64(0xDFD395339CDBF4A7), U64(0xEF927DBCF00C20F2), U64(0x7B32F7D1E03680EC),
+   U64(0xB9FD7620E7316243), U64(0x05A7E8A57DB91B77), U64(0xB5889C6E15630A75), U64(0x4A750A09CE9573F7),
+   U64(0xCF464CEC899A2F8A), U64(0xF538639CE705B824), U64(0x3C79A0FF5580EF7F), U64(0xEDE6C87F8477609D),
+   U64(0x799E81F05BC93F31), U64(0x86536B8CF3428A8C), U64(0x97D7374C60087B73), U64(0xA246637CFF328532),
+   U64(0x043FCAE60CC0EBA0), U64(0x920E449535DD359E), U64(0x70EB093B15B290CC), U64(0x73A1921916591CBD),
+   U64(0x56436C9FE1A1AA8D), U64(0xEFAC4B70633B8F81), U64(0xBB215798D45DF7AF), U64(0x45F20042F24F1768),
+   U64(0x930F80F4E8EB7462), U64(0xFF6712FFCFD75EA1), U64(0xAE623FD67468AA70), U64(0xDD2C5BC84BC8D8FC),
+   U64(0x7EED120D54CF2DD9), U64(0x22FE545401165F1C), U64(0xC91800E98FB99929), U64(0x808BD68E6AC10365),
+   U64(0xDEC468145B7605F6), U64(0x1BEDE3A3AEF53302), U64(0x43539603D6C55602), U64(0xAA969B5C691CCB7A),
+   U64(0xA87832D392EFEE56), U64(0x65942C7B3C7E11AE), U64(0xDED2D633CAD004F6), U64(0x21F08570F420E565),
+   U64(0xB415938D7DA94E3C), U64(0x91B859E59ECB6350), U64(0x10CFF333E0ED804A), U64(0x28AED140BE0BB7DD),
+   U64(0xC5CC1D89724FA456), U64(0x5648F680F11A2741), U64(0x2D255069F0B7DAB3), U64(0x9BC5A38EF729ABD4),
+   U64(0xEF2F054308F6A2BC), U64(0xAF2042F5CC5C2858), U64(0x480412BAB7F5BE2A), U64(0xAEF3AF4A563DFE43),
+   U64(0x19AFE59AE451497F), U64(0x52593803DFF1E840), U64(0xF4F076E65F2CE6F0), U64(0x11379625747D5AF3),
+   U64(0xBCE5D2248682C115), U64(0x9DA4243DE836994F), U64(0x066F70B33FE09017), U64(0x4DC4DE189B671A1C),
+   U64(0x51039AB7712457C3), U64(0xC07A3F80C31FB4B4), U64(0xB46EE9C5E64A6E7C), U64(0xB3819A42ABE61C87),
+   U64(0x21A007933A522A20), U64(0x2DF16F761598AA4F), U64(0x763C4A1371B368FD), U64(0xF793C46702E086A0),
+   U64(0xD7288E012AEB8D31), U64(0xDE336A2A4BC1C44B), U64(0x0BF692B38D079F23), U64(0x2C604A7A177326B3),
+   U64(0x4850E73E03EB6064), U64(0xCFC447F1E53C8E1B), U64(0xB05CA3F564268D99), U64(0x9AE182C8BC9474E8),
+   U64(0xA4FC4BD4FC5558CA), U64(0xE755178D58FC4E76), U64(0x69B97DB1A4C03DFE), U64(0xF9B5B7C4ACC67C96),
+   U64(0xFC6A82D64B8655FB), U64(0x9C684CB6C4D24417), U64(0x8EC97D2917456ED0), U64(0x6703DF9D2924E97E),
+   U64(0xC547F57E42A7444E), U64(0x78E37644E7CAD29E), U64(0xFE9A44E9362F05FA), U64(0x08BD35CC38336615),
+   U64(0x9315E5EB3A129ACE), U64(0x94061B871E04DF75), U64(0xDF1D9F9D784BA010), U64(0x3BBA57B68871B59D),
+   U64(0xD2B7ADEEDED1F73F), U64(0xF7A255D83BC373F8), U64(0xD7F4F2448C0CEB81), U64(0xD95BE88CD210FFA7),
+   U64(0x336F52F8FF4728E7), U64(0xA74049DAC312AC71), U64(0xA2F61BB6E437FDB5), U64(0x4F2A5CB07F6A35B3),
+   U64(0x87D380BDA5BF7859), U64(0x16B9F7E06C453A21), U64(0x7BA2484C8A0FD54E), U64(0xF3A678CAD9A2E38C),
+   U64(0x39B0BF7DDE437BA2), U64(0xFCAF55C1BF8A4424), U64(0x18FCF680573FA594), U64(0x4C0563B89F495AC3),
+   U64(0x40E087931A00930D), U64(0x8CFFA9412EB642C1), U64(0x68CA39053261169F), U64(0x7A1EE967D27579E2),
+   U64(0x9D1D60E5076F5B6F), U64(0x3810E399B6F65BA2), U64(0x32095B6D4AB5F9B1), U64(0x35CAB62109DD038A),
+   U64(0xA90B24499FCFAFB1), U64(0x77A225A07CC2C6BD), U64(0x513E5E634C70E331), U64(0x4361C0CA3F692F12),
+   U64(0xD941ACA44B20A45B), U64(0x528F7C8602C5807B), U64(0x52AB92BEB9613989), U64(0x9D1DFA2EFC557F73),
+   U64(0x722FF175F572C348), U64(0x1D1260A51107FE97), U64(0x7A249A57EC0C9BA2), U64(0x04208FE9E8F7F2D6),
+   U64(0x5A110C6058B920A0), U64(0x0CD9A497658A5698), U64(0x56FD23C8F9715A4C), U64(0x284C847B9D887AAE),
+   U64(0x04FEABFBBDB619CB), U64(0x742E1E651C60BA83), U64(0x9A9632E65904AD3C), U64(0x881B82A13B51B9E2),
+   U64(0x506E6744CD974924), U64(0xB0183DB56FFC6A79), U64(0x0ED9B915C66ED37E), U64(0x5E11E86D5873D484),
+   U64(0xF678647E3519AC6E), U64(0x1B85D488D0F20CC5), U64(0xDAB9FE6525D89021), U64(0x0D151D86ADB73615),
+   U64(0xA865A54EDCC0F019), U64(0x93C42566AEF98FFB), U64(0x99E7AFEABE000731), U64(0x48CBFF086DDF285A),
+   U64(0x7F9B6AF1EBF78BAF), U64(0x58627E1A149BBA21), U64(0x2CD16E2ABD791E33), U64(0xD363EFF5F0977996),
+   U64(0x0CE2A38C344A6EED), U64(0x1A804AADB9CFA741), U64(0x907F30421D78C5DE), U64(0x501F65EDB3034D07),
+   U64(0x37624AE5A48FA6E9), U64(0x957BAF61700CFF4E), U64(0x3A6C27934E31188A), U64(0xD49503536ABCA345),
+   U64(0x088E049589C432E0), U64(0xF943AEE7FEBF21B8), U64(0x6C3B8E3E336139D3), U64(0x364F6FFA464EE52E),
+   U64(0xD60F6DCEDC314222), U64(0x56963B0DCA418FC0), U64(0x16F50EDF91E513AF), U64(0xEF1955914B609F93),
+   U64(0x565601C0364E3228), U64(0xECB53939887E8175), U64(0xBAC7A9A18531294B), U64(0xB344C470397BBA52),
+   U64(0x65D34954DAF3CEBD), U64(0xB4B81B3FA97511E2), U64(0xB422061193D6F6A7), U64(0x071582401C38434D),
+   U64(0x7A13F18BBEDC4FF5), U64(0xBC4097B116C524D2), U64(0x59B97885E2F2EA28), U64(0x99170A5DC3115544),
+   U64(0x6F423357E7C6A9F9), U64(0x325928EE6E6F8794), U64(0xD0E4366228B03343), U64(0x565C31F7DE89EA27),
+   U64(0x30F5611484119414), U64(0xD873DB391292ED4F), U64(0x7BD94E1D8E17DEBC), U64(0xC7D9F16864A76E94),
+   U64(0x947AE053EE56E63C), U64(0xC8C93882F9475F5F), U64(0x3A9BF55BA91F81CA), U64(0xD9A11FBB3D9808E4),
+   U64(0x0FD22063EDC29FCA), U64(0xB3F256D8ACA0B0B9), U64(0xB03031A8B4516E84), U64(0x35DD37D5871448AF),
+   U64(0xE9F6082B05542E4E), U64(0xEBFAFA33D7254B59), U64(0x9255ABB50D532280), U64(0xB9AB4CE57F2D34F3),
+   U64(0x693501D628297551), U64(0xC62C58F97DD949BF), U64(0xCD454F8F19C5126A), U64(0xBBE83F4ECC2BDECB),
+   U64(0xDC842B7E2819E230), U64(0xBA89142E007503B8), U64(0xA3BC941D0A5061CB), U64(0xE9F6760E32CD8021),
+   U64(0x09C7E552BC76492F), U64(0x852F54934DA55CC9), U64(0x8107FCCF064FCF56), U64(0x098954D51FFF6580),
+   U64(0x23B70EDB1955C4BF), U64(0xC330DE426430F69D), U64(0x4715ED43E8A45C0A), U64(0xA8D7E4DAB780A08D),
+   U64(0x0572B974F03CE0BB), U64(0xB57D2E985E1419C7), U64(0xE8D9ECBE2CF3D73F), U64(0x2FE4B17170E59750),
+   U64(0x11317BA87905E790), U64(0x7FBF21EC8A1F45EC), U64(0x1725CABFCB045B00), U64(0x964E915CD5E2B207),
+   U64(0x3E2B8BCBF016D66D), U64(0xBE7444E39328A0AC), U64(0xF85B2B4FBCDE44B7), U64(0x49353FEA39BA63B1),
+   U64(0x1DD01AAFCD53486A), U64(0x1FCA8A92FD719F85), U64(0xFC7C95D827357AFA), U64(0x18A6A990C8B35EBD),
+   U64(0xCCCB7005C6B9C28D), U64(0x3BDBB92C43B17F26), U64(0xAA70B5B4F89695A2), U64(0xE94C39A54A98307F),
+   U64(0xB7A0B174CFF6F36E), U64(0xD4DBA84729AF48AD), U64(0x2E18BC1AD9704A68), U64(0x2DE0966DAF2F8B1C),
+   U64(0xB9C11D5B1E43A07E), U64(0x64972D68DEE33360), U64(0x94628D38D0C20584), U64(0xDBC0D2B6AB90A559),
+   U64(0xD2733C4335C6A72F), U64(0x7E75D99D94A70F4D), U64(0x6CED1983376FA72B), U64(0x97FCAACBF030BC24),
+   U64(0x7B77497B32503B12), U64(0x8547EDDFB81CCB94), U64(0x79999CDFF70902CB), U64(0xCFFE1939438E9B24),
+   U64(0x829626E3892D95D7), U64(0x92FAE24291F2B3F1), U64(0x63E22C147B9C3403), U64(0xC678B6D860284A1C),
+   U64(0x5873888850659AE7), U64(0x0981DCD296A8736D), U64(0x9F65789A6509A440), U64(0x9FF38FED72E9052F),
+   U64(0xE479EE5B9930578C), U64(0xE7F28ECD2D49EECD), U64(0x56C074A581EA17FE), U64(0x5544F7D774B14AEF),
+   U64(0x7B3F0195FC6F290F), U64(0x12153635B2C0CF57), U64(0x7F5126DBBA5E0CA7), U64(0x7A76956C3EAFB413),
+   U64(0x3D5774A11D31AB39), U64(0x8A1B083821F40CB4), U64(0x7B4A38E32537DF62), U64(0x950113646D1D6E03),
+   U64(0x4DA8979A0041E8A9), U64(0x3BC36E078F7515D7), U64(0x5D0A12F27AD310D1), U64(0x7F9D1A2E1EBE1327),
+   U64(0xDA3A361B1C5157B1), U64(0xDCDD7D20903D0C25), U64(0x36833336D068F707), U64(0xCE68341F79893389),
+   U64(0xAB9090168DD05F34), U64(0x43954B3252DC25E5), U64(0xB438C2B67F98E5E9), U64(0x10DCD78E3851A492),
+   U64(0xDBC27AB5447822BF), U64(0x9B3CDB65F82CA382), U64(0xB67B7896167B4C84), U64(0xBFCED1B0048EAC50),
+   U64(0xA9119B60369FFEBD), U64(0x1FFF7AC80904BF45), U64(0xAC12FB171817EEE7), U64(0xAF08DA9177DDA93D),
+   U64(0x1B0CAB936E65C744), U64(0xB559EB1D04E5E932), U64(0xC37B45B3F8D6F2BA), U64(0xC3A9DC228CAAC9E9),
+   U64(0xF3B8B6675A6507FF), U64(0x9FC477DE4ED681DA), U64(0x67378D8ECCEF96CB), U64(0x6DD856D94D259236),
+   U64(0xA319CE15B0B4DB31), U64(0x073973751F12DD5E), U64(0x8A8E849EB32781A5), U64(0xE1925C71285279F5),
+   U64(0x74C04BF1790C0EFE), U64(0x4DDA48153C94938A), U64(0x9D266D6A1CC0542C), U64(0x7440FB816508C4FE),
+   U64(0x13328503DF48229F), U64(0xD6BF7BAEE43CAC40), U64(0x4838D65F6EF6748F), U64(0x1E152328F3318DEA),
+   U64(0x8F8419A348F296BF), U64(0x72C8834A5957B511), U64(0xD7A023A73260B45C), U64(0x94EBC8ABCFB56DAE),
+   U64(0x9FC10D0F989993E0), U64(0xDE68A2355B93CAE6), U64(0xA44CFE79AE538BBE), U64(0x9D1D84FCCE371425),
+   U64(0x51D2B1AB2DDFB636), U64(0x2FD7E4B9E72CD38C), U64(0x65CA5B96B7552210), U64(0xDD69A0D8AB3B546D),
+   U64(0x604D51B25FBF70E2), U64(0x73AA8A564FB7AC9E), U64(0x1A8C1E992B941148), U64(0xAAC40A2703D9BEA0),
+   U64(0x764DBEAE7FA4F3A6), U64(0x1E99B96E70A9BE8B), U64(0x2C5E9DEB57EF4743), U64(0x3A938FEE32D29981),
+   U64(0x26E6DB8FFDF5ADFE), U64(0x469356C504EC9F9D), U64(0xC8763C5B08D1908C), U64(0x3F6C6AF859D80055),
+   U64(0x7F7CC39420A3A545), U64(0x9BFB227EBDF4C5CE), U64(0x89039D79D6FC5C5C), U64(0x8FE88B57305E2AB6),
+   U64(0xA09E8C8C35AB96DE), U64(0xFA7E393983325753), U64(0xD6B6D0ECC617C699), U64(0xDFEA21EA9E7557E3),
+   U64(0xB67C1FA481680AF8), U64(0xCA1E3785A9E724E5), U64(0x1CFC8BED0D681639), U64(0xD18D8549D140CAEA),
+   U64(0x4ED0FE7E9DC91335), U64(0xE4DBF0634473F5D2), U64(0x1761F93A44D5AEFE), U64(0x53898E4C3910DA55),
+   U64(0x734DE8181F6EC39A), U64(0x2680B122BAA28D97), U64(0x298AF231C85BAFAB), U64(0x7983EED3740847D5),
+   U64(0x66C1A2A1A60CD889), U64(0x9E17E49642A3E4C1), U64(0xEDB454E7BADC0805), U64(0x50B704CAB602C329),
+   U64(0x4CC317FB9CDDD023), U64(0x66B4835D9EAFEA22), U64(0x219B97E26FFC81BD), U64(0x261E4E4C0A333A9D),
+   U64(0x1FE2CCA76517DB90), U64(0xD7504DFA8816EDBB), U64(0xB9571FA04DC089C8), U64(0x1DDC0325259B27DE),
+   U64(0xCF3F4688801EB9AA), U64(0xF4F5D05C10CAB243), U64(0x38B6525C21A42B0E), U64(0x36F60E2BA4FA6800),
+   U64(0xEB3593803173E0CE), U64(0x9C4CD6257C5A3603), U64(0xAF0C317D32ADAA8A), U64(0x258E5A80C7204C4B),
+   U64(0x8B889D624D44885D), U64(0xF4D14597E660F855), U64(0xD4347F66EC8941C3), U64(0xE699ED85B0DFB40D),
+   U64(0x2472F6207C2D0484), U64(0xC2A1E7B5B459AEB5), U64(0xAB4F6451CC1D45EC), U64(0x63767572AE3D6174),
+   U64(0xA59E0BD101731A28), U64(0x116D0016CB948F09), U64(0x2CF9C8CA052F6E9F), U64(0x0B090A7560A968E3),
+   U64(0xABEEDDB2DDE06FF1), U64(0x58EFC10B06A2068D), U64(0xC6E57A78FBD986E0), U64(0x2EAB8CA63CE802D7),
+   U64(0x14A195640116F336), U64(0x7C0828DD624EC390), U64(0xD74BBE77E6116AC7), U64(0x804456AF10F5FB53),
+   U64(0xEBE9EA2ADF4321C7), U64(0x03219A39EE587A30), U64(0x49787FEF17AF9924), U64(0xA1E9300CD8520548),
+   U64(0x5B45E522E4B1B4EF), U64(0xB49C3B3995091A36), U64(0xD4490AD526F14431), U64(0x12A8F216AF9418C2),
+   U64(0x001F837CC7350524), U64(0x1877B51E57A764D5), U64(0xA2853B80F17F58EE), U64(0x993E1DE72D36D310),
+   U64(0xB3598080CE64A656), U64(0x252F59CF0D9F04BB), U64(0xD23C8E176D113600), U64(0x1BDA0492E7E4586E),
+   U64(0x21E0BD5026C619BF), U64(0x3B097ADAF088F94E), U64(0x8D14DEDB30BE846E), U64(0xF95CFFA23AF5F6F4),
+   U64(0x3871700761B3F743), U64(0xCA672B91E9E4FA16), U64(0x64C8E531BFF53B55), U64(0x241260ED4AD1E87D),
+   U64(0x106C09B972D2E822), U64(0x7FBA195410E5CA30), U64(0x7884D9BC6CB569D8), U64(0x0647DFEDCD894A29),
+   U64(0x63573FF03E224774), U64(0x4FC8E9560F91B123), U64(0x1DB956E450275779), U64(0xB8D91274B9E9D4FB),
+   U64(0xA2EBEE47E2FBFCE1), U64(0xD9F1F30CCD97FB09), U64(0xEFED53D75FD64E6B), U64(0x2E6D02C36017F67F),
+   U64(0xA9AA4D20DB084E9B), U64(0xB64BE8D8B25396C1), U64(0x70CB6AF7C2D5BCF0), U64(0x98F076A4F7A2322E),
+   U64(0xBF84470805E69B5F), U64(0x94C3251F06F90CF3), U64(0x3E003E616A6591E9), U64(0xB925A6CD0421AFF3),
+   U64(0x61BDD1307C66E300), U64(0xBF8D5108E27E0D48), U64(0x240AB57A8B888B20), U64(0xFC87614BAF287E07),
+   U64(0xEF02CDD06FFDB432), U64(0xA1082C0466DF6C0A), U64(0x8215E577001332C8), U64(0xD39BB9C3A48DB6CF),
+   U64(0x2738259634305C14), U64(0x61CF4F94C97DF93D), U64(0x1B6BACA2AE4E125B), U64(0x758F450C88572E0B),
+   U64(0x959F587D507A8359), U64(0xB063E962E045F54D), U64(0x60E8ED72C0DFF5D1), U64(0x7B64978555326F9F),
+   U64(0xFD080D236DA814BA), U64(0x8C90FD9B083F4558), U64(0x106F72FE81E2C590), U64(0x7976033A39F7D952),
+   U64(0xA4EC0132764CA04B), U64(0x733EA705FAE4FA77), U64(0xB4D8F77BC3E56167), U64(0x9E21F4F903B33FD9),
+   U64(0x9D765E419FB69F6D), U64(0xD30C088BA61EA5EF), U64(0x5D94337FBFAF7F5B), U64(0x1A4E4822EB4D7A59),
+   U64(0x6FFE73E81B637FB3), U64(0xDDF957BC36D8B9CA), U64(0x64D0E29EEA8838B3), U64(0x08DD9BDFD96B9F63),
+   U64(0x087E79E5A57D1D13), U64(0xE328E230E3E2B3FB), U64(0x1C2559E30F0946BE), U64(0x720BF5F26F4D2EAA),
+   U64(0xB0774D261CC609DB), U64(0x443F64EC5A371195), U64(0x4112CF68649A260E), U64(0xD813F2FAB7F5C5CA),
+   U64(0x660D3257380841EE), U64(0x59AC2C7873F910A3), U64(0xE846963877671A17), U64(0x93B633ABFA3469F8),
+   U64(0xC0C0F5A60EF4CDCF), U64(0xCAF21ECD4377B28C), U64(0x57277707199B8175), U64(0x506C11B9D90E8B1D),
+   U64(0xD83CC2687A19255F), U64(0x4A29C6465A314CD1), U64(0xED2DF21216235097), U64(0xB5635C95FF7296E2),
+   U64(0x22AF003AB672E811), U64(0x52E762596BF68235), U64(0x9AEBA33AC6ECC6B0), U64(0x944F6DE09134DFB6),
+   U64(0x6C47BEC883A7DE39), U64(0x6AD047C430A12104), U64(0xA5B1CFDBA0AB4067), U64(0x7C45D833AFF07862),
+   U64(0x5092EF950A16DA0B), U64(0x9338E69C052B8E7B), U64(0x455A4B4CFE30E3F5), U64(0x6B02E63195AD0CF8),
+   U64(0x6B17B224BAD6BF27), U64(0xD1E0CCD25BB9C169), U64(0xDE0C89A556B9AE70), U64(0x50065E535A213CF6),
+   U64(0x9C1169FA2777B874), U64(0x78EDEFD694AF1EED), U64(0x6DC93D9526A50E68), U64(0xEE97F453F06791ED),
+   U64(0x32AB0EDB696703D3), U64(0x3A6853C7E70757A7), U64(0x31865CED6120F37D), U64(0x67FEF95D92607890),
+   U64(0x1F2B1D1F15F6DC9C), U64(0xB69E38A8965C6B65), U64(0xAA9119FF184CCCF4), U64(0xF43C732873F24C13),
+   U64(0xFB4A3D794A9A80D2), U64(0x3550C2321FD6109C), U64(0x371F77E76BB8417E), U64(0x6BFA9AAE5EC05779),
+   U64(0xCD04F3FF001A4778), U64(0xE3273522064480CA), U64(0x9F91508BFFCFC14A), U64(0x049A7F41061A9E60),
+   U64(0xFCB6BE43A9F2FE9B), U64(0x08DE8A1C7797DA9B), U64(0x8F9887E6078735A1), U64(0xB5B4071DBFC73A66),
+   U64(0x230E343DFBA08D33), U64(0x43ED7F5A0FAE657D), U64(0x3A88A0FBBCB05C63), U64(0x21874B8B4D2DBC4F),
+   U64(0x1BDEA12E35F6A8C9), U64(0x53C065C6C8E63528), U64(0xE34A1D250E7A8D6B), U64(0xD6B04D3B7651DD7E),
+   U64(0x5E90277E7CB39E2D), U64(0x2C046F22062DC67D), U64(0xB10BB459132D0A26), U64(0x3FA9DDFB67E2F199),
+   U64(0x0E09B88E1914F7AF), U64(0x10E8B35AF3EEAB37), U64(0x9EEDECA8E272B933), U64(0xD4C718BC4AE8AE5F),
+   U64(0x81536D601170FC20), U64(0x91B534F885818A06), U64(0xEC8177F83F900978), U64(0x190E714FADA5156E),
+   U64(0xB592BF39B0364963), U64(0x89C350C893AE7DC1), U64(0xAC042E70F8B383F2), U64(0xB49B52E587A1EE60),
+   U64(0xFB152FE3FF26DA89), U64(0x3E666E6F69AE2C15), U64(0x3B544EBE544C19F9), U64(0xE805A1E290CF2456),
+   U64(0x24B33C9D7ED25117), U64(0xE74733427B72F0C1), U64(0x0A804D18B7097475), U64(0x57E3306D881EDB4F),
+   U64(0x4AE7D6A36EB5DBCB), U64(0x2D8D5432157064C8), U64(0xD1E649DE1E7F268B), U64(0x8A328A1CEDFE552C),
+   U64(0x07A3AEC79624C7DA), U64(0x84547DDC3E203C94), U64(0x990A98FD5071D263), U64(0x1A4FF12616EEFC89),
+   U64(0xF6F7FD1431714200), U64(0x30C05B1BA332F41C), U64(0x8D2636B81555A786), U64(0x46C9FEB55D120902),
+   U64(0xCCEC0A73B49C9921), U64(0x4E9D2827355FC492), U64(0x19EBB029435DCB0F), U64(0x4659D2B743848A2C),
+   U64(0x963EF2C96B33BE31), U64(0x74F85198B05A2E7D), U64(0x5A0F544DD2B1FB18), U64(0x03727073C2E134B1),
+   U64(0xC7F6AA2DE59AEA61), U64(0x352787BAA0D7C22F), U64(0x9853EAB63B5E0B35), U64(0xABBDCDD7ED5C0860),
+   U64(0xCF05DAF5AC8D77B0), U64(0x49CAD48CEBF4A71E), U64(0x7A4C10EC2158C4A6), U64(0xD9E92AA246BF719E),
+   U64(0x13AE978D09FE5557), U64(0x730499AF921549FF), U64(0x4E4B705B92903BA4), U64(0xFF577222C14F0A3A),
+   U64(0x55B6344CF97AAFAE), U64(0xB862225B055B6960), U64(0xCAC09AFBDDD2CDB4), U64(0xDAF8E9829FE96B5F),
+   U64(0xB5FDFC5D3132C498), U64(0x310CB380DB6F7503), U64(0xE87FBB46217A360E), U64(0x2102AE466EBB1148),
+   U64(0xF8549E1A3AA5E00D), U64(0x07A69AFDCC42261A), U64(0xC4C118BFE78FEAAE), U64(0xF9F4892ED96BD438),
+   U64(0x1AF3DBE25D8F45DA), U64(0xF5B4B0B0D2DEEEB4), U64(0x962ACEEFA82E1C84), U64(0x046E3ECAAF453CE9),
+   U64(0xF05D129681949A4C), U64(0x964781CE734B3C84), U64(0x9C2ED44081CE5FBD), U64(0x522E23F3925E319E),
+   U64(0x177E00F9FC32F791), U64(0x2BC60A63A6F3B3F2), U64(0x222BBFAE61725606), U64(0x486289DDCC3D6780),
+   U64(0x7DC7785B8EFDFC80), U64(0x8AF38731C02BA980), U64(0x1FAB64EA29A2DDF7), U64(0xE4D9429322CD065A),
+   U64(0x9DA058C67844F20C), U64(0x24C0E332B70019B0), U64(0x233003B5A6CFE6AD), U64(0xD586BD01C5C217F6),
+   U64(0x5E5637885F29BC2B), U64(0x7EBA726D8C94094B), U64(0x0A56A5F0BFE39272), U64(0xD79476A84EE20D06),
+   U64(0x9E4C1269BAA4BF37), U64(0x17EFEE45B0DEE640), U64(0x1D95B0A5FCF90BC6), U64(0x93CBE0B699C2585D),
+   U64(0x65FA4F227A2B6D79), U64(0xD5F9E858292504D5), U64(0xC2B5A03F71471A6F), U64(0x59300222B4561E00),
+   U64(0xCE2F8642CA0712DC), U64(0x7CA9723FBB2E8988), U64(0x2785338347F2BA08), U64(0xC61BB3A141E50E8C),
+   U64(0x150F361DAB9DEC26), U64(0x9F6A419D382595F4), U64(0x64A53DC924FE7AC9), U64(0x142DE49FFF7A7C3D),
+   U64(0x0C335248857FA9E7), U64(0x0A9C32D5EAE45305), U64(0xE6C42178C4BBB92E), U64(0x71F1CE2490D20B07),
+   U64(0xF1BCC3D275AFE51A), U64(0xE728E8C83C334074), U64(0x96FBF83A12884624), U64(0x81A1549FD6573DA5),
+   U64(0x5FA7867CAF35E149), U64(0x56986E2EF3ED091B), U64(0x917F1DD5F8886C61), U64(0xD20D8C88C8FFE65F),
+   U64(0x31D71DCE64B2C310), U64(0xF165B587DF898190), U64(0xA57E6339DD2CF3A0), U64(0x1EF6E6DBB1961EC9),
+   U64(0x70CC73D90BC26E24), U64(0xE21A6B35DF0C3AD7), U64(0x003A93D8B2806962), U64(0x1C99DED33CB890A1),
+   U64(0xCF3145DE0ADD4289), U64(0xD0E4427A5514FB72), U64(0x77C621CC9FB3A483), U64(0x67A34DAC4356550B),
+   U64(0xF8D626AAAF278509),
+};
+
+uint64 *RandomPiece     =Random64;
+uint64 *RandomCastle    =Random64+768;
+uint64 *RandomEnPassant =Random64+772;
+uint64 *RandomTurn      =Random64+780;
+
+
+uint64 hash(int moveNr)
+{
+    char c;
+    int p, r, f, i, p_enc;
+    uint64 key=0;
+
+    for(f=BOARD_LEFT; f<BOARD_RGHT; f++){
+        for(r=0; r<BOARD_HEIGHT;r++){
+            ChessSquare p = boards[moveNr][r][f];
+            if(p != EmptySquare){
+               int j = (int)p;
+               j -= (j >= (int)BlackPawn) ? (int)BlackPawn :(int)WhitePawn;
+               p_enc = 2*j + ((int)p < (int)BlackPawn);
+               if(p_enc >= 2*(int)WhiteKing) // king code is not contiguous!
+                       p_enc += 2*((int)WhiteQueen - (int)WhiteKing + 1);
+                key ^= RandomPiece[64*p_enc+8*r+f];
+            }
+        }
+    }
+    if(castlingRights[moveNr][2] >= 0) {
+       if(castlingRights[moveNr][0] >= 0) key^=RandomCastle[0];
+       if(castlingRights[moveNr][1] >= 0) key^=RandomCastle[1];
+    }
+    if(castlingRights[moveNr][5] >= 0) {
+       if(castlingRights[moveNr][3] >= 0) key^=RandomCastle[2];
+       if(castlingRights[moveNr][4] >= 0) key^=RandomCastle[3];
+    }
+
+    f = epStatus[moveNr];
+    if(f >= 0 && f < 8){
+        if(!WhiteOnMove(moveNr)){
+           // the test for neighboring Pawns might not be needed, 
+           // as epStatus already kept track of it, but better safe than sorry.
+            if((f>0 && boards[moveNr][3][f-1]==BlackPawn)||
+               (f<7 && boards[moveNr][3][f+1]==BlackPawn)){
+                key^=RandomEnPassant[f];
+            }
+        }else{
+            if((f>0 && boards[moveNr][4][f-1]==WhitePawn)||
+               (f<7 && boards[moveNr][4][f+1]==WhitePawn)){
+                key^=RandomEnPassant[f];
+            }
+        }
+    }
+
+    if(WhiteOnMove(moveNr)){
+        key^=RandomTurn[0];
+    }
+    return key;
+}
+
+#define MOVE_BUF 100
+
+int int_from_file(FILE *f, int l, uint64 *r)
+{
+    int i,c;
+    for(i=0;i<l;i++){
+        c=fgetc(f);
+        if(c==EOF){
+            return 1;
+        }
+        (*r)=((*r)<<8)+c;
+    }
+    return 0;
+}
+
+int entry_from_file(FILE *f, entry_t *entry)
+{
+    int ret;
+    uint64 r;
+    ret=int_from_file(f,8,&r);
+    if(ret) return 1;
+    entry->key=r;
+    ret=int_from_file(f,2,&r);
+    if(ret) return 1;
+    entry->move=r;
+    ret=int_from_file(f,2,&r);
+    if(ret) return 1;
+    entry->weight=r;
+    ret=int_from_file(f,4,&r);
+    if(ret) return 1;
+    entry->learn=r;
+    return 0;
+}
+
+int find_key(FILE *f, uint64 key, entry_t *entry)
+{
+    int first, last, middle;
+    entry_t first_entry=entry_none, last_entry,middle_entry;
+    first=-1;
+    if(fseek(f,-16,SEEK_END)){
+        *entry=entry_none;
+        entry->key=key+1; //hack
+        return -1;
+    }
+    last=ftell(f)/16;
+    entry_from_file(f,&last_entry);
+    while(1){
+        if(last-first==1){
+            *entry=last_entry;
+            return last;
+        }
+        middle=(first+last)/2;
+        fseek(f,16*middle,SEEK_SET);
+        entry_from_file(f,&middle_entry);
+        if(key<=middle_entry.key){
+            last=middle;
+            last_entry=middle_entry;
+        }else{
+            first=middle;
+            first_entry=middle_entry;
+        }
+    }
+}
+
+void move_to_string(char move_s[6], uint16 move)
+{
+    int f,fr,ff,t,tr,tf,p;
+    f=(move>>6)&077;
+    fr=(f>>3)&0x7;
+    ff=f&0x7;
+    t=move&077;
+    tr=(t>>3)&0x7;
+    tf=t&0x7;
+    p=(move>>12)&0x7;
+    move_s[0]=ff+'a';
+    move_s[1]=fr+'1';
+    move_s[2]=tf+'a';
+    move_s[3]=tr+'1';
+    if(p){
+        move_s[4]=promote_pieces[p];
+        move_s[5]='\0';
+    }else{
+        move_s[4]='\0';
+    }
+    if(!strcmp(move_s,"e1h1")){
+        strcpy(move_s,"e1g1");
+    }else  if(!strcmp(move_s,"e1a1")){
+        strcpy(move_s,"e1c1");
+    }else  if(!strcmp(move_s,"e8h8")){
+        strcpy(move_s,"e8g8");
+    }else  if(!strcmp(move_s,"e8a8")){
+        strcpy(move_s,"e8c8");
+    }
+}
+
+char *ProbeBook(int moveNr, char *book)
+{
+    FILE *f;
+    entry_t entry;
+    int offset;
+    uint64 key;
+    entry_t entries[MOVE_BUF];
+    int count=0;
+    int ret, i, j;
+    static char move_s[6];
+    int total_weight;
+
+    if(book == NULL) return NULL; 
+    if(gameInfo.variant != VariantNormal) return NULL; // Zobrist scheme only works for normal Chess, so far
+    f=fopen(book,"rb");
+    if(!f){
+        DisplayError("Polyglot book not valid", 0);
+       appData.usePolyglotBook = FALSE;
+        return NULL;
+    }
+
+    key = hash(moveNr);
+
+    offset=find_key(f, key, &entry);
+    if(entry.key != key) return NULL;
+    entries[0] = entry;
+    count=1;
+    fseek(f, 16*(offset+1), SEEK_SET);
+    while(1){
+        ret=entry_from_file(f, &entry);
+        if(ret){
+            break;
+        }
+        if(entry.key != key){
+            break;
+        }
+        if(count == MOVE_BUF) break;
+        entries[count++] = entry;
+    }
+    total_weight = 0;
+    for(i=0; i<count; i++){
+        total_weight += entries[i].weight;
+    }
+    j = (random() & 0x7FFF) * total_weight >> 15; // create random < total_weight
+    total_weight = 0;
+    for(i=0; i<count; i++){
+        total_weight += entries[i].weight;
+       if(total_weight > j) break;
+    }
+    if(i >= count) DisplayFatalError("Book Fault", 0, 1); // safety catch, cannot happen
+    move_to_string(move_s, entries[i].move);
+
+    return move_s;
+}
index cde32fb..6d8a6ec 100644 (file)
--- a/common.h
+++ b/common.h
@@ -100,7 +100,11 @@ int pclose(FILE *);
 \r
 /* End compatibility grunge */\r
 \r
-#define PROTOVER                2       /* engine protocol version */\r
+#define PROTOVER                2       /* engine protocol version */
+
+// [HGM] license: Messages that engines must print to satisfy their license requirements for patented variants\r
+#define GOTHIC "Gothic Chess (see www.GothicChess.com) is licensed under U.S. Patent #6,481,716 by Ed Trice"\r
+#define NOFALCON "Falcon Chess (see www.chessvariants.com) is licensed under U.S. Patent #5,690,334 by George W. Duke"\r
 \r
 /* [HGM] Some notes about board sizes:\r
    In games that allow piece drops, the holdings are considered part of the\r
@@ -221,10 +225,10 @@ typedef enum {
     BlackHSideCastleFR, BlackASideCastleFR, \r
     WhitePromotionKnight, WhitePromotionBishop,\r
     WhitePromotionRook, WhitePromotionQueen, WhitePromotionKing,\r
-    WhitePromotionChancellor, WhitePromotionArchbishop,\r
+    WhitePromotionChancellor, WhitePromotionArchbishop, WhitePromotionCentaur,\r
     BlackPromotionKnight, BlackPromotionBishop,\r
     BlackPromotionRook, BlackPromotionQueen, BlackPromotionKing,\r
-    BlackPromotionChancellor, BlackPromotionArchbishop,\r
+    BlackPromotionChancellor, BlackPromotionArchbishop, BlackPromotionCentaur,\r
     WhiteCapturesEnPassant, BlackCapturesEnPassant,\r
     WhiteDrop, BlackDrop, \r
     NormalMove, AmbiguousMove, IllegalMove, ImpossibleMove,\r
@@ -244,13 +248,6 @@ typedef enum {
     SoundIcsDraw, SoundIcsUnfinished, NSoundClasses\r
 } SoundClass;\r
 \r
-typedef enum { \r
-  SizeTiny, SizeTeeny, SizeDinky, SizePetite, SizeSlim, SizeSmall,\r
-  SizeMediocre, SizeMiddling, SizeAverage, SizeModerate, SizeMedium,\r
-  SizeBulky, SizeLarge, SizeBig, SizeHuge, SizeGiant, SizeColossal,\r
-  SizeTitanic, NUM_SIZES \r
-} BoardSize;\r
-\r
 /* Names for chess variants, not necessarily supported */\r
 typedef enum {\r
     VariantNormal,       /* Normal chess */\r
@@ -288,6 +285,7 @@ typedef enum {
     VariantCapaRandom,\r
     VariantBerolina,\r
     VariantJanus,\r
+    VariantSuper,\r
     VariantUnknown       /* Catchall for other unknown variants */\r
 } VariantClass;\r
 \r
@@ -326,6 +324,8 @@ typedef enum {
   "falcon",\\r
   "caparandom",\\r
   "berolina",\\r
+  "janus",\\r
+  "super",\\r
   "unknown" \\r
 }\r
 \r
@@ -573,6 +573,10 @@ typedef struct {
     Boolean autoKibitz;\r
     int engineComments;\r
     char *userName;\r
+    int rewindIndex;    /* [HGM] autoinc   */\r
+    int sameColorGames; /* [HGM] alternate */\r
+    int smpCores;\r
+    char *egtFormats;\r
 } AppData, *AppDataPtr;\r
 \r
 /* [AS] PGN tags (for showing in the game list) */\r
old mode 100755 (executable)
new mode 100644 (file)
index 5f518f1..b07e8e1 100644 (file)
@@ -1,27 +1,18 @@
-/* config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+/* This file is just here to make autoheader happy, so it will generate
+   config.h for me. */
 
-/* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
-#undef HAVE_SYS_WAIT_H
+#define FIRST_PTY_LETTER 'p'
 
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
+#define HAVE_FCNTL_H 0
 
-/* Define as the return type of signal handlers (int or void).  */
-#undef RETSIGTYPE
+#define HAVE_GETHOSTNAME 0
 
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
+#define HAVE_GETTIMEOFDAY 0
 
-/* Define if you can safely include both <sys/time.h> and <time.h>.  */
-#undef TIME_WITH_SYS_TIME
+#define HAVE_RANDOM 0
 
-/* Define if the X Window System is missing or not being used.  */
-#undef X_DISPLAY_MISSING
-
-/* Define if lex declares yytext as a char * by default, not a char[].  */
-#undef YYTEXT_POINTER
-
-#define FIRST_PTY_LETTER 'p'
+#define HAVE_SYS_SOCKET_H 0
 
 #undef IBMRTAIX
 
@@ -35,6 +26,8 @@
 
 #undef PTY_NAME_SPRINTF
 
+#undef PTY_OPEN
+
 #undef PTY_TTY_NAME_SPRINTF
 
 #define REMOTE_SHELL "rsh"
 
 #undef HAVE_LIBXPM
 
+#define HAVE_USLEEP 0
+
 #undef USE_XAW3D
 
-/* Define if you have the _getpty function.  */
-#undef HAVE__GETPTY
+#define X_LOCALE
 
-/* Define if you have the ftime function.  */
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `ftime' function. */
 #undef HAVE_FTIME
 
-/* Define if you have the gethostname function.  */
+/* Define to 1 if you have the `gethostname' function. */
 #undef HAVE_GETHOSTNAME
 
-/* Define if you have the gettimeofday function.  */
+/* Define to 1 if you have the `gettimeofday' function. */
 #undef HAVE_GETTIMEOFDAY
 
-/* Define if you have the grantpt function.  */
+/* Define to 1 if you have the `grantpt' function. */
 #undef HAVE_GRANTPT
 
-/* Define if you have the rand48 function.  */
-#undef HAVE_RAND48
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define if you have the random function.  */
-#undef HAVE_RANDOM
+/* Define to 1 if you have the <lan/socket.h> header file. */
+#undef HAVE_LAN_SOCKET_H
 
-/* Define if you have the sysinfo function.  */
-#undef HAVE_SYSINFO
+/* Define to 1 if you have the `i' library (-li). */
+#undef HAVE_LIBI
 
-/* Define if you have the usleep function.  */
-#undef HAVE_USLEEP
+/* Define to 1 if you have the `seq' library (-lseq). */
+#undef HAVE_LIBSEQ
 
-/* Define if you have the <X11/xpm.h> header file.  */
-#undef HAVE_X11_XPM_H
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
 
-/* Define if you have the <dirent.h> header file.  */
-#undef HAVE_DIRENT_H
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#undef HAVE_NDIR_H
 
-/* Define if you have the <fcntl.h> header file.  */
-#undef HAVE_FCNTL_H
+/* Define to 1 if you have the `rand48' function. */
+#undef HAVE_RAND48
 
-/* Define if you have the <lan/socket.h> header file.  */
-#undef HAVE_LAN_SOCKET_H
+/* Define to 1 if you have the `random' function. */
+#undef HAVE_RANDOM
 
-/* Define if you have the <ndir.h> header file.  */
-#undef HAVE_NDIR_H
+/* Define to 1 if you have the `setitimer' function. */
+#undef HAVE_SETITIMER
 
-/* Define if you have the <string.h> header file.  */
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
-/* Define if you have the <stropts.h> header file.  */
+/* Define to 1 if you have the <stropts.h> header file. */
 #undef HAVE_STROPTS_H
 
-/* Define if you have the <sys/dir.h> header file.  */
+/* Define to 1 if you have the `sysinfo' function. */
+#undef HAVE_SYSINFO
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
 #undef HAVE_SYS_DIR_H
 
-/* Define if you have the <sys/fcntl.h> header file.  */
+/* Define to 1 if you have the <sys/fcntl.h> header file. */
 #undef HAVE_SYS_FCNTL_H
 
-/* Define if you have the <sys/ndir.h> header file.  */
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
 #undef HAVE_SYS_NDIR_H
 
-/* Define if you have the <sys/socket.h> header file.  */
+/* Define to 1 if you have the <sys/socket.h> header file. */
 #undef HAVE_SYS_SOCKET_H
 
-/* Define if you have the <sys/systeminfo.h> header file.  */
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/systeminfo.h> header file. */
 #undef HAVE_SYS_SYSTEMINFO_H
 
-/* Define if you have the <sys/time.h> header file.  */
+/* Define to 1 if you have the <sys/time.h> header file. */
 #undef HAVE_SYS_TIME_H
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define if you have the i library (-li).  */
-#undef HAVE_LIBI
+/* Define to 1 if you have the `usleep' function. */
+#undef HAVE_USLEEP
 
-/* Define if you have the seq library (-lseq).  */
-#undef HAVE_LIBSEQ
+/* Define to 1 if you have the <X11/xpm.h> header file. */
+#undef HAVE_X11_XPM_H
+
+/* Define to 1 if you have the `_getpty' function. */
+#undef HAVE__GETPTY
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to 1 if the X Window System is missing or not being used. */
+#undef X_DISPLAY_MISSING
+
+/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
+   `char[]'. */
+#undef YYTEXT_POINTER
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
index 16030dd..631b067
--- a/configure
+++ b/configure
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.57.
+# Generated by GNU Autoconf 2.61 for xboard 4.3.
 #
-# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 ## --------------------- ##
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be Bourne compatible
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
 fi
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -41,21 +105,22 @@ for as_var in \
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
@@ -63,253 +128,613 @@ fi
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
 
+# CDPATH.
+$as_unset CDPATH
 
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
+if test "x$CONFIG_SHELL" = x; then
+  if (eval ":") 2>/dev/null; then
+  as_have_required=yes
+else
+  as_have_required=no
 fi
 
+  if test $as_have_required = yes &&    (eval ":
+(as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
 
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+  as_lineno_1=\$LINENO
+  as_lineno_2=\$LINENO
+  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+  :
+else
+  as_candidate_shells=
     as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
+  case $as_dir in
         /*)
-          if ("$as_dir/$as_base" -c '
+          for as_base in sh bash ksh sh5; do
+            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+          done;;
+       esac
+done
+IFS=$as_save_IFS
+
+
+      for as_shell in $as_candidate_shells $SHELL; do
+        # Try only shells that exist, to save several forks.
+        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+               { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+  CONFIG_SHELL=$as_shell
+              as_have_required=yes
+              if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+  (exit $1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+  break
+fi
+
+fi
+
+      done
+
+      if test "x$CONFIG_SHELL" != x; then
+  for as_var in BASH_ENV ENV
+        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+        done
+        export CONFIG_SHELL
+        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+    if test $as_have_required = no; then
+  echo This script requires a shell more modern than all the
+      echo shells that I found on your system.  Please install a
+      echo modern shell, or manually run the script under such a
+      echo shell if you do have one.
+      { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+  (exit \$1)
+}
+as_func_success () {
+  as_func_return 0
+}
+as_func_failure () {
+  as_func_return 1
+}
+as_func_ret_success () {
+  return 0
+}
+as_func_ret_failure () {
+  return 1
+}
+
+exitcode=0
+if as_func_success; then
+  :
+else
+  exitcode=1
+  echo as_func_success failed.
+fi
+
+if as_func_failure; then
+  exitcode=1
+  echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+  :
+else
+  exitcode=1
+  echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+  exitcode=1
+  echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+  :
+else
+  exitcode=1
+  echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+  echo No shell found that supports shell functions.
+  echo Please tell autoconf@gnu.org about your system,
+  echo including any error possibly output before this
+  echo message
+}
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
+  chmod +x "$as_me.lineno" ||
     { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
     as_ln_s='cp -p'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
 
+exec 7<&0 </dev/null 6>&1
 
 # Name of the host.
 # hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
 # so uname gets run too.
 ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
 
-exec 6>&1
-
 #
 # Initializations.
 #
 ac_default_prefix=/usr/local
+ac_clean_files=
 ac_config_libobj_dir=.
+LIBOBJS=
 cross_compiling=no
 subdirs=
 MFLAGS=
 MAKEFLAGS=
 SHELL=${CONFIG_SHELL-/bin/sh}
 
-# Maximum number of lines to put in a shell here document.
-# This variable seems obsolete.  It should probably be removed, and
-# only ac_max_sed_lines should be used.
-: ${ac_max_here_lines=38}
-
 # Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
+PACKAGE_NAME='xboard'
+PACKAGE_TARNAME='xboard'
+PACKAGE_VERSION='4.3'
+PACKAGE_STRING='xboard 4.3'
+PACKAGE_BUGREPORT=''
 
-ac_unique_file="xboard.c"
 # Factoring default headers for most tests.
 ac_includes_default="\
 #include <stdio.h>
-#if HAVE_SYS_TYPES_H
+#ifdef HAVE_SYS_TYPES_H
 # include <sys/types.h>
 #endif
-#if HAVE_SYS_STAT_H
+#ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#if STDC_HEADERS
+#ifdef STDC_HEADERS
 # include <stdlib.h>
 # include <stddef.h>
 #else
-# if HAVE_STDLIB_H
+# ifdef HAVE_STDLIB_H
 #  include <stdlib.h>
 # endif
 #endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
 #  include <memory.h>
 # endif
 # include <string.h>
 #endif
-#if HAVE_STRINGS_H
+#ifdef HAVE_STRINGS_H
 # include <strings.h>
 #endif
-#if HAVE_INTTYPES_H
+#ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
 #endif
-#if HAVE_UNISTD_H
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LEX LEXLIB LEX_OUTPUT_ROOT RSH NROFF NROFFFLAGS AWKPATH PERLPATH XAW_LIBS EGREP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os PRE_XMULIB POST_XMULIB CONF_CFLAGS CONF_LDFLAGS ZIPPY_O ZIPPY_H PRODUCT VERSION PATCHLEVEL LIBOBJS LTLIBOBJS'
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+LIBOBJS
+LTLIBOBJS
+CPP
+LEX
+LEX_OUTPUT_ROOT
+LEXLIB
+RSH
+MINFO
+NROFF
+NROFFFLAGS
+AWKPATH
+PERLPATH
+GREP
+EGREP
+XMKMF
+X_CFLAGS
+X_PRE_LIBS
+X_LIBS
+X_EXTRA_LIBS
+XAW_LIBS
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+PRE_XMULIB
+POST_XMULIB
+CONF_CFLAGS
+CONF_LDFLAGS
+ZIPPY_O
+ZIPPY_H
+PRODUCT
+PATCHLEVEL'
 ac_subst_files=''
+      ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+XMKMF'
+
 
 # Initialize some variables set by options.
 ac_init_help=
@@ -336,34 +761,48 @@ x_libraries=NONE
 # and all the variables that are supposed to be based on exec_prefix
 # by default will actually change.
 # Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
 sysconfdir='${prefix}/etc'
 sharedstatedir='${prefix}/com'
 localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
 includedir='${prefix}/include'
 oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
 
 ac_prev=
+ac_dashdash=
 for ac_option
 do
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
-    eval "$ac_prev=\$ac_option"
+    eval $ac_prev=\$ac_option
     ac_prev=
     continue
   fi
 
-  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+  case $ac_option in
+  *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+  *)   ac_optarg=yes ;;
+  esac
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case $ac_option in
+  case $ac_dashdash$ac_option in
+  --)
+    ac_dashdash=yes ;;
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
@@ -385,33 +824,45 @@ do
   --config-cache | -C)
     cache_file=config.cache ;;
 
-  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+  -datadir | --datadir | --datadi | --datad)
     ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
-  | --da=*)
+  -datadir=* | --datadir=* | --datadi=* | --datad=*)
     datadir=$ac_optarg ;;
 
+  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+  | --dataroo | --dataro | --datar)
+    ac_prev=datarootdir ;;
+  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+    datarootdir=$ac_optarg ;;
+
   -disable-* | --disable-*)
     ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval "enable_$ac_feature=no" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=no ;;
+
+  -docdir | --docdir | --docdi | --doc | --do)
+    ac_prev=docdir ;;
+  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+    docdir=$ac_optarg ;;
+
+  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+    ac_prev=dvidir ;;
+  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+    dvidir=$ac_optarg ;;
 
   -enable-* | --enable-*)
     ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid feature name: $ac_feature" >&2
    { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "enable_$ac_feature='$ac_optarg'" ;;
+    ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+    eval enable_$ac_feature=\$ac_optarg ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -438,6 +889,12 @@ do
   -host=* | --host=* | --hos=* | --ho=*)
     host_alias=$ac_optarg ;;
 
+  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+    ac_prev=htmldir ;;
+  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+  | --ht=*)
+    htmldir=$ac_optarg ;;
+
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
@@ -462,13 +919,16 @@ do
   | --libexe=* | --libex=* | --libe=*)
     libexecdir=$ac_optarg ;;
 
+  -localedir | --localedir | --localedi | --localed | --locale)
+    ac_prev=localedir ;;
+  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+    localedir=$ac_optarg ;;
+
   -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst \
-  | --locals | --local | --loca | --loc | --lo)
+  | --localstate | --localstat | --localsta | --localst | --locals)
     ac_prev=localstatedir ;;
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
-  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
     localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
@@ -533,6 +993,16 @@ do
   | --progr-tra=* | --program-tr=* | --program-t=*)
     program_transform_name=$ac_optarg ;;
 
+  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+    ac_prev=pdfdir ;;
+  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+    pdfdir=$ac_optarg ;;
+
+  -psdir | --psdir | --psdi | --psd | --ps)
+    ac_prev=psdir ;;
+  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+    psdir=$ac_optarg ;;
+
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
@@ -585,24 +1055,20 @@ do
   -with-* | --with-*)
     ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case $ac_option in
-      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
-      *) ac_optarg=yes ;;
-    esac
-    eval "with_$ac_package='$ac_optarg'" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=\$ac_optarg ;;
 
   -without-* | --without-*)
     ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+    expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid package name: $ac_package" >&2
    { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval "with_$ac_package=no" ;;
+    ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+    eval with_$ac_package=no ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -633,8 +1099,7 @@ Try \`$0 --help' for more information." >&2
     expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
       { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
    { (exit 1); exit 1; }; }
-    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
-    eval "$ac_envvar='$ac_optarg'"
+    eval $ac_envvar=\$ac_optarg
     export $ac_envvar ;;
 
   *)
@@ -654,27 +1119,19 @@ if test -n "$ac_prev"; then
    { (exit 1); exit 1; }; }
 fi
 
-# Be sure to have absolute paths.
-for ac_var in exec_prefix prefix
+# Be sure to have absolute directory names.
+for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
+               datadir sysconfdir sharedstatedir localstatedir includedir \
+               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+               libdir localedir mandir
 do
-  eval ac_val=$`echo $ac_var`
+  eval ac_val=\$$ac_var
   case $ac_val in
-    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
-  esac
-done
-
-# Be sure to have absolute paths.
-for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
-              localstatedir libdir includedir oldincludedir infodir mandir
-do
-  eval ac_val=$`echo $ac_var`
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* ) ;;
-    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; };;
+    [\\/$]* | ?:[\\/]* )  continue;;
+    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
   esac
+  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; }
 done
 
 # There might be people who depend on the old broken behavior: `$host'
@@ -701,74 +1158,76 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias-
 test "$silent" = yes && exec 6>/dev/null
 
 
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+  { echo "$as_me: error: Working directory cannot be determined" >&2
+   { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+  { echo "$as_me: error: pwd does not report name of working directory" >&2
+   { (exit 1); exit 1; }; }
+
+
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then its parent.
-  ac_confdir=`(dirname "$0") 2>/dev/null ||
+  # Try the directory containing this script, then the parent directory.
+  ac_confdir=`$as_dirname -- "$0" ||
 $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$0" : 'X\(//\)[^/]' \| \
-         X"$0" : 'X\(//\)$' \| \
-         X"$0" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(//\)[^/]' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
   srcdir=$ac_confdir
-  if test ! -r $srcdir/$ac_unique_file; then
+  if test ! -r "$srcdir/$ac_unique_file"; then
     srcdir=..
   fi
 else
   ac_srcdir_defaulted=no
 fi
-if test ! -r $srcdir/$ac_unique_file; then
-  if test "$ac_srcdir_defaulted" = yes; then
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
-   { (exit 1); exit 1; }; }
-  else
-    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+if test ! -r "$srcdir/$ac_unique_file"; then
+  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
    { (exit 1); exit 1; }; }
-  fi
 fi
-(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
-  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+       cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
    { (exit 1); exit 1; }; }
-srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
-ac_env_build_alias_set=${build_alias+set}
-ac_env_build_alias_value=$build_alias
-ac_cv_env_build_alias_set=${build_alias+set}
-ac_cv_env_build_alias_value=$build_alias
-ac_env_host_alias_set=${host_alias+set}
-ac_env_host_alias_value=$host_alias
-ac_cv_env_host_alias_set=${host_alias+set}
-ac_cv_env_host_alias_value=$host_alias
-ac_env_target_alias_set=${target_alias+set}
-ac_env_target_alias_value=$target_alias
-ac_cv_env_target_alias_set=${target_alias+set}
-ac_cv_env_target_alias_value=$target_alias
-ac_env_CC_set=${CC+set}
-ac_env_CC_value=$CC
-ac_cv_env_CC_set=${CC+set}
-ac_cv_env_CC_value=$CC
-ac_env_CFLAGS_set=${CFLAGS+set}
-ac_env_CFLAGS_value=$CFLAGS
-ac_cv_env_CFLAGS_set=${CFLAGS+set}
-ac_cv_env_CFLAGS_value=$CFLAGS
-ac_env_LDFLAGS_set=${LDFLAGS+set}
-ac_env_LDFLAGS_value=$LDFLAGS
-ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
-ac_cv_env_LDFLAGS_value=$LDFLAGS
-ac_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_env_CPPFLAGS_value=$CPPFLAGS
-ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
-ac_cv_env_CPPFLAGS_value=$CPPFLAGS
-ac_env_CPP_set=${CPP+set}
-ac_env_CPP_value=$CPP
-ac_cv_env_CPP_set=${CPP+set}
-ac_cv_env_CPP_value=$CPP
+       pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+  srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+  eval ac_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_env_${ac_var}_value=\$${ac_var}
+  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+  eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
 
 #
 # Report the --help message.
@@ -777,7 +1236,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
+\`configure' configures xboard 4.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -797,14 +1256,11 @@ Configuration:
   -n, --no-create         do not create output files
       --srcdir=DIR        find the sources in DIR [configure dir or \`..']
 
-_ACEOF
-
-  cat <<_ACEOF
 Installation directories:
   --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
+                         [$ac_default_prefix]
   --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [PREFIX]
+                         [PREFIX]
 
 By default, \`make install' will install all the files in
 \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
@@ -817,19 +1273,31 @@ Fine tuning of the installation directories:
   --bindir=DIR           user executables [EPREFIX/bin]
   --sbindir=DIR          system admin executables [EPREFIX/sbin]
   --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
   --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
   --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
   --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
   --libdir=DIR           object code libraries [EPREFIX/lib]
   --includedir=DIR       C header files [PREFIX/include]
   --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --infodir=DIR          info documentation [PREFIX/info]
-  --mandir=DIR           man documentation [PREFIX/man]
+  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
+  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
+  --infodir=DIR          info documentation [DATAROOTDIR/info]
+  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
+  --mandir=DIR           man documentation [DATAROOTDIR/man]
+  --docdir=DIR           documentation root [DATAROOTDIR/doc/xboard]
+  --htmldir=DIR          html documentation [DOCDIR]
+  --dvidir=DIR           dvi documentation [DOCDIR]
+  --pdfdir=DIR           pdf documentation [DOCDIR]
+  --psdir=DIR            ps documentation [DOCDIR]
 _ACEOF
 
   cat <<\_ACEOF
 
+Program names:
+  --program-prefix=PREFIX            prepend PREFIX to installed program names
+  --program-suffix=SUFFIX            append SUFFIX to installed program names
+  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
+
 X features:
   --x-includes=DIR    X include files are in DIR
   --x-libraries=DIR   X library files are in DIR
@@ -841,12 +1309,16 @@ _ACEOF
 fi
 
 if test -n "$ac_init_help"; then
-
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of xboard 4.3:";;
+   esac
   cat <<\_ACEOF
 
 Optional Features:
   --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking  speeds up one-time build
+  --enable-dependency-tracking   do not reject slow dependency extractors
   --enable-xpm            libXpm will be used if found (default)
   --disable-xpm           libXpm will not be used
   --enable-ptys           force use of pseudo-ttys with child processes
@@ -859,102 +1331,104 @@ Optional Features:
 Optional Packages:
   --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
   --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-Xaw3d            use Xaw3d instead of Xaw
   --with-x                use the X Window System
+  --with-Xaw3d            use Xaw3d instead of Xaw
 
 Some influential environment variables:
   CC          C compiler command
   CFLAGS      C compiler flags
   LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
               nonstandard directory <lib dir>
-  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
-              headers in a nonstandard directory <include dir>
+  LIBS        libraries to pass to the linker, e.g. -l<library>
+  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+              you have headers in a nonstandard directory <include dir>
   CPP         C preprocessor
+  XMKMF       Path to xmkmf, Makefile generator for X Window System
 
 Use these variables to override the choices made by `configure' or to help
 it to find libraries and programs with nonstandard names/locations.
 
 _ACEOF
+ac_status=$?
 fi
 
 if test "$ac_init_help" = "recursive"; then
   # If there are subdirs, report their specific --help.
-  ac_popdir=`pwd`
   for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d $ac_dir || continue
+    test -d "$ac_dir" || continue
     ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
 case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
-    cd $ac_dir
-    # Check for guested configure; otherwise get Cygnus style configure.
-    if test -f $ac_srcdir/configure.gnu; then
-      echo
-      $SHELL $ac_srcdir/configure.gnu  --help=recursive
-    elif test -f $ac_srcdir/configure; then
-      echo
-      $SHELL $ac_srcdir/configure  --help=recursive
-    elif test -f $ac_srcdir/configure.ac ||
-           test -f $ac_srcdir/configure.in; then
-      echo
-      $ac_configure --help
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+    cd "$ac_dir" || { ac_status=$?; continue; }
+    # Check for guested configure.
+    if test -f "$ac_srcdir/configure.gnu"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+    elif test -f "$ac_srcdir/configure"; then
+      echo &&
+      $SHELL "$ac_srcdir/configure" --help=recursive
     else
       echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi
-    cd $ac_popdir
+    fi || ac_status=$?
+    cd "$ac_pwd" || { ac_status=$?; break; }
   done
 fi
 
-test -n "$ac_init_help" && exit 0
+test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
+xboard configure 4.3
+generated by GNU Autoconf 2.61
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
-Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
-  exit 0
+  exit
 fi
-exec 5>config.log
-cat >&5 <<_ACEOF
+cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
+It was created by xboard $as_me 4.3, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   $ $0 $@
 
 _ACEOF
+exec 5>>config.log
 {
 cat <<_ASUNAME
 ## --------- ##
@@ -973,7 +1447,7 @@ uname -v = `(uname -v) 2>/dev/null || echo unknown`
 /bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
 /usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
 /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
 /bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
 /usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
 /bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
@@ -987,6 +1461,7 @@ do
   test -z "$as_dir" && as_dir=.
   echo "PATH: $as_dir"
 done
+IFS=$as_save_IFS
 
 } >&5
 
@@ -1008,7 +1483,6 @@ _ACEOF
 ac_configure_args=
 ac_configure_args0=
 ac_configure_args1=
-ac_sep=
 ac_must_keep_next=false
 for ac_pass in 1 2
 do
@@ -1019,7 +1493,7 @@ do
     -q | -quiet | --quiet | --quie | --qui | --qu | --q \
     | -silent | --silent | --silen | --sile | --sil)
       continue ;;
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    *\'*)
       ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
     esac
     case $ac_pass in
@@ -1027,23 +1501,21 @@ do
     2)
       ac_configure_args1="$ac_configure_args1 '$ac_arg'"
       if test $ac_must_keep_next = true; then
-        ac_must_keep_next=false # Got value, back to normal.
+       ac_must_keep_next=false # Got value, back to normal.
       else
-        case $ac_arg in
-          *=* | --config-cache | -C | -disable-* | --disable-* \
-          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-          | -with-* | --with-* | -without-* | --without-* | --x)
-            case "$ac_configure_args0 " in
-              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-            esac
-            ;;
-          -* ) ac_must_keep_next=true ;;
-        esac
+       case $ac_arg in
+         *=* | --config-cache | -C | -disable-* | --disable-* \
+         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+         | -with-* | --with-* | -without-* | --without-* | --x)
+           case "$ac_configure_args0 " in
+             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+           esac
+           ;;
+         -* ) ac_must_keep_next=true ;;
+       esac
       fi
-      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
-      # Get rid of the leading space.
-      ac_sep=" "
+      ac_configure_args="$ac_configure_args '$ac_arg'"
       ;;
     esac
   done
@@ -1054,8 +1526,8 @@ $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_
 # When interrupted or exit'd, cleanup temporary files, and complete
 # config.log.  We remove comments because anyway the quotes in there
 # would cause problems or look ugly.
-# WARNING: Be sure not to use single quotes in there, as some shells,
-# such as our DU 5.0 friend, will then `close' the trap.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
 trap 'exit_status=$?
   # Save into config.log some information that might help in debugging.
   {
@@ -1068,20 +1540,34 @@ trap 'exit_status=$?
 _ASBOX
     echo
     # The following way of writing the cache mishandles newlines in values,
-{
+(
+  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
   (set) 2>&1 |
-    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
       sed -n \
-        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
-      ;;
+       "s/'\''/'\''\\\\'\'''\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+      ;; #(
     *)
-      sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-}
+    esac |
+    sort
+)
     echo
 
     cat <<\_ASBOX
@@ -1092,22 +1578,28 @@ _ASBOX
     echo
     for ac_var in $ac_subst_vars
     do
-      eval ac_val=$`echo $ac_var`
-      echo "$ac_var='"'"'$ac_val'"'"'"
+      eval ac_val=\$$ac_var
+      case $ac_val in
+      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+      esac
+      echo "$ac_var='\''$ac_val'\''"
     done | sort
     echo
 
     if test -n "$ac_subst_files"; then
       cat <<\_ASBOX
-## ------------- ##
-## Output files. ##
-## ------------- ##
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
 _ASBOX
       echo
       for ac_var in $ac_subst_files
       do
-       eval ac_val=$`echo $ac_var`
-        echo "$ac_var='"'"'$ac_val'"'"'"
+       eval ac_val=\$$ac_var
+       case $ac_val in
+       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+       esac
+       echo "$ac_var='\''$ac_val'\''"
       done | sort
       echo
     fi
@@ -1119,26 +1611,24 @@ _ASBOX
 ## ----------- ##
 _ASBOX
       echo
-      sed "/^$/d" confdefs.h | sort
+      cat confdefs.h
       echo
     fi
     test "$ac_signal" != 0 &&
       echo "$as_me: caught signal $ac_signal"
     echo "$as_me: exit $exit_status"
   } >&5
-  rm -f core core.* *.core &&
-  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+  rm -f core *.core core.conftest.* &&
+    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
     exit $exit_status
-     ' 0
+' 0
 for ac_signal in 1 2 13 15; do
   trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
 done
 ac_signal=0
 
 # confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo >confdefs.h
+rm -f -r conftest* confdefs.h
 
 # Predefined preprocessor variables.
 
@@ -1169,14 +1659,17 @@ _ACEOF
 
 # Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
-  if test "x$prefix" != xNONE; then
-    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
-  else
-    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
-  fi
+if test -n "$CONFIG_SITE"; then
+  set x "$CONFIG_SITE"
+elif test "x$prefix" != xNONE; then
+  set x "$prefix/share/config.site" "$prefix/etc/config.site"
+else
+  set x "$ac_default_prefix/share/config.site" \
+       "$ac_default_prefix/etc/config.site"
 fi
-for ac_site_file in $CONFIG_SITE; do
+shift
+for ac_site_file
+do
   if test -r "$ac_site_file"; then
     { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
 echo "$as_me: loading site script $ac_site_file" >&6;}
@@ -1192,8 +1685,8 @@ if test -r "$cache_file"; then
     { echo "$as_me:$LINENO: loading cache $cache_file" >&5
 echo "$as_me: loading cache $cache_file" >&6;}
     case $cache_file in
-      [\\/]* | ?:[\\/]* ) . $cache_file;;
-      *)                      . ./$cache_file;;
+      [\\/]* | ?:[\\/]* ) . "$cache_file";;
+      *)                      . "./$cache_file";;
     esac
   fi
 else
@@ -1205,12 +1698,11 @@ fi
 # Check that the precious variables saved in the cache have kept the same
 # value.
 ac_cache_corrupted=false
-for ac_var in `(set) 2>&1 |
-               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+for ac_var in $ac_precious_vars; do
   eval ac_old_set=\$ac_cv_env_${ac_var}_set
   eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
-  eval ac_new_val="\$ac_env_${ac_var}_value"
+  eval ac_old_val=\$ac_cv_env_${ac_var}_value
+  eval ac_new_val=\$ac_env_${ac_var}_value
   case $ac_old_set,$ac_new_set in
     set,)
       { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
@@ -1223,20 +1715,19 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
     ,);;
     *)
       if test "x$ac_old_val" != "x$ac_new_val"; then
-        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
 echo "$as_me:   former value:  $ac_old_val" >&2;}
-        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
 echo "$as_me:   current value: $ac_new_val" >&2;}
-        ac_cache_corrupted=:
+       ac_cache_corrupted=:
       fi;;
   esac
   # Pass precious variables to config.status.
   if test "$ac_new_set" = set; then
     case $ac_new_val in
-    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
-      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
     *) ac_arg=$ac_var=$ac_new_val ;;
     esac
     case " $ac_configure_args " in
@@ -1253,6 +1744,30 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov
    { (exit 1); exit 1; }; }
 fi
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -1260,48 +1775,388 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
+am__api_version='1.10'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+  if test -f "$ac_dir/install-sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f "$ac_dir/install.sh"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install.sh -c"
+    break
+  elif test -f "$ac_dir/shtool"; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
+  fi
+done
+if test -z "$ac_aux_dir"; then
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
 
 
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
+      done
+    done
+    ;;
+esac
+done
+IFS=$as_save_IFS
 
 
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    INSTALL=$ac_install_sh
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
 
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
 
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+test "$program_prefix" != NONE &&
+  program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; }
+if test -z "$MKDIR_P"; then
+  if test "${ac_cv_path_mkdir+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in mkdir gmkdir; do
+        for ac_exec_ext in '' $ac_executable_extensions; do
+          { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+          case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+            'mkdir (GNU coreutils) '* | \
+            'mkdir (coreutils) '* | \
+            'mkdir (fileutils) '4.1*)
+              ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+              break 3;;
+          esac
+        done
+       done
+done
+IFS=$as_save_IFS
 
+fi
 
+  if test "${ac_cv_path_mkdir+set}" = set; then
+    MKDIR_P="$ac_cv_path_mkdir -p"
+  else
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for MKDIR_P within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the value is a relative name.
+    test -d ./--version && rmdir ./--version
+    MKDIR_P="$ac_install_sh -d"
+  fi
+fi
+{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+echo "${ECHO_T}$MKDIR_P" >&6; }
 
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+  [\\/$]* | ?:[\\/]*) ;;
+  */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
 
+for ac_prog in gawk mawk nawk awk
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
 
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
 
 
+  test -n "$AWK" && break
+done
 
-          ac_config_headers="$ac_config_headers config.h"
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+       @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+  *@@@%%%=?*=@@@%%%*)
+    eval ac_cv_prog_make_${ac_make}_set=yes;;
+  *)
+    eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+  SET_MAKE=
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
 
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+  am__leading_dot=.
+else
+  am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
 
-PRODUCT=xboard
-VERSION=4.3
-PATCHLEVEL=14k
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+  # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+  # is not polluted with repeated "-I."
+  am__isrc=' -I$(srcdir)'
+  # test to see if srcdir already configured
+  if test -f $srcdir/config.status; then
+    { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+fi
 
-if test -z "$CFLAGS" ; then
-  CFLAGS=" "
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
 fi
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_CC+set}" = set; then
+
+
+# Define the identity of the package.
+ PACKAGE='xboard'
+ VERSION='4.3'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -1309,37 +2164,39 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
 else
 as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
@@ -1347,36 +2204,70 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="gcc"
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_STRIP="strip"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_STRIP" = x; then
+    STRIP=":"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    STRIP=$ac_ct_STRIP
+  fi
 else
-  CC="$ac_cv_prog_CC"
+  STRIP="$ac_cv_prog_STRIP"
 fi
 
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1389,32 +2280,34 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$ac_cv_prog_CC"; then
   ac_ct_CC=$CC
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1427,36 +2320,91 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_ac_ct_CC="cc"
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 else
   CC="$ac_cv_prog_CC"
 fi
 
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
 fi
 if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1470,7 +2418,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -1481,6 +2429,7 @@ do
   fi
 done
 done
+IFS=$as_save_IFS
 
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
@@ -1498,22 +2447,23 @@ fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
 fi
 if test -z "$CC"; then
   if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl
+  for ac_prog in cl.exe
   do
     # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
 set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1526,36 +2476,38 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
     test -n "$CC" && break
   done
 fi
 if test -z "$CC"; then
   ac_ct_CC=$CC
-  for ac_prog in cl
+  for ac_prog in cl.exe
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -1568,29 +2520,45 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 ac_ct_CC=$ac_cv_prog_ac_ct_CC
 if test -n "$ac_ct_CC"; then
-  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$ac_ct_CC" && break
 done
 
-  CC=$ac_ct_CC
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
 fi
 
 fi
@@ -1603,27 +2571,40 @@ See \`config.log' for more details." >&2;}
    { (exit 1); exit 1; }; }
 
 # Provide some information about the compiler.
-echo "$as_me:$LINENO:" \
-     "checking for C compiler version" >&5
+echo "$as_me:$LINENO: checking for C compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
-  (eval $ac_compiler --version </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
-  (eval $ac_compiler -v </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
-{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
-  (eval $ac_compiler -V </dev/null >&5) 2>&5
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }
 
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1643,47 +2624,77 @@ ac_clean_files="$ac_clean_files a.out a.exe b.out"
 # Try to create an executable without -o first, disregard a.out.
 # It will help us diagnose broken compilers, and finding out an intuition
 # of exeext.
-echo "$as_me:$LINENO: checking for C compiler default output" >&5
-echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
-  (eval $ac_link_default) 2>&5
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort.  b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions.  Remove them first so a
+# subsequent execution test works.
+ac_rmfiles=
+for ac_file in $ac_files
+do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+  esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link_default") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  # Find the output, starting from the most likely.  This scheme is
-# not robust to junk in `.', hence go to wildcards (a.*) only as a last
-# resort.
-
-# Be careful to initialize this variable, since it used to be cached.
-# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
-ac_cv_exeext=
-# b.out is created by i960 compilers.
-for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile.  We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
 do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
-        ;;
-    conftest.$ac_ext )
-        # This is the source file.
-        ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+       ;;
     [ab].out )
-        # We found the default executable, but exeext='' is most
-        # certainly right.
-        break;;
+       # We found the default executable, but exeext='' is most
+       # certainly right.
+       break;;
     *.* )
-        ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-        # FIXME: I believe we export ac_cv_exeext for Libtool,
-        # but it would be cool to find out if it's true.  Does anybody
-        # maintain Libtool? --akim.
-        export ac_cv_exeext
-        break;;
+        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+       then :; else
+          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+       fi
+       # We set ac_cv_exeext here because the later test for it is not
+       # safe: cross compilers may not add the suffix if given an `-o'
+       # argument, so we may need to know it at that point already.
+       # Even if this section looks crufty: it has the advantage of
+       # actually working.
+       break;;
     * )
-        break;;
+       break;;
   esac
 done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
 else
+  ac_file=''
+fi
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
@@ -1695,19 +2706,21 @@ See \`config.log' for more details." >&2;}
 fi
 
 ac_exeext=$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6
 
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether the C compiler works" >&5
-echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0
 # If not cross compiling, check that we can run a simple program.
 if test "$cross_compiling" != yes; then
   if { ac_try='./$ac_file'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -1726,22 +2739,27 @@ See \`config.log' for more details." >&2;}
     fi
   fi
 fi
-echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
 
 rm -f a.out a.exe conftest$ac_cv_exeext b.out
 ac_clean_files=$ac_clean_files_save
-# Check the compiler produces executables we can run.  If not, either
+# Check that the compiler produces executables we can run.  If not, either
 # the compiler is broken, or we cross compile.
-echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
-echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6
-
-echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
@@ -1752,10 +2770,9 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
 for ac_file in conftest.exe conftest conftest.*; do
   test -f "$ac_file" || continue
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
     *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-          export ac_cv_exeext
-          break;;
+         break;;
     * ) break;;
   esac
 done
@@ -1768,19 +2785,18 @@ See \`config.log' for more details." >&2;}
 fi
 
 rm -f conftest$ac_cv_exeext
-echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
 
 rm -f conftest.$ac_ext
 EXEEXT=$ac_cv_exeext
 ac_exeext=$EXEEXT
-echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
 if test "${ac_cv_objext+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1796,14 +2812,20 @@ main ()
 }
 _ACEOF
 rm -f conftest.o conftest.obj
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; then
-  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  for ac_file in conftest.o conftest.obj conftest.*; do
+  test -f "$ac_file" || continue;
   case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
     *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
        break;;
   esac
@@ -1821,17 +2843,16 @@ fi
 
 rm -f conftest.$ac_cv_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
 OBJEXT=$ac_cv_objext
 ac_objext=$OBJEXT
-echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
 if test "${ac_cv_c_compiler_gnu+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1850,41 +2871,49 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_compiler_gnu=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_compiler_gnu=no
+       ac_compiler_gnu=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 ac_cv_c_compiler_gnu=$ac_compiler_gnu
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
 GCC=`test $ac_compiler_gnu = yes && echo yes`
 ac_test_CFLAGS=${CFLAGS+set}
 ac_save_CFLAGS=$CFLAGS
-CFLAGS="-g"
-echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
 if test "${ac_cv_prog_cc_g+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1900,28 +2929,118 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_prog_cc_g=no
+
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
 if test "$ac_test_CFLAGS" = set; then
   CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
@@ -1937,15 +3056,14 @@ else
     CFLAGS=
   fi
 fi
-echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
-echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
-if test "${ac_cv_prog_cc_stdc+set}" = set; then
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_prog_cc_stdc=no
+  ac_cv_prog_cc_c89=no
 ac_save_CC=$CC
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -1973,6 +3091,21 @@ static char *f (char * (*g) (char **, int), char **p, ...)
   va_end (v);
   return s;
 }
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
 int test (int i, double x);
 struct s1 {int (*f) (int a);};
 struct s2 {int (*f) (double a);};
@@ -1987,181 +3120,2356 @@ return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
   return 0;
 }
 _ACEOF
-# Don't try gcc -ansi; that turns off useful extensions and
-# breaks some systems' header files.
-# AIX                  -qlanglvl=ansi
-# Ultrix and OSF/1     -std1
-# HP-UX 10.20 and later        -Ae
-# HP-UX older versions -Aa -D_HPUX_SOURCE
-# SVR4                 -Xc -D__EXTENSIONS__
-for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
 do
   CC="$ac_save_CC $ac_arg"
   rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_stdc=$ac_arg
-break
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.$ac_objext
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
 done
-rm -f conftest.$ac_ext conftest.$ac_objext
+rm -f conftest.$ac_ext
 CC=$ac_save_CC
 
 fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+       @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+{ echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
+  (set) 2>&1 |
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+      ;;
+    esac |
+    sort
+) |
+  sed '
+     /^ac_cv_env_/b end
+     t clear
+     :clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+    cat confcache >$cache_file
+  else
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+  fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
+fi
 
-case "x$ac_cv_prog_cc_stdc" in
-  x|xno)
-    echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6 ;;
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
+    sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
+      N
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+      t loop
+      s/-\n.*//
+    ' >$as_me.lineno &&
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
+  # Exit status is that of the last command.
+  exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+    as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  test -d ./-p && rmdir ./-p
+  as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by xboard $as_me 4.3, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number and configuration settings, then exit
+  -q, --quiet      do not print progress messages
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                  instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                  instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+xboard config.status 4.3
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2006 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
   *)
-    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
-    CC="$CC $ac_cv_prog_cc_stdc" ;;
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # This is an error.
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
+
+  esac
+  shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+  case $ac_config_target in
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&2
+   { (exit 1); exit 1; }
+}
+
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 77; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
+_ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[    ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
+  esac
+
+  ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+  ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
 esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
-# Some people use a C++ compiler to compile C.  Since we use `exit',
-# in C++ we need to declare it.  In case someone uses the same compiler
-# for both compiling C and C++ we need to have the C++ compiler decide
-# the declaration of exit, since it's the most demanding environment.
-cat >conftest.$ac_ext <<_ACEOF
-#ifndef __cplusplus
-  choke me
-#endif
+case $srcdir in
+  .)  # We are building in place.
+    ac_srcdir=.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+  esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
 _ACEOF
-rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
+  case $ac_file in
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+  esac
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([  #]*\\)[^        ]*\\([  ]*'
+ac_dB='\\)[     (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+       t rset
+       :rset
+       s/^[     ]*#[    ]*define[       ][      ]*//
+       t ok
+       d
+       :ok
+       s/[\\&,]/\\&/g
+       s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+       s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[    #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:    sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[     ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
+/^[     ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
+  if test x"$ac_file" != x-; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      rm -f $ac_file
+      mv "$tmp/config.h" $ac_file
+    fi
+  else
+    echo "/* $configure_input  */"
+    cat "$ac_result"
+  fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_arg=$ac_file
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
+
+
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+
+  esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
+
+PRODUCT=xboard
+#VERSION=4.3  # version is already defined
+PATCHLEVEL=15
+
+
+if test -z "$CFLAGS" ; then
+  CFLAGS=" "
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+          if test -n "$ac_tool_prefix"; then
+    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  fi
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl.exe
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl.exe
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$ac_ct_CC" && break
+done
+
+  if test "x$ac_ct_CC" = x; then
+    CC=""
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet.  If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+    CC=$ac_ct_CC
+  fi
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler --version >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -v >&5") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  for ac_declaration in \
-   ''\
-   '#include <stdlib.h>' \
-   'extern "C" void std::exit (int) throw (); using std::exit;' \
-   'extern "C" void std::exit (int); using std::exit;' \
-   'extern "C" void exit (int) throw ();' \
-   'extern "C" void exit (int);' \
-   'void exit (int);'
-do
+  (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compiler -V >&5") 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <stdlib.h>
-$ac_declaration
+
 int
 main ()
 {
-exit (42);
+#ifndef __GNUC__
+       choke me
+#endif
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_save_c_werror_flag=$ac_c_werror_flag
+   ac_c_werror_flag=yes
+   ac_cv_prog_cc_g=no
+   CFLAGS="-g"
+   cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-continue
-fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-  cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
+       CFLAGS=""
+      cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-$ac_declaration
+
 int
 main ()
 {
-exit (42);
+
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_c_werror_flag=$ac_save_c_werror_flag
+        CFLAGS="-g"
+        cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  break
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_g=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-done
-rm -f conftest*
-if test -n "$ac_declaration"; then
-  echo '#ifdef __cplusplus' >>confdefs.h
-  echo $ac_declaration      >>confdefs.h
-  echo '#endif'             >>confdefs.h
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
 
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+   ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+  CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
+   function prototypes and stuff, but not '\xHH' hex character constants.
+   These don't provoke an error unfortunately, instead are silently treated
+   as 'x'.  The following induces an error, until -std is added to get
+   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
+   array size at least.  It's necessary to write '\x00'==0 to get something
+   that's true only with -std.  */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+   inside strings and character constants.  */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_prog_cc_c89=$ac_arg
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext
+  test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+  x)
+    { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+  xno)
+    { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+  *)
+    CC="$CC $ac_cv_prog_cc_c89"
+    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
+depcc="$CC"   am_compiler_list=
+
+{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+  # We will build objects and dependencies in a subdirectory because
+  # it helps to detect inapplicable dependency modes.  For instance
+  # both Tru64's cc and ICC support -MD to output dependencies as a
+  # side effect of compilation, but ICC will put the dependencies in
+  # the current directory while Tru64 will put them in the object
+  # directory.
+  mkdir sub
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # Setup a source with many dependencies, because some compilers
+    # like to wrap large dependency lists on column 80 (with \), and
+    # we should not choose a depcomp mode which is confused by this.
+    #
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    : > sub/conftest.c
+    for i in 1 2 3 4 5 6; do
+      echo '#include "conftst'$i'.h"' >> sub/conftest.c
+      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+      # Solaris 8's {/usr,}/bin/sh.
+      touch sub/conftst$i.h
+    done
+    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+       continue
+      else
+       break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+         >/dev/null 2>conftest.err &&
+       grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      # icc doesn't choke on unknown options, it will just issue warnings
+      # or remarks (even with -Werror).  So we grep stderr for any message
+      # that says an option was ignored or not supported.
+      # When given -MP, icc 7.0 and 7.1 complain thusly:
+      #   icc: Command line warning: ignoring option '-M'; no argument required
+      # The diagnosis changed in icc 8.0:
+      #   icc: Command line remark: option '-MP' not supported
+      if (grep 'ignoring option' conftest.err ||
+          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+        am_cv_CC_dependencies_compiler_type=$depmode
+        break
+      fi
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
 ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
-echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
-echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -2183,7 +5491,6 @@ do
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2194,25 +5501,24 @@ cat >>conftest.$ac_ext <<_ACEOF
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+                    Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -2221,12 +5527,12 @@ sed 's/^/| /' conftest.$ac_ext >&5
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2234,23 +5540,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -2261,6 +5566,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2278,8 +5584,8 @@ fi
 else
   ac_cv_prog_CPP=$CPP
 fi
-echo "$as_me:$LINENO: result: $CPP" >&5
-echo "${ECHO_T}$CPP" >&6
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
 ac_preproc_ok=false
 for ac_c_preproc_warn_flag in '' yes
 do
@@ -2290,7 +5596,6 @@ do
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp. "Syntax error" is here to catch this case.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2301,25 +5606,24 @@ cat >>conftest.$ac_ext <<_ACEOF
 #else
 # include <assert.h>
 #endif
-                     Syntax error
+                    Syntax error
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   :
 else
   echo "$as_me: failed program was:" >&5
@@ -2328,12 +5632,12 @@ sed 's/^/| /' conftest.$ac_ext >&5
   # Broken: fails on valid input.
 continue
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
-  # OK, works on sane cases.  Now check whether non-existent headers
+  # OK, works on sane cases.  Now check whether nonexistent headers
   # can be detected and how.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -2341,23 +5645,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ac_nonexistent.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   # Broken: success on invalid input.
 continue
 else
@@ -2368,6 +5671,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ac_preproc_ok=:
 break
 fi
+
 rm -f conftest.err conftest.$ac_ext
 
 done
@@ -2390,136 +5694,88 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-echo "$as_me:$LINENO: checking for library containing strerror" >&5
-echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; }
 if test "${ac_cv_search_strerror+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_strerror=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char strerror ();
 int
 main ()
 {
-strerror ();
+return strerror ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+for ac_lib in '' cposix; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_strerror="none required"
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_strerror=$ac_res
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_strerror" = no; then
-  for ac_lib in cposix; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char strerror ();
-int
-main ()
-{
-strerror ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_strerror="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_strerror+set}" = set; then
+  break
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
+done
+if test "${ac_cv_search_strerror+set}" = set; then
+  :
+else
+  ac_cv_search_strerror=no
 fi
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
-echo "${ECHO_T}$ac_cv_search_strerror" >&6
-if test "$ac_cv_search_strerror" != no; then
-  test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
-
-fi
+{ echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6; }
+ac_res=$ac_cv_search_strerror
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
-ac_aux_dir=
-for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
-  if test -f $ac_dir/install-sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f $ac_dir/install.sh; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f $ac_dir/shtool; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
-echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
-   { (exit 1); exit 1; }; }
 fi
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"
-ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -2532,9 +5788,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
 # ./install, which can be erroneously created by make from ./install.sh.
-echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
 if test -z "$INSTALL"; then
 if test "${ac_cv_path_install+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
@@ -2548,6 +5805,7 @@ do
 case $as_dir/ in
   ./ | .// | /cC/* | \
   /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
   /usr/ucb/* ) ;;
   *)
     # OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2555,40 +5813,41 @@ case $as_dir/ in
     # by default.
     for ac_prog in ginstall scoinst install; do
       for ac_exec_ext in '' $ac_executable_extensions; do
-        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
-          if test $ac_prog = install &&
-            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # AIX install.  It has an incompatible calling convention.
-            :
-          elif test $ac_prog = install &&
-            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-            # program-specific install script used by HP pwplus--don't use.
-            :
-          else
-            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-            break 3
-          fi
-        fi
+       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+         if test $ac_prog = install &&
+           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # AIX install.  It has an incompatible calling convention.
+           :
+         elif test $ac_prog = install &&
+           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+           # program-specific install script used by HP pwplus--don't use.
+           :
+         else
+           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+           break 3
+         fi
+       fi
       done
     done
     ;;
 esac
 done
+IFS=$as_save_IFS
 
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
     INSTALL=$ac_cv_path_install
   else
-    # As a last resort, use the slow shell script.  We don't cache a
-    # path for INSTALL within a source directory, because that will
+    # As a last resort, use the slow shell script.  Don't cache a
+    # value for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
-    # removed, or if the path is relative.
+    # removed, or if the value is a relative name.
     INSTALL=$ac_install_sh
   fi
 fi
-echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
@@ -2602,8 +5861,8 @@ for ac_prog in lex flex
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_LEX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2616,25 +5875,27 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LEX="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 LEX=$ac_cv_prog_LEX
 if test -n "$LEX"; then
-  echo "$as_me:$LINENO: result: $LEX" >&5
-echo "${ECHO_T}$LEX" >&6
+  { echo "$as_me:$LINENO: result: $LEX" >&5
+echo "${ECHO_T}$LEX" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$LEX" && break
 done
 test -n "$LEX" || LEX="lex_not_found"
@@ -2644,8 +5905,8 @@ if test "$LEX" != lex_not_found ; then
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_LEX+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_LEX="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 LEX=$ac_cv_prog_LEX
 if test -n "$LEX"; then
-  echo "$as_me:$LINENO: result: $LEX" >&5
-echo "${ECHO_T}$LEX" >&6
+  { echo "$as_me:$LINENO: result: $LEX" >&5
+echo "${ECHO_T}$LEX" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$LEX" && break
 done
 test -n "$LEX" || LEX=":"
 
-if test -z "$LEXLIB"
-then
-  echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5
-echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6
-if test "${ac_cv_lib_fl_yywrap+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-lfl  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
+if test "x$LEX" != "x:"; then
+  cat >conftest.l <<_ACEOF
+%%
+a { ECHO; }
+b { REJECT; }
+c { yymore (); }
+d { yyless (1); }
+e { yyless (input () != 0); }
+f { unput (yytext[0]); }
+. { BEGIN INITIAL; }
+%%
+#ifdef YYTEXT_POINTER
+extern char *yytext;
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char yywrap ();
 int
-main ()
+main (void)
 {
-yywrap ();
-  ;
-  return 0;
+  return ! yylex () + ! yywrap ();
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+{ (ac_try="$LEX conftest.l"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$LEX conftest.l") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_fl_yywrap=yes
+  (exit $ac_status); }
+{ echo "$as_me:$LINENO: checking lex output file root" >&5
+echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
+if test "${ac_cv_prog_lex_root+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_fl_yywrap=no
+if test -f lex.yy.c; then
+  ac_cv_prog_lex_root=lex.yy
+elif test -f lexyy.c; then
+  ac_cv_prog_lex_root=lexyy
+else
+  { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
+echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
+   { (exit 1); exit 1; }; }
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5
-echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6
-if test $ac_cv_lib_fl_yywrap = yes; then
-  LEXLIB="-lfl"
-else
-  echo "$as_me:$LINENO: checking for yywrap in -ll" >&5
-echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6
-if test "${ac_cv_lib_l_yywrap+set}" = set; then
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
+LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
+
+if test -z "${LEXLIB+set}"; then
+  { echo "$as_me:$LINENO: checking lex library" >&5
+echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
+if test "${ac_cv_lib_lex+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-ll  $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char yywrap ();
-int
-main ()
-{
-yywrap ();
-  ;
-  return 0;
-}
+    ac_save_LIBS=$LIBS
+    ac_cv_lib_lex='none needed'
+    for ac_lib in '' -lfl -ll; do
+      LIBS="$ac_lib $ac_save_LIBS"
+      cat >conftest.$ac_ext <<_ACEOF
+`cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_lib_l_yywrap=yes
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_lex=$ac_lib
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_l_yywrap=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5
-echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6
-if test $ac_cv_lib_l_yywrap = yes; then
-  LEXLIB="-ll"
-fi
 
 fi
 
-fi
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+      test "$ac_cv_lib_lex" != 'none needed' && break
+    done
+    LIBS=$ac_save_LIBS
 
-if test "x$LEX" != "x:"; then
-  echo "$as_me:$LINENO: checking lex output file root" >&5
-echo $ECHO_N "checking lex output file root... $ECHO_C" >&6
-if test "${ac_cv_prog_lex_root+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # The minimal lex program is just a single line: %%.  But some broken lexes
-# (Solaris, I think it was) want two %% lines, so accommodate them.
-cat >conftest.l <<_ACEOF
-%%
-%%
-_ACEOF
-{ (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5
-  (eval $LEX conftest.l) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-if test -f lex.yy.c; then
-  ac_cv_prog_lex_root=lex.yy
-elif test -f lexyy.c; then
-  ac_cv_prog_lex_root=lexyy
-else
-  { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
-echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
-   { (exit 1); exit 1; }; }
 fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
+echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
+  test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
-echo "${ECHO_T}$ac_cv_prog_lex_root" >&6
-rm -f conftest.l
-LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
 
-echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
-echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6
+
+{ echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
+echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   # POSIX says lex can declare yytext either as a pointer or an array; the
-# default is implementation-dependent. Figure out which it is, since
+# default is implementation-dependent.  Figure out which it is, since
 # not all implementations provide the %pointer and %array declarations.
 ac_cv_prog_lex_yytext_pointer=no
-echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c
 ac_save_LIBS=$LIBS
-LIBS="$LIBS $LEXLIB"
+LIBS="$LEXLIB $ac_save_LIBS"
 cat >conftest.$ac_ext <<_ACEOF
+#define YYTEXT_POINTER 1
 `cat $LEX_OUTPUT_ROOT.c`
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_prog_lex_yytext_pointer=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
+
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_save_LIBS
-rm -f "${LEX_OUTPUT_ROOT}.c"
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
-echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
 if test $ac_cv_prog_lex_yytext_pointer = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -2881,6 +6102,7 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 fi
+rm -f conftest.l $LEX_OUTPUT_ROOT.c
 
 fi
 fi
@@ -2888,8 +6110,8 @@ for ac_prog in remsh rsh
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_RSH+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2902,37 +6124,86 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_RSH="$ac_prog"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
 fi
 fi
 RSH=$ac_cv_prog_RSH
 if test -n "$RSH"; then
-  echo "$as_me:$LINENO: result: $RSH" >&5
-echo "${ECHO_T}$RSH" >&6
+  { echo "$as_me:$LINENO: result: $RSH" >&5
+echo "${ECHO_T}$RSH" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$RSH" && break
 done
 test -n "$RSH" || RSH="rsh"
 
+for ac_prog in makeinfo
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_MINFO+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$MINFO"; then
+  ac_cv_prog_MINFO="$MINFO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_MINFO="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+MINFO=$ac_cv_prog_MINFO
+if test -n "$MINFO"; then
+  { echo "$as_me:$LINENO: result: $MINFO" >&5
+echo "${ECHO_T}$MINFO" >&6; }
+else
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+  test -n "$MINFO" && break
+done
+test -n "$MINFO" || MINFO="makeinfo_not_found"
+
+if test "$MINFO" == makeinfo_not_found ; then
+   echo Please install \"makeinfo\"
+   exit 1
+fi
 cat >>confdefs.h <<_ACEOF
 #define REMOTE_SHELL "$RSH"
 _ACEOF
 
 # Extract the first word of "nroff", so it can be a program name with args.
 set dummy nroff; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_prog_NROFF+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2945,33 +6216,35 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_prog_NROFF="nroff -man"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   test -z "$ac_cv_prog_NROFF" && ac_cv_prog_NROFF="cat"
 fi
 fi
 NROFF=$ac_cv_prog_NROFF
 if test -n "$NROFF"; then
-  echo "$as_me:$LINENO: result: $NROFF" >&5
-echo "${ECHO_T}$NROFF" >&6
+  { echo "$as_me:$LINENO: result: $NROFF" >&5
+echo "${ECHO_T}$NROFF" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
 
+
 for ac_prog in awk mawk gawk nawk
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_AWKPATH+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
@@ -2986,27 +6259,28 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_AWKPATH="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 AWKPATH=$ac_cv_path_AWKPATH
-
 if test -n "$AWKPATH"; then
-  echo "$as_me:$LINENO: result: $AWKPATH" >&5
-echo "${ECHO_T}$AWKPATH" >&6
+  { echo "$as_me:$LINENO: result: $AWKPATH" >&5
+echo "${ECHO_T}$AWKPATH" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$AWKPATH" && break
 done
 
@@ -3014,8 +6288,8 @@ for ac_prog in perl
 do
   # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
-echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
 if test "${ac_cv_path_PERLPATH+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
   for ac_exec_ext in '' $ac_executable_extensions; do
-  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
     ac_cv_path_PERLPATH="$as_dir/$ac_word$ac_exec_ext"
     echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi
 done
 done
+IFS=$as_save_IFS
 
   ;;
 esac
 fi
 PERLPATH=$ac_cv_path_PERLPATH
-
 if test -n "$PERLPATH"; then
-  echo "$as_me:$LINENO: result: $PERLPATH" >&5
-echo "${ECHO_T}$PERLPATH" >&6
+  { echo "$as_me:$LINENO: result: $PERLPATH" >&5
+echo "${ECHO_T}$PERLPATH" >&6; }
 else
-  echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
 fi
 
+
   test -n "$PERLPATH" && break
 done
 
 
 
-# Check whether --with-Xaw3d or --without-Xaw3d was given.
-if test "${with_Xaw3d+set}" = set; then
-  withval="$with_Xaw3d"
-  cat >>confdefs.h <<\_ACEOF
-#define USE_XAW3D 1
-_ACEOF
 
-   XAW_LIBS="-lXaw3d"
+
+
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_path_GREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in grep ggrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+    # Check for GNU ac_path_GREP and select it if it is found.
+  # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'GREP' >> "conftest.nl"
+    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_GREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_GREP="$ac_path_GREP"
+      ac_path_GREP_max=$ac_count
+    fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_GREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
 else
-  XAW_LIBS="-lXaw"
-fi;
+  ac_cv_path_GREP=$GREP
+fi
 
 
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
 
-echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6
-if test "${ac_cv_prog_egrep+set}" = set; then
+
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+   then ac_cv_path_EGREP="$GREP -E"
+   else
+     # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
-    then ac_cv_prog_egrep='grep -E'
-    else ac_cv_prog_egrep='egrep'
+  ac_path_EGREP_found=false
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_prog in egrep; do
+  for ac_exec_ext in '' $ac_executable_extensions; do
+    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+    { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+    # Check for GNU ac_path_EGREP and select it if it is found.
+  # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+  ac_count=0
+  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+  while :
+  do
+    cat "conftest.in" "conftest.in" >"conftest.tmp"
+    mv "conftest.tmp" "conftest.in"
+    cp "conftest.in" "conftest.nl"
+    echo 'EGREP' >> "conftest.nl"
+    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+    ac_count=`expr $ac_count + 1`
+    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+      # Best one so far, save it but keep looking for a better one
+      ac_cv_path_EGREP="$ac_path_EGREP"
+      ac_path_EGREP_max=$ac_count
     fi
+    # 10*(2^10) chars as input seems more than enough
+    test $ac_count -gt 10 && break
+  done
+  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+
+    $ac_path_EGREP_found && break 3
+  done
+done
+
+done
+IFS=$as_save_IFS
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+   { (exit 1); exit 1; }; }
 fi
-echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
-echo "${ECHO_T}$ac_cv_prog_egrep" >&6
- EGREP=$ac_cv_prog_egrep
 
+else
+  ac_cv_path_EGREP=$EGREP
+fi
 
-echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+
+   fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
 if test "${ac_cv_header_stdc+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3111,30 +6521,35 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_stdc=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_stdc=no
+       ac_cv_header_stdc=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3156,7 +6571,6 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3181,21 +6595,21 @@ if test $ac_cv_header_stdc = yes; then
   :
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <ctype.h>
+#include <stdlib.h>
 #if ((' ' & 0x0FF) == 0x020)
 # define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
 # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
 #else
 # define ISLOWER(c) \
-                   (('a' <= (c) && (c) <= 'i') \
-                     || ('j' <= (c) && (c) <= 'r') \
-                     || ('s' <= (c) && (c) <= 'z'))
+                  (('a' <= (c) && (c) <= 'i') \
+                    || ('j' <= (c) && (c) <= 'r') \
+                    || ('s' <= (c) && (c) <= 'z'))
 # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
 #endif
 
@@ -3206,19 +6620,28 @@ main ()
   int i;
   for (i = 0; i < 256; i++)
     if (XOR (islower (i), ISLOWER (i))
-        || toupper (i) != TOUPPER (i))
-      exit(2);
-  exit (0);
+       || toupper (i) != TOUPPER (i))
+      return 2;
+  return 0;
 }
 _ACEOF
 rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+  { (case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_try") 2>&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
@@ -3231,12 +6654,14 @@ sed 's/^/| /' conftest.$ac_ext >&5
 ( exit $ac_status )
 ac_cv_header_stdc=no
 fi
-rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
+
+
 fi
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
 if test $ac_cv_header_stdc = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -3245,13 +6670,12 @@ _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
-echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
 if test "${ac_cv_header_time+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3271,28 +6695,34 @@ return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_time=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_time=no
+       ac_cv_header_time=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
-echo "${ECHO_T}$ac_cv_header_time" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
 if test $ac_cv_header_time = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -3301,13 +6731,12 @@ _ACEOF
 
 fi
 
-echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
-echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6; }
 if test "${ac_cv_header_sys_wait_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3316,7 +6745,7 @@ cat >>conftest.$ac_ext <<_ACEOF
 #include <sys/types.h>
 #include <sys/wait.h>
 #ifndef WEXITSTATUS
-# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
 #endif
 #ifndef WIFEXITED
 # define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
@@ -3333,28 +6762,34 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_cv_header_sys_wait_h=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_header_sys_wait_h=no
+       ac_cv_header_sys_wait_h=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
-echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6; }
 if test $ac_cv_header_sys_wait_h = yes; then
 
 cat >>confdefs.h <<\_ACEOF
@@ -3371,13 +6806,12 @@ fi
 ac_header_dirent=no
 for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
   as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
-echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3396,28 +6830,35 @@ return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+       eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
 done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char opendir ();
 int
 main ()
 {
-opendir ();
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+for ac_lib in '' dir; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in dir; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
 fi
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 else
-  echo "$as_me:$LINENO: checking for library containing opendir" >&5
-echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for library containing opendir" >&5
+echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; }
 if test "${ac_cv_search_opendir+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_func_search_save_LIBS=$LIBS
-ac_cv_search_opendir=no
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char opendir ();
 int
 main ()
 {
-opendir ();
+return opendir ();
   ;
   return 0;
 }
 _ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+for ac_lib in '' x; do
+  if test -z "$ac_lib"; then
+    ac_res="none required"
+  else
+    ac_res=-l$ac_lib
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+  fi
+  rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="none required"
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_search_opendir=$ac_res
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-if test "$ac_cv_search_opendir" = no; then
-  for ac_lib in x; do
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-    cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
-char opendir ();
-int
-main ()
-{
-opendir ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_opendir="-l$ac_lib"
-break
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
 
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext
+  if test "${ac_cv_search_opendir+set}" = set; then
+  break
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-  done
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+  :
+else
+  ac_cv_search_opendir=no
 fi
+rm conftest.$ac_ext
 LIBS=$ac_func_search_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
-echo "${ECHO_T}$ac_cv_search_opendir" >&6
-if test "$ac_cv_search_opendir" != no; then
-  test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS"
+{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+echo "${ECHO_T}$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
 
 fi
 
 fi
 
-echo "$as_me:$LINENO: checking return type of signal handlers" >&5
-echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
 if test "${ac_cv_type_signal+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3658,46 +7052,44 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <sys/types.h>
 #include <signal.h>
-#ifdef signal
-# undef signal
-#endif
-#ifdef __cplusplus
-extern "C" void (*signal (int, void (*)(int)))(int);
-#else
-void (*signal ()) ();
-#endif
 
 int
 main ()
 {
-int i;
+return *(signal (0, 0)) (0) == 1;
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_signal=void
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_cv_type_signal=int
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_type_signal=int
+       ac_cv_type_signal=void
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
-echo "${ECHO_T}$ac_cv_type_signal" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
 
 cat >>confdefs.h <<_ACEOF
 #define RETSIGTYPE $ac_cv_type_signal
@@ -3715,16 +7107,15 @@ _ACEOF
 
 
 for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                  inttypes.h stdint.h unistd.h
+                 inttypes.h stdint.h unistd.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3735,28 +7126,35 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   eval "$as_ac_Header=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_Header=no"
+       eval "$as_ac_Header=no"
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
@@ -3775,20 +7173,20 @@ done
 for ac_header in stropts.h sys/time.h string.h unistd.h sys/systeminfo.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3798,33 +7196,38 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3832,23 +7235,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3856,52 +7258,46 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -3918,20 +7314,20 @@ done
 for ac_header in fcntl.h sys/fcntl.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3941,33 +7337,38 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -3975,23 +7376,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -3999,52 +7399,46 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -4061,20 +7455,20 @@ done
 for ac_header in sys/socket.h lan/socket.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4084,33 +7478,38 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4118,23 +7517,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4142,52 +7540,46 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -4200,19 +7592,18 @@ fi
 done
 
 if test "${ac_cv_header_stddef_h+set}" = set; then
-  echo "$as_me:$LINENO: checking for stddef.h" >&5
-echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for stddef.h" >&5
+echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_stddef_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
-echo "${ECHO_T}$ac_cv_header_stddef_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
+echo "${ECHO_T}$ac_cv_header_stddef_h" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking stddef.h usability" >&5
-echo $ECHO_N "checking stddef.h usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking stddef.h usability" >&5
+echo $ECHO_N "checking stddef.h usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4222,33 +7613,38 @@ $ac_includes_default
 #include <stddef.h>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking stddef.h presence" >&5
-echo $ECHO_N "checking stddef.h presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking stddef.h presence" >&5
+echo $ECHO_N "checking stddef.h presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -4256,23 +7652,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <stddef.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -4280,52 +7675,45 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: stddef.h: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: stddef.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: stddef.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: stddef.h: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: stddef.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: stddef.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: stddef.h: present but cannot be compiled" >&5
 echo "$as_me: WARNING: stddef.h: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: stddef.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: stddef.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stddef.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: stddef.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: stddef.h:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: stddef.h: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: stddef.h: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: stddef.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: stddef.h: in the future, the compiler will take precedence" >&2;}
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for stddef.h" >&5
-echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for stddef.h" >&5
+echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6; }
 if test "${ac_cv_header_stddef_h+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_header_stddef_h=$ac_header_preproc
 fi
-echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
-echo "${ECHO_T}$ac_cv_header_stddef_h" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
+echo "${ECHO_T}$ac_cv_header_stddef_h" >&6; }
 
 fi
 if test $ac_cv_header_stddef_h = yes; then
@@ -4346,78 +7734,88 @@ fi
 for ac_func in _getpty grantpt setitimer usleep
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+       eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4431,78 +7829,88 @@ done
 for ac_func in gettimeofday ftime
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+       eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4516,78 +7924,88 @@ done
 for ac_func in random rand48
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+       eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4601,78 +8019,88 @@ done
 for ac_func in gethostname sysinfo
 do
 as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
-if eval "test \"\${$as_ac_var+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char $ac_func ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+#if defined __stub_$ac_func || defined __stub___$ac_func
 choke me
-#else
-char (*f) () = $ac_func;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != $ac_func;
+return $ac_func ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   eval "$as_ac_var=yes"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-eval "$as_ac_var=no"
+       eval "$as_ac_var=no"
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+ac_res=`eval echo '${'$as_ac_var'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 if test `eval echo '${'$as_ac_var'}'` = yes; then
   cat >>confdefs.h <<_ACEOF
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
@@ -4681,136 +8109,152 @@ _ACEOF
 fi
 done
 
-echo "$as_me:$LINENO: checking for setlocale" >&5
-echo $ECHO_N "checking for setlocale... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for setlocale" >&5
+echo $ECHO_N "checking for setlocale... $ECHO_C" >&6; }
 if test "${ac_cv_func_setlocale+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define setlocale to an innocuous variant, in case <limits.h> declares setlocale.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define setlocale innocuous_setlocale
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char setlocale (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef setlocale
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char setlocale ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_setlocale) || defined (__stub___setlocale)
+#if defined __stub_setlocale || defined __stub___setlocale
 choke me
-#else
-char (*f) () = setlocale;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != setlocale;
+return setlocale ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_setlocale=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_setlocale=no
+       ac_cv_func_setlocale=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_setlocale" >&5
-echo "${ECHO_T}$ac_cv_func_setlocale" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_setlocale" >&5
+echo "${ECHO_T}$ac_cv_func_setlocale" >&6; }
 if test $ac_cv_func_setlocale = yes; then
   :
 else
 
-echo "$as_me:$LINENO: checking for setlocale in -li" >&5
-echo $ECHO_N "checking for setlocale in -li... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for setlocale in -li" >&5
+echo $ECHO_N "checking for setlocale in -li... $ECHO_C" >&6; }
 if test "${ac_cv_lib_i_setlocale+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-li  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char setlocale ();
 int
 main ()
 {
-setlocale ();
+return setlocale ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_i_setlocale=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_i_setlocale=no
+       ac_cv_lib_i_setlocale=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_i_setlocale" >&5
-echo "${ECHO_T}$ac_cv_lib_i_setlocale" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_i_setlocale" >&5
+echo "${ECHO_T}$ac_cv_lib_i_setlocale" >&6; }
 if test $ac_cv_lib_i_setlocale = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBI 1
@@ -4829,60 +8273,67 @@ fi
 
 
 
-echo "$as_me:$LINENO: checking for getpseudotty in -lseq" >&5
-echo $ECHO_N "checking for getpseudotty in -lseq... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for getpseudotty in -lseq" >&5
+echo $ECHO_N "checking for getpseudotty in -lseq... $ECHO_C" >&6; }
 if test "${ac_cv_lib_seq_getpseudotty+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lseq  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char getpseudotty ();
 int
 main ()
 {
-getpseudotty ();
+return getpseudotty ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_seq_getpseudotty=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_seq_getpseudotty=no
+       ac_cv_lib_seq_getpseudotty=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_seq_getpseudotty" >&5
-echo "${ECHO_T}$ac_cv_lib_seq_getpseudotty" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_seq_getpseudotty" >&5
+echo "${ECHO_T}$ac_cv_lib_seq_getpseudotty" >&6; }
 if test $ac_cv_lib_seq_getpseudotty = yes; then
   cat >>confdefs.h <<_ACEOF
 #define HAVE_LIBSEQ 1
@@ -4893,52 +8344,57 @@ _ACEOF
 fi
 
 
-echo "$as_me:$LINENO: checking for X" >&5
-echo $ECHO_N "checking for X... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking for X" >&5
+echo $ECHO_N "checking for X... $ECHO_C" >&6; }
 
 
-# Check whether --with-x or --without-x was given.
+# Check whether --with-x was given.
 if test "${with_x+set}" = set; then
-  withval="$with_x"
+  withval=$with_x;
+fi
 
-fi;
 # $have_x is `yes', `no', `disabled', or empty when we do not yet know.
 if test "x$with_x" = xno; then
   # The user explicitly disabled X.
   have_x=disabled
 else
-  if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
-    # Both variables are already set.
-    have_x=yes
-  else
-    if test "${ac_cv_have_x+set}" = set; then
+  case $x_includes,$x_libraries in #(
+    *\'*) { { echo "$as_me:$LINENO: error: Cannot use X directory names containing '" >&5
+echo "$as_me: error: Cannot use X directory names containing '" >&2;}
+   { (exit 1); exit 1; }; };; #(
+    *,NONE | NONE,*) if test "${ac_cv_have_x+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   # One or both of the vars are not set, and there is no cached value.
 ac_x_includes=no ac_x_libraries=no
-rm -fr conftest.dir
+rm -f -r conftest.dir
 if mkdir conftest.dir; then
   cd conftest.dir
-  # Make sure to not put "make" in the Imakefile rules, since we grep it out.
   cat >Imakefile <<'_ACEOF'
-acfindx:
-       @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-_ACEOF
-  if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
+incroot:
+       @echo incroot='${INCROOT}'
+usrlibdir:
+       @echo usrlibdir='${USRLIBDIR}'
+libdir:
+       @echo libdir='${LIBDIR}'
+_ACEOF
+  if (export CC; ${XMKMF-xmkmf}) >/dev/null 2>/dev/null && test -f Makefile; then
     # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-    eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
+    for ac_var in incroot usrlibdir libdir; do
+      eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`"
+    done
     # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
     for ac_extension in a so sl; do
-      if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
-         test -f $ac_im_libdir/libX11.$ac_extension; then
-        ac_im_usrlibdir=$ac_im_libdir; break
+      if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" &&
+        test -f "$ac_im_libdir/libX11.$ac_extension"; then
+       ac_im_usrlibdir=$ac_im_libdir; break
       fi
     done
     # Screen out bogus values from the imake configuration.  They are
     # bogus both because they are the default anyway, and because
     # using them would break gcc on systems where it needs fixed includes.
     case $ac_im_incroot in
-       /usr/include) ;;
+       /usr/include) ac_x_includes= ;;
        *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes=$ac_im_incroot;;
     esac
     case $ac_im_usrlibdir in
@@ -4947,7 +8403,7 @@ _ACEOF
     esac
   fi
   cd ..
-  rm -fr conftest.dir
+  rm -f -r conftest.dir
 fi
 
 # Standard set of common directories for X headers.
@@ -4988,34 +8444,32 @@ ac_x_header_dirs='
 /usr/openwin/share/include'
 
 if test "$ac_x_includes" = no; then
-  # Guess where to find include files, by looking for Intrinsic.h.
+  # Guess where to find include files, by looking for Xlib.h.
   # First, try using that file with no special directory specified.
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   # We can compile using X headers with no special include directory.
 ac_x_includes=
 else
@@ -5023,12 +8477,13 @@ else
 sed 's/^/| /' conftest.$ac_ext >&5
 
   for ac_dir in $ac_x_header_dirs; do
-  if test -r "$ac_dir/X11/Intrinsic.h"; then
+  if test -r "$ac_dir/X11/Xlib.h"; then
     ac_x_includes=$ac_dir
     break
   fi
 done
 fi
+
 rm -f conftest.err conftest.$ac_ext
 fi # $ac_x_includes = no
 
@@ -5037,35 +8492,40 @@ if test "$ac_x_libraries" = no; then
   # See if we find them without any special options.
   # Don't add to $LIBS permanently.
   ac_save_LIBS=$LIBS
-  LIBS="-lXt $LIBS"
+  LIBS="-lX11 $LIBS"
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
-#include <X11/Intrinsic.h>
+#include <X11/Xlib.h>
 int
 main ()
 {
-XtMalloc (0)
+XrmInitialize ()
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   LIBS=$ac_save_LIBS
 # We can link X programs with no special library path.
 ac_x_libraries=
@@ -5073,48 +8533,54 @@ else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-LIBS=$ac_save_LIBS
+       LIBS=$ac_save_LIBS
 for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g`
 do
   # Don't even attempt the hair of trying to link an X program!
   for ac_extension in a so sl; do
-    if test -r $ac_dir/libXt.$ac_extension; then
+    if test -r "$ac_dir/libX11.$ac_extension"; then
       ac_x_libraries=$ac_dir
       break 2
     fi
   done
 done
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi # $ac_x_libraries = no
 
-if test "$ac_x_includes" = no || test "$ac_x_libraries" = no; then
-  # Didn't find X anywhere.  Cache the known absence of X.
-  ac_cv_have_x="have_x=no"
-else
-  # Record where we found X for the cache.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-fi
+case $ac_x_includes,$ac_x_libraries in #(
+  no,* | *,no | *\'*)
+    # Didn't find X, or a directory has "'" in its name.
+    ac_cv_have_x="have_x=no";; #(
+  *)
+    # Record where we found X for the cache.
+    ac_cv_have_x="have_x=yes\
+       ac_x_includes='$ac_x_includes'\
+       ac_x_libraries='$ac_x_libraries'"
+esac
 fi
-
-  fi
+;; #(
+    *) have_x=yes;;
+  esac
   eval "$ac_cv_have_x"
 fi # $with_x != no
 
 if test "$have_x" != yes; then
-  echo "$as_me:$LINENO: result: $have_x" >&5
-echo "${ECHO_T}$have_x" >&6
+  { echo "$as_me:$LINENO: result: $have_x" >&5
+echo "${ECHO_T}$have_x" >&6; }
   no_x=yes
 else
   # If each of the values was on the command line, it overrides each guess.
   test "x$x_includes" = xNONE && x_includes=$ac_x_includes
   test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
   # Update the cache value to reflect the command line values.
-  ac_cv_have_x="have_x=yes \
-               ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
-  echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
-echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6
+  ac_cv_have_x="have_x=yes\
+       ac_x_includes='$x_includes'\
+       ac_x_libraries='$x_libraries'"
+  { echo "$as_me:$LINENO: result: libraries $x_libraries, headers $x_includes" >&5
+echo "${ECHO_T}libraries $x_libraries, headers $x_includes" >&6; }
 fi
 
 if test "$no_x" = yes; then
@@ -5135,13 +8601,12 @@ else
     X_LIBS="$X_LIBS -L$x_libraries"
     # For Solaris; some versions of Sun CC require a space after -R and
     # others require no space.  Words are not sufficient . . . .
-    case `(uname -sr) 2>/dev/null` in
-    "SunOS 5"*)
-      echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
-echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6
-      ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
-      cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
+    { echo "$as_me:$LINENO: checking whether -R must be followed by a space" >&5
+echo $ECHO_N "checking whether -R must be followed by a space... $ECHO_C" >&6; }
+    ac_xsave_LIBS=$LIBS; LIBS="$LIBS -R$x_libraries"
+    ac_xsave_c_werror_flag=$ac_c_werror_flag
+    ac_c_werror_flag=yes
+    cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5157,33 +8622,32 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_R_nospace=yes
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+       X_LIBS="$X_LIBS -R$x_libraries"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_R_nospace=no
-fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-      if test $ac_R_nospace = yes; then
-       echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-       X_LIBS="$X_LIBS -R$x_libraries"
-      else
        LIBS="$ac_xsave_LIBS -R $x_libraries"
-       cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
+       cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -5199,36 +8663,42 @@ main ()
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_R_space=yes
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+         X_LIBS="$X_LIBS -R $x_libraries"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_R_space=no
+       { echo "$as_me:$LINENO: result: neither works" >&5
+echo "${ECHO_T}neither works" >&6; }
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
-       if test $ac_R_space = yes; then
-         echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-         X_LIBS="$X_LIBS -R $x_libraries"
-       else
-         echo "$as_me:$LINENO: result: neither works" >&5
-echo "${ECHO_T}neither works" >&6
-       fi
-      fi
-      LIBS=$ac_xsave_LIBS
-    esac
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+    ac_c_werror_flag=$ac_xsave_c_werror_flag
+    LIBS=$ac_xsave_LIBS
   fi
 
   # Check for system-dependent libraries X programs must link with.
@@ -5243,165 +8713,186 @@ echo "${ECHO_T}neither works" >&6
     # the Alpha needs dnet_stub (dnet does not exist).
     ac_xsave_LIBS="$LIBS"; LIBS="$LIBS $X_LIBS -lX11"
     cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char XOpenDisplay ();
 int
 main ()
 {
-XOpenDisplay ();
+return XOpenDisplay ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   :
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6
+       { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dnet_dnet_ntoa+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldnet  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dnet_ntoa ();
 int
 main ()
 {
-dnet_ntoa ();
+return dnet_ntoa ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dnet_dnet_ntoa=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dnet_dnet_ntoa=no
+       ac_cv_lib_dnet_dnet_ntoa=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_dnet_ntoa" >&6; }
 if test $ac_cv_lib_dnet_dnet_ntoa = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
 fi
 
     if test $ac_cv_lib_dnet_dnet_ntoa = no; then
-      echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
-echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for dnet_ntoa in -ldnet_stub" >&5
+echo $ECHO_N "checking for dnet_ntoa in -ldnet_stub... $ECHO_C" >&6; }
 if test "${ac_cv_lib_dnet_stub_dnet_ntoa+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldnet_stub  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char dnet_ntoa ();
 int
 main ()
 {
-dnet_ntoa ();
+return dnet_ntoa ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_dnet_stub_dnet_ntoa=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_dnet_stub_dnet_ntoa=no
+       ac_cv_lib_dnet_stub_dnet_ntoa=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
-echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dnet_stub_dnet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_dnet_stub_dnet_ntoa" >&6; }
 if test $ac_cv_lib_dnet_stub_dnet_ntoa = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
 fi
 
     fi
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
     LIBS="$ac_xsave_LIBS"
 
     # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
@@ -5412,193 +8903,216 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     # on Irix 5.2, according to T.E. Dickey.
     # The functions gethostbyname, getservbyname, and inet_addr are
     # in -lbsd on LynxOS 3.0.1/i386, according to Lars Hecking.
-    echo "$as_me:$LINENO: checking for gethostbyname" >&5
-echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for gethostbyname" >&5
+echo $ECHO_N "checking for gethostbyname... $ECHO_C" >&6; }
 if test "${ac_cv_func_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define gethostbyname to an innocuous variant, in case <limits.h> declares gethostbyname.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define gethostbyname innocuous_gethostbyname
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gethostbyname (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef gethostbyname
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
+#if defined __stub_gethostbyname || defined __stub___gethostbyname
 choke me
-#else
-char (*f) () = gethostbyname;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != gethostbyname;
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_gethostbyname=no
+       ac_cv_func_gethostbyname=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname" >&6; }
 
     if test $ac_cv_func_gethostbyname = no; then
-      echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
-echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6; }
 if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lnsl  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 int
 main ()
 {
-gethostbyname ();
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_nsl_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_nsl_gethostbyname=no
+       ac_cv_lib_nsl_gethostbyname=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6; }
 if test $ac_cv_lib_nsl_gethostbyname = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 fi
 
       if test $ac_cv_lib_nsl_gethostbyname = no; then
-        echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
-echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6
+       { echo "$as_me:$LINENO: checking for gethostbyname in -lbsd" >&5
+echo $ECHO_N "checking for gethostbyname in -lbsd... $ECHO_C" >&6; }
 if test "${ac_cv_lib_bsd_gethostbyname+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lbsd  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char gethostbyname ();
 int
 main ()
 {
-gethostbyname ();
+return gethostbyname ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_bsd_gethostbyname=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_bsd_gethostbyname=no
+       ac_cv_lib_bsd_gethostbyname=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_bsd_gethostbyname" >&6; }
 if test $ac_cv_lib_bsd_gethostbyname = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lbsd"
 fi
     # variants that don't use the name server (or something).  -lsocket
     # must be given before -lnsl if both are needed.  We assume that
     # if connect needs -lnsl, so does gethostbyname.
-    echo "$as_me:$LINENO: checking for connect" >&5
-echo $ECHO_N "checking for connect... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for connect" >&5
+echo $ECHO_N "checking for connect... $ECHO_C" >&6; }
 if test "${ac_cv_func_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define connect to an innocuous variant, in case <limits.h> declares connect.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define connect innocuous_connect
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char connect (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef connect
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char connect ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_connect) || defined (__stub___connect)
+#if defined __stub_connect || defined __stub___connect
 choke me
-#else
-char (*f) () = connect;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != connect;
+return connect ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_connect=no
+       ac_cv_func_connect=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
-echo "${ECHO_T}$ac_cv_func_connect" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_connect" >&5
+echo "${ECHO_T}$ac_cv_func_connect" >&6; }
 
     if test $ac_cv_func_connect = no; then
-      echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
-echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6; }
 if test "${ac_cv_lib_socket_connect+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char connect ();
 int
 main ()
 {
-connect ();
+return connect ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_socket_connect=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_socket_connect=no
+       ac_cv_lib_socket_connect=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
-echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6; }
 if test $ac_cv_lib_socket_connect = yes; then
   X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
 fi
     fi
 
     # Guillermo Gomez says -lposix is necessary on A/UX.
-    echo "$as_me:$LINENO: checking for remove" >&5
-echo $ECHO_N "checking for remove... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for remove" >&5
+echo $ECHO_N "checking for remove... $ECHO_C" >&6; }
 if test "${ac_cv_func_remove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define remove to an innocuous variant, in case <limits.h> declares remove.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define remove innocuous_remove
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char remove (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef remove
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char remove ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_remove) || defined (__stub___remove)
+#if defined __stub_remove || defined __stub___remove
 choke me
-#else
-char (*f) () = remove;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != remove;
+return remove ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_remove=no
+       ac_cv_func_remove=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
-echo "${ECHO_T}$ac_cv_func_remove" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_remove" >&5
+echo "${ECHO_T}$ac_cv_func_remove" >&6; }
 
     if test $ac_cv_func_remove = no; then
-      echo "$as_me:$LINENO: checking for remove in -lposix" >&5
-echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for remove in -lposix" >&5
+echo $ECHO_N "checking for remove in -lposix... $ECHO_C" >&6; }
 if test "${ac_cv_lib_posix_remove+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lposix  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char remove ();
 int
 main ()
 {
-remove ();
+return remove ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_posix_remove=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_posix_remove=no
+       ac_cv_lib_posix_remove=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
-echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_posix_remove" >&5
+echo "${ECHO_T}$ac_cv_lib_posix_remove" >&6; }
 if test $ac_cv_lib_posix_remove = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
 fi
     fi
 
     # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
-    echo "$as_me:$LINENO: checking for shmat" >&5
-echo $ECHO_N "checking for shmat... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for shmat" >&5
+echo $ECHO_N "checking for shmat... $ECHO_C" >&6; }
 if test "${ac_cv_func_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
+/* Define shmat to an innocuous variant, in case <limits.h> declares shmat.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define shmat innocuous_shmat
+
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char shmat (); below.
     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
     <limits.h> exists even on freestanding compilers.  */
+
 #ifdef __STDC__
 # include <limits.h>
 #else
 # include <assert.h>
 #endif
-/* Override any gcc2 internal prototype to avoid an error.  */
+
+#undef shmat
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
-{
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char shmat ();
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_shmat) || defined (__stub___shmat)
+#if defined __stub_shmat || defined __stub___shmat
 choke me
-#else
-char (*f) () = shmat;
-#endif
-#ifdef __cplusplus
-}
 #endif
 
 int
 main ()
 {
-return f != shmat;
+return shmat ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_func_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_func_shmat=no
+       ac_cv_func_shmat=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 fi
-echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
-echo "${ECHO_T}$ac_cv_func_shmat" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shmat" >&5
+echo "${ECHO_T}$ac_cv_func_shmat" >&6; }
 
     if test $ac_cv_func_shmat = no; then
-      echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
-echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6
+      { echo "$as_me:$LINENO: checking for shmat in -lipc" >&5
+echo $ECHO_N "checking for shmat in -lipc... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ipc_shmat+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lipc  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char shmat ();
 int
 main ()
 {
-shmat ();
+return shmat ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_ipc_shmat=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ipc_shmat=no
+       ac_cv_lib_ipc_shmat=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
-echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ipc_shmat" >&5
+echo "${ECHO_T}$ac_cv_lib_ipc_shmat" >&6; }
 if test $ac_cv_lib_ipc_shmat = yes; then
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
 fi
@@ -6027,60 +9589,67 @@ fi
   # These have to be linked with before -lX11, unlike the other
   # libraries we check for below, so use a different variable.
   # John Interrante, Karl Berry
-  echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
-echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6
+  { echo "$as_me:$LINENO: checking for IceConnectionNumber in -lICE" >&5
+echo $ECHO_N "checking for IceConnectionNumber in -lICE... $ECHO_C" >&6; }
 if test "${ac_cv_lib_ICE_IceConnectionNumber+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lICE $X_EXTRA_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char IceConnectionNumber ();
 int
 main ()
 {
-IceConnectionNumber ();
+return IceConnectionNumber ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_ICE_IceConnectionNumber=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_ICE_IceConnectionNumber=no
+       ac_cv_lib_ICE_IceConnectionNumber=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
-echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ICE_IceConnectionNumber" >&5
+echo "${ECHO_T}$ac_cv_lib_ICE_IceConnectionNumber" >&6; }
 if test $ac_cv_lib_ICE_IceConnectionNumber = yes; then
   X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 fi
@@ -6096,58 +9665,727 @@ if test -n "$no_x" ; then
   exit 1
 fi
 
+if test "${ac_cv_header_X11_Intrinsic_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for X11/Intrinsic.h" >&5
+echo $ECHO_N "checking for X11/Intrinsic.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Intrinsic_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Intrinsic_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Intrinsic_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking X11/Intrinsic.h usability" >&5
+echo $ECHO_N "checking X11/Intrinsic.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <X11/Intrinsic.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking X11/Intrinsic.h presence" >&5
+echo $ECHO_N "checking X11/Intrinsic.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Intrinsic.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Intrinsic.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: X11/Intrinsic.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for X11/Intrinsic.h" >&5
+echo $ECHO_N "checking for X11/Intrinsic.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Intrinsic_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_X11_Intrinsic_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Intrinsic_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Intrinsic_h" >&6; }
+
+fi
+if test $ac_cv_header_X11_Intrinsic_h = yes; then
+  xt="yes"
+else
+  xt="no"
+fi
+
+
+
+if test "$xt" == "no" ; then
+   echo Xt headers not found
+   exit 1
+fi
+
+
+# Check whether --with-Xaw3d was given.
+if test "${with_Xaw3d+set}" = set; then
+  withval=$with_Xaw3d; with_xaw3d="yes"
+else
+  with_xaw3d="no"
+fi
+
+
+
+xaw_headers="no"
+if test "$with_xaw3d" == "yes" ; then
+   XAW_LIBS="-lXaw3d"
+   { echo "$as_me:$LINENO: checking for XawTextReplace in -lXaw3d" >&5
+echo $ECHO_N "checking for XawTextReplace in -lXaw3d... $ECHO_C" >&6; }
+if test "${ac_cv_lib_Xaw3d_XawTextReplace+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lXaw3d  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XawTextReplace ();
+int
+main ()
+{
+return XawTextReplace ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_Xaw3d_XawTextReplace=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_cv_lib_Xaw3d_XawTextReplace=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xaw3d_XawTextReplace" >&5
+echo "${ECHO_T}$ac_cv_lib_Xaw3d_XawTextReplace" >&6; }
+if test $ac_cv_lib_Xaw3d_XawTextReplace = yes; then
+  xaw3d_lib="yes"
+else
+  xaw3d_lib="no"
+fi
+
+   if test "$xaw3d_lib" == "no" ; then
+      echo Xaw3d libraries not found
+      exit 1
+   else
+      if test "${ac_cv_header_X11_Xaw3d_Dialog_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for X11/Xaw3d/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw3d/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw3d_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw3d_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw3d_Dialog_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking X11/Xaw3d/Dialog.h usability" >&5
+echo $ECHO_N "checking X11/Xaw3d/Dialog.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <X11/Xaw3d/Dialog.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking X11/Xaw3d/Dialog.h presence" >&5
+echo $ECHO_N "checking X11/Xaw3d/Dialog.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xaw3d/Dialog.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw3d/Dialog.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: X11/Xaw3d/Dialog.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for X11/Xaw3d/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw3d/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw3d_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_X11_Xaw3d_Dialog_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw3d_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw3d_Dialog_h" >&6; }
+
+fi
+if test $ac_cv_header_X11_Xaw3d_Dialog_h = yes; then
+  xaw3d_headers="yes"
+else
+  xaw3d_headers="no"
+fi
+
+
+      if test "$xaw3d_headers" == "yes" ; then
+        cat >>confdefs.h <<\_ACEOF
+#define USE_XAW3D 1
+_ACEOF
+
+        xaw_headers="yes"
+      else
+       if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for X11/Xaw/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw_Dialog_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking X11/Xaw/Dialog.h usability" >&5
+echo $ECHO_N "checking X11/Xaw/Dialog.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <X11/Xaw/Dialog.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking X11/Xaw/Dialog.h presence" >&5
+echo $ECHO_N "checking X11/Xaw/Dialog.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xaw/Dialog.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for X11/Xaw/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_X11_Xaw_Dialog_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw_Dialog_h" >&6; }
+
+fi
+if test $ac_cv_header_X11_Xaw_Dialog_h = yes; then
+  xaw_headers="yes"
+fi
+
+
+      fi
+   fi
+else
+   XAW_LIBS="-lXaw"
+   if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  { echo "$as_me:$LINENO: checking for X11/Xaw/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw_Dialog_h" >&6; }
+else
+  # Is the header compilable?
+{ echo "$as_me:$LINENO: checking X11/Xaw/Dialog.h usability" >&5
+echo $ECHO_N "checking X11/Xaw/Dialog.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <X11/Xaw/Dialog.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking X11/Xaw/Dialog.h presence" >&5
+echo $ECHO_N "checking X11/Xaw/Dialog.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <X11/Xaw/Dialog.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: X11/Xaw/Dialog.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: X11/Xaw/Dialog.h: in the future, the compiler will take precedence" >&2;}
+
+    ;;
+esac
+{ echo "$as_me:$LINENO: checking for X11/Xaw/Dialog.h" >&5
+echo $ECHO_N "checking for X11/Xaw/Dialog.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_X11_Xaw_Dialog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_X11_Xaw_Dialog_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_X11_Xaw_Dialog_h" >&5
+echo "${ECHO_T}$ac_cv_header_X11_Xaw_Dialog_h" >&6; }
+
+fi
+if test $ac_cv_header_X11_Xaw_Dialog_h = yes; then
+  xaw_headers="yes"
+fi
+
+
+fi
+
+
+
+
+
+if test "$xaw_headers" == "no" ; then
+   echo Xaw headers not found
+   exit 1
+
+fi
+
+
+
+
 # Make sure we can run config.sub.
-$ac_config_sub sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
-echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
    { (exit 1); exit 1; }; }
 
-echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
 if test "${ac_cv_build+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_build_alias=$build_alias
-test -z "$ac_cv_build_alias" &&
-  ac_cv_build_alias=`$ac_config_guess`
-test -z "$ac_cv_build_alias" &&
+  ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
   { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
 echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
    { (exit 1); exit 1; }; }
-ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
    { (exit 1); exit 1; }; }
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
 build=$ac_cv_build
-build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-
-echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
 if test "${ac_cv_host+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_cv_host_alias=$host_alias
-test -z "$ac_cv_host_alias" &&
-  ac_cv_host_alias=$ac_cv_build_alias
-ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
-  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
-echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+  if test "x$host_alias" = x; then
+  ac_cv_host=$ac_cv_build
+else
+  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
    { (exit 1); exit 1; }; }
+fi
 
 fi
-echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+   { (exit 1); exit 1; }; };;
+esac
 host=$ac_cv_host
-host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
@@ -6333,13 +10571,13 @@ _ACEOF
   ;;
 esac
 
-# Check whether --enable-xpm or --disable-xpm was given.
+# Check whether --enable-xpm was given.
 if test "${enable_xpm+set}" = set; then
-  enableval="$enable_xpm"
-  enable_xpm="$enableval"
+  enableval=$enable_xpm; enable_xpm="$enableval"
 else
   enable_xpm="yes"
-fi;
+fi
+
 
 if test "$enable_xpm" = "yes"; then
   save_cflags="$CFLAGS"
@@ -6349,20 +10587,20 @@ if test "$enable_xpm" = "yes"; then
 for ac_header in X11/xpm.h
 do
 as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
-  echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+  { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 else
   # Is the header compilable?
-echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6372,33 +10610,38 @@ $ac_includes_default
 #include <$ac_header>
 _ACEOF
 rm -f conftest.$ac_objext
-if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
-  (eval $ac_compile) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest.$ac_objext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_compile") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest.$ac_objext; then
   ac_header_compiler=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_header_compiler=no
+       ac_header_compiler=no
 fi
-rm -f conftest.$ac_objext conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
 
 # Is the header present?
-echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
@@ -6406,23 +10649,22 @@ cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 #include <$ac_header>
 _ACEOF
-if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
-  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
   ac_status=$?
   grep -v '^ *+' conftest.er1 >conftest.err
   rm -f conftest.er1
   cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_c_preproc_warn_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
+  (exit $ac_status); } >/dev/null && {
+        test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       }; then
   ac_header_preproc=yes
 else
   echo "$as_me: failed program was:" >&5
@@ -6430,52 +10672,46 @@ sed 's/^/| /' conftest.$ac_ext >&5
 
   ac_header_preproc=no
 fi
+
 rm -f conftest.err conftest.$ac_ext
-echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
 
 # So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc in
-  yes:no )
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
     { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
     ;;
-  no:yes )
+  no:yes:* )
     { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
     { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
 echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    (
-      cat <<\_ASBOX
-## ------------------------------------ ##
-## Report this to bug-autoconf@gnu.org. ##
-## ------------------------------------ ##
-_ASBOX
-    ) |
-      sed "s/^/$as_me: WARNING:     /" >&2
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+
     ;;
 esac
-echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
-if eval "test \"\${$as_ac_Header+set}\" = set"; then
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  eval "$as_ac_Header=$ac_header_preproc"
+  eval "$as_ac_Header=\$ac_header_preproc"
 fi
-echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
-echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+              { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
 
 fi
 if test `eval echo '${'$as_ac_Header'}'` = yes; then
@@ -6491,60 +10727,67 @@ done
   if test "$ac_cv_header_X11_xpm_h" = "yes"; then
     save_ldflags="$LDFLAGS"
     LDFLAGS="$LDFLAGS $X_LIBS"
-    echo "$as_me:$LINENO: checking for XpmReadFileToPixmap in -lXpm" >&5
-echo $ECHO_N "checking for XpmReadFileToPixmap in -lXpm... $ECHO_C" >&6
+    { echo "$as_me:$LINENO: checking for XpmReadFileToPixmap in -lXpm" >&5
+echo $ECHO_N "checking for XpmReadFileToPixmap in -lXpm... $ECHO_C" >&6; }
 if test "${ac_cv_lib_Xpm_XpmReadFileToPixmap+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
 LIBS="-lXpm $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
 /* confdefs.h.  */
 _ACEOF
 cat confdefs.h >>conftest.$ac_ext
 cat >>conftest.$ac_ext <<_ACEOF
 /* end confdefs.h.  */
 
-/* Override any gcc2 internal prototype to avoid an error.  */
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
 #ifdef __cplusplus
 extern "C"
 #endif
-/* We use char because int might match the return type of a gcc2
-   builtin and then its argument prototype would still apply.  */
 char XpmReadFileToPixmap ();
 int
 main ()
 {
-XpmReadFileToPixmap ();
+return XpmReadFileToPixmap ();
   ;
   return 0;
 }
 _ACEOF
 rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
-  (eval $ac_link) 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-         { ac_try='test -s conftest$ac_exeext'
-  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
-  (eval $ac_try) 2>&5
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
   ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
+  (exit $ac_status); } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
   ac_cv_lib_Xpm_XpmReadFileToPixmap=yes
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
 
-ac_cv_lib_Xpm_XpmReadFileToPixmap=no
+       ac_cv_lib_Xpm_XpmReadFileToPixmap=no
 fi
-rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
 LIBS=$ac_check_lib_save_LIBS
 fi
-echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5
-echo "${ECHO_T}$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_Xpm_XpmReadFileToPixmap" >&5
+echo "${ECHO_T}$ac_cv_lib_Xpm_XpmReadFileToPixmap" >&6; }
 if test $ac_cv_lib_Xpm_XpmReadFileToPixmap = yes; then
   X_PRE_LIBS="-lXpm $X_PRE_LIBS"; cat >>confdefs.h <<\_ACEOF
 #define HAVE_LIBXPM 1
 
 
 
-echo "$as_me:$LINENO: checking whether ptys or pipes should be used" >&5
-echo $ECHO_N "checking whether ptys or pipes should be used... $ECHO_C" >&6
-# Check whether --enable-ptys or --disable-ptys was given.
+{ echo "$as_me:$LINENO: checking whether ptys or pipes should be used" >&5
+echo $ECHO_N "checking whether ptys or pipes should be used... $ECHO_C" >&6; }
+# Check whether --enable-ptys was given.
 if test "${enable_ptys+set}" = set; then
-  enableval="$enable_ptys"
-  if test "$enableval" = yes; then
+  enableval=$enable_ptys; if test "$enableval" = yes; then
   USE_PTYS=1
-  echo "$as_me:$LINENO: result: ptys (user override)" >&5
-echo "${ECHO_T}ptys (user override)" >&6
+  { echo "$as_me:$LINENO: result: ptys (user override)" >&5
+echo "${ECHO_T}ptys (user override)" >&6; }
 fi
 if test "$enableval" = no; then
   USE_PTYS=0
-  echo "$as_me:$LINENO: result: pipes (user override)" >&5
-echo "${ECHO_T}pipes (user override)" >&6
+  { echo "$as_me:$LINENO: result: pipes (user override)" >&5
+echo "${ECHO_T}pipes (user override)" >&6; }
 fi
 else
   if test "$USE_PTYS" = 1; then
-  echo "$as_me:$LINENO: result: ptys" >&5
-echo "${ECHO_T}ptys" >&6
+  { echo "$as_me:$LINENO: result: ptys" >&5
+echo "${ECHO_T}ptys" >&6; }
 else
-  echo "$as_me:$LINENO: result: pipes" >&5
-echo "${ECHO_T}pipes" >&6
+  { echo "$as_me:$LINENO: result: pipes" >&5
+echo "${ECHO_T}pipes" >&6; }
+fi
 fi
-fi;
+
 cat >>confdefs.h <<_ACEOF
 #define USE_PTYS $USE_PTYS
 _ACEOF
 
 
-# Check whether --enable-zippy or --disable-zippy was given.
+# Check whether --enable-zippy was given.
 if test "${enable_zippy+set}" = set; then
-  enableval="$enable_zippy"
-  enable_zippy="$enableval"
+  enableval=$enable_zippy; enable_zippy="$enableval"
 else
   enable_zippy="yes"
-fi;
+fi
+
 if test "$enable_zippy" = yes; then
   cat >>confdefs.h <<\_ACEOF
 #define ZIPPY 1
@@ -6608,10 +10851,9 @@ fi
 
 
 
-# Check whether --enable-sigint or --disable-sigint was given.
+# Check whether --enable-sigint was given.
 if test "${enable_sigint+set}" = set; then
-  enableval="$enable_sigint"
-  if test "$enableval" = yes; then
+  enableval=$enable_sigint; if test "$enableval" = yes; then
   cat >>confdefs.h <<\_ACEOF
 #define ATTENTION 1
 _ACEOF
@@ -6622,7 +10864,8 @@ else
 #define ATTENTION 1
 _ACEOF
 
-fi;
+fi
+
 
 cat >>confdefs.h <<_ACEOF
 #define PRODUCT "$PRODUCT"
@@ -6640,8 +10883,10 @@ _ACEOF
 
 
 
-                              ac_config_files="$ac_config_files Makefile cmail xboard.texinfo"
-          ac_config_commands="$ac_config_commands default"
+ac_config_files="$ac_config_files cmail xboard.texinfo"
+
+ac_config_commands="$ac_config_commands default"
+
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -6660,39 +10905,58 @@ _ACEOF
 
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
+# So, we kill variables containing newlines.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-{
+(
+  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+    eval ac_val=\$$ac_var
+    case $ac_val in #(
+    *${as_nl}*)
+      case $ac_var in #(
+      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+      esac
+      case $ac_var in #(
+      _ | IFS | as_nl) ;; #(
+      *) $as_unset $ac_var ;;
+      esac ;;
+    esac
+  done
+
   (set) 2>&1 |
-    case `(ac_space=' '; set | grep ac_space) 2>&1` in
-    *ac_space=\ *)
+    case $as_nl`(ac_space=' '; set) 2>&1` in #(
+    *${as_nl}ac_space=\ *)
       # `set' does not quote correctly, so add quotes (double-quote
       # substitution turns \\\\ into \\, and sed turns \\ into \).
       sed -n \
-        "s/'/'\\\\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;;
+       "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;; #(
     *)
       # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n \
-        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
       ;;
-    esac;
-} |
+    esac |
+    sort
+) |
   sed '
+     /^ac_cv_env_/b end
      t clear
-     : clear
+     :clear
      s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
      t end
-     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     : end' >>confcache
-if diff $cache_file confcache >/dev/null 2>&1; then :; else
-  if test -w $cache_file; then
-    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+  if test -w "$cache_file"; then
+    test "x$cache_file" != "x/dev/null" &&
+      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
     cat confcache >$cache_file
   else
-    echo "not updating unwritable cache $cache_file"
+    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
   fi
 fi
 rm -f confcache
@@ -6701,38 +10965,45 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[        ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/;
-s/:*\${srcdir}:*/:/;
-s/:*@srcdir@:*/:/;
-s/^\([^=]*=[   ]*\):*/\1/;
-s/:*$//;
-s/^[^=]*=[     ]*$//;
-}'
-fi
-
 DEFS=-DHAVE_CONFIG_H
 
 ac_libobjs=
 ac_ltlibobjs=
 for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
   # 1. Remove the extension, and $U if already installed.
-  ac_i=`echo "$ac_i" |
-         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
-  # 2. Add them.
-  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+  ac_i=`echo "$ac_i" | sed "$ac_script"`
+  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
+  #    will be set to the directory where LIBOBJS objects are built.
+  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
 done
 LIBOBJS=$ac_libobjs
 
 LTLIBOBJS=$ac_ltlibobjs
 
 
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 
 : ${CONFIG_STATUS=./config.status}
 ac_clean_files_save=$ac_clean_files
@@ -6757,27 +11028,91 @@ cat >>$CONFIG_STATUS <<\_ACEOF
 ## M4sh Initialization.  ##
 ## --------------------- ##
 
-# Be Bourne compatible
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   emulate sh
   NULLCMD=:
   # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   # is contrary to our usage.  Disable this feature.
   alias -g '${1+"$@"}'='"$@"'
-elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
-  set -o posix
+  setopt NO_GLOB_SUBST
+else
+  case `(set -o) 2>/dev/null` in
+  *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.sh
 fi
 
 # Support unset when possible.
-if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
   as_unset=unset
 else
   as_unset=false
 fi
 
 
+# IFS
+# We need space, tab and new line, in precisely that order.  Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+as_nl='
+'
+IFS=" ""       $as_nl"
+
+# Find who we are.  Look in the path if we contain no directory separator.
+case $0 in
+  *[\\/]* ) as_myself=$0 ;;
+  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+     ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+  as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+  { (exit 1); exit 1; }
+fi
+
 # Work around bugs in pre-3.0 UWIN ksh.
-$as_unset ENV MAIL MAILPATH
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
 PS1='$ '
 PS2='> '
 PS4='+ '
@@ -6788,21 +11123,22 @@ for as_var in \
   LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
   LC_TELEPHONE LC_TIME
 do
-  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
     eval $as_var=C; export $as_var
   else
-    $as_unset $as_var
+    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
   fi
 done
 
 # Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
-if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
   as_basename=basename
 else
   as_basename=false
 
 
 # Name of the executable.
-as_me=`$as_basename "$0" ||
+as_me=`$as_basename -- "$0" ||
 $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
         X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)$' \| \
-        .     : '\(.\)' 2>/dev/null ||
+        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
 echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
-         /^X\/\(\/\/\)$/{ s//\1/; q; }
-         /^X\/\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-
-
-# PATH needs CR, and LINENO needs CR and PATH.
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+    sed '/^.*\/\([^/][^/]*\)\/*$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\/\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
 
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
+# CDPATH.
+$as_unset CDPATH
 
 
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
-  # Find who we are.  Look in the path if we contain no path at all
-  # relative or not.
-  case $0 in
-    *[\\/]* ) as_myself=$0 ;;
-    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
 
-       ;;
-  esac
-  # We did not find ourselves, most probably we were run as `sh COMMAND'
-  # in which case we are not to be found in the path.
-  if test "x$as_myself" = x; then
-    as_myself=$0
-  fi
-  if test ! -f "$as_myself"; then
-    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
-echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
-   { (exit 1); exit 1; }; }
-  fi
-  case $CONFIG_SHELL in
-  '')
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for as_base in sh bash ksh sh5; do
-        case $as_dir in
-        /*)
-          if ("$as_dir/$as_base" -c '
   as_lineno_1=$LINENO
   as_lineno_2=$LINENO
-  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
   test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
-            $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
-            $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
-            CONFIG_SHELL=$as_dir/$as_base
-            export CONFIG_SHELL
-            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
-          fi;;
-        esac
-       done
-done
-;;
-  esac
+  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
 
   # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
   # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line before each line; the second 'sed' does the real
-  # work.  The second script uses 'N' to pair each line-number line
-  # with the numbered line, and appends trailing '-' during
-  # substitution so that $LINENO is not a special case at line end.
+  # line-number line after each line using $LINENO; the second 'sed'
+  # does the real work.  The second script uses 'N' to pair each
+  # line-number line with the line containing $LINENO, and appends
+  # trailing '-' during substitution so that $LINENO is not a special
+  # case at line end.
   # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
-  sed '=' <$as_myself |
+  # scripts with optimization help from Paolo Bonzini.  Blame Lee
+  # E. McMahon (1931-1989) for sed's syntax.  :-)
+  sed -n '
+    p
+    /[$]LINENO/=
+  ' <$as_myself |
     sed '
+      s/[$]LINENO.*/&-/
+      t lineno
+      b
+      :lineno
       N
-      s,$,-,
-      : loop
-      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      :loop
+      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
       t loop
-      s,-$,,
-      s,^['$as_cr_digits']*\n,,
+      s/-\n.*//
     ' >$as_me.lineno &&
-  chmod +x $as_me.lineno ||
-    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
-echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+  chmod +x "$as_me.lineno" ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
    { (exit 1); exit 1; }; }
 
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensible to this).
-  . ./$as_me.lineno
+  # original and so on.  Autoconf is especially sensitive to this).
+  . "./$as_me.lineno"
   # Exit status is that of the last command.
   exit
 }
 
 
-case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
-  *c*,-n*) ECHO_N= ECHO_C='
-' ECHO_T='     ' ;;
-  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
-  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+  as_dirname=dirname
+else
+  as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+  case `echo 'x\c'` in
+  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
+  *)   ECHO_C='\c';;
+  esac;;
+*)
+  ECHO_N='-n';;
 esac
 
-if expr a : '\(a\)' >/dev/null 2>&1; then
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+   test "X`expr 00001 : '.*\(...\)'`" = X001; then
   as_expr=expr
 else
   as_expr=false
 fi
 
 rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+  rm -f conf$$.dir/conf$$.file
+else
+  rm -f conf$$.dir
+  mkdir conf$$.dir
+fi
 echo >conf$$.file
 if ln -s conf$$.file conf$$ 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conf$$.exe; then
-    # Don't use ln at all; we don't have any links
+  as_ln_s='ln -s'
+  # ... but there are two gotchas:
+  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+  # In both cases, we have to default to `cp -p'.
+  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
     as_ln_s='cp -p'
-  else
-    as_ln_s='ln -s'
-  fi
 elif ln conf$$.file conf$$ 2>/dev/null; then
   as_ln_s=ln
 else
   as_ln_s='cp -p'
 fi
-rm -f conf$$ conf$$.exe conf$$.file
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
 
 if mkdir -p . 2>/dev/null; then
   as_mkdir_p=:
 else
+  test -d ./-p && rmdir ./-p
   as_mkdir_p=false
 fi
 
-as_executable_p="test -f"
+if test -x / >/dev/null 2>&1; then
+  as_test_x='test -x'
+else
+  if ls -dL / >/dev/null 2>&1; then
+    as_ls_L_option=L
+  else
+    as_ls_L_option=
+  fi
+  as_test_x='
+    eval sh -c '\''
+      if test -d "$1"; then
+        test -d "$1/.";
+      else
+       case $1 in
+        -*)set "./$1";;
+       esac;
+       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+       ???[sx]*):;;*)false;;esac;fi
+    '\'' sh
+  '
+fi
+as_executable_p=$as_test_x
 
 # Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
 
 # Sed expression to map a string onto a valid variable name.
-as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
 
 
-# IFS
-# We need space, tab and new line, in precisely that order.
-as_nl='
-'
-IFS="  $as_nl"
-
-# CDPATH.
-$as_unset CDPATH
-
 exec 6>&1
 
-# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# Save the log message, to keep $[0] and so on meaningful, and to
 # report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.  Logging --version etc. is OK.
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-} >&5
-cat >&5 <<_CSEOF
-
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.57.  Invocation command line was
+# values after options handling.
+ac_log="
+This file was extended by xboard $as_me 4.3, which was
+generated by GNU Autoconf 2.61.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -7011,30 +11313,20 @@ generated by GNU Autoconf 2.57.  Invocation command line was
   CONFIG_COMMANDS = $CONFIG_COMMANDS
   $ $0 $@
 
-_CSEOF
-echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
-echo >&5
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
 _ACEOF
 
+cat >>$CONFIG_STATUS <<_ACEOF
 # Files that config.status was made for.
-if test -n "$ac_config_files"; then
-  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
-fi
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
 
-if test -n "$ac_config_headers"; then
-  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_links"; then
-  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
-fi
-
-if test -n "$ac_config_commands"; then
-  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
-fi
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
-
 ac_cs_usage="\
 \`$as_me' instantiates files from templates according to the
 current configuration.
@@ -7042,14 +11334,14 @@ current configuration.
 Usage: $0 [OPTIONS] [FILE]...
 
   -h, --help       print this help, then exit
-  -V, --version    print version number, then exit
+  -V, --version    print version number and configuration settings, then exit
   -q, --quiet      do not print progress messages
   -d, --debug      don't remove temporary files
       --recheck    update $as_me by reconfiguring in the same conditions
   --file=FILE[:TEMPLATE]
-                   instantiate the configuration file FILE
+                  instantiate the configuration file FILE
   --header=FILE[:TEMPLATE]
-                   instantiate the configuration header FILE
+                  instantiate the configuration header FILE
 
 Configuration files:
 $config_files
@@ -7061,20 +11353,22 @@ Configuration commands:
 $config_commands
 
 Report bugs to <bug-autoconf@gnu.org>."
-_ACEOF
 
+_ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.57,
-  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+xboard config.status 4.3
+configured by $0, generated by GNU Autoconf 2.61,
+  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
 
-Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
-Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
-srcdir=$srcdir
-INSTALL="$INSTALL"
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
 _ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
@@ -7085,39 +11379,24 @@ while test $# != 0
 do
   case $1 in
   --*=*)
-    ac_option=`expr "x$1" : 'x\([^=]*\)='`
-    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_option=`expr "X$1" : 'X\([^=]*\)='`
+    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
     ac_shift=:
     ;;
-  -*)
+  *)
     ac_option=$1
     ac_optarg=$2
     ac_shift=shift
     ;;
-  *) # This is not an option, so the user has probably given explicit
-     # arguments.
-     ac_option=$1
-     ac_need_defaults=false;;
   esac
 
   case $ac_option in
   # Handling of the options.
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
     ac_cs_recheck=: ;;
-  --version | --vers* | -V )
-    echo "$ac_cs_version"; exit 0 ;;
-  --he | --h)
-    # Conflict between --help and --header
-    { { echo "$as_me:$LINENO: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2;}
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit 0 ;;
-  --debug | --d* | -d )
+  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+    echo "$ac_cs_version"; exit ;;
+  --debug | --debu | --deb | --de | --d | -d )
     debug=: ;;
   --file | --fil | --fi | --f )
     $ac_shift
@@ -7127,18 +11406,24 @@ Try \`$0 --help' for more information." >&2;}
     $ac_shift
     CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
     ac_need_defaults=false;;
+  --he | --h)
+    # Conflict between --help and --header
+    { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit ;;
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil | --si | --s)
     ac_cs_silent=: ;;
 
   # This is an error.
-  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&5
-echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2;}
+  -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
    { (exit 1); exit 1; }; } ;;
 
-  *) ac_config_targets="$ac_config_targets $1" ;;
+  *) ac_config_targets="$ac_config_targets $1"
+     ac_need_defaults=false ;;
 
   esac
   shift
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
 if \$ac_cs_recheck; then
-  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  CONFIG_SHELL=$SHELL
+  export CONFIG_SHELL
+  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
 fi
 
 _ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+  echo "$ac_log"
+} >&5
 
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
 
-
-
+_ACEOF
 
 cat >>$CONFIG_STATUS <<\_ACEOF
+
+# Handling of arguments.
 for ac_config_target in $ac_config_targets
 do
-  case "$ac_config_target" in
-  # Handling of arguments.
-  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-  "cmail" ) CONFIG_FILES="$CONFIG_FILES cmail" ;;
-  "xboard.texinfo" ) CONFIG_FILES="$CONFIG_FILES xboard.texinfo" ;;
-  "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
-  "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+  case $ac_config_target in
+    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+    "cmail") CONFIG_FILES="$CONFIG_FILES cmail" ;;
+    "xboard.texinfo") CONFIG_FILES="$CONFIG_FILES xboard.texinfo" ;;
+    "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;;
+
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
 echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
    { (exit 1); exit 1; }; };;
   esac
 done
 
+
 # If the user did not use the arguments to specify the items to instantiate,
 # then the envvar interface is used.  Set only those that are not.
 # We use the long form for the default assignment because of an extremely
@@ -7191,609 +11496,777 @@ if $ac_need_defaults; then
 fi
 
 # Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason to put it here, and in addition,
+# simply because there is no reason against having it here, and in addition,
 # creating and moving files from /tmp can sometimes cause problems.
-# Create a temporary directory, and hook for its removal unless debugging.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
 $debug ||
 {
-  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  tmp=
+  trap 'exit_status=$?
+  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
   trap '{ (exit 1); exit 1; }' 1 2 13 15
 }
-
 # Create a (secure) tmp directory for tmp files.
 
 {
-  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
   test -n "$tmp" && test -d "$tmp"
 }  ||
 {
-  tmp=./confstat$$-$RANDOM
-  (umask 077 && mkdir $tmp)
+  tmp=./conf$$-$RANDOM
+  (umask 077 && mkdir "$tmp")
 } ||
 {
    echo "$me: cannot create a temporary directory in ." >&2
    { (exit 1); exit 1; }
 }
 
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-
 #
-# CONFIG_FILES section.
+# Set up the sed scripts for CONFIG_FILES section.
 #
 
 # No need to generate the scripts if there are no CONFIG_FILES.
 # This happens for instance when ./config.status config.h
-if test -n "\$CONFIG_FILES"; then
-  # Protect against being on the right side of a sed subst in config.status.
-  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
-   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
-s,@SHELL@,$SHELL,;t t
-s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
-s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
-s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
-s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
-s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
-s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
-s,@exec_prefix@,$exec_prefix,;t t
-s,@prefix@,$prefix,;t t
-s,@program_transform_name@,$program_transform_name,;t t
-s,@bindir@,$bindir,;t t
-s,@sbindir@,$sbindir,;t t
-s,@libexecdir@,$libexecdir,;t t
-s,@datadir@,$datadir,;t t
-s,@sysconfdir@,$sysconfdir,;t t
-s,@sharedstatedir@,$sharedstatedir,;t t
-s,@localstatedir@,$localstatedir,;t t
-s,@libdir@,$libdir,;t t
-s,@includedir@,$includedir,;t t
-s,@oldincludedir@,$oldincludedir,;t t
-s,@infodir@,$infodir,;t t
-s,@mandir@,$mandir,;t t
-s,@build_alias@,$build_alias,;t t
-s,@host_alias@,$host_alias,;t t
-s,@target_alias@,$target_alias,;t t
-s,@DEFS@,$DEFS,;t t
-s,@ECHO_C@,$ECHO_C,;t t
-s,@ECHO_N@,$ECHO_N,;t t
-s,@ECHO_T@,$ECHO_T,;t t
-s,@LIBS@,$LIBS,;t t
-s,@CC@,$CC,;t t
-s,@CFLAGS@,$CFLAGS,;t t
-s,@LDFLAGS@,$LDFLAGS,;t t
-s,@CPPFLAGS@,$CPPFLAGS,;t t
-s,@ac_ct_CC@,$ac_ct_CC,;t t
-s,@EXEEXT@,$EXEEXT,;t t
-s,@OBJEXT@,$OBJEXT,;t t
-s,@CPP@,$CPP,;t t
-s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
-s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
-s,@INSTALL_DATA@,$INSTALL_DATA,;t t
-s,@LEX@,$LEX,;t t
-s,@LEXLIB@,$LEXLIB,;t t
-s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t
-s,@RSH@,$RSH,;t t
-s,@NROFF@,$NROFF,;t t
-s,@NROFFFLAGS@,$NROFFFLAGS,;t t
-s,@AWKPATH@,$AWKPATH,;t t
-s,@PERLPATH@,$PERLPATH,;t t
-s,@XAW_LIBS@,$XAW_LIBS,;t t
-s,@EGREP@,$EGREP,;t t
-s,@X_CFLAGS@,$X_CFLAGS,;t t
-s,@X_PRE_LIBS@,$X_PRE_LIBS,;t t
-s,@X_LIBS@,$X_LIBS,;t t
-s,@X_EXTRA_LIBS@,$X_EXTRA_LIBS,;t t
-s,@build@,$build,;t t
-s,@build_cpu@,$build_cpu,;t t
-s,@build_vendor@,$build_vendor,;t t
-s,@build_os@,$build_os,;t t
-s,@host@,$host,;t t
-s,@host_cpu@,$host_cpu,;t t
-s,@host_vendor@,$host_vendor,;t t
-s,@host_os@,$host_os,;t t
-s,@PRE_XMULIB@,$PRE_XMULIB,;t t
-s,@POST_XMULIB@,$POST_XMULIB,;t t
-s,@CONF_CFLAGS@,$CONF_CFLAGS,;t t
-s,@CONF_LDFLAGS@,$CONF_LDFLAGS,;t t
-s,@ZIPPY_O@,$ZIPPY_O,;t t
-s,@ZIPPY_H@,$ZIPPY_H,;t t
-s,@PRODUCT@,$PRODUCT,;t t
-s,@VERSION@,$VERSION,;t t
-s,@PATCHLEVEL@,$PATCHLEVEL,;t t
-s,@LIBOBJS@,$LIBOBJS,;t t
-s,@LTLIBOBJS@,$LTLIBOBJS,;t t
-CEOF
-
-_ACEOF
-
-  cat >>$CONFIG_STATUS <<\_ACEOF
-  # Split the substitutions into bite-sized pieces for seds with
-  # small command number limits, like on Digital OSF/1 and HP-UX.
-  ac_max_sed_lines=48
-  ac_sed_frag=1 # Number of current file.
-  ac_beg=1 # First line for current file.
-  ac_end=$ac_max_sed_lines # Line after last line for current file.
-  ac_more_lines=:
-  ac_sed_cmds=
-  while $ac_more_lines; do
-    if test $ac_beg -gt 1; then
-      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    else
-      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
-    fi
-    if test ! -s $tmp/subs.frag; then
-      ac_more_lines=false
-    else
-      # The purpose of the label and of the branching condition is to
-      # speed up the sed processing (if there are no `@' at all, there
-      # is no need to browse any of the substitutions).
-      # These are the two extra sed commands mentioned above.
-      (echo ':t
-  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
-      if test -z "$ac_sed_cmds"; then
-       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
-      else
-       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
-      fi
-      ac_sed_frag=`expr $ac_sed_frag + 1`
-      ac_beg=$ac_end
-      ac_end=`expr $ac_end + $ac_max_sed_lines`
-    fi
-  done
-  if test -z "$ac_sed_cmds"; then
-    ac_sed_cmds=cat
+if test -n "$CONFIG_FILES"; then
+
+_ACEOF
+
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+am__isrc!$am__isrc$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+AMTAR!$AMTAR$ac_delim
+am__tar!$am__tar$ac_delim
+am__untar!$am__untar$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+DEPDIR!$DEPDIR$ac_delim
+am__include!$am__include$ac_delim
+am__quote!$am__quote$ac_delim
+AMDEP_TRUE!$AMDEP_TRUE$ac_delim
+AMDEP_FALSE!$AMDEP_FALSE$ac_delim
+AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
+CPP!$CPP$ac_delim
+LEX!$LEX$ac_delim
+LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
+LEXLIB!$LEXLIB$ac_delim
+RSH!$RSH$ac_delim
+MINFO!$MINFO$ac_delim
+NROFF!$NROFF$ac_delim
+NROFFFLAGS!$NROFFFLAGS$ac_delim
+AWKPATH!$AWKPATH$ac_delim
+PERLPATH!$PERLPATH$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+XMKMF!$XMKMF$ac_delim
+X_CFLAGS!$X_CFLAGS$ac_delim
+X_PRE_LIBS!$X_PRE_LIBS$ac_delim
+X_LIBS!$X_LIBS$ac_delim
+X_EXTRA_LIBS!$X_EXTRA_LIBS$ac_delim
+XAW_LIBS!$XAW_LIBS$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
   fi
-fi # test -n "$CONFIG_FILES"
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
+
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
+_ACEOF
+
+
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+  cat >conf$$subs.sed <<_ACEOF
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+PRE_XMULIB!$PRE_XMULIB$ac_delim
+POST_XMULIB!$POST_XMULIB$ac_delim
+CONF_CFLAGS!$CONF_CFLAGS$ac_delim
+CONF_LDFLAGS!$CONF_LDFLAGS$ac_delim
+ZIPPY_O!$ZIPPY_O$ac_delim
+ZIPPY_H!$ZIPPY_H$ac_delim
+PRODUCT!$PRODUCT$ac_delim
+PATCHLEVEL!$PATCHLEVEL$ac_delim
+_ACEOF
+
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 14; then
+    break
+  elif $ac_last_try; then
+    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+   { (exit 1); exit 1; }; }
+  else
+    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+  fi
+done
+
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+  ac_eof=`expr $ac_eof + 1`
+fi
 
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
 _ACEOF
+
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+  ac_vpsub='/^[         ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[    ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[      ]*$//
+}'
+fi
+
 cat >>$CONFIG_STATUS <<\_ACEOF
-for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-        cat >$tmp/stdin
-        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
+do
+  case $ac_tag in
+  :[FHLC]) ac_mode=$ac_tag; continue;;
+  esac
+  case $ac_mode$ac_tag in
+  :[FHL]*:*);;
+  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+   { (exit 1); exit 1; }; };;
+  :[FH]-) ac_tag=-:-;;
+  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+  esac
+  ac_save_IFS=$IFS
+  IFS=:
+  set x $ac_tag
+  IFS=$ac_save_IFS
+  shift
+  ac_file=$1
+  shift
+
+  case $ac_mode in
+  :L) ac_source=$1;;
+  :[FH])
+    ac_file_inputs=
+    for ac_f
+    do
+      case $ac_f in
+      -) ac_f="$tmp/stdin";;
+      *) # Look for the file first in the build tree, then in the source tree
+        # (if the path is not absolute).  The absolute path cannot be DOS-style,
+        # because $ac_f cannot contain `:'.
+        test -f "$ac_f" ||
+          case $ac_f in
+          [\\/$]*) false;;
+          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+          esac ||
+          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+   { (exit 1); exit 1; }; };;
+      esac
+      ac_file_inputs="$ac_file_inputs $ac_f"
+    done
+
+    # Let's still pretend it is `configure' which instantiates (i.e., don't
+    # use $as_me), people would be surprised to read:
+    #    /* config.h.  Generated by config.status.  */
+    configure_input="Generated from "`IFS=:
+         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+    if test x"$ac_file" != x-; then
+      configure_input="$ac_file.  $configure_input"
+      { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    fi
+
+    case $ac_tag in
+    *:-:* | *:-) cat >"$tmp/stdin";;
+    esac
+    ;;
   esac
 
-  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
-  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+  ac_dir=`$as_dirname -- "$ac_file" ||
 $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_file" : 'X\(//\)[^/]' \| \
-         X"$ac_file" : 'X\(//\)$' \| \
-         X"$ac_file" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+        X"$ac_file" : 'X\(//\)[^/]' \| \
+        X"$ac_file" : 'X\(//\)$' \| \
+        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-  { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  { as_dir="$ac_dir"
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
     as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
 $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$as_dir" : 'X\(//\)[^/]' \| \
-         X"$as_dir" : 'X\(//\)$' \| \
-         X"$as_dir" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
 echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
     done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
    { (exit 1); exit 1; }; }; }
-
   ac_builddir=.
 
-if test "$ac_dir" != .; then
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
   ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
+  # A ".." for each directory in $ac_dir_suffix.
+  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+  case $ac_top_builddir_sub in
+  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+  esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
 
 case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
+  .)  # We are building in place.
     ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_top_srcdir=$ac_top_builddir_sub
+    ac_abs_top_srcdir=$ac_pwd ;;
+  [\\/]* | ?:[\\/]* )  # Absolute name.
     ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+    ac_top_srcdir=$srcdir
+    ac_abs_top_srcdir=$srcdir ;;
+  *) # Relative name.
+    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_build_prefix$srcdir
+    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
 esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
 
+  case $ac_mode in
+  :F)
+  #
+  # CONFIG_FILE
+  #
 
   case $INSTALL in
   [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
   esac
+  ac_MKDIR_P=$MKDIR_P
+  case $MKDIR_P in
+  [\\/$]* | ?:[\\/]* ) ;;
+  */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+  esac
+_ACEOF
 
-  if test x"$ac_file" != x-; then
-    { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    rm -f "$ac_file"
-  fi
-  # Let's still pretend it is `configure' which instantiates (i.e., don't
-  # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated by config.status.  */
-  if test x"$ac_file" = x-; then
-    configure_input=
-  else
-    configure_input="$ac_file.  "
-  fi
-  configure_input=$configure_input"Generated from `echo $ac_file_in |
-                                     sed 's,.*/,,'` by configure."
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-         # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         echo $f;;
-      *) # Relative
-         if test -f "$f"; then
-           # Build tree
-           echo $f
-         elif test -f "$srcdir/$f"; then
-           # Source tree
-           echo $srcdir/$f
-         else
-           # /dev/null tree
-           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         fi;;
-      esac
-    done` || { (exit 1); exit 1; }
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+case `sed -n '/datarootdir/ {
+  p
+  q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+' $ac_file_inputs` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF
+  ac_datarootdir_hack='
+  s&@datadir@&$datadir&g
+  s&@docdir@&$docdir&g
+  s&@infodir@&$infodir&g
+  s&@localedir@&$localedir&g
+  s&@mandir@&$mandir&g
+    s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF
   sed "$ac_vpsub
 $extrasub
 _ACEOF
 cat >>$CONFIG_STATUS <<\_ACEOF
 :t
 /@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@configure_input@,$configure_input,;t t
-s,@srcdir@,$ac_srcdir,;t t
-s,@abs_srcdir@,$ac_abs_srcdir,;t t
-s,@top_srcdir@,$ac_top_srcdir,;t t
-s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
-s,@builddir@,$ac_builddir,;t t
-s,@abs_builddir@,$ac_abs_builddir,;t t
-s,@top_builddir@,$ac_top_builddir,;t t
-s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
-s,@INSTALL@,$ac_INSTALL,;t t
-" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
-  rm -f $tmp/stdin
-  if test x"$ac_file" != x-; then
-    mv $tmp/out $ac_file
-  else
-    cat $tmp/out
-    rm -f $tmp/out
-  fi
-
-done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-#
-# CONFIG_HEADER section.
-#
-
-# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
-# NAME is the cpp macro being defined and VALUE is the value it is being given.
-#
-# ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s,^\([  ]*\)#\([        ]*define[       ][      ]*\)'
-ac_dB='[       ].*$,\1#\2'
-ac_dC=' '
-ac_dD=',;t'
-# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_uA='s,^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_uB='$,\1#\2define\3'
-ac_uC=' '
-ac_uD=',;t'
-
-for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
-  # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
+s&@configure_input@&$configure_input&;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined.  Please make sure it is defined." >&2;}
+
+  rm -f "$tmp/stdin"
   case $ac_file in
-  - | *:- | *:-:* ) # input from stdin
-        cat >$tmp/stdin
-        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
-        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
-  * )   ac_file_in=$ac_file.in ;;
+  -) cat "$tmp/out"; rm -f "$tmp/out";;
+  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
   esac
-
-  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-
-  # First look for the input files in the build tree, otherwise in the
-  # src tree.
-  ac_file_inputs=`IFS=:
-    for f in $ac_file_in; do
-      case $f in
-      -) echo $tmp/stdin ;;
-      [\\/$]*)
-         # Absolute (can't be DOS-style, as IFS=:)
-         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         echo $f;;
-      *) # Relative
-         if test -f "$f"; then
-           # Build tree
-           echo $f
-         elif test -f "$srcdir/$f"; then
-           # Source tree
-           echo $srcdir/$f
-         else
-           # /dev/null tree
-           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
-echo "$as_me: error: cannot find input file: $f" >&2;}
-   { (exit 1); exit 1; }; }
-         fi;;
-      esac
-    done` || { (exit 1); exit 1; }
-  # Remove the trailing spaces.
-  sed 's/[     ]*$//' $ac_file_inputs >$tmp/in
-
-_ACEOF
-
-# Transform confdefs.h into two sed scripts, `conftest.defines' and
-# `conftest.undefs', that substitutes the proper values into
-# config.h.in to produce config.h.  The first handles `#define'
-# templates, and the second `#undef' templates.
-# And first: Protect against being on the right side of a sed subst in
-# config.status.  Protect against being in an unquoted here document
-# in config.status.
-rm -f conftest.defines conftest.undefs
-# Using a here document instead of a string reduces the quoting nightmare.
-# Putting comments in sed scripts is not portable.
-#
-# `end' is used to avoid that the second main sed command (meant for
-# 0-ary CPP macros) applies to n-ary macro definitions.
-# See the Autoconf documentation for `clear'.
-cat >confdef2sed.sed <<\_ACEOF
-s/[\\&,]/\\&/g
-s,[\\$`],\\&,g
-t clear
-: clear
-s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
-t end
-s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
-: end
-_ACEOF
-# If some macros were called several times there might be several times
-# the same #defines, which is useless.  Nevertheless, we may not want to
-# sort them, since we want the *last* AC-DEFINE to be honored.
-uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
-sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
-rm -f confdef2sed.sed
-
-# This sed command replaces #undef with comments.  This is necessary, for
+ ;;
+  :H)
+  #
+  # CONFIG_HEADER
+  #
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status.  If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless.  But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([  #]*\\)[^        ]*\\([  ]*'
+ac_dB='\\)[     (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+  sed -n '
+       t rset
+       :rset
+       s/^[     ]*#[    ]*define[       ][      ]*//
+       t ok
+       d
+       :ok
+       s/[\\&,]/\\&/g
+       s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+       s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+  ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments.  This is necessary, for
 # example, in the case of _POSIX_SOURCE, which is predefined and required
 # on some systems where configure will not decide to define it.
-cat >>conftest.undefs <<\_ACEOF
-s,^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
-_ACEOF
-
-# Break up conftest.defines because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
-echo '  if grep "^[    ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
-echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
-echo '  :' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.defines >/dev/null
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[    #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be:    sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
 do
-  # Write a limited-size here document to $tmp/defines.sed.
-  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#define' lines.
-  echo '/^[    ]*#[    ]*define/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  # Write a here document:
+    cat >>$CONFIG_STATUS <<_ACEOF
+    # First, check the format of the line:
+    cat >"\$tmp/defines.sed" <<\\CEOF
+/^[     ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
+/^[     ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
+b
+:def
+_ACEOF
+  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
   echo 'CEOF
-  sed -f $tmp/defines.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+  grep . conftest.tail >/dev/null || break
   rm -f conftest.defines
   mv conftest.tail conftest.defines
 done
-rm -f conftest.defines
-echo '  fi # grep' >>$CONFIG_STATUS
-echo >>$CONFIG_STATUS
-
-# Break up conftest.undefs because some shells have a limit on the size
-# of here documents, and old seds have small limits too (100 cmds).
-echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
-rm -f conftest.tail
-while grep . conftest.undefs >/dev/null
-do
-  # Write a limited-size here document to $tmp/undefs.sed.
-  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
-  # Speed up: don't consider the non `#undef'
-  echo '/^[    ]*#[    ]*undef/!b' >>$CONFIG_STATUS
-  # Work around the forget-to-reset-the-flag bug.
-  echo 't clr' >>$CONFIG_STATUS
-  echo ': clr' >>$CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
-  echo 'CEOF
-  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
-  rm -f $tmp/in
-  mv $tmp/out $tmp/in
-' >>$CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
-  rm -f conftest.undefs
-  mv conftest.tail conftest.undefs
-done
-rm -f conftest.undefs
+rm -f conftest.defines conftest.tail
 
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
 cat >>$CONFIG_STATUS <<\_ACEOF
-  # Let's still pretend it is `configure' which instantiates (i.e., don't
-  # use $as_me), people would be surprised to read:
-  #    /* config.h.  Generated by config.status.  */
-  if test x"$ac_file" = x-; then
-    echo "/* Generated by configure.  */" >$tmp/config.h
-  else
-    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
-  fi
-  cat $tmp/in >>$tmp/config.h
-  rm -f $tmp/in
   if test x"$ac_file" != x-; then
-    if diff $ac_file $tmp/config.h >/dev/null 2>&1; then
+    echo "/* $configure_input  */" >"$tmp/config.h"
+    cat "$ac_result" >>"$tmp/config.h"
+    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
       { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
 echo "$as_me: $ac_file is unchanged" >&6;}
     else
-      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_file" : 'X\(//\)[^/]' \| \
-         X"$ac_file" : 'X\(//\)$' \| \
-         X"$ac_file" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-      { if $as_mkdir_p; then
-    mkdir -p "$ac_dir"
-  else
-    as_dir="$ac_dir"
-    as_dirs=
-    while test ! -d "$as_dir"; do
-      as_dirs="$as_dir $as_dirs"
-      as_dir=`(dirname "$as_dir") 2>/dev/null ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$as_dir" : 'X\(//\)[^/]' \| \
-         X"$as_dir" : 'X\(//\)$' \| \
-         X"$as_dir" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-    done
-    test ! -n "$as_dirs" || mkdir $as_dirs
-  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
-echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
-   { (exit 1); exit 1; }; }; }
-
       rm -f $ac_file
-      mv $tmp/config.h $ac_file
+      mv "$tmp/config.h" $ac_file
     fi
   else
-    cat $tmp/config.h
-    rm -f $tmp/config.h
+    echo "/* $configure_input  */"
+    cat "$ac_result"
   fi
+  rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
+_am_arg=$ac_file
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+  case $_am_header in
+    $_am_arg | $_am_arg:* )
+      break ;;
+    * )
+      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+  esac
 done
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$_am_arg" : 'X\(//\)[^/]' \| \
+        X"$_am_arg" : 'X\(//\)$' \| \
+        X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$_am_arg" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
 
-#
-# CONFIG_COMMANDS section.
-#
-for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
-  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
-  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
-  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
-$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-         X"$ac_dest" : 'X\(//\)[^/]' \| \
-         X"$ac_dest" : 'X\(//\)$' \| \
-         X"$ac_dest" : 'X\(/\)' \| \
-         .     : '\(.\)' 2>/dev/null ||
-echo X"$ac_dest" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
-         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
-         /^X\(\/\/\)$/{ s//\1/; q; }
-         /^X\(\/\).*/{ s//\1/; q; }
-         s/.*/./; q'`
-  ac_builddir=.
+  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
+echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+  esac
 
-if test "$ac_dir" != .; then
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A "../" for each directory in $ac_dir_suffix.
-  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
-else
-  ac_dir_suffix= ac_top_builddir=
-fi
 
-case $srcdir in
-  .)  # No --srcdir option.  We are building in place.
-    ac_srcdir=.
-    if test -z "$ac_top_builddir"; then
-       ac_top_srcdir=.
-    else
-       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
-    fi ;;
-  [\\/]* | ?:[\\/]* )  # Absolute path.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir ;;
-  *) # Relative path.
-    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_builddir$srcdir ;;
-esac
-# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
-# absolute.
-ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
-ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
-ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
-ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
-
-
-  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
-echo "$as_me: executing $ac_dest commands" >&6;}
-  case $ac_dest in
-    default ) test -z "$CONFIG_HEADERS" || date > stamp-h
+  case $ac_file$ac_mode in
+    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # Grep'ing the whole file is not good either: AIX grep has a line
+  # limit of 2048, but all sed's we know have understand at least 4000.
+  if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+    dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$mf" : 'X\(//\)[^/]' \| \
+        X"$mf" : 'X\(//\)$' \| \
+        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+  else
+    continue
+  fi
+  # Extract the definition of DEPDIR, am__include, and am__quote
+  # from the Makefile without running `make'.
+  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  am__include=`sed -n 's/^am__include = //p' < "$mf"`
+  test -z "am__include" && continue
+  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n 's/^U = //p' < "$mf"`
+  # Find all dependency output files, they are included files with
+  # $(DEPDIR) in their names.  We invoke sed twice because it is the
+  # simplest approach to changing $(DEPDIR) to its actual value in the
+  # expansion.
+  for file in `sed -n "
+    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$file" : 'X\(//\)[^/]' \| \
+        X"$file" : 'X\(//\)$' \| \
+        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+    { as_dir=$dirpart/$fdir
+  case $as_dir in #(
+  -*) as_dir=./$as_dir;;
+  esac
+  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+    as_dirs=
+    while :; do
+      case $as_dir in #(
+      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+      *) as_qdir=$as_dir;;
+      esac
+      as_dirs="'$as_qdir' $as_dirs"
+      as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+        X"$as_dir" : 'X\(//\)[^/]' \| \
+        X"$as_dir" : 'X\(//\)$' \| \
+        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)[^/].*/{
+           s//\1/
+           q
+         }
+         /^X\(\/\/\)$/{
+           s//\1/
+           q
+         }
+         /^X\(\/\).*/{
+           s//\1/
+           q
+         }
+         s/.*/./; q'`
+      test -d "$as_dir" && break
+    done
+    test -z "$as_dirs" || eval "mkdir $as_dirs"
+  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+   { (exit 1); exit 1; }; }; }
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+    "default":C) test -z "$CONFIG_HEADERS" || date > stamp-h
 chmod 755 cmail
  ;;
+
   esac
-done
-_ACEOF
+done # for ac_tag
 
-cat >>$CONFIG_STATUS <<\_ACEOF
 
 { (exit 0); exit 0; }
 _ACEOF
index c7f55f6..da09924 100644 (file)
@@ -9,12 +9,18 @@ dnl| it portable to sites and systems other than your own), and run autoconf
 dnl| to regenerate configure.  Then submit your changes to be folded into
 dnl| the standard version of xboard.
 
-AC_INIT(xboard.c)
-AC_CONFIG_HEADER(config.h)
-
+AC_INIT([xboard],[4.3])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([
+Makefile
+])
+AC_OUTPUT
 PRODUCT=xboard
-VERSION=4.2
-PATCHLEVEL=7
+#VERSION=4.3  # version is already defined
+PATCHLEVEL=15
+
 
 if test -z "$CFLAGS" ; then
 dnl| Prevent the next macro from setting CFLAGS to -g
@@ -29,17 +35,19 @@ if test "$LEX" != lex_not_found ; then
   AC_DECL_YYTEXT
 fi
 AC_CHECK_PROGS(RSH, remsh rsh, rsh)
+AC_CHECK_PROGS(MINFO, makeinfo, makeinfo_not_found)
+if test "$MINFO" == makeinfo_not_found ; then
+   echo Please install \"makeinfo\"
+   exit 1
+fi
 AC_DEFINE_UNQUOTED(REMOTE_SHELL, "$RSH")
 AC_CHECK_PROG(NROFF, nroff, [nroff -man], cat)
 AC_SUBST(NROFFFLAGS)
 AC_PATH_PROGS(AWKPATH, awk mawk gawk nawk)
 AC_PATH_PROGS(PERLPATH, perl)
 
-AC_ARG_WITH(Xaw3d, [  --with-Xaw3d            use Xaw3d instead of Xaw],
-  [AC_DEFINE(USE_XAW3D)
-   XAW_LIBS="-lXaw3d"],
-  XAW_LIBS="-lXaw")
-AC_SUBST(XAW_LIBS)
+
+
 
 AC_HEADER_STDC
 AC_HEADER_TIME
@@ -68,6 +76,51 @@ if test -n "$no_x" ; then
   exit 1
 fi
 
+AC_CHECK_HEADER(X11/Intrinsic.h,xt="yes",xt="no")
+
+if test "$xt" == "no" ; then
+   echo Xt headers not found
+   exit 1
+fi
+
+AC_ARG_WITH(Xaw3d, [  --with-Xaw3d            use Xaw3d instead of Xaw],
+  with_xaw3d="yes", with_xaw3d="no")
+
+
+xaw_headers="no"
+if test "$with_xaw3d" == "yes" ; then
+   XAW_LIBS="-lXaw3d"
+   AC_CHECK_LIB([Xaw3d], [XawTextReplace], xaw3d_lib="yes", xaw3d_lib="no")
+   if test "$xaw3d_lib" == "no" ; then
+      echo Xaw3d libraries not found
+      exit 1
+   else
+      AC_CHECK_HEADER(X11/Xaw3d/Dialog.h,xaw3d_headers="yes",xaw3d_headers="no")       
+      if test "$xaw3d_headers" == "yes" ; then
+        AC_DEFINE(USE_XAW3D)
+        xaw_headers="yes"
+      else
+       AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")     
+      fi
+   fi
+else
+   XAW_LIBS="-lXaw"
+   AC_CHECK_HEADER(X11/Xaw/Dialog.h,xaw_headers="yes")
+fi
+
+AC_SUBST(XAW_LIBS)
+
+
+
+if test "$xaw_headers" == "no" ; then
+   echo Xaw headers not found 
+   exit 1
+
+fi
+
+
+
+
 AC_CANONICAL_HOST
 
 dnl| The following info is mostly gathered from GNU Emacs 19.24.  Basically,
@@ -315,7 +368,7 @@ AC_SUBST(PRODUCT)
 AC_SUBST(VERSION)
 AC_SUBST(PATCHLEVEL)
 
-AC_OUTPUT(Makefile cmail xboard.texinfo,
+AC_OUTPUT(cmail xboard.texinfo,
 [test -z "$CONFIG_HEADERS" || date > stamp-h
 chmod 755 cmail
 ])
index 661d27a..ab2be49 100644 (file)
@@ -1,3 +1,5 @@
+@setfilename copyright.info
+
 Copyright @copyright{} 1991 Digital Equipment Corporation, Maynard, Massachusetts.
 
 All Rights Reserved.
index 01f0e5b..b2cd121 100644 (file)
@@ -12,7 +12,8 @@
 $Id: engine-intf.html,v 2.1 2003/10/27 19:21:00 mann Exp $<br>\r
 Version 2; implemented in xboard/WinBoard 4.2.1 and later.<br>\r
 Changes since version 1 are indicated in <font color=red>red</font>.<br>\r
-Changes for WinBoard 4.3.xx are indicated in <font color=green>green</font>.\r
+Changes for WinBoard 4.3.xx are indicated in <font color=green>green</font>.<br>\r
+Proposed changes, implemented only in alpha versions are indicated in <font color=blue>blue</font>.\r
 <hr noshade size="2">\r
 \r
 <ul>\r
@@ -535,6 +536,8 @@ or by having no legal moves (ICC)</font>
 <td><font color=green>shuffle variant like FRC (10x8 board)</font>\r
 <tr align="left"><th><font color=green>cylinder</font>\r
 <td><font color=green>Pieces wrap around between side edges, like board is a cylinder</font>\r
+<tr align="left"><th><font color=blue>super</font>\r
+<td><font color=blue>Superchess: a shuffle variant with 4 fairy pieces on 8x8 board</font>\r
 <tr align="left"><th>unknown<td>Unknown variant (not supported)\r
 </table>\r
 <p>\r
@@ -655,7 +658,7 @@ otim clock with the opposite color.
 that many engines implement it wrong.\r
 The clocks in fact always remain with the color.\r
 Which clock reading is relayed with "time", and which by "otim", is determined by which side the engine plays.\r
-Not that the way the clocks operate and receive extra time (in accordance with the selected time control)\r
+Note that the way the clocks operate and receive extra time (in accordance with the selected time control)\r
 is not affected in any way by which moves are made by the engine, which by the opponent, and which were forced.\r
 </font>\r
 </p>\r
@@ -1004,6 +1007,52 @@ paused thinking or pondering (if any) resumes from exactly where it
 left off, and the clock of the player on move resumes running from\r
 where it stopped.\r
 </font>\r
+<p>\r
+\r
+<dt><font color=blue><strong>memory N</strong></font>\r
+<dd><font color=blue>\r
+This command informs the engine on how much memory it is allowed to use maximally, in MegaBytes.\r
+On receipt of this command, the engine should adapt the size of its hash tables accordingly.\r
+This command does only fix the total memory use,\r
+the engine has to decide for itself \r
+(or be configured by the user by other means) \r
+how to divide up the available memory between the various tables it wants to use \r
+(e.g. main hash, pawn hash, tablebase cache, bitbases).\r
+This command will only be sent to engines that have requested it through the memory feature,\r
+and only at the beginning of a game\r
+(before any moves have been done).\r
+</font>\r
+<p>\r
+\r
+<dt><font color=blue><strong>cores N</strong></font>\r
+<dd><font color=blue>\r
+This command informs the engine on how many CPU cores it is allowed to use maximally.\r
+This could be interpreted as the number of search threads for SMP engines. \r
+(Threads that do not consume significant amounts of CPU time, like I/O threads, need not be included in the count.)\r
+This command will only be sent to engines that have requested it through the smp feature.\r
+The engine should be able to respond to the "cores" command any time during a game,\r
+but it is allowed to finish a search in progress before procesing the command.\r
+(Reaction during ponder time should be immediate, though.)\r
+</font>\r
+<p>\r
+\r
+<dt><font color=blue><strong>egtpath TYPE PATH</strong></font>\r
+<dd><font color=blue>\r
+This command informs the engine in which directory (given by the PATH argument)\r
+it can find end-game tables of the specified TYPE.\r
+The TYPE argument can be any character string which does not contain spaces.\r
+Currently <strong>nalimov</strong> and <strong>scorpio</strong> are defined types, \r
+for Nalimov tablebases and Scorpio bitbases, respectively,\r
+but future developers of other formats are free to define their own format names.\r
+The GUI simply matches the TYPE names the engine says it supports \r
+with those that the user supplied when configuring xboard.\r
+For every match, it sends a separate "y" command.\r
+The PATH argument would normally (for Nalimov) be the pathname of the directory the EGT files are in,\r
+but could also be the name of a file, or in fact anything the particular EGT type requires.\r
+It is upto the developer of the EGT format to specify the syntax of this parameter.\r
+This command will only be sent to engines that have told the GUI they support EGTs of the given TYPE\r
+through the egt feature.\r
+</font>\r
 </dl>\r
 \r
 <h3>Bughouse commands:</h3>\r
@@ -1252,9 +1301,9 @@ Zippy mode.)  It is recommended that you set this feature to the
 correct value for your engine (just "normal" in most cases) rather\r
 than leaving the default in place, so that the user will get an\r
 appropriate error message if he tries to play a variant that your\r
-engine does not support.\r
+engine does not support.</font>\r
 <br>\r
-If your engine can play variants on a deviating board size,\r
+<font color=green>If your engine can play variants on a deviating board size,\r
 like capablanca on an 8x8 board, or capablanca crazyhouse,\r
 it can list them amongst the variants with a prefix spcifying board size plus\r
 holdings size, like 8x8+0_capablanca or 10x8+7_capablanca.\r
@@ -1328,6 +1377,33 @@ engines must refrain from sending the debug output,
 or do so at their own risk.\r
 </font>\r
 \r
+<dt><font color=blue>\r
+<strong>memory</strong> (boolean, default 0)\r
+</font>\r
+<dd><font color=blue>\r
+If memory=1, the size of the total amount of memory available for the memory-consuming tables of the engine \r
+(e.g. hash, EGTB cache)\r
+will be set by the GUI through the "memory" command.\r
+</font>\r
+\r
+<dt><font color=blue>\r
+<strong>smp</strong> (boolean, default 0)\r
+</font>\r
+<dd><font color=blue>\r
+If smp=1, the GUI will send the "cores" command to the engine to inform it how many CPU cores it can use.\r
+</font>\r
+\r
+<dt><font color=blue>\r
+<strong>egt</strong> (string, see text below)\r
+</font>\r
+<dd><font color=blue>\r
+This feature indicates which end-game table formats the engine supports.\r
+It should be a comma-separated list of format names.\r
+See under the "egtpath" command in <a href="#8">section 8</a> above.\r
+If you do not set this feature, xboard will assume the engine does not support end-game tables,\r
+and will not send any "egtpath" commands to inform the engine about their whereabouts.\r
+</font>\r
+\r
 <dt><font color=red>\r
 <strong>done</strong> (integer, no default)\r
 </font>\r
@@ -1720,7 +1796,7 @@ can go negative and then become positive again because of the
 increment.)\r
 </p>\r
 \r
-<p>\r
+<p><font color=blue>\r
 The number of moves given in the level command (when non-zero) should \r
 be taken as the number of moves still to do before the specified time\r
 will be added to the clock, if the "level" command is received after\r
@@ -1739,7 +1815,7 @@ and the engine receives "level 20 22 0" just before move 41,
 it should understand that it should do the next 20 moves in 22 minutes\r
 (pehaps because the secondary session was 20 moves per 15 minutes,\r
 and it had 7 minutes left on its clock after the first 40 moves).\r
-</p>\r
+</font></p>\r
 \r
 <p>\r
 A special rule on some ICS implementations: if you ask for a game with\r
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/manual.html b/manual.html
new file mode 100644 (file)
index 0000000..1d89a86
--- /dev/null
@@ -0,0 +1,535 @@
+<!DOCTYPE HTML>\r
+<html>\r
+\r
+<head>\r
+<title>WinBoard 4.3.15</title>\r
+</head>\r
+\r
+<body>\r
+<table><tr><td halign="top">\r
+<h1>WinBoard 4.3.15</h1>\r
+<h2>"For the ultimate WinBoard experience"</h2>\r
+<h3>Introduction</h3>\r
+<p>\r
+The WinBoard 4.3 series is a continuation of the WinBoard_x line by Allessandro Scotti.\r
+It is been further developed, and is maintained, by H.G. Muller.\r
+Most addtions and improvements that went into this since the last version produced\r
+by the GNU-Savannah xboard project team, WinBoard 4.2.7b,\r
+are unfortunately not parallelled in xboard.\r
+On the contrary, they have destroyed the compatibility of the back-end sources\r
+shared by WinBoard and xboard with the xboard front-end of version 4.2.7b.\r
+Since WinBoard 4.3.14, however, the releases again coms with a compatible xboard front-end.\r
+That does not mean that all the features added to WinBoard can already be used\r
+in this xboard version.\r
+But some can, an in 4.3.15 many more have been added.\r
+</p><p>\r
+The description below applies specifically to WinBoard, \r
+although we have tried to mark features that can also be used in xboard by (x) everywhere.\r
+This version of xboard does does have som new menus added to control such features.\r
+Other functionss, if they work at all, must be switched on from the command line.\r
+</p>\r
+</td><td width="20">\r
+</td><td width="600" halign="center" cellpdding="20">\r
+<img src="mini.gif">\r
+</td></tr></table>\r
+<h3>New features since 4.2.7b</h3>\r
+<p>\r
+Below follows a table that lists the new features, \r
+the command-line option needed to control them,\r
+and if there is a menu provided that can switch the option while WinBoard is running\r
+(command-line options exert their effect only at startup).\r
+Note that, unlike WinBoard 4.2.7, the WinBoard 4.3 series is fully castling and e.p. aware,\r
+and handles the castling, e.p. and 50-move field in FENs on input and output as should be expected.\r
+</p>\r
+<table cellpadding="3" border="1"><tr><td width="220">\r
+      <h3>command-line option</h3>\r
+    </td><td>\r
+      <h3>description</h3>\r
+    </td><td width="250">\r
+      <h3>menu</h3>\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>ENGINE-ENGINE ADJUDICATION OPTIONS<strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -adjudicateLossThreshold 0 (*x)\r
+    </td><td>\r
+      adjudicates engine-engine game based on score\r
+    </td><td>\r
+      Options -> Engine... (x)\r
+  </td></tr><tr><td>\r
+      -checkMates false (*x)\r
+    </td><td>\r
+      detect and end game on checkmates and stalemates\r
+    </td><td>\r
+      Options -> Engine... (x)\r
+  </td></tr><tr><td>\r
+      -testClaims false (*x)\r
+    </td><td>\r
+      WinBoard corrects false RESULT claims\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -materialDraws false (*x)\r
+    </td><td>\r
+      adjudicate draw when no mating material present\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -trivialDraws false (*x)\r
+    </td><td>\r
+      adjudicate draw in endgames like KRKR and KNNK\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -adjudicateDrawMoves 0 (*)\r
+    </td><td>\r
+      adjudicate draw when game lasts too long\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -ruleMoves 51 (*x)\r
+    </td><td>\r
+      number of reversible moves after which to adjudicate draw\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -repeatsToDraw 6 (*x)\r
+    </td><td>\r
+      adjudicate draw when a position occurs this many times\r
+    </td><td>\r
+      Options -> Engine.. (x)\r
+  </td></tr><tr><td>\r
+      -firstScoreAbs false (x)\r
+      <br>\r
+      -secondScoreAbs false (x)\r
+    </td><td>\r
+      Engine indicates score for white, even when playing black\r
+    </td><td>\r
+      Options -> Adjudications.. (xboard-only)\r
+  </td></tr><tr><td>\r
+      -\r
+    </td><td>\r
+      Adjudicate the game in progress as win to white, win to black, or draw\r
+    </td><td>\r
+      Action -> Adjudicate to White\r
+      <br>\r
+      Action -> Adjudicate to Black\r
+      <br>\r
+      Action -> Adjudicate Draw\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>TIME-CONTROL AND TIMING OPTIONS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -firstTimeOdds 1 (x)\r
+      <br>\r
+      -secondTimeOdds 1 (x)\r
+    </td><td>\r
+      reduce the thinking time of the mentioned engine by the given factor\r
+    </td><td>\r
+      Options -> Engine Settings.. (xboard only)\r
+  </td></tr><tr><td>\r
+      -timeOddsMode 1 (*x)\r
+    </td><td>\r
+      determines what happens when both engine have time odds\r
+    </td><td>\r
+      Options -> Engine Settings.. (xboard only)\r
+  </td></tr><tr><td>\r
+      -firstNPS -1 (x)\r
+      <br>\r
+      -secondNPS -1 (x)\r
+    </td><td>\r
+      engine must use node count for its time control, as if running at specified rate\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -matchPause 10000 (*x)\r
+    </td><td>\r
+      number of msec to wait between games in match mode\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -delayBeforeQuit 0 (*)\r
+      <br>\r
+      -delayAfterQuit 0 (*)\r
+    </td><td>\r
+      timing parameter specifying how to terminate the engine processes\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -\r
+    </td><td>\r
+      adjust the clocks by 1 minute (up or down)\r
+    </td><td>\r
+      left- or right-cick on clock in edit-game mode\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>DISPLAY-LOOK OPTIONS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -liteBackTextureFile "" (*)\r
+      <br>\r
+      -darkBackTextureFile "" (*)\r
+      <br>\r
+      -liteBackTextureMode 1 (*)\r
+      <br>\r
+      -darkBackTextureMode 1 (*)\r
+    </td><td>\r
+      Allows you to use any bitmap picture for displaying the board square\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -renderPiecesWithFont "" (*)\r
+    </td><td>\r
+      specifies a true-type Chess font to be used for piece symbols\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -fontPieceToCharTable "" (*)\r
+    </td><td>\r
+      specifies which font character to use for the various piece types\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -overrideLineGap 1 (*)\r
+    </td><td>\r
+      controls the width of the black grid lines between squares\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -fontPieceBackColorWhite #0 (*)\r
+      <br>\r
+      -fontPieceForeColorWhite #0 (*)\r
+      <br>\r
+      -fontPieceBackColorBlack #0 (*)\r
+      <br>\r
+      -fontPieceForeColorBlack #0 (*)\r
+    </td><td>\r
+      control piece colors in font-based rendering\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -fontPieceSize 80 (*)\r
+    </td><td>\r
+      tunes the size of pieces in font-based rendering (% of square size)\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -highlightMoveWithArrow false (*)\r
+    </td><td>\r
+      draws a big arrow to indicate the move last played\r
+    </td><td>\r
+      Options -> General...\r
+  </td></tr><tr><td>\r
+      -highlightArrowColor #FFFF80 (*)\r
+    </td><td>\r
+      controls the color of the highlight arrow\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -\r
+    </td><td>\r
+      Swap white and black clock\r
+    </td><td>\r
+      Options -> Swap Clocks\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>UCI ENGINE OPTIONS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -polyglotDir "" (*)\r
+    </td><td>\r
+      tells WinBoard where you installed Polyglot, for automatic invocation with UCI engines\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -polyglotBook "" (*)\r
+    </td><td>\r
+      tells WinBoard which opening book it should use, or should make Polyglot use.\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -usePolyglotBook false (*)\r
+    </td><td>\r
+      turns the use of the Polygot book on or off\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -defaultPathEGTB "c:\egtb" (*)\r
+    </td><td>\r
+      folder where to find end-game tables\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -defaultCacheSizeEGTB 4 (*)\r
+    </td><td>\r
+      specifies the cache size for UCI engines\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -defaultHashSize 64 (*)\r
+    </td><td>\r
+      Specifies the size of the main hash table for UCI engines\r
+    </td><td>\r
+      Options -> UCI... (x)\r
+  </td></tr><tr><td>\r
+      -firstIsUCI false\r
+      <br>\r
+      -secondIsUCI false\r
+      <br>\r
+      -fUCI\r
+      <br>\r
+      -sUCI\r
+    </td><td>\r
+      tells WinBoard the corresponding engine should be run through Polyglot\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -firstHasOwnBookUCI true\r
+      <br>\r
+      -secondHasOwnBookUCI true\r
+      <br>\r
+      -fNoOwnBookUCI true\r
+      <br>\r
+      -sNoOwnBookUCI true\r
+    </td><td>\r
+      tells Polyglot if the engine should use its own opening book\r
+    </td><td>\r
+      Options -> Engine Settings... (xboard only)\r
+  </td></tr><tr><td>\r
+      -smpCores 1 (*x)\r
+    </td><td>\r
+      Sets the maximum number of CPUs an SMP engine can use.\r
+      (only affects engines that support the <strong>cores</strong> command of WB protocol)\r
+    </td><td>\r
+      Options -> Engine Settings... (xboard only)\r
+  </td></tr><tr><td>\r
+      -egtFormats "" (*x)\r
+    </td><td>\r
+      Specifies which end-game tables are installed on the computer,\r
+      and where they can be found\r
+      (e.g. "nalimov:\chess\egtb,scorpio:\chess\bitbases")\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>CHESS-VARIANT OPTIONS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -boardHeight -1 (*x)\r
+      <br>\r
+      -boardWidth -1 (*x)\r
+      <br>\r
+      -holdingsSize -1 (*x)\r
+    </td><td>\r
+      specifies the board format and nr of piece types that can be dropped,\r
+      when you want it to be different from what is usual in the chosen varint\r
+    </td><td>\r
+      File -> New Variant...\r
+  </td></tr><tr><td>\r
+      -variant normal (x)\r
+    </td><td>\r
+      supports many new variants: xiangqi, shogi, fischerandom, capabanca, gothic, caparandom, janus,\r
+      shatranj, courier, knightmate, berolina, falcon, cylinder, fairy, super\r
+    </td><td>\r
+      File -> New Variant... (x)\r
+  </td></tr><tr><td>\r
+      -defaultFrcOpening -1 (x)\r
+    </td><td>\r
+      allows you to play from a specific opening shuffle, or make a new shuffle each game\r
+    </td><td>\r
+      File -> New Shuffle Game... (x)\r
+  </td></tr><tr><td>\r
+      -pieceToCharTable "" (x)\r
+    </td><td>\r
+      allows you to specify by which letters pieces are referred to in FEN and SAN,\r
+      if you want to deviate from what is usual for the current variant\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -flipBlack fase (*x)\r
+    </td><td>\r
+      displays opponent pieces uppside down (for Shogi)\r
+    </td><td>\r
+      Options -> Board...\r
+  </td></tr><tr><td>\r
+      -allWhite false (*x)\r
+    </td><td>\r
+      use white bitmaps (with black outline) also for display of black pieces (for Shogi)\r
+    </td><td>\r
+      Options -> Board...\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>PGN FILE OPTIONS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -pgnExtendedInfo false (*x)\r
+    </td><td>\r
+      save engine output (depth, score time) in PGN\r
+    </td><td>\r
+      Options->General...\r
+  </td></tr><tr><td>\r
+      -pgnEventHeader </br>"Computer Chess Game" (*x)\r
+    </td><td>\r
+      specify the event for the PGN event tag\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -saveOutOfBookInfo true (*)\r
+    </td><td>\r
+      include an 'annotator' tag in the PGN file\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -hideThinkingFromHuman false (*x)\r
+    </td><td>\r
+      suppresses the engine thinking output in the display, without the need to switch it off\r
+      (so it can still appear in the PGN file)\r
+    </td><td>\r
+      Options -> General... (x)\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>USER-INTERFACE OPTIONS AND WINDOW CONTROL</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -moveHistoryUP true (*)\r
+      <br>\r
+      -moveHistoryX 0 (*)\r
+      <br>\r
+      -moveHistoryY 0 (*)\r
+      <br>\r
+      -moveHistoryW 0 (*)\r
+      <br>\r
+      -moveHistoryH 0 (*)\r
+    </td><td>\r
+      controls opening, placement and size of a window containing the moves of the current game\r
+    </td><td>\r
+      Mode -> Show Move History (x)\r
+  </td></tr><tr><td>\r
+      -evalGraphUp true (*)\r
+      <br>\r
+      -evalGraphX 0 (*)\r
+      <br>\r
+      -evalGraphY 0 (*)\r
+      <br>\r
+      -evalGraphW 0 (*)\r
+      <br>\r
+      -evalGraphH 0 (*)\r
+    </td><td>\r
+      controls opening, placement and size of a window containing a graph of the\r
+      evaluation score of the engine(s) as a function of move number of the current game\r
+    </td><td>\r
+      Mode -> Show Evaluation Graph\r
+  </td></tr><tr><td>\r
+      -engineOutputUp true (*)\r
+      <br>\r
+      -engineOutputX 0 (*)\r
+      <br>\r
+      -engineOutputY 0 (*)\r
+      <br>\r
+      -engineOutputW 0 (*)\r
+      <br>\r
+      -engineOutputH 0 (*)\r
+    </td><td>\r
+      controls opening, placement and size of a window containing the thinking output of the engine(s)\r
+    </td><td>\r
+      Mode -> Show Engine Output (x)\r
+  </td></tr><tr><td>\r
+      -stickyWindows true (*)\r
+    </td><td>\r
+      make the various windows snap onto each other, and stick together\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -showEvalInMoveHistory true (*)\r
+    </td><td>\r
+      depth/score info of the engine is included as comments in the move history window\r
+    </td><td>\r
+      Options -> General...\r
+  </td></tr><tr><td>\r
+      -evalHistColorWhite #FFFFB0 (*)\r
+      <br>\r
+      -evalHistColorBlack #AD5D3D (*)\r
+    </td><td>\r
+      determines the color of the eval-score comments in the move-history window\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -autoDisplayComment true (*)\r
+    </td><td>\r
+      causes a window for displaying PGN comments to pop up automatically when such a comment is encountered\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -autoDisplayTags true (*)\r
+    </td><td>\r
+      causes a window with PGN tags to be displayed as soon as a PGN file is loaded\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -gameListTags "eprd" (*)\r
+    </td><td>\r
+      specifies the PGN tags that should be displayed in the game list\r
+    </td><td>\r
+      Options -> Game List...\r
+  </td></tr><tr><td>\r
+      \r
+    </td><td bgcolor="lightblue">\r
+      <strong>MISCELLANEOUS</strong>\r
+    </td><td>\r
+      \r
+  </td></tr><tr><td>\r
+      -debugFile "winboard.debug"\r
+      <br>\r
+      -nameOfDebugFile "winboard.debug"\r
+    </td><td>\r
+      allows you to specify an alternative name for saving the debug information\r
+    </td><td>\r
+      -\r
+  </td></tr><tr><td>\r
+      -\r
+    </td><td>\r
+      save chess-board display as diagram in bitmap file\r
+      (only works for the smaller board formats!)\r
+    </td><td>\r
+      File -> Save Diagram...\r
+  </td></tr><tr><td>\r
+      -\r
+    </td><td>\r
+      display only those lines in the game list that contain a given string\r
+    </td><td>\r
+      in Game-List window\r
+  </td></tr><tr><td>\r
+      -rewindFile 0 (x)\r
+    </td><td>\r
+      A nonzero value for this option causes the loadGameIndex or loadPositionIndex\r
+      to rewind to the beginning of the Games or Position file when it reaches\r
+      the given value in auto-increment match mode. \r
+      This mode is specified by a negative value as argument of the /lgi or /lpi options,\r
+      where -1 increments the index after every game of the match,\r
+      and -2 after every two games (so that each position is played with black and white).\r
+    </td><td>\r
+      -\r
+</td></tr></table>\r
+<p>\r
+The value with which the option is listed is the default value.\r
+If it is false or true, it is a Boolean option, a number implies an integer option.\r
+A value starting with # indicates an RGB color indication in hexadecimal notation.\r
+Options the settings of which are saved into the winboard.ini file are marked with (*).\r
+</p>\r
+</body>\r
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/moves.c b/moves.c
index edccef8..0def075 100644 (file)
--- a/moves.c
+++ b/moves.c
@@ -117,89 +117,26 @@ ChessSquare PromoPiece(moveType)
        return WhiteKing;\r
       case BlackPromotionKing:\r
        return BlackKing;\r
-#ifdef FAIRY\r
       case WhitePromotionChancellor:\r
         return WhiteMarshall;\r
       case BlackPromotionChancellor:\r
         return BlackMarshall;\r
       case WhitePromotionArchbishop:\r
-        return WhiteCardinal;\r
+        return WhiteAngel;\r
       case BlackPromotionArchbishop:\r
-        return BlackCardinal;\r
-#endif\r
-    }\r
-}\r
-\r
-ChessMove PromoCharToMoveType(whiteOnMove, promoChar)\r
-     int whiteOnMove;\r
-     int promoChar;\r
-{\r
-    if (whiteOnMove) {\r
-       switch (promoChar) {\r
-         case 'n':\r
-         case 'N':\r
-           return WhitePromotionKnight;\r
-         case 'b':\r
-         case 'B':\r
-           return WhitePromotionBishop;\r
-         case 'r':\r
-         case 'R':\r
-           return WhitePromotionRook;\r
-#ifdef FAIRY\r
-          case 'a':\r
-          case 'A':\r
-            return WhitePromotionArchbishop;\r
-          case 'c':\r
-          case 'C':\r
-            return WhitePromotionChancellor;\r
-#endif\r
-         case 'q':\r
-         case 'Q':\r
-           return WhitePromotionQueen;\r
-         case 'k':\r
-         case 'K':\r
-           return WhitePromotionKing;\r
-         case NULLCHAR:\r
-         default:\r
-           return NormalMove;\r
-       }\r
-    } else {\r
-       switch (promoChar) {\r
-         case 'n':\r
-         case 'N':\r
-           return BlackPromotionKnight;\r
-         case 'b':\r
-         case 'B':\r
-           return BlackPromotionBishop;\r
-         case 'r':\r
-         case 'R':\r
-           return BlackPromotionRook;\r
-#ifdef FAIRY\r
-          case 'a':\r
-          case 'A':\r
-            return BlackPromotionArchbishop;\r
-          case 'c':\r
-          case 'C':\r
-            return BlackPromotionChancellor;\r
-#endif\r
-         case 'q':\r
-         case 'Q':\r
-           return BlackPromotionQueen;\r
-         case 'k':\r
-         case 'K':\r
-           return BlackPromotionKing;\r
-         case NULLCHAR:\r
-         default:\r
-           return NormalMove;\r
-       }\r
+        return BlackAngel;\r
+      case WhitePromotionCentaur:\r
+        return WhiteSilver;\r
+      case BlackPromotionCentaur:\r
+        return BlackSilver;\r
     }\r
 }\r
 \r
 char pieceToChar[] = {\r
                         'P', 'N', 'B', 'R', 'Q', 'F', 'E', 'A', 'C', 'W', 'M', \r
-                        'O', 'H', 'I', 'J', 'G', 'D', 'V', 'S', 'L', 'U', 'K',\r
+                        'O', 'H', 'I', 'J', 'G', 'D', 'V', 'L', 's', 'U', 'K',\r
                         'p', 'n', 'b', 'r', 'q', 'f', 'e', 'a', 'c', 'w', 'm', \r
-                        'o', 'h', 'i', 'j', 'g', 'd', 'v', 's', 'l', 'u', 'k', \r
+                        'o', 'h', 'i', 'j', 'g', 'd', 'v', 'l', 's', 'u', 'k', \r
                         'x' };\r
 \r
 char PieceToChar(p)\r
@@ -228,6 +165,51 @@ ChessSquare CharToPiece(c)
      return EmptySquare;\r
 }\r
 \r
+ChessMove PromoCharToMoveType(whiteOnMove, promoChar)\r
+     int whiteOnMove;\r
+     int promoChar;\r
+{      /* [HGM] made dependent on CharToPiece to alow alternate piece letters */\r
+       ChessSquare piece = CharToPiece(whiteOnMove ? ToUpper(promoChar) : ToLower(promoChar) );\r
+\r
+       switch(piece) {\r
+               case WhiteQueen:\r
+                       return WhitePromotionQueen;\r
+               case WhiteRook:\r
+                       return WhitePromotionRook;\r
+               case WhiteBishop:\r
+                       return WhitePromotionBishop;\r
+               case WhiteKnight:\r
+                       return WhitePromotionKnight;\r
+               case WhiteKing:\r
+                       return WhitePromotionKing;\r
+               case WhiteAngel:\r
+                       return WhitePromotionArchbishop;\r
+               case WhiteMarshall:\r
+                       return WhitePromotionChancellor;\r
+               case WhiteSilver:\r
+                       return WhitePromotionCentaur;\r
+               case BlackQueen:\r
+                       return BlackPromotionQueen;\r
+               case BlackRook:\r
+                       return BlackPromotionRook;\r
+               case BlackBishop:\r
+                       return BlackPromotionBishop;\r
+               case BlackKnight:\r
+                       return BlackPromotionKnight;\r
+               case BlackKing:\r
+                       return BlackPromotionKing;\r
+               case BlackAngel:\r
+                       return BlackPromotionArchbishop;\r
+               case BlackMarshall:\r
+                       return BlackPromotionChancellor;\r
+               case BlackSilver:\r
+                       return BlackPromotionCentaur;\r
+               default:\r
+                       // not all promotion implemented yet! Take Queen for those we don't know.\r
+                       return (whiteOnMove ? WhitePromotionQueen : BlackPromotionQueen);\r
+       }\r
+}\r
+\r
 void CopyBoard(to, from)\r
      Board to, from;\r
 {\r
@@ -650,6 +632,9 @@ void GenPseudoLegal(board, flags, epfile, callback, closure)
                  }\r
                 break;\r
 \r
+           case WhiteSilver:\r
+           case BlackSilver:\r
+               m++; // [HGM] superchess: use for Centaur\r
             case WhiteMan:\r
             case BlackMan:\r
             case SHOGI WhiteKing:\r
@@ -667,6 +652,7 @@ void GenPseudoLegal(board, flags, epfile, callback, closure)
                    callback(board, flags, NormalMove,\r
                             rf, ff, rt, ft, closure);\r
                }\r
+               if(m==1) goto mounted;\r
              break;\r
 \r
            case WhiteNightrider:\r
@@ -1557,8 +1543,6 @@ ChessMove CoordsToAlgebraic(board, flags, epfile,
       /* [HGM] Always long notation for fairies we don't know */\r
       case WhiteFalcon:\r
       case BlackFalcon:\r
-      case WhiteSilver:\r
-      case BlackSilver:\r
       case WhiteLance:\r
       case BlackLance:\r
       case WhiteGrasshopper:\r
diff --git a/moves.h b/moves.h
index 569fc89..d48b9f2 100644 (file)
--- a/moves.h
+++ b/moves.h
-/*\r
- * moves.h - Move generation and checking\r
- * $Id: moves.h,v 2.1 2003/10/27 19:21:00 mann Exp $\r
- *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
- * Enhancements Copyright 1992-95 Free Software Foundation, Inc.\r
- *\r
- * The following terms apply to Digital Equipment Corporation's copyright\r
- * interest in XBoard:\r
- * ------------------------------------------------------------------------\r
- * All Rights Reserved\r
- *\r
- * Permission to use, copy, modify, and distribute this software and its\r
- * documentation for any purpose and without fee is hereby granted,\r
- * provided that the above copyright notice appear in all copies and that\r
- * both that copyright notice and this permission notice appear in\r
- * supporting documentation, and that the name of Digital not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission.\r
- *\r
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
- * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- * ------------------------------------------------------------------------\r
- *\r
- * The following terms apply to the enhanced version of XBoard distributed\r
- * by the Free Software Foundation:\r
- * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
-\r
-extern ChessSquare PromoPiece P((ChessMove moveType));\r
-extern ChessMove PromoCharToMoveType P((int whiteOnMove, int promoChar));\r
-extern char PieceToChar P((ChessSquare p));\r
-extern ChessSquare CharToPiece P((int c));\r
-extern int PieceToNumber P((ChessSquare p));\r
-\r
-extern void CopyBoard P((Board to, Board from));\r
-extern int CompareBoards P((Board board1, Board board2));\r
-extern char pieceToChar[(int)EmptySquare+1];\r
-\r
-typedef void (*MoveCallback) P((Board board, int flags, ChessMove kind,\r
-                               int rf, int ff, int rt, int ft,\r
-                               VOIDSTAR closure));\r
-\r
-/* Values for flags arguments */\r
-#define F_WHITE_ON_MOVE 1\r
-#define F_WHITE_KCASTLE_OK 2\r
-#define F_WHITE_QCASTLE_OK 4\r
-#define F_BLACK_KCASTLE_OK 8\r
-#define F_BLACK_QCASTLE_OK 16\r
-#define F_ALL_CASTLE_OK (F_WHITE_KCASTLE_OK | F_WHITE_QCASTLE_OK | \\r
-                        F_BLACK_KCASTLE_OK | F_BLACK_QCASTLE_OK)\r
-#define F_IGNORE_CHECK 32\r
-#define F_KRIEGSPIEL_CAPTURE 64 /* pawns can try to capture invisible pieces */\r
-#define F_ATOMIC_CAPTURE 128    /* capturing piece explodes, destroying itself\r
-                                  and all non-pawns on adjacent squares; \r
-                                  destroying your own king is illegal */\r
-#define F_FRC_TYPE_CASTLING 256 /* generate castlings as captures of own Rook */\r
-\r
-/* Special epfile values. [HGM] positive values are non-reversible moves! */\r
-#define EP_NONE (-4)           /* [HGM] Tricky! order matters:            */\r
-#define EP_UNKNOWN (-1)        /*       >= EP_UNKNOWN spils rep-draw      */\r
-#define EP_CAPTURE (-2)        /*       <= EP_NONE is reversible move     */\r
-#define EP_PAWN_MOVE (-3)\r
-#define EP_REP_DRAW   (-15)\r
-#define EP_RULE_DRAW  (-14)\r
-#define EP_INSUF_DRAW  (-13)\r
-#define EP_DRAWS (-10)\r
-#define EP_BEROLIN_A 16        /* [HGM] berolina: add to file if pawn to be taken of a-side of e.p.file */\r
-\r
-/* Call callback once for each pseudo-legal move in the given\r
-   position, except castling moves.  A move is pseudo-legal if it is\r
-   legal, or if it would be legal except that it leaves the king in\r
-   check.  In the arguments, epfile is EP_NONE if the previous move\r
-   was not a double pawn push, or the file 0..7 if it was, or\r
-   EP_UNKNOWN if we don't know and want to allow all e.p. captures.\r
-   Promotion moves generated are to Queen only.\r
-*/\r
-extern void GenPseudoLegal P((Board board, int flags, int epfile,\r
-                             MoveCallback callback, VOIDSTAR closure));\r
-\r
-/* Like GenPseudoLegal, but include castling moves and (unless \r
-   F_IGNORE_CHECK is set in the flags) omit moves that would leave the\r
-   king in check.  The CASTLE_OK flags are true if castling is not yet\r
-   ruled out by a move of the king or rook.  Return TRUE if the player\r
-   on move is currently in check and F_IGNORE_CHECK is not set.\r
-*/\r
-extern int GenLegal P((Board board, int flags, int epfile,\r
-                        char castlingRights[], /* [HGM] */\r
-                       MoveCallback callback, VOIDSTAR closure));\r
-\r
-/* If the player on move were to move from (rf, ff) to (rt, ft), would\r
-   he leave himself in check?  Or if rf == -1, is the player on move\r
-   in check now?  enPassant must be TRUE if the indicated move is an\r
-   e.p. capture.  The possibility of castling out of a check along the\r
-   back rank is not accounted for (i.e., we still return nonzero), as\r
-   this is illegal anyway.  Return value is the number of times the\r
-   king is in check. */ \r
-extern int CheckTest P((Board board, int flags,\r
-                       int rf, int ff, int rt, int ft, int enPassant));\r
-\r
-/* Is a move from (rf, ff) to (rt, ft) legal for the player whom the\r
-   flags say is on move?  Other arguments as in GenPseudoLegal.\r
-   Returns the type of move made, taking promoChar into account. */\r
-extern ChessMove LegalityTest P((Board board, int flags, int epfile,\r
-                                 char castlingRights[], /* [HGM] */\r
-                                int rf, int ff, int rt, int ft,\r
-                                int promoChar));\r
-\r
-#define MT_NONE 0\r
-#define MT_CHECK 1\r
-#define MT_CHECKMATE 2\r
-#define MT_STALEMATE 3\r
-\r
-/* Return MT_NONE, MT_CHECK, MT_CHECKMATE, or MT_STALEMATE */\r
-extern int MateTest P((Board board, int flags, int epfile,\r
-                                        char castlingRights[])); /* [HGM] */\r
-\r
-typedef struct {\r
-    /* Input data */\r
-    ChessSquare pieceIn;        /* EmptySquare if unknown */\r
-    int rfIn, ffIn, rtIn, ftIn; /* -1 if unknown */\r
-    int promoCharIn;            /* NULLCHAR if unknown */\r
-    /* Output data for matched move */\r
-    ChessMove kind;\r
-    ChessSquare piece;\r
-    int rf, ff, rt, ft;\r
-    int promoChar; /* 'q' if a promotion and promoCharIn was NULLCHAR */\r
-    int count;     /* Number of possibilities found */\r
-} DisambiguateClosure;\r
-\r
-/* Disambiguate a partially-known move */\r
-void Disambiguate P((Board board, int flags, int epfile,\r
-                    DisambiguateClosure *closure));\r
-\r
-\r
-/* Convert coordinates to normal algebraic notation.\r
-   promoChar must be NULLCHAR or '.' if not a promotion.\r
-*/\r
-ChessMove CoordsToAlgebraic P((Board board, int flags, int epfile,\r
-                              int rf, int ff, int rt, int ft,\r
-                              int promoChar, char out[MOVE_LEN]));\r
+/*
+ * moves.h - Move generation and checking
+ * $Id: moves.h,v 2.1 2003/10/27 19:21:00 mann Exp $
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+ * Enhancements Copyright 1992-95 Free Software Foundation, Inc.
+ *
+ * The following terms apply to Digital Equipment Corporation's copyright
+ * interest in XBoard:
+ * ------------------------------------------------------------------------
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * ------------------------------------------------------------------------
+ *
+ * The following terms apply to the enhanced version of XBoard distributed
+ * by the Free Software Foundation:
+ * ------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ------------------------------------------------------------------------
+ */
+
+extern ChessSquare PromoPiece P((ChessMove moveType));
+extern ChessMove PromoCharToMoveType P((int whiteOnMove, int promoChar));
+extern char PieceToChar P((ChessSquare p));
+extern ChessSquare CharToPiece P((int c));
+extern int PieceToNumber P((ChessSquare p));
+
+extern void CopyBoard P((Board to, Board from));
+extern int CompareBoards P((Board board1, Board board2));
+extern char pieceToChar[(int)EmptySquare+1];
+
+typedef void (*MoveCallback) P((Board board, int flags, ChessMove kind,
+                               int rf, int ff, int rt, int ft,
+                               VOIDSTAR closure));
+
+/* Values for flags arguments */
+#define F_WHITE_ON_MOVE 1
+#define F_WHITE_KCASTLE_OK 2
+#define F_WHITE_QCASTLE_OK 4
+#define F_BLACK_KCASTLE_OK 8
+#define F_BLACK_QCASTLE_OK 16
+#define F_ALL_CASTLE_OK (F_WHITE_KCASTLE_OK | F_WHITE_QCASTLE_OK | \
+                        F_BLACK_KCASTLE_OK | F_BLACK_QCASTLE_OK)
+#define F_IGNORE_CHECK 32
+#define F_KRIEGSPIEL_CAPTURE 64 /* pawns can try to capture invisible pieces */
+#define F_ATOMIC_CAPTURE 128    /* capturing piece explodes, destroying itself
+                                  and all non-pawns on adjacent squares; 
+                                  destroying your own king is illegal */
+#define F_FRC_TYPE_CASTLING 256 /* generate castlings as captures of own Rook */
+
+/* Special epfile values. [HGM] positive values are non-reversible moves! */
+#define EP_NONE (-4)           /* [HGM] Tricky! order matters:            */
+#define EP_UNKNOWN (-1)        /*       >= EP_UNKNOWN spils rep-draw      */
+#define EP_CAPTURE (-2)        /*       <= EP_NONE is reversible move     */
+#define EP_PAWN_MOVE (-3)
+#define EP_REP_DRAW   (-15)
+#define EP_RULE_DRAW  (-14)
+#define EP_INSUF_DRAW  (-13)
+#define EP_DRAWS (-10)
+#define EP_BEROLIN_A 16        /* [HGM] berolina: add to file if pawn to be taken of a-side of e.p.file */
+#define EP_CHECKMATE 100       /* [HGM] verify: record mates in epStatus for easy claim verification    */
+#define EP_STALEMATE -16
+
+/* Call callback once for each pseudo-legal move in the given
+   position, except castling moves.  A move is pseudo-legal if it is
+   legal, or if it would be legal except that it leaves the king in
+   check.  In the arguments, epfile is EP_NONE if the previous move
+   was not a double pawn push, or the file 0..7 if it was, or
+   EP_UNKNOWN if we don't know and want to allow all e.p. captures.
+   Promotion moves generated are to Queen only.
+*/
+extern void GenPseudoLegal P((Board board, int flags, int epfile,
+                             MoveCallback callback, VOIDSTAR closure));
+
+/* Like GenPseudoLegal, but include castling moves and (unless 
+   F_IGNORE_CHECK is set in the flags) omit moves that would leave the
+   king in check.  The CASTLE_OK flags are true if castling is not yet
+   ruled out by a move of the king or rook.  Return TRUE if the player
+   on move is currently in check and F_IGNORE_CHECK is not set.
+*/
+extern int GenLegal P((Board board, int flags, int epfile,
+                        char castlingRights[], /* [HGM] */
+                       MoveCallback callback, VOIDSTAR closure));
+
+/* If the player on move were to move from (rf, ff) to (rt, ft), would
+   he leave himself in check?  Or if rf == -1, is the player on move
+   in check now?  enPassant must be TRUE if the indicated move is an
+   e.p. capture.  The possibility of castling out of a check along the
+   back rank is not accounted for (i.e., we still return nonzero), as
+   this is illegal anyway.  Return value is the number of times the
+   king is in check. */ 
+extern int CheckTest P((Board board, int flags,
+                       int rf, int ff, int rt, int ft, int enPassant));
+
+/* Is a move from (rf, ff) to (rt, ft) legal for the player whom the
+   flags say is on move?  Other arguments as in GenPseudoLegal.
+   Returns the type of move made, taking promoChar into account. */
+extern ChessMove LegalityTest P((Board board, int flags, int epfile,
+                                 char castlingRights[], /* [HGM] */
+                                int rf, int ff, int rt, int ft,
+                                int promoChar));
+
+#define MT_NONE 0
+#define MT_CHECK 1
+#define MT_CHECKMATE 2
+#define MT_STALEMATE 3
+
+/* Return MT_NONE, MT_CHECK, MT_CHECKMATE, or MT_STALEMATE */
+extern int MateTest P((Board board, int flags, int epfile,
+                                        char castlingRights[])); /* [HGM] */
+
+typedef struct {
+    /* Input data */
+    ChessSquare pieceIn;        /* EmptySquare if unknown */
+    int rfIn, ffIn, rtIn, ftIn; /* -1 if unknown */
+    int promoCharIn;            /* NULLCHAR if unknown */
+    /* Output data for matched move */
+    ChessMove kind;
+    ChessSquare piece;
+    int rf, ff, rt, ft;
+    int promoChar; /* 'q' if a promotion and promoCharIn was NULLCHAR */
+    int count;     /* Number of possibilities found */
+} DisambiguateClosure;
+
+/* Disambiguate a partially-known move */
+void Disambiguate P((Board board, int flags, int epfile,
+                    DisambiguateClosure *closure));
+
+
+/* Convert coordinates to normal algebraic notation.
+   promoChar must be NULLCHAR or '.' if not a promotion.
+*/
+ChessMove CoordsToAlgebraic P((Board board, int flags, int epfile,
+                              int rf, int ff, int rt, int ft,
+                              int promoChar, char out[MOVE_LEN]));
diff --git a/pg_key.c b/pg_key.c
new file mode 100644 (file)
index 0000000..6d946bc
--- /dev/null
+++ b/pg_key.c
@@ -0,0 +1,340 @@
+
+/* 
+ * This little proof of concept utility for educational purposes 
+ * computes the Polyglot key of a fen.
+ *
+ * Usage:
+ * pg_key "<fen string>"
+ *
+ *
+ * For brevity this code does ZERO error checking and will 
+ * unceremoniously segfault in case of an illegal fen.
+ *
+ *
+ * This code is released in the public domain by Michel Van den Bergh.
+ * The array Random64 is taken from the Polyglot source code. 
+ * I am pretty sure that a table of random numbers is never protected
+ * by copyright.
+ *
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+
+#ifdef _MSC_VER
+  typedef unsigned __int64 uint64;
+#else
+  typedef unsigned long long int uint64;
+#endif
+
+
+#ifdef _MSC_VER
+#  define U64(u) (u##ui64)
+#else
+#  define U64(u) (u##ULL)
+#endif
+
+uint64 Random64[781] = {
+   U64(0x9D39247E33776D41), U64(0x2AF7398005AAA5C7), U64(0x44DB015024623547), U64(0x9C15F73E62A76AE2),
+   U64(0x75834465489C0C89), U64(0x3290AC3A203001BF), U64(0x0FBBAD1F61042279), U64(0xE83A908FF2FB60CA),
+   U64(0x0D7E765D58755C10), U64(0x1A083822CEAFE02D), U64(0x9605D5F0E25EC3B0), U64(0xD021FF5CD13A2ED5),
+   U64(0x40BDF15D4A672E32), U64(0x011355146FD56395), U64(0x5DB4832046F3D9E5), U64(0x239F8B2D7FF719CC),
+   U64(0x05D1A1AE85B49AA1), U64(0x679F848F6E8FC971), U64(0x7449BBFF801FED0B), U64(0x7D11CDB1C3B7ADF0),
+   U64(0x82C7709E781EB7CC), U64(0xF3218F1C9510786C), U64(0x331478F3AF51BBE6), U64(0x4BB38DE5E7219443),
+   U64(0xAA649C6EBCFD50FC), U64(0x8DBD98A352AFD40B), U64(0x87D2074B81D79217), U64(0x19F3C751D3E92AE1),
+   U64(0xB4AB30F062B19ABF), U64(0x7B0500AC42047AC4), U64(0xC9452CA81A09D85D), U64(0x24AA6C514DA27500),
+   U64(0x4C9F34427501B447), U64(0x14A68FD73C910841), U64(0xA71B9B83461CBD93), U64(0x03488B95B0F1850F),
+   U64(0x637B2B34FF93C040), U64(0x09D1BC9A3DD90A94), U64(0x3575668334A1DD3B), U64(0x735E2B97A4C45A23),
+   U64(0x18727070F1BD400B), U64(0x1FCBACD259BF02E7), U64(0xD310A7C2CE9B6555), U64(0xBF983FE0FE5D8244),
+   U64(0x9F74D14F7454A824), U64(0x51EBDC4AB9BA3035), U64(0x5C82C505DB9AB0FA), U64(0xFCF7FE8A3430B241),
+   U64(0x3253A729B9BA3DDE), U64(0x8C74C368081B3075), U64(0xB9BC6C87167C33E7), U64(0x7EF48F2B83024E20),
+   U64(0x11D505D4C351BD7F), U64(0x6568FCA92C76A243), U64(0x4DE0B0F40F32A7B8), U64(0x96D693460CC37E5D),
+   U64(0x42E240CB63689F2F), U64(0x6D2BDCDAE2919661), U64(0x42880B0236E4D951), U64(0x5F0F4A5898171BB6),
+   U64(0x39F890F579F92F88), U64(0x93C5B5F47356388B), U64(0x63DC359D8D231B78), U64(0xEC16CA8AEA98AD76),
+   U64(0x5355F900C2A82DC7), U64(0x07FB9F855A997142), U64(0x5093417AA8A7ED5E), U64(0x7BCBC38DA25A7F3C),
+   U64(0x19FC8A768CF4B6D4), U64(0x637A7780DECFC0D9), U64(0x8249A47AEE0E41F7), U64(0x79AD695501E7D1E8),
+   U64(0x14ACBAF4777D5776), U64(0xF145B6BECCDEA195), U64(0xDABF2AC8201752FC), U64(0x24C3C94DF9C8D3F6),
+   U64(0xBB6E2924F03912EA), U64(0x0CE26C0B95C980D9), U64(0xA49CD132BFBF7CC4), U64(0xE99D662AF4243939),
+   U64(0x27E6AD7891165C3F), U64(0x8535F040B9744FF1), U64(0x54B3F4FA5F40D873), U64(0x72B12C32127FED2B),
+   U64(0xEE954D3C7B411F47), U64(0x9A85AC909A24EAA1), U64(0x70AC4CD9F04F21F5), U64(0xF9B89D3E99A075C2),
+   U64(0x87B3E2B2B5C907B1), U64(0xA366E5B8C54F48B8), U64(0xAE4A9346CC3F7CF2), U64(0x1920C04D47267BBD),
+   U64(0x87BF02C6B49E2AE9), U64(0x092237AC237F3859), U64(0xFF07F64EF8ED14D0), U64(0x8DE8DCA9F03CC54E),
+   U64(0x9C1633264DB49C89), U64(0xB3F22C3D0B0B38ED), U64(0x390E5FB44D01144B), U64(0x5BFEA5B4712768E9),
+   U64(0x1E1032911FA78984), U64(0x9A74ACB964E78CB3), U64(0x4F80F7A035DAFB04), U64(0x6304D09A0B3738C4),
+   U64(0x2171E64683023A08), U64(0x5B9B63EB9CEFF80C), U64(0x506AACF489889342), U64(0x1881AFC9A3A701D6),
+   U64(0x6503080440750644), U64(0xDFD395339CDBF4A7), U64(0xEF927DBCF00C20F2), U64(0x7B32F7D1E03680EC),
+   U64(0xB9FD7620E7316243), U64(0x05A7E8A57DB91B77), U64(0xB5889C6E15630A75), U64(0x4A750A09CE9573F7),
+   U64(0xCF464CEC899A2F8A), U64(0xF538639CE705B824), U64(0x3C79A0FF5580EF7F), U64(0xEDE6C87F8477609D),
+   U64(0x799E81F05BC93F31), U64(0x86536B8CF3428A8C), U64(0x97D7374C60087B73), U64(0xA246637CFF328532),
+   U64(0x043FCAE60CC0EBA0), U64(0x920E449535DD359E), U64(0x70EB093B15B290CC), U64(0x73A1921916591CBD),
+   U64(0x56436C9FE1A1AA8D), U64(0xEFAC4B70633B8F81), U64(0xBB215798D45DF7AF), U64(0x45F20042F24F1768),
+   U64(0x930F80F4E8EB7462), U64(0xFF6712FFCFD75EA1), U64(0xAE623FD67468AA70), U64(0xDD2C5BC84BC8D8FC),
+   U64(0x7EED120D54CF2DD9), U64(0x22FE545401165F1C), U64(0xC91800E98FB99929), U64(0x808BD68E6AC10365),
+   U64(0xDEC468145B7605F6), U64(0x1BEDE3A3AEF53302), U64(0x43539603D6C55602), U64(0xAA969B5C691CCB7A),
+   U64(0xA87832D392EFEE56), U64(0x65942C7B3C7E11AE), U64(0xDED2D633CAD004F6), U64(0x21F08570F420E565),
+   U64(0xB415938D7DA94E3C), U64(0x91B859E59ECB6350), U64(0x10CFF333E0ED804A), U64(0x28AED140BE0BB7DD),
+   U64(0xC5CC1D89724FA456), U64(0x5648F680F11A2741), U64(0x2D255069F0B7DAB3), U64(0x9BC5A38EF729ABD4),
+   U64(0xEF2F054308F6A2BC), U64(0xAF2042F5CC5C2858), U64(0x480412BAB7F5BE2A), U64(0xAEF3AF4A563DFE43),
+   U64(0x19AFE59AE451497F), U64(0x52593803DFF1E840), U64(0xF4F076E65F2CE6F0), U64(0x11379625747D5AF3),
+   U64(0xBCE5D2248682C115), U64(0x9DA4243DE836994F), U64(0x066F70B33FE09017), U64(0x4DC4DE189B671A1C),
+   U64(0x51039AB7712457C3), U64(0xC07A3F80C31FB4B4), U64(0xB46EE9C5E64A6E7C), U64(0xB3819A42ABE61C87),
+   U64(0x21A007933A522A20), U64(0x2DF16F761598AA4F), U64(0x763C4A1371B368FD), U64(0xF793C46702E086A0),
+   U64(0xD7288E012AEB8D31), U64(0xDE336A2A4BC1C44B), U64(0x0BF692B38D079F23), U64(0x2C604A7A177326B3),
+   U64(0x4850E73E03EB6064), U64(0xCFC447F1E53C8E1B), U64(0xB05CA3F564268D99), U64(0x9AE182C8BC9474E8),
+   U64(0xA4FC4BD4FC5558CA), U64(0xE755178D58FC4E76), U64(0x69B97DB1A4C03DFE), U64(0xF9B5B7C4ACC67C96),
+   U64(0xFC6A82D64B8655FB), U64(0x9C684CB6C4D24417), U64(0x8EC97D2917456ED0), U64(0x6703DF9D2924E97E),
+   U64(0xC547F57E42A7444E), U64(0x78E37644E7CAD29E), U64(0xFE9A44E9362F05FA), U64(0x08BD35CC38336615),
+   U64(0x9315E5EB3A129ACE), U64(0x94061B871E04DF75), U64(0xDF1D9F9D784BA010), U64(0x3BBA57B68871B59D),
+   U64(0xD2B7ADEEDED1F73F), U64(0xF7A255D83BC373F8), U64(0xD7F4F2448C0CEB81), U64(0xD95BE88CD210FFA7),
+   U64(0x336F52F8FF4728E7), U64(0xA74049DAC312AC71), U64(0xA2F61BB6E437FDB5), U64(0x4F2A5CB07F6A35B3),
+   U64(0x87D380BDA5BF7859), U64(0x16B9F7E06C453A21), U64(0x7BA2484C8A0FD54E), U64(0xF3A678CAD9A2E38C),
+   U64(0x39B0BF7DDE437BA2), U64(0xFCAF55C1BF8A4424), U64(0x18FCF680573FA594), U64(0x4C0563B89F495AC3),
+   U64(0x40E087931A00930D), U64(0x8CFFA9412EB642C1), U64(0x68CA39053261169F), U64(0x7A1EE967D27579E2),
+   U64(0x9D1D60E5076F5B6F), U64(0x3810E399B6F65BA2), U64(0x32095B6D4AB5F9B1), U64(0x35CAB62109DD038A),
+   U64(0xA90B24499FCFAFB1), U64(0x77A225A07CC2C6BD), U64(0x513E5E634C70E331), U64(0x4361C0CA3F692F12),
+   U64(0xD941ACA44B20A45B), U64(0x528F7C8602C5807B), U64(0x52AB92BEB9613989), U64(0x9D1DFA2EFC557F73),
+   U64(0x722FF175F572C348), U64(0x1D1260A51107FE97), U64(0x7A249A57EC0C9BA2), U64(0x04208FE9E8F7F2D6),
+   U64(0x5A110C6058B920A0), U64(0x0CD9A497658A5698), U64(0x56FD23C8F9715A4C), U64(0x284C847B9D887AAE),
+   U64(0x04FEABFBBDB619CB), U64(0x742E1E651C60BA83), U64(0x9A9632E65904AD3C), U64(0x881B82A13B51B9E2),
+   U64(0x506E6744CD974924), U64(0xB0183DB56FFC6A79), U64(0x0ED9B915C66ED37E), U64(0x5E11E86D5873D484),
+   U64(0xF678647E3519AC6E), U64(0x1B85D488D0F20CC5), U64(0xDAB9FE6525D89021), U64(0x0D151D86ADB73615),
+   U64(0xA865A54EDCC0F019), U64(0x93C42566AEF98FFB), U64(0x99E7AFEABE000731), U64(0x48CBFF086DDF285A),
+   U64(0x7F9B6AF1EBF78BAF), U64(0x58627E1A149BBA21), U64(0x2CD16E2ABD791E33), U64(0xD363EFF5F0977996),
+   U64(0x0CE2A38C344A6EED), U64(0x1A804AADB9CFA741), U64(0x907F30421D78C5DE), U64(0x501F65EDB3034D07),
+   U64(0x37624AE5A48FA6E9), U64(0x957BAF61700CFF4E), U64(0x3A6C27934E31188A), U64(0xD49503536ABCA345),
+   U64(0x088E049589C432E0), U64(0xF943AEE7FEBF21B8), U64(0x6C3B8E3E336139D3), U64(0x364F6FFA464EE52E),
+   U64(0xD60F6DCEDC314222), U64(0x56963B0DCA418FC0), U64(0x16F50EDF91E513AF), U64(0xEF1955914B609F93),
+   U64(0x565601C0364E3228), U64(0xECB53939887E8175), U64(0xBAC7A9A18531294B), U64(0xB344C470397BBA52),
+   U64(0x65D34954DAF3CEBD), U64(0xB4B81B3FA97511E2), U64(0xB422061193D6F6A7), U64(0x071582401C38434D),
+   U64(0x7A13F18BBEDC4FF5), U64(0xBC4097B116C524D2), U64(0x59B97885E2F2EA28), U64(0x99170A5DC3115544),
+   U64(0x6F423357E7C6A9F9), U64(0x325928EE6E6F8794), U64(0xD0E4366228B03343), U64(0x565C31F7DE89EA27),
+   U64(0x30F5611484119414), U64(0xD873DB391292ED4F), U64(0x7BD94E1D8E17DEBC), U64(0xC7D9F16864A76E94),
+   U64(0x947AE053EE56E63C), U64(0xC8C93882F9475F5F), U64(0x3A9BF55BA91F81CA), U64(0xD9A11FBB3D9808E4),
+   U64(0x0FD22063EDC29FCA), U64(0xB3F256D8ACA0B0B9), U64(0xB03031A8B4516E84), U64(0x35DD37D5871448AF),
+   U64(0xE9F6082B05542E4E), U64(0xEBFAFA33D7254B59), U64(0x9255ABB50D532280), U64(0xB9AB4CE57F2D34F3),
+   U64(0x693501D628297551), U64(0xC62C58F97DD949BF), U64(0xCD454F8F19C5126A), U64(0xBBE83F4ECC2BDECB),
+   U64(0xDC842B7E2819E230), U64(0xBA89142E007503B8), U64(0xA3BC941D0A5061CB), U64(0xE9F6760E32CD8021),
+   U64(0x09C7E552BC76492F), U64(0x852F54934DA55CC9), U64(0x8107FCCF064FCF56), U64(0x098954D51FFF6580),
+   U64(0x23B70EDB1955C4BF), U64(0xC330DE426430F69D), U64(0x4715ED43E8A45C0A), U64(0xA8D7E4DAB780A08D),
+   U64(0x0572B974F03CE0BB), U64(0xB57D2E985E1419C7), U64(0xE8D9ECBE2CF3D73F), U64(0x2FE4B17170E59750),
+   U64(0x11317BA87905E790), U64(0x7FBF21EC8A1F45EC), U64(0x1725CABFCB045B00), U64(0x964E915CD5E2B207),
+   U64(0x3E2B8BCBF016D66D), U64(0xBE7444E39328A0AC), U64(0xF85B2B4FBCDE44B7), U64(0x49353FEA39BA63B1),
+   U64(0x1DD01AAFCD53486A), U64(0x1FCA8A92FD719F85), U64(0xFC7C95D827357AFA), U64(0x18A6A990C8B35EBD),
+   U64(0xCCCB7005C6B9C28D), U64(0x3BDBB92C43B17F26), U64(0xAA70B5B4F89695A2), U64(0xE94C39A54A98307F),
+   U64(0xB7A0B174CFF6F36E), U64(0xD4DBA84729AF48AD), U64(0x2E18BC1AD9704A68), U64(0x2DE0966DAF2F8B1C),
+   U64(0xB9C11D5B1E43A07E), U64(0x64972D68DEE33360), U64(0x94628D38D0C20584), U64(0xDBC0D2B6AB90A559),
+   U64(0xD2733C4335C6A72F), U64(0x7E75D99D94A70F4D), U64(0x6CED1983376FA72B), U64(0x97FCAACBF030BC24),
+   U64(0x7B77497B32503B12), U64(0x8547EDDFB81CCB94), U64(0x79999CDFF70902CB), U64(0xCFFE1939438E9B24),
+   U64(0x829626E3892D95D7), U64(0x92FAE24291F2B3F1), U64(0x63E22C147B9C3403), U64(0xC678B6D860284A1C),
+   U64(0x5873888850659AE7), U64(0x0981DCD296A8736D), U64(0x9F65789A6509A440), U64(0x9FF38FED72E9052F),
+   U64(0xE479EE5B9930578C), U64(0xE7F28ECD2D49EECD), U64(0x56C074A581EA17FE), U64(0x5544F7D774B14AEF),
+   U64(0x7B3F0195FC6F290F), U64(0x12153635B2C0CF57), U64(0x7F5126DBBA5E0CA7), U64(0x7A76956C3EAFB413),
+   U64(0x3D5774A11D31AB39), U64(0x8A1B083821F40CB4), U64(0x7B4A38E32537DF62), U64(0x950113646D1D6E03),
+   U64(0x4DA8979A0041E8A9), U64(0x3BC36E078F7515D7), U64(0x5D0A12F27AD310D1), U64(0x7F9D1A2E1EBE1327),
+   U64(0xDA3A361B1C5157B1), U64(0xDCDD7D20903D0C25), U64(0x36833336D068F707), U64(0xCE68341F79893389),
+   U64(0xAB9090168DD05F34), U64(0x43954B3252DC25E5), U64(0xB438C2B67F98E5E9), U64(0x10DCD78E3851A492),
+   U64(0xDBC27AB5447822BF), U64(0x9B3CDB65F82CA382), U64(0xB67B7896167B4C84), U64(0xBFCED1B0048EAC50),
+   U64(0xA9119B60369FFEBD), U64(0x1FFF7AC80904BF45), U64(0xAC12FB171817EEE7), U64(0xAF08DA9177DDA93D),
+   U64(0x1B0CAB936E65C744), U64(0xB559EB1D04E5E932), U64(0xC37B45B3F8D6F2BA), U64(0xC3A9DC228CAAC9E9),
+   U64(0xF3B8B6675A6507FF), U64(0x9FC477DE4ED681DA), U64(0x67378D8ECCEF96CB), U64(0x6DD856D94D259236),
+   U64(0xA319CE15B0B4DB31), U64(0x073973751F12DD5E), U64(0x8A8E849EB32781A5), U64(0xE1925C71285279F5),
+   U64(0x74C04BF1790C0EFE), U64(0x4DDA48153C94938A), U64(0x9D266D6A1CC0542C), U64(0x7440FB816508C4FE),
+   U64(0x13328503DF48229F), U64(0xD6BF7BAEE43CAC40), U64(0x4838D65F6EF6748F), U64(0x1E152328F3318DEA),
+   U64(0x8F8419A348F296BF), U64(0x72C8834A5957B511), U64(0xD7A023A73260B45C), U64(0x94EBC8ABCFB56DAE),
+   U64(0x9FC10D0F989993E0), U64(0xDE68A2355B93CAE6), U64(0xA44CFE79AE538BBE), U64(0x9D1D84FCCE371425),
+   U64(0x51D2B1AB2DDFB636), U64(0x2FD7E4B9E72CD38C), U64(0x65CA5B96B7552210), U64(0xDD69A0D8AB3B546D),
+   U64(0x604D51B25FBF70E2), U64(0x73AA8A564FB7AC9E), U64(0x1A8C1E992B941148), U64(0xAAC40A2703D9BEA0),
+   U64(0x764DBEAE7FA4F3A6), U64(0x1E99B96E70A9BE8B), U64(0x2C5E9DEB57EF4743), U64(0x3A938FEE32D29981),
+   U64(0x26E6DB8FFDF5ADFE), U64(0x469356C504EC9F9D), U64(0xC8763C5B08D1908C), U64(0x3F6C6AF859D80055),
+   U64(0x7F7CC39420A3A545), U64(0x9BFB227EBDF4C5CE), U64(0x89039D79D6FC5C5C), U64(0x8FE88B57305E2AB6),
+   U64(0xA09E8C8C35AB96DE), U64(0xFA7E393983325753), U64(0xD6B6D0ECC617C699), U64(0xDFEA21EA9E7557E3),
+   U64(0xB67C1FA481680AF8), U64(0xCA1E3785A9E724E5), U64(0x1CFC8BED0D681639), U64(0xD18D8549D140CAEA),
+   U64(0x4ED0FE7E9DC91335), U64(0xE4DBF0634473F5D2), U64(0x1761F93A44D5AEFE), U64(0x53898E4C3910DA55),
+   U64(0x734DE8181F6EC39A), U64(0x2680B122BAA28D97), U64(0x298AF231C85BAFAB), U64(0x7983EED3740847D5),
+   U64(0x66C1A2A1A60CD889), U64(0x9E17E49642A3E4C1), U64(0xEDB454E7BADC0805), U64(0x50B704CAB602C329),
+   U64(0x4CC317FB9CDDD023), U64(0x66B4835D9EAFEA22), U64(0x219B97E26FFC81BD), U64(0x261E4E4C0A333A9D),
+   U64(0x1FE2CCA76517DB90), U64(0xD7504DFA8816EDBB), U64(0xB9571FA04DC089C8), U64(0x1DDC0325259B27DE),
+   U64(0xCF3F4688801EB9AA), U64(0xF4F5D05C10CAB243), U64(0x38B6525C21A42B0E), U64(0x36F60E2BA4FA6800),
+   U64(0xEB3593803173E0CE), U64(0x9C4CD6257C5A3603), U64(0xAF0C317D32ADAA8A), U64(0x258E5A80C7204C4B),
+   U64(0x8B889D624D44885D), U64(0xF4D14597E660F855), U64(0xD4347F66EC8941C3), U64(0xE699ED85B0DFB40D),
+   U64(0x2472F6207C2D0484), U64(0xC2A1E7B5B459AEB5), U64(0xAB4F6451CC1D45EC), U64(0x63767572AE3D6174),
+   U64(0xA59E0BD101731A28), U64(0x116D0016CB948F09), U64(0x2CF9C8CA052F6E9F), U64(0x0B090A7560A968E3),
+   U64(0xABEEDDB2DDE06FF1), U64(0x58EFC10B06A2068D), U64(0xC6E57A78FBD986E0), U64(0x2EAB8CA63CE802D7),
+   U64(0x14A195640116F336), U64(0x7C0828DD624EC390), U64(0xD74BBE77E6116AC7), U64(0x804456AF10F5FB53),
+   U64(0xEBE9EA2ADF4321C7), U64(0x03219A39EE587A30), U64(0x49787FEF17AF9924), U64(0xA1E9300CD8520548),
+   U64(0x5B45E522E4B1B4EF), U64(0xB49C3B3995091A36), U64(0xD4490AD526F14431), U64(0x12A8F216AF9418C2),
+   U64(0x001F837CC7350524), U64(0x1877B51E57A764D5), U64(0xA2853B80F17F58EE), U64(0x993E1DE72D36D310),
+   U64(0xB3598080CE64A656), U64(0x252F59CF0D9F04BB), U64(0xD23C8E176D113600), U64(0x1BDA0492E7E4586E),
+   U64(0x21E0BD5026C619BF), U64(0x3B097ADAF088F94E), U64(0x8D14DEDB30BE846E), U64(0xF95CFFA23AF5F6F4),
+   U64(0x3871700761B3F743), U64(0xCA672B91E9E4FA16), U64(0x64C8E531BFF53B55), U64(0x241260ED4AD1E87D),
+   U64(0x106C09B972D2E822), U64(0x7FBA195410E5CA30), U64(0x7884D9BC6CB569D8), U64(0x0647DFEDCD894A29),
+   U64(0x63573FF03E224774), U64(0x4FC8E9560F91B123), U64(0x1DB956E450275779), U64(0xB8D91274B9E9D4FB),
+   U64(0xA2EBEE47E2FBFCE1), U64(0xD9F1F30CCD97FB09), U64(0xEFED53D75FD64E6B), U64(0x2E6D02C36017F67F),
+   U64(0xA9AA4D20DB084E9B), U64(0xB64BE8D8B25396C1), U64(0x70CB6AF7C2D5BCF0), U64(0x98F076A4F7A2322E),
+   U64(0xBF84470805E69B5F), U64(0x94C3251F06F90CF3), U64(0x3E003E616A6591E9), U64(0xB925A6CD0421AFF3),
+   U64(0x61BDD1307C66E300), U64(0xBF8D5108E27E0D48), U64(0x240AB57A8B888B20), U64(0xFC87614BAF287E07),
+   U64(0xEF02CDD06FFDB432), U64(0xA1082C0466DF6C0A), U64(0x8215E577001332C8), U64(0xD39BB9C3A48DB6CF),
+   U64(0x2738259634305C14), U64(0x61CF4F94C97DF93D), U64(0x1B6BACA2AE4E125B), U64(0x758F450C88572E0B),
+   U64(0x959F587D507A8359), U64(0xB063E962E045F54D), U64(0x60E8ED72C0DFF5D1), U64(0x7B64978555326F9F),
+   U64(0xFD080D236DA814BA), U64(0x8C90FD9B083F4558), U64(0x106F72FE81E2C590), U64(0x7976033A39F7D952),
+   U64(0xA4EC0132764CA04B), U64(0x733EA705FAE4FA77), U64(0xB4D8F77BC3E56167), U64(0x9E21F4F903B33FD9),
+   U64(0x9D765E419FB69F6D), U64(0xD30C088BA61EA5EF), U64(0x5D94337FBFAF7F5B), U64(0x1A4E4822EB4D7A59),
+   U64(0x6FFE73E81B637FB3), U64(0xDDF957BC36D8B9CA), U64(0x64D0E29EEA8838B3), U64(0x08DD9BDFD96B9F63),
+   U64(0x087E79E5A57D1D13), U64(0xE328E230E3E2B3FB), U64(0x1C2559E30F0946BE), U64(0x720BF5F26F4D2EAA),
+   U64(0xB0774D261CC609DB), U64(0x443F64EC5A371195), U64(0x4112CF68649A260E), U64(0xD813F2FAB7F5C5CA),
+   U64(0x660D3257380841EE), U64(0x59AC2C7873F910A3), U64(0xE846963877671A17), U64(0x93B633ABFA3469F8),
+   U64(0xC0C0F5A60EF4CDCF), U64(0xCAF21ECD4377B28C), U64(0x57277707199B8175), U64(0x506C11B9D90E8B1D),
+   U64(0xD83CC2687A19255F), U64(0x4A29C6465A314CD1), U64(0xED2DF21216235097), U64(0xB5635C95FF7296E2),
+   U64(0x22AF003AB672E811), U64(0x52E762596BF68235), U64(0x9AEBA33AC6ECC6B0), U64(0x944F6DE09134DFB6),
+   U64(0x6C47BEC883A7DE39), U64(0x6AD047C430A12104), U64(0xA5B1CFDBA0AB4067), U64(0x7C45D833AFF07862),
+   U64(0x5092EF950A16DA0B), U64(0x9338E69C052B8E7B), U64(0x455A4B4CFE30E3F5), U64(0x6B02E63195AD0CF8),
+   U64(0x6B17B224BAD6BF27), U64(0xD1E0CCD25BB9C169), U64(0xDE0C89A556B9AE70), U64(0x50065E535A213CF6),
+   U64(0x9C1169FA2777B874), U64(0x78EDEFD694AF1EED), U64(0x6DC93D9526A50E68), U64(0xEE97F453F06791ED),
+   U64(0x32AB0EDB696703D3), U64(0x3A6853C7E70757A7), U64(0x31865CED6120F37D), U64(0x67FEF95D92607890),
+   U64(0x1F2B1D1F15F6DC9C), U64(0xB69E38A8965C6B65), U64(0xAA9119FF184CCCF4), U64(0xF43C732873F24C13),
+   U64(0xFB4A3D794A9A80D2), U64(0x3550C2321FD6109C), U64(0x371F77E76BB8417E), U64(0x6BFA9AAE5EC05779),
+   U64(0xCD04F3FF001A4778), U64(0xE3273522064480CA), U64(0x9F91508BFFCFC14A), U64(0x049A7F41061A9E60),
+   U64(0xFCB6BE43A9F2FE9B), U64(0x08DE8A1C7797DA9B), U64(0x8F9887E6078735A1), U64(0xB5B4071DBFC73A66),
+   U64(0x230E343DFBA08D33), U64(0x43ED7F5A0FAE657D), U64(0x3A88A0FBBCB05C63), U64(0x21874B8B4D2DBC4F),
+   U64(0x1BDEA12E35F6A8C9), U64(0x53C065C6C8E63528), U64(0xE34A1D250E7A8D6B), U64(0xD6B04D3B7651DD7E),
+   U64(0x5E90277E7CB39E2D), U64(0x2C046F22062DC67D), U64(0xB10BB459132D0A26), U64(0x3FA9DDFB67E2F199),
+   U64(0x0E09B88E1914F7AF), U64(0x10E8B35AF3EEAB37), U64(0x9EEDECA8E272B933), U64(0xD4C718BC4AE8AE5F),
+   U64(0x81536D601170FC20), U64(0x91B534F885818A06), U64(0xEC8177F83F900978), U64(0x190E714FADA5156E),
+   U64(0xB592BF39B0364963), U64(0x89C350C893AE7DC1), U64(0xAC042E70F8B383F2), U64(0xB49B52E587A1EE60),
+   U64(0xFB152FE3FF26DA89), U64(0x3E666E6F69AE2C15), U64(0x3B544EBE544C19F9), U64(0xE805A1E290CF2456),
+   U64(0x24B33C9D7ED25117), U64(0xE74733427B72F0C1), U64(0x0A804D18B7097475), U64(0x57E3306D881EDB4F),
+   U64(0x4AE7D6A36EB5DBCB), U64(0x2D8D5432157064C8), U64(0xD1E649DE1E7F268B), U64(0x8A328A1CEDFE552C),
+   U64(0x07A3AEC79624C7DA), U64(0x84547DDC3E203C94), U64(0x990A98FD5071D263), U64(0x1A4FF12616EEFC89),
+   U64(0xF6F7FD1431714200), U64(0x30C05B1BA332F41C), U64(0x8D2636B81555A786), U64(0x46C9FEB55D120902),
+   U64(0xCCEC0A73B49C9921), U64(0x4E9D2827355FC492), U64(0x19EBB029435DCB0F), U64(0x4659D2B743848A2C),
+   U64(0x963EF2C96B33BE31), U64(0x74F85198B05A2E7D), U64(0x5A0F544DD2B1FB18), U64(0x03727073C2E134B1),
+   U64(0xC7F6AA2DE59AEA61), U64(0x352787BAA0D7C22F), U64(0x9853EAB63B5E0B35), U64(0xABBDCDD7ED5C0860),
+   U64(0xCF05DAF5AC8D77B0), U64(0x49CAD48CEBF4A71E), U64(0x7A4C10EC2158C4A6), U64(0xD9E92AA246BF719E),
+   U64(0x13AE978D09FE5557), U64(0x730499AF921549FF), U64(0x4E4B705B92903BA4), U64(0xFF577222C14F0A3A),
+   U64(0x55B6344CF97AAFAE), U64(0xB862225B055B6960), U64(0xCAC09AFBDDD2CDB4), U64(0xDAF8E9829FE96B5F),
+   U64(0xB5FDFC5D3132C498), U64(0x310CB380DB6F7503), U64(0xE87FBB46217A360E), U64(0x2102AE466EBB1148),
+   U64(0xF8549E1A3AA5E00D), U64(0x07A69AFDCC42261A), U64(0xC4C118BFE78FEAAE), U64(0xF9F4892ED96BD438),
+   U64(0x1AF3DBE25D8F45DA), U64(0xF5B4B0B0D2DEEEB4), U64(0x962ACEEFA82E1C84), U64(0x046E3ECAAF453CE9),
+   U64(0xF05D129681949A4C), U64(0x964781CE734B3C84), U64(0x9C2ED44081CE5FBD), U64(0x522E23F3925E319E),
+   U64(0x177E00F9FC32F791), U64(0x2BC60A63A6F3B3F2), U64(0x222BBFAE61725606), U64(0x486289DDCC3D6780),
+   U64(0x7DC7785B8EFDFC80), U64(0x8AF38731C02BA980), U64(0x1FAB64EA29A2DDF7), U64(0xE4D9429322CD065A),
+   U64(0x9DA058C67844F20C), U64(0x24C0E332B70019B0), U64(0x233003B5A6CFE6AD), U64(0xD586BD01C5C217F6),
+   U64(0x5E5637885F29BC2B), U64(0x7EBA726D8C94094B), U64(0x0A56A5F0BFE39272), U64(0xD79476A84EE20D06),
+   U64(0x9E4C1269BAA4BF37), U64(0x17EFEE45B0DEE640), U64(0x1D95B0A5FCF90BC6), U64(0x93CBE0B699C2585D),
+   U64(0x65FA4F227A2B6D79), U64(0xD5F9E858292504D5), U64(0xC2B5A03F71471A6F), U64(0x59300222B4561E00),
+   U64(0xCE2F8642CA0712DC), U64(0x7CA9723FBB2E8988), U64(0x2785338347F2BA08), U64(0xC61BB3A141E50E8C),
+   U64(0x150F361DAB9DEC26), U64(0x9F6A419D382595F4), U64(0x64A53DC924FE7AC9), U64(0x142DE49FFF7A7C3D),
+   U64(0x0C335248857FA9E7), U64(0x0A9C32D5EAE45305), U64(0xE6C42178C4BBB92E), U64(0x71F1CE2490D20B07),
+   U64(0xF1BCC3D275AFE51A), U64(0xE728E8C83C334074), U64(0x96FBF83A12884624), U64(0x81A1549FD6573DA5),
+   U64(0x5FA7867CAF35E149), U64(0x56986E2EF3ED091B), U64(0x917F1DD5F8886C61), U64(0xD20D8C88C8FFE65F),
+   U64(0x31D71DCE64B2C310), U64(0xF165B587DF898190), U64(0xA57E6339DD2CF3A0), U64(0x1EF6E6DBB1961EC9),
+   U64(0x70CC73D90BC26E24), U64(0xE21A6B35DF0C3AD7), U64(0x003A93D8B2806962), U64(0x1C99DED33CB890A1),
+   U64(0xCF3145DE0ADD4289), U64(0xD0E4427A5514FB72), U64(0x77C621CC9FB3A483), U64(0x67A34DAC4356550B),
+   U64(0xF8D626AAAF278509),
+};
+
+uint64 *RandomPiece     =Random64;
+uint64 *RandomCastle    =Random64+768;
+uint64 *RandomEnPassant =Random64+772;
+uint64 *RandomTurn      =Random64+780;
+
+char *piece_names="pPnNbBrRqQkK";
+
+uint64 hash(char *fen){
+    char board_s[72+1];
+    char to_move_c;
+    char castle_flags_s[4+1];
+    char ep_square_s[2+1]; 
+    char board[8][8];
+    char c;
+    int p,r,f,i,p_enc;
+    uint64 key=0;
+    sscanf(fen,"%72s %c %4s %2s",
+           board_s,
+           &to_move_c,
+           castle_flags_s,
+           ep_square_s);
+    r=7;
+    f=0;
+    p=0;
+    while(1){
+        if(p>=strlen(board_s)) break;
+        c=board_s[p++];
+        if(c=='/'){
+            r--;
+            f=0;
+            continue;
+        }
+        if(('1'<=c)&&('8'>=c)){
+            for(i=0;i<=c-'1';i++){
+                board[f++][r]='-';
+            }
+            continue;
+        }
+        board[f++][r]=c;
+    }
+    for(f=0;f<=7;f++){
+        for(r=0;r<=7;r++){
+            c=board[f][r];
+            if(c!='-'){
+                p_enc=strchr(piece_names,c)-piece_names;
+                key^=RandomPiece[64*p_enc+8*r+f];
+            }
+        }
+    }
+    p=0;
+    while(1){
+        if(p>=strlen(castle_flags_s)) break;
+        c=castle_flags_s[p++];
+        switch(c){
+            case '-' :
+                break;
+            case 'K' :
+                key^=RandomCastle[0];
+                break;
+            case 'Q' :
+                key^=RandomCastle[1];
+                break;
+            case 'k' :
+                key^=RandomCastle[2];
+                break;
+            case 'q' :
+                key^=RandomCastle[3];
+                break;
+            default:
+                break;
+        }
+    }
+    if(ep_square_s[0]!='-'){
+        f=ep_square_s[0]-'a';
+        if(to_move_c=='b'){
+            if((f>0 && board[f-1][3]=='p')||
+               (f<7 && board[f+1][3]=='p')){
+                key^=RandomEnPassant[f];
+            }
+        }else{
+            if((f>0 && board[f-1][4]=='P')||
+               (f<7 && board[f+1][4]=='P')){
+                key^=RandomEnPassant[f];
+            }
+        }
+    }
+    if(to_move_c=='w'){
+        key^=RandomTurn[0];
+    }
+    return key;
+}
+
+int main(int argc, char *argv[]){
+    if(argc==1){
+        printf("Usage:  pg_key \"<fen string>\"\n");
+    }else{
+#ifdef _MSC_VER
+        printf("%016I64x\n",hash(argv[1]));
+#else
+        printf("%016llx\n",hash(argv[1]));
+#endif
+    }
+    return 0;
+}
diff --git a/pg_show.c b/pg_show.c
new file mode 100644 (file)
index 0000000..c377cbb
--- /dev/null
+++ b/pg_show.c
@@ -0,0 +1,194 @@
+/* 
+ * This utility looks up the moves and their scores in a Polyglot book
+ *
+ * Usage:
+ * pg_show <book> <hex key>"
+ *
+ * You can find the hex key of a FEN using pg_key. 
+ *
+ * This code is released in the public domain by Michel Van den Bergh.
+ *
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+
+typedef unsigned char uint8;
+typedef unsigned short uint16;
+typedef unsigned int uint32;
+
+#ifdef _MSC_VER
+  typedef unsigned __int64 uint64;
+#else
+  typedef unsigned long long int uint64;
+#endif
+
+typedef struct {
+    uint64 key;        
+    uint16 move;
+    uint16 weight;
+    uint32 learn;
+} entry_t;
+
+entry_t entry_none = {
+    0, 0, 0, 0
+};
+
+char *promote_pieces=" nbrq";
+
+#define MAX_MOVES 100
+
+int int_from_file(FILE *f, int l, uint64 *r){
+    int i,c;
+    for(i=0;i<l;i++){
+        c=fgetc(f);
+        if(c==EOF){
+            return 1;
+        }
+        (*r)=((*r)<<8)+c;
+    }
+    return 0;
+}
+
+int entry_from_file(FILE *f, entry_t *entry){
+    int ret;
+    uint64 r;
+    ret=int_from_file(f,8,&r);
+    if(ret) return 1;
+    entry->key=r;
+    ret=int_from_file(f,2,&r);
+    if(ret) return 1;
+    entry->move=r;
+    ret=int_from_file(f,2,&r);
+    if(ret) return 1;
+    entry->weight=r;
+    ret=int_from_file(f,4,&r);
+    if(ret) return 1;
+    entry->learn=r;
+    return 0;
+}
+
+int find_key(FILE *f, uint64 key, entry_t *entry){
+    int first, last, middle;
+    entry_t first_entry=entry_none, last_entry,middle_entry;
+    first=-1;
+    if(fseek(f,-16,SEEK_END)){
+        *entry=entry_none;
+        entry->key=key+1; //hack
+        return -1;
+    }
+    last=ftell(f)/16;
+    entry_from_file(f,&last_entry);
+    while(1){
+        if(last-first==1){
+            *entry=last_entry;
+            return last;
+        }
+        middle=(first+last)/2;
+        fseek(f,16*middle,SEEK_SET);
+        entry_from_file(f,&middle_entry);
+        if(key<=middle_entry.key){
+            last=middle;
+            last_entry=middle_entry;
+        }else{
+            first=middle;
+            first_entry=middle_entry;
+        }
+    }
+}
+
+void move_to_string(char move_s[6], uint16 move){
+    int f,fr,ff,t,tr,tf,p;
+    f=(move>>6)&077;
+    fr=(f>>3)&0x7;
+    ff=f&0x7;
+    t=move&077;
+    tr=(t>>3)&0x7;
+    tf=t&0x7;
+    p=(move>>12)&0x7;
+    move_s[0]=ff+'a';
+    move_s[1]=fr+'1';
+    move_s[2]=tf+'a';
+    move_s[3]=tr+'1';
+    if(p){
+        move_s[4]=promote_pieces[p];
+        move_s[5]='\0';
+    }else{
+        move_s[4]='\0';
+    }
+    if(!strcmp(move_s,"e1h1")){
+        strcpy(move_s,"e1g1");
+    }else  if(!strcmp(move_s,"e1a1")){
+        strcpy(move_s,"e1c1");
+    }else  if(!strcmp(move_s,"e8h8")){
+        strcpy(move_s,"e8g8");
+    }else  if(!strcmp(move_s,"e8a8")){
+        strcpy(move_s,"e8c8");
+    }
+}
+
+int main(int argc, char *argv[]){
+    FILE *f;
+    entry_t entry;
+    int offset;
+    char *file_name;
+    uint64 key;
+    entry_t entries[MAX_MOVES];
+    int count=0;
+    int ret, i;
+    char move_s[6];
+    int total_weight;
+    if(argc<=2){
+        printf("Usage: pg_show <book> <hex key>\n");
+        return 1;
+    }
+    file_name=argv[1];
+#ifdef _MSC_VER
+    sscanf(argv[2],"%16I64x",&key);
+#else
+    sscanf(argv[2],"%16llx",&key);
+#endif
+    f=fopen(file_name,"rb");
+    if(!f){
+        perror(file_name);
+        return 1;
+    }
+    offset=find_key(f,key,&entry);
+    if(entry.key!=key){
+#ifdef _MSC_VER
+        printf("%016I64x: No such key\n",key);
+#else
+        printf("%016llx: No such key\n",key);
+#endif        
+        return 1;
+    }
+    entries[0]=entry;
+    count=1;
+    fseek(f,16*(offset+1),SEEK_SET);
+    while(1){
+        ret=entry_from_file(f,&entry);
+        if(ret){
+            break;
+        }
+        if(entry.key!=key){
+            break;
+        }
+        if(count==MAX_MOVES){
+            printf("Too many moves in this position (max=%d)\n",MAX_MOVES);
+            return 1;
+        }
+        entries[count++]=entry;
+    }
+    total_weight=0;
+    for(i=0;i<count;i++){
+        total_weight+=entries[i].weight;
+    }
+    for(i=0;i<count;i++){
+        move_to_string(move_s,entries[i].move);
+        printf("move=%s weight=%5.2f%%\n",
+                move_s,
+               100*((double) entries[i].weight/ (double) total_weight));
+    }
+    return 0;
+}
diff --git a/pixmaps/ANALYZING_14.xpm b/pixmaps/ANALYZING_14.xpm
new file mode 100644 (file)
index 0000000..b43e871
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *ANALYZE_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+".......   ....",\r
+".....  ...  ..",\r
+".... ....... .",\r
+".... .. .... .",\r
+"... ..  ..... ",\r
+"... ......... ",\r
+"... ......... ",\r
+".... ....... .",\r
+".... ....... .",\r
+"... .  ...  ..",\r
+".. . ..   ....",\r
+". . ..........",\r
+"   ...........",\r
+".............."\r
+};\r
diff --git a/pixmaps/BLACK_14.xpm b/pixmaps/BLACK_14.xpm
new file mode 100644 (file)
index 0000000..cab2a1e
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *BLACK_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+".....****.....",\r
+"...**    **...",\r
+"..*        *..",\r
+".*          *.",\r
+".*          *.",\r
+"*            *",\r
+"*            *",\r
+"*            *",\r
+"*            *",\r
+".*          *.",\r
+".*          *.",\r
+"..*        *..",\r
+"...**    **...",\r
+".....****....."\r
+};\r
diff --git a/pixmaps/CLEAR_14.xpm b/pixmaps/CLEAR_14.xpm
new file mode 100644 (file)
index 0000000..68a0efd
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *CLEAR_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+"..............",\r
+".............."\r
+};\r
diff --git a/pixmaps/PONDER_14.xpm b/pixmaps/PONDER_14.xpm
new file mode 100644 (file)
index 0000000..2f732ab
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *PONDER_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+"....  ..  ....",\r
+"..  ... ..  ..",\r
+". .......... .",\r
+" .......... ..",\r
+" ........... .",\r
+".  .......... ",\r
+".. .......... ",\r
+". .......... .",\r
+".. .......  ..",\r
+"... ..  .. ...",\r
+".. .  ..  ....",\r
+".   ..........",\r
+" .............",\r
+".............."\r
+};\r
diff --git a/pixmaps/THINKING_14.xpm b/pixmaps/THINKING_14.xpm
new file mode 100644 (file)
index 0000000..4b28f19
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *THINK_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+".....   ......",\r
+"...  ...  ....",\r
+".. ... ... ...",\r
+". .... .... ..",\r
+". .... .... ..",\r
+" ..... ..... .",\r
+" ....     .. .",\r
+" ..... ..... .",\r
+". ......... ..",\r
+". ......... ..",\r
+".. ....... ...",\r
+"...  ...  ....",\r
+".....   ......",\r
+".............."\r
+};\r
diff --git a/pixmaps/UNKNOWN_14.xpm b/pixmaps/UNKNOWN_14.xpm
new file mode 100644 (file)
index 0000000..9f4c241
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *UNKNOWN_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+".....****.....",\r
+"...**    **...",\r
+"..*  . .   *..",\r
+".* . . . .  *.",\r
+".*  . . . . *.",\r
+"*  . . . . . *",\r
+"* . . . . .  *",\r
+"*  . . . . . *",\r
+"* . . . . .  *",\r
+".* . . . .  *.",\r
+".*  . . . . *.",\r
+"..*  . .   *..",\r
+"...**    **...",\r
+".....****....."\r
+};\r
diff --git a/pixmaps/WHITE_14.xpm b/pixmaps/WHITE_14.xpm
new file mode 100644 (file)
index 0000000..3f13936
--- /dev/null
@@ -0,0 +1,23 @@
+/* XPM */\r
+static char *WHITE_14[] = {\r
+/* columns rows colors chars-per-pixel */\r
+"14 14 3 1",\r
+"  c white",\r
+"* c black",\r
+". c None",\r
+/* pixels */\r
+".....****.....",\r
+"...**    **...",\r
+"..*  ....  *..",\r
+".* ........ *.",\r
+".* ........ *.",\r
+"* .......... *",\r
+"* .......... *",\r
+"* .......... *",\r
+"* .......... *",\r
+".* ........ *.",\r
+".* ........ *.",\r
+"..*  ....  *..",\r
+"...**    **...",\r
+".....****....."\r
+};\r
index 26cd928..e6ef3a0 100644 (file)
@@ -26,12 +26,12 @@ static char *kdd49[] = {
 ".......  XXXXXX   .. X     X ..   XXXXXX  .......",
 "...... XX      XX    X     X    XX      XX ......",
 "..... X          XX   X   X   XX          X .....",
-".... .             X  X   X  X             . ....",
-"......              X  X X  X              ......",
-"... .                X X X X                . ...",
-"... .                X  X  X                . ...",
-"... .                 X X X                 . ...",
-"... .                 X   X                 . ...",
+".... X             X  X   X  X             X ....",
+".....X              X  X X  X              X.....",
+"... X                X X X X                X ...",
+"... X                X  X  X                X ...",
+"... X                 X X X                 X ...",
+"... X                 X   X                 X ...",
 "...  X                XX XX                X  ...",
 ".... X                 X X                 X ....",
 "....  X                X X                X  ....",
index d49b1fb..cb10fd1 100644 (file)
@@ -26,12 +26,12 @@ static char *kdl49[] = {
 ".......  XXXXXX   .. X     X ..   XXXXXX  .......",
 "...... XX      XX    X     X    XX      XX ......",
 "..... X          XX   X   X   XX          X .....",
-".... .             X  X   X  X             . ....",
-"......              X  X X  X              ......",
-"... .                X X X X                . ...",
-"... .                X  X  X                . ...",
-"... .                 X X X                 . ...",
-"... .                 X   X                 . ...",
+".... X             X  X   X  X             X ....",
+".....X              X  X X  X              X.....",
+"... X                X X X X                X ...",
+"... X                X  X  X                X ...",
+"... X                 X X X                 X ...",
+"... X                 X   X                 X ...",
 "...  X                XX XX                X  ...",
 ".... X                 X X                 X ....",
 "....  X                X X                X  ....",
index 0faaa1b..8ccecf3 100644 (file)
@@ -1,40 +1,41 @@
 /* XPM */\r
 static char *mdd33[] = {\r
 /* columns rows colors chars-per-pixel */\r
-"33 33 2 1",\r
-"  c black s dark_piece",\r
+"33 33 3 1",\r
+"  c white s light_piece",\r
 ". c green s dark_square",\r
+"X c black s dark_piece",\r
 /* pixels */\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-"........................        .",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
+"................X................",\r
+"...............XXX...............",\r
+"..............XXXXX..............",\r
+"..............XXXXX..............",\r
+"...............XXX...............",\r
+"...............   ...............",\r
+"...........XXXXXXXXXXX...........",\r
+"........XXXXXXXXXXXXXXXXX........",\r
+".......XXXXXXXXXXXXXXXXXXX.......",\r
+"......XXXXXXXXXXXXXXXXXXXXX......",\r
+"......XXXXXXXXXXXXXXXXXXXXX......",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+"....XXXXXXXXXXXXXXXXXXXXXXXXX....",\r
+"....XXXXXXXXXXXXXXXXXXXXXXXXX....",\r
+"....XXXXXX             XXXXXX....",\r
+"...XX     XXXXXXXXXXXXX     XX...",\r
+"...X XXXXXXXXXXXXXXXXXXXXXXX X...",\r
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..",\r
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..",\r
+"...XXXXXXXXXXXXXXXXXXXXXXXXXXX...",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+"..........XXXXXXXXXXXXX..........",\r
 ".................................",\r
 ".................................",\r
 "................................."\r
index 9b4f157..cda976f 100644 (file)
@@ -1,40 +1,41 @@
 /* XPM */\r
 static char *mdl33[] = {\r
 /* columns rows colors chars-per-pixel */\r
-"33 33 2 1",\r
-"  c black s dark_piece",\r
+"33 33 3 1",\r
+"  c white s light_piece",\r
 ". c gray s light_square",\r
+"X c black s dark_piece",\r
 /* pixels */\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
 ".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-"........................        .",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
-".................................",\r
+"................X................",\r
+"...............XXX...............",\r
+"..............XXXXX..............",\r
+"..............XXXXX..............",\r
+"...............XXX...............",\r
+"...............   ...............",\r
+"...........XXXXXXXXXXX...........",\r
+"........XXXXXXXXXXXXXXXXX........",\r
+".......XXXXXXXXXXXXXXXXXXX.......",\r
+"......XXXXXXXXXXXXXXXXXXXXX......",\r
+"......XXXXXXXXXXXXXXXXXXXXX......",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+"....XXXXXXXXXXXXXXXXXXXXXXXXX....",\r
+"....XXXXXXXXXXXXXXXXXXXXXXXXX....",\r
+"....XXXXXX             XXXXXX....",\r
+"...XX     XXXXXXXXXXXXX     XX...",\r
+"...X XXXXXXXXXXXXXXXXXXXXXXX X...",\r
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..",\r
+"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXX..",\r
+"...XXXXXXXXXXXXXXXXXXXXXXXXXXX...",\r
+".....XXXXXXXXXXXXXXXXXXXXXXX.....",\r
+"..........XXXXXXXXXXXXX..........",\r
 ".................................",\r
 ".................................",\r
 "................................."\r
index 0d6ea07..741b260 100644 (file)
@@ -829,10 +829,10 @@ XpmPieces builtInXpms[] = {\
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
-    { kll129, kld129, kdl129, kdd129, },\\r
-    { kll129, kld129, kdl129, kdd129, },\\r
-    { kll129, kld129, kdl129, kdd129, },\\r
-    { kll129, kld129, kdl129, kdd129, },\\r
+    { nll129, nld129, ndl129, ndd129, },\\r
+    { bll129, bld129, bdl129, bdd129, },\\r
+    { rll129, rld129, rdl129, rdd129, },\\r
+    { qll129, qld129, qdl129, qdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
     { kll129, kld129, kdl129, kdd129, },\\r
@@ -853,10 +853,10 @@ XpmPieces builtInXpms[] = {\
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
-    { kll116, kld116, kdl116, kdd116, },\\r
-    { kll116, kld116, kdl116, kdd116, },\\r
-    { kll116, kld116, kdl116, kdd116, },\\r
-    { kll116, kld116, kdl116, kdd116, },\\r
+    { nll116, nld116, ndl116, ndd116, },\\r
+    { bll116, bld116, bdl116, bdd116, },\\r
+    { rll116, rld116, rdl116, rdd116, },\\r
+    { qll116, qld116, qdl116, qdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
     { kll116, kld116, kdl116, kdd116, },\\r
@@ -877,10 +877,10 @@ XpmPieces builtInXpms[] = {\
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
-    { kll108, kld108, kdl108, kdd108, },\\r
-    { kll108, kld108, kdl108, kdd108, },\\r
-    { kll108, kld108, kdl108, kdd108, },\\r
-    { kll108, kld108, kdl108, kdd108, },\\r
+    { nll108, nld108, ndl108, ndd108, },\\r
+    { bll108, bld108, bdl108, bdd108, },\\r
+    { rll108, rld108, rdl108, rdd108, },\\r
+    { qll108, qld108, qdl108, qdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
     { kll108, kld108, kdl108, kdd108, },\\r
@@ -901,10 +901,10 @@ XpmPieces builtInXpms[] = {\
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
-    { kll95, kld95, kdl95, kdd95, },\\r
-    { kll95, kld95, kdl95, kdd95, },\\r
-    { kll95, kld95, kdl95, kdd95, },\\r
-    { kll95, kld95, kdl95, kdd95, },\\r
+    { nll95, nld95, ndl95, ndd95, },\\r
+    { bll95, bld95, bdl95, bdd95, },\\r
+    { rll95, rld95, rdl95, rdd95, },\\r
+    { qll95, qld95, qdl95, qdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
     { kll95, kld95, kdl95, kdd95, },\\r
@@ -925,10 +925,10 @@ XpmPieces builtInXpms[] = {\
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
-    { kll87, kld87, kdl87, kdd87, },\\r
-    { kll87, kld87, kdl87, kdd87, },\\r
-    { kll87, kld87, kdl87, kdd87, },\\r
-    { kll87, kld87, kdl87, kdd87, },\\r
+    { nll87, nld87, ndl87, ndd87, },\\r
+    { bll87, bld87, bdl87, bdd87, },\\r
+    { rll87, rld87, rdl87, rdd87, },\\r
+    { qll87, qld87, qdl87, qdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
     { kll87, kld87, kdl87, kdd87, },\\r
@@ -949,10 +949,10 @@ XpmPieces builtInXpms[] = {\
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
-    { kll80, kld80, kdl80, kdd80, },\\r
-    { kll80, kld80, kdl80, kdd80, },\\r
-    { kll80, kld80, kdl80, kdd80, },\\r
-    { kll80, kld80, kdl80, kdd80, },\\r
+    { nll80, nld80, ndl80, ndd80, },\\r
+    { bll80, bld80, bdl80, bdd80, },\\r
+    { rll80, rld80, rdl80, rdd80, },\\r
+    { qll80, qld80, qdl80, qdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
     { kll80, kld80, kdl80, kdd80, },\\r
@@ -997,10 +997,10 @@ XpmPieces builtInXpms[] = {\
     { lll64, lld64, ldl64, ldd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
-    { lll64, lld64, ldl64, ldd64, },\\r
-    { lll64, lld64, ldl64, ldd64, },\\r
-    { lll64, lld64, ldl64, ldd64, },\\r
-    { lll64, lld64, ldl64, ldd64, },\\r
+    { nll64, nld64, ndl64, ndd64, },\\r
+    { bll64, bld64, bdl64, bdd64, },\\r
+    { rll64, rld64, rdl64, rdd64, },\\r
+    { qll64, qld64, qdl64, qdd64, },\\r
     { cvll64, cvld64, cvdl64, cvdd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
     { lll64, lld64, ldl64, ldd64, },\\r
@@ -1021,10 +1021,10 @@ XpmPieces builtInXpms[] = {\
     { lll58, lld58, ldl58, ldd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
-    { lll58, lld58, ldl58, ldd58, },\\r
-    { lll58, lld58, ldl58, ldd58, },\\r
-    { lll58, lld58, ldl58, ldd58, },\\r
-    { lll58, lld58, ldl58, ldd58, },\\r
+    { nll58, nld58, ndl58, ndd58, },\\r
+    { bll58, bld58, bdl58, bdd58, },\\r
+    { rll58, rld58, rdl58, rdd58, },\\r
+    { qll58, qld58, qdl58, qdd58, },\\r
     { cvll58, cvld58, cvdl58, cvdd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
     { lll58, lld58, ldl58, ldd58, },\\r
@@ -1045,10 +1045,10 @@ XpmPieces builtInXpms[] = {\
     { lll54, lld54, ldl54, ldd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
-    { lll54, lld54, ldl54, ldd54, },\\r
-    { lll54, lld54, ldl54, ldd54, },\\r
-    { lll54, lld54, ldl54, ldd54, },\\r
-    { lll54, lld54, ldl54, ldd54, },\\r
+    { nll54, nld54, ndl54, ndd54, },\\r
+    { bll54, bld54, bdl54, bdd54, },\\r
+    { rll54, rld54, rdl54, rdd54, },\\r
+    { qll54, qld54, qdl54, qdd54, },\\r
     { cvll54, cvld54, cvdl54, cvdd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
     { lll54, lld54, ldl54, ldd54, },\\r
@@ -1093,10 +1093,10 @@ XpmPieces builtInXpms[] = {\
     { lll45, lld45, ldl45, ldd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
-    { lll45, lld45, ldl45, ldd45, },\\r
-    { lll45, lld45, ldl45, ldd45, },\\r
-    { lll45, lld45, ldl45, ldd45, },\\r
-    { lll45, lld45, ldl45, ldd45, },\\r
+    { nll45, nld45, ndl45, ndd45, },\\r
+    { bll45, bld45, bdl45, bdd45, },\\r
+    { rll45, rld45, rdl45, rdd45, },\\r
+    { qll45, qld45, qdl45, qdd45, },\\r
     { cvll45, cvld45, cvdl45, cvdd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
     { lll45, lld45, ldl45, ldd45, },\\r
@@ -1117,10 +1117,10 @@ XpmPieces builtInXpms[] = {\
     { lll40, lld40, ldl40, ldd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
-    { lll40, lld40, ldl40, ldd40, },\\r
-    { lll40, lld40, ldl40, ldd40, },\\r
-    { lll40, lld40, ldl40, ldd40, },\\r
-    { lll40, lld40, ldl40, ldd40, },\\r
+    { nll40, nld40, ndl40, ndd40, },\\r
+    { bll40, bld40, bdl40, bdd40, },\\r
+    { rll40, rld40, rdl40, rdd40, },\\r
+    { qll40, qld40, qdl40, qdd40, },\\r
     { cvll40, cvld40, cvdl40, cvdd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
     { lll40, lld40, ldl40, ldd40, },\\r
@@ -1141,10 +1141,10 @@ XpmPieces builtInXpms[] = {\
     { lll37, lld37, ldl37, ldd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
-    { lll37, lld37, ldl37, ldd37, },\\r
-    { lll37, lld37, ldl37, ldd37, },\\r
-    { lll37, lld37, ldl37, ldd37, },\\r
-    { lll37, lld37, ldl37, ldd37, },\\r
+    { nll37, nld37, ndl37, ndd37, },\\r
+    { bll37, bld37, bdl37, bdd37, },\\r
+    { rll37, rld37, rdl37, rdd37, },\\r
+    { qll37, qld37, qdl37, qdd37, },\\r
     { cvll37, cvld37, cvdl37, cvdd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
     { lll37, lld37, ldl37, ldd37, },\\r
@@ -1189,10 +1189,10 @@ XpmPieces builtInXpms[] = {\
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
-    { kll29, kld29, kdl29, kdd29, },\\r
-    { kll29, kld29, kdl29, kdd29, },\\r
-    { kll29, kld29, kdl29, kdd29, },\\r
-    { kll29, kld29, kdl29, kdd29, },\\r
+    { nll29, nld29, ndl29, ndd29, },\\r
+    { bll29, bld29, bdl29, bdd29, },\\r
+    { rll29, rld29, rdl29, rdd29, },\\r
+    { qll29, qld29, qdl29, qdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
     { kll29, kld29, kdl29, kdd29, },\\r
@@ -1213,10 +1213,10 @@ XpmPieces builtInXpms[] = {\
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
-    { kll25, kld25, kdl25, kdd25, },\\r
-    { kll25, kld25, kdl25, kdd25, },\\r
-    { kll25, kld25, kdl25, kdd25, },\\r
-    { kll25, kld25, kdl25, kdd25, },\\r
+    { nll25, nld25, ndl25, ndd25, },\\r
+    { bll25, bld25, bdl25, bdd25, },\\r
+    { rll25, rld25, rdl25, rdd25, },\\r
+    { qll25, qld25, qdl25, qdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
     { kll25, kld25, kdl25, kdd25, },\\r
@@ -1237,10 +1237,10 @@ XpmPieces builtInXpms[] = {\
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
-    { kll21, kld21, kdl21, kdd21, },\\r
-    { kll21, kld21, kdl21, kdd21, },\\r
-    { kll21, kld21, kdl21, kdd21, },\\r
-    { kll21, kld21, kdl21, kdd21, },\\r
+    { nll21, nld21, ndl21, ndd21, },\\r
+    { bll21, bld21, bdl21, bdd21, },\\r
+    { rll21, rld21, rdl21, rdd21, },\\r
+    { qll21, qld21, qdl21, qdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
     { kll21, kld21, kdl21, kdd21, },\\r
diff --git a/pxboard b/pxboard
old mode 100755 (executable)
new mode 100644 (file)
old mode 100755 (executable)
new mode 100644 (file)
diff --git a/uci.c b/uci.c
index ff0e336..e63fb02 100644 (file)
--- a/uci.c
+++ b/uci.c
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  * ------------------------------------------------------------------------
  */
-#include "config.h"
-
-#include <windows.h> /* required for all Windows applications */
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <malloc.h>
 
+#ifdef WIN32
+// [HGM] this was probably a Windows-specific constant. Needs to be defined here now I
+//       threw out the Windows-specific includes (winboard.h etc.). 100 seems enough.
+#include <windows.h>
+#define SLASH_CHAR "\\"
+#else
+#define MAX_PATH 100
+#define SLASH_CHAR "/"
+#endif
+
 #include "common.h"
-#include "winboard.h"
-#include "frontend.h"
 #include "backend.h"
 
 #define INIFILE_PREFIX      "polyglot_"
@@ -37,6 +41,7 @@
 #define INIFILE_SUFFIX_2ND  "2nd"
 #define INIFILE_EXT         ".ini"
 
+
 static const char * GetIniFilename( ChessProgramState * cps )
 {
     return cps == &first ? INIFILE_PREFIX INIFILE_SUFFIX_1ST INIFILE_EXT : INIFILE_PREFIX INIFILE_SUFFIX_2ND INIFILE_EXT;
@@ -52,16 +57,21 @@ void InitEngineUCI( const char * iniDir, ChessProgramState * cps )
         /* Build name of initialization file */
         if( strchr( iniDir, ' ' ) != NULL ) {
             char iniDirShort[ MAX_PATH ];
-
+#ifdef WIN32
             GetShortPathName( iniDir, iniDirShort, sizeof(iniDirShort) );
 
             strcpy( polyglotIniFile, iniDirShort );
+#else
+           // [HGM] UCI: not sure if this works, but GetShortPathName seems Windows pecific
+           // and names with spaces in it do not work in xboard in many places, so ignore
+            strcpy( polyglotIniFile, iniDir );
+#endif
         }
         else {
             strcpy( polyglotIniFile, iniDir );
         }
         
-        strcat( polyglotIniFile, "\\" );
+        strcat( polyglotIniFile, SLASH_CHAR );
         strcat( polyglotIniFile, iniFileName );
 
         /* Create initialization file */
index 9a99266..bc657f5 100644 (file)
@@ -1,13 +1,5 @@
 /* config.h.in.  Generated automatically from configure.in by autoheader.  */\r
 \r
-/* [HGM] Defining ADJUDICATE switches on rep-draw and insuf-material draws */\r
-#define ADJUDICATE\r
-\r
-/* [HGM] Defining FAIRY allows different K- & Q-side piece symbols */\r
-#define FAIRY\r
-\r
-#define GOTHIC "Gothic Chess (see www.GothicChess.com) is licensed under U.S. Patent #6,481,716 by Ed Trice"\r
-#define FALCON "Falcon Chess (see www.chessvariants.com) is licensed under U.S. Patent #5,690,334 by George W. Duke"\r
 \r
 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */\r
 /*#undef HAVE_SYS_WAIT_H*/\r
@@ -36,9 +28,7 @@
 #define HAVE_GETTIMEOFDAY 0\r
 \r
 /* Use our own random() defined in winboard.c. */\r
-#define HAVE_RANDOM 1\r
-#define random myrandom\r
-#define srandom mysrandom\r
+#define HAVE_RANDOM 0\r
 \r
 #define HAVE_SYS_SOCKET_H 0\r
 \r
@@ -46,7 +36,7 @@
 \r
 #define LAST_PTY_LETTER 'q'\r
 \r
-#define PATCHLEVEL "14k"\r
+#define PATCHLEVEL "15m"\r
 \r
 #define PRODUCT "WinBoard"\r
 \r
index c83f0a7..cb4781e 100644 (file)
@@ -1,91 +1,97 @@
-#
-# Makefile for WinBoard, using the GNU Cygwin toolset
-#
-
-# Uncomment both lines to turn on debugging symbols #######
-cdebug= -g
-linkdebug= -g
-#######################################################
-
-proj=winboard
-allobj=  winboard.o backend.o parser.o moves.o lists.o \
-        gamelist.o pgntags.o wedittags.o wgamelist.o zippy.o \
-         wsockerr.o wbres.o wclipbrd.o woptions.o
-
-dotc=   winboard.c backend.c parser.c moves.c lists.c \
-        gamelist.c pgntags.c wedittags.c wgamelist.c zippy.c \
-         wsockerr.c winboard.rc wclipbrd.c woptions.c
-
-# Currently WinBoard will build either with or without -mno-cygwin
-# however, a Cygwin bug in forming the command line to WinMain() is
-# exposed if -mno-cygwin is not used.
-cygwin= -mno-cygwin
-
-VPATH= .:..
-CFLAGS= $(cdebug)
-INCLUDES= -I. -I..
-CVARS= $(INCLUDES) $(cygwin)
-CC = gcc $(CVARS)
-WCC = $(CC) -mwindows $(linkdebug)
-HC="/c/program files/help workshop/hcrtf.exe" -xn
-
-all: $(proj).exe
-
-depend: $(dotc)
-       makedepend -Y -f cygwin.mak $(INCLUDES) $^
-
-clean:
-       rm -f *.obj *~ $(proj).exe $(proj).err $(proj).rbj \
-               $(proj).RES $(proj).res $(proj).ini *.sbr *.bsc *.o \
-               *.plg *.opt *.ncb *.debug *.bak *.gid *.GID
-
-maintainer-clean: clean
-       rm -f parser.c *.hlp *.HLP
-
-# Update the help file if necessary
-$(proj).hlp : $(proj).rtf
-       $(HC) $(proj).hpj
-       cat $(proj).err
-
-# Update the resource if necessary
-wbres.o: $(proj).rc $(proj).h resource.h
-       windres --use-temp-file --include-dir .. $< -O coff -o $@
-
-# Update the object files if necessary
-
-parser.c: parser.l
-       flex -oparser.c -L $<
-
-$(proj).exe: $(allobj) $(proj).hlp $(proj).rc
-       $(WCC) $(guiflags) $(allobj) \
-       -lwsock32 -lwinmm \
-       -o $(proj).exe
-
-# DO NOT DELETE
-
-winboard.o: config.h ../common.h winboard.h resource.h ../frontend.h
-winboard.o: ../backend.h ../lists.h ../moves.h wclipbrd.h wgamelist.h
-winboard.o: wedittags.h woptions.h wsockerr.h defaults.h
-backend.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h
-backend.o: ../parser.h ../moves.h ../zippy.h ../backendz.h
-parser.o: config.h ../common.h ../backend.h ../lists.h ../frontend.h
-parser.o: ../parser.h ../moves.h
-moves.o: config.h ../common.h ../backend.h ../lists.h ../frontend.h
-moves.o: ../moves.h ../parser.h
-lists.o: config.h ../common.h ../lists.h
-gamelist.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h
-gamelist.o: ../parser.h
-pgntags.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h
-pgntags.o: ../parser.h
-wedittags.o: config.h ../common.h winboard.h resource.h ../frontend.h
-wedittags.o: ../backend.h ../lists.h
-wgamelist.o: config.h ../common.h winboard.h resource.h ../frontend.h
-wgamelist.o: ../backend.h ../lists.h
-zippy.o: config.h ../common.h ../zippy.h ../frontend.h ../backend.h
-zippy.o: ../lists.h ../backendz.h
-wsockerr.o: wsockerr.h
-winboard.o: resource.h
-wclipbrd.o: config.h ../common.h winboard.h resource.h ../frontend.h
-wclipbrd.o: ../backend.h ../lists.h wclipbrd.h
-woptions.o: config.h ../common.h winboard.h resource.h ../backend.h
-woptions.o: ../lists.h ../frontend.h woptions.h defaults.h wedittags.h
+#\r
+# Makefile for WinBoard, using the GNU Cygwin toolset\r
+#\r
+\r
+# Uncomment both lines to turn on debugging symbols #######\r
+cdebug= -g\r
+linkdebug= -g\r
+#######################################################\r
+\r
+proj=winboard\r
+allobj=  winboard.o backend.o parser.o moves.o lists.o \\r
+        gamelist.o pgntags.o wedittags.o wgamelist.o zippy.o \\r
+        wsockerr.o wbres.o wclipbrd.o woptions.o uci.o \\r
+        wengineo.o wevalgraph.o whistory.o wlayout.o \\r
+        wplugin.o wsnap.o book.o\r
+\r
+dotc=   winboard.c backend.c parser.c moves.c lists.c \\r
+       gamelist.c pgntags.c wedittags.c wgamelist.c zippy.c \\r
+       wsockerr.c winboard.rc wclipbrd.c woptions.c uci.c \\r
+       wengineo.c wevalgraph.c whistory.c wlayout.c \\r
+       wplugin.c wsnap.c book.c\r
+\r
+# Currently WinBoard will build either with or without -mno-cygwin\r
+# however, a Cygwin bug in forming the command line to WinMain() is\r
+# exposed if -mno-cygwin is not used.\r
+cygwin= -mno-cygwin\r
+\r
+VPATH= .:..\r
+CFLAGS= $(cdebug)\r
+INCLUDES= -I. -I..\r
+CVARS= $(INCLUDES) $(cygwin)\r
+CC = gcc $(CVARS)\r
+WCC = $(CC) -mwindows $(linkdebug)\r
+HC="/c/program files/help workshop/hcrtf.exe" -xn\r
+\r
+all: $(proj).exe\r
+\r
+depend: $(dotc)\r
+       makedepend -Y -f cygwin.mak $(INCLUDES) $^\r
+\r
+clean:\r
+       rm -f *.obj *~ $(proj).exe $(proj).err $(proj).rbj \\r
+               $(proj).RES $(proj).res $(proj).ini *.sbr *.bsc *.o \\r
+               *.plg *.opt *.ncb *.debug *.bak *.gid *.GID\r
+\r
+maintainer-clean: clean\r
+       rm -f parser.c *.hlp *.HLP\r
+\r
+# Update the help file if necessary\r
+#$(proj).hlp : $(proj).rtf\r
+#      $(HC) $(proj).hpj\r
+#      cat $(proj).err\r
+\r
+# Update the resource if necessary\r
+wbres.o: $(proj).rc $(proj).h resource.h\r
+       windres --use-temp-file --include-dir .. $< -O coff -o $@\r
+\r
+# Update the object files if necessary\r
+\r
+parser.c: parser.l\r
+       flex -oparser.c -L $<\r
+\r
+#$(proj).exe: $(allobj) $(proj).hlp $(proj).rc\r
+$(proj).exe: $(allobj) $(proj).rc\r
+       $(WCC) $(guiflags) $(allobj) \\r
+       -lwsock32 -lwinmm \\r
+       -o $(proj).exe\r
+\r
+# DO NOT DELETE\r
+\r
+winboard.o: config.h ../common.h winboard.h resource.h ../frontend.h\r
+winboard.o: ../backend.h ../lists.h ../moves.h wclipbrd.h wgamelist.h\r
+winboard.o: wedittags.h woptions.h wsockerr.h defaults.h\r
+backend.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h\r
+backend.o: ../parser.h ../moves.h ../zippy.h ../backendz.h\r
+parser.o: config.h ../common.h ../backend.h ../lists.h ../frontend.h\r
+parser.o: ../parser.h ../moves.h\r
+moves.o: config.h ../common.h ../backend.h ../lists.h ../frontend.h\r
+moves.o: ../moves.h ../parser.h\r
+lists.o: config.h ../common.h ../lists.h\r
+gamelist.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h\r
+gamelist.o: ../parser.h\r
+pgntags.o: config.h ../common.h ../frontend.h ../backend.h ../lists.h\r
+pgntags.o: ../parser.h\r
+wedittags.o: config.h ../common.h winboard.h resource.h ../frontend.h\r
+wedittags.o: ../backend.h ../lists.h\r
+wgamelist.o: config.h ../common.h winboard.h resource.h ../frontend.h\r
+wgamelist.o: ../backend.h ../lists.h\r
+zippy.o: config.h ../common.h ../zippy.h ../frontend.h ../backend.h\r
+zippy.o: ../lists.h ../backendz.h\r
+wsockerr.o: wsockerr.h\r
+winboard.o: resource.h\r
+wclipbrd.o: config.h ../common.h winboard.h resource.h ../frontend.h\r
+wclipbrd.o: ../backend.h ../lists.h wclipbrd.h\r
+woptions.o: config.h ../common.h winboard.h resource.h ../backend.h\r
+woptions.o: ../lists.h ../frontend.h woptions.h defaults.h wedittags.h\r
+book.o: ../common.h ../backend.h
\ No newline at end of file
index b22e6b4..8ebc2ca 100644 (file)
@@ -1,3 +1,34 @@
+                             WinBoard 4.3.15m RELEASE NOTES\r
+\r
+Compared to version 4.3.14k described below, this version features\r
+\r
+New command-line options\r
+/rewindIndex=N (for the new auto-increment mode of the loadGameIndex or loadPositionIndex in match mode\r
+/sameColorGames=N (for playing a match where the same player has white all the time)\r
+/egtFormats="..." (for specifying where various end-game tables are installed on the computer)\r
+\r
+New menu items\r
++ Time-odds factors can be set in the time-control dialog\r
++ Nr of CPUs for SMP engines can be set in the Options -> UCI dialog\r
++ Own-Book options can be switched from the Options -> UCI dialog\r
++ The ScoreIsAbs options can be set from the Options -> Engine dialog\r
++ New-Variant menu adds Superchess\r
+\r
+General Enhancements:\r
+* WinBoard engines can now also use the Polyglot opening book (implemented as general GUI book)\r
+* New WB-protocol commands memory, cores and egtpath make interactive setting of these parameters \r
+  possible on WB engines\r
+* New Polyglot is available that relays the interactive setting of these parameters to UCI engines\r
+* Match mode suports an auto-increment mode, so that all games or positions from a file can be played\r
+* Draw claims with Kings and an arbitrary number of like Bishops (e.g. KBBKB) are accepted\r
+\r
+The source tree in original XBoard 4.2.7 format can now be compiled under Cygwin with the aid\r
+of the cygwin.mak file in the ~/winboard/ subdirectory of the source release. Makefiles for \r
+other compilers are not updated since 4.2.7, as I do not have those compilers.\r
+\r
+Note that this release is a bug-fix for the 4.3.15k release, which had a bug in human-ICS play mode.\r
+\r
+\r
                              WinBoard 4.3.14k RELEASE NOTES\r
 \r
 Compared to version 4.3.13 described below, this version features\r
@@ -21,7 +52,7 @@ Bugfixes:
 * In ICS observing mode game history is now fully accessible \r
 * Moves are not fed to engine in zippy mode, when observing a game from a variant unknown to the engine \r
 * a problem with loading PGN of FRC games with move disambiguation and initial castling rights was fixed.\r
-* A bug in the clock display that mad previous versions of WinBoard crash for tiny displays is fixed\r
+* A bug in the clock display that made previous versions of WinBoard crash for tiny displays is fixed\r
 \r
 General enhancements: \r
 * variant name displayed in title bar in ICS mode, when not 'normal' \r
index 86e7169..aa5dc8b 100644 (file)
@@ -85,6 +85,8 @@
 #define OPT_TCInc                       407\r
 #define OPT_TCitext3                    408\r
 #define OPT_TCTime2                     409\r
+#define OPT_TCOdds1                     410\r
+#define OPT_TCOdds2                     411\r
 #define DLG_PremoveOptions              450\r
 #define DLG_GeneralOptions              453\r
 #define DLG_IcsOptions                  454\r
 #define PB_Archbishop                   507\r
 #define IDC_Yes                         520\r
 #define IDC_No                          521\r
+#define IDC_Centaur                     522\r
 #define EP_White                        600\r
 #define EP_WhitePawn                    601\r
 #define EP_WhiteKnight                  602\r
 #define IDC_StateIcon2                  1464\r
 #define IDC_PathToEGTB                  1466\r
 #define IDC_SizeOfEGTB                  1467\r
-#define IDC_UseBook                     1469\r
-#define IDC_BookFile                    1470\r
+#define IDC_BookFile                    1469\r
+#define IDC_UseBook                     1470\r
+#define IDC_OwnBook1                    1471\r
+#define IDC_OwnBook2                    1472\r
+#define IDC_Cores                       1473\r
 #define DLG_NewVariant                  1500\r
 #define OPT_VariantGothic               1501\r
 #define OPT_VariantCrazyhouse           1502\r
 #define OPT_VariantFalcon               1518\r
 #define OPT_VariantCRC                  1519\r
 #define OPT_VariantBerolina             1520\r
-#define OPT_Variant3Checks              1521\r
+#define OPT_VariantSuper                1521\r
 #define OPT_VariantJanus                1522\r
 #define OPT_VariantWildcastle           1523\r
 #define OPT_VariantNocastle             1524\r
 #define IDC_TrivialDraws                1603\r
 #define IDC_RuleMoves                   1604\r
 #define IDC_DrawRepeats                 1605\r
+#define IDC_ScoreAbs1                   1606\r
+#define IDC_ScoreAbs2                   1607\r
 #define IDM_FlipClock                   1700\r
 #define OPT_AllWhite                    1701\r
 #define OPT_UpsideDown                  1702\r
diff --git a/winboard/shogibitmaps/bamazon.bmp b/winboard/shogibitmaps/bamazon.bmp
new file mode 100644 (file)
index 0000000..e9ed472
Binary files /dev/null and b/winboard/shogibitmaps/bamazon.bmp differ
diff --git a/winboard/shogibitmaps/king.bmp b/winboard/shogibitmaps/king.bmp
new file mode 100644 (file)
index 0000000..c80a2b3
Binary files /dev/null and b/winboard/shogibitmaps/king.bmp differ
diff --git a/winboard/shogibitmaps/largeking.bmp b/winboard/shogibitmaps/largeking.bmp
new file mode 100644 (file)
index 0000000..20c4c0c
Binary files /dev/null and b/winboard/shogibitmaps/largeking.bmp differ
diff --git a/winboard/wengineo.c b/winboard/wengineo.c
new file mode 100644 (file)
index 0000000..0623e3d
--- /dev/null
@@ -0,0 +1,751 @@
+/*\r
+ * Engine output (PV)\r
+ *\r
+ * Author: Alessandro Scotti (Dec 2005)\r
+ *\r
+ * ------------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ * ------------------------------------------------------------------------\r
+ */\r
+#include "config.h"\r
+\r
+#include <windows.h> /* required for all Windows applications */\r
+#include <richedit.h>\r
+#include <stdio.h>\r
+#include <stdlib.h>\r
+#include <malloc.h>\r
+#include <commdlg.h>\r
+#include <dlgs.h>\r
+\r
+#include "common.h"\r
+#include "winboard.h"\r
+#include "frontend.h"\r
+#include "backend.h"\r
+\r
+#include "wsnap.h"\r
+\r
+VOID EngineOutputPopUp();\r
+VOID EngineOutputPopDown();\r
+BOOL EngineOutputIsUp();\r
+\r
+#define SHOW_PONDERING\r
+\r
+/* Imports from backend.c */\r
+char * SavePart(char *str);\r
+\r
+/* Imports from winboard.c */\r
+extern HWND engineOutputDialog;\r
+extern BOOLEAN engineOutputDialogUp;\r
+\r
+extern HINSTANCE hInst;\r
+extern HWND hwndMain;\r
+\r
+extern WindowPlacement wpEngineOutput;\r
+\r
+/* Module variables */\r
+#define H_MARGIN            2\r
+#define V_MARGIN            2\r
+#define LABEL_V_DISTANCE    1   /* Distance between label and memo */\r
+#define SPLITTER_SIZE       4   /* Distance between first memo and second label */\r
+\r
+#define ICON_SIZE           14\r
+\r
+#define STATE_UNKNOWN   -1\r
+#define STATE_THINKING   0\r
+#define STATE_IDLE       1\r
+#define STATE_PONDERING  2\r
+#define STATE_ANALYZING  3\r
+\r
+static int  windowMode = 1;\r
+\r
+static BOOL needInit = TRUE;\r
+\r
+static HICON hiColorBlack = NULL;\r
+static HICON hiColorWhite = NULL;\r
+static HICON hiColorUnknown = NULL;\r
+static HICON hiClear = NULL;\r
+static HICON hiPondering = NULL;\r
+static HICON hiThinking = NULL;\r
+static HICON hiAnalyzing = NULL;\r
+\r
+static int  lastDepth[2] = { -1, -1 };\r
+static int  lastForwardMostMove[2] = { -1, -1 };\r
+static int  engineState[2] = { -1, -1 };\r
+\r
+typedef struct {\r
+    HWND hColorIcon;\r
+    HWND hLabel;\r
+    HWND hStateIcon;\r
+    HWND hStateData;\r
+    HWND hLabelNPS;\r
+    HWND hMemo;\r
+    char * name;\r
+    int which;\r
+    int depth;\r
+    unsigned long nodes;\r
+    int score;\r
+    int time;\r
+    char * pv;\r
+    char * hint;\r
+    int an_move_index;\r
+    int an_move_count;\r
+} EngineOutputData;\r
+\r
+static HICON LoadIconEx( int id )\r
+{\r
+    return LoadImage( hInst, MAKEINTRESOURCE(id), IMAGE_ICON, ICON_SIZE, ICON_SIZE, 0 );\r
+}\r
+\r
+static VOID InitializeEngineOutput()\r
+{\r
+    if( needInit ) {\r
+        hiColorBlack = LoadIconEx( IDI_BLACK_14 );\r
+        hiColorWhite = LoadIconEx( IDI_WHITE_14 );\r
+        hiColorUnknown = LoadIconEx( IDI_UNKNOWN_14 );\r
+        hiClear = LoadIconEx( IDI_TRANS_14 );\r
+        hiPondering = LoadIconEx( IDI_PONDER_14 );\r
+        hiThinking = LoadIconEx( IDI_CLOCK_14 );\r
+        hiAnalyzing = LoadIconEx( IDI_ANALYZE2_14 );\r
+        needInit = FALSE;\r
+    }\r
+}\r
+\r
+static VOID SetControlPos( HWND hDlg, int id, int x, int y, int width, int height )\r
+{\r
+    HWND hControl = GetDlgItem( hDlg, id );\r
+\r
+    SetWindowPos( hControl, HWND_TOP, x, y, width, height, SWP_NOZORDER );\r
+}\r
+\r
+#define HIDDEN_X    20000\r
+#define HIDDEN_Y    20000\r
+\r
+static VOID HideControl( HWND hDlg, int id )\r
+{\r
+    HWND hControl = GetDlgItem( hDlg, id );\r
+    RECT rc;\r
+\r
+    GetWindowRect( hControl, &rc );\r
+\r
+    /* \r
+        Avoid hiding an already hidden control, because that causes many\r
+        unnecessary WM_ERASEBKGND messages!\r
+    */\r
+    if( rc.left != HIDDEN_X || rc.top != HIDDEN_Y ) {\r
+        SetControlPos( hDlg, id, 20000, 20000, 100, 100 );\r
+    }\r
+}\r
+\r
+static int GetControlWidth( HWND hDlg, int id )\r
+{\r
+    RECT rc;\r
+\r
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );\r
+\r
+    return rc.right - rc.left;\r
+}\r
+\r
+static int GetControlHeight( HWND hDlg, int id )\r
+{\r
+    RECT rc;\r
+\r
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );\r
+\r
+    return rc.bottom - rc.top;\r
+}\r
+\r
+static int GetHeaderHeight()\r
+{\r
+    int result = GetControlHeight( engineOutputDialog, IDC_EngineLabel1 );\r
+\r
+    if( result < ICON_SIZE ) result = ICON_SIZE;\r
+\r
+    return result;\r
+}\r
+\r
+#define ENGINE_COLOR_WHITE      'w'\r
+#define ENGINE_COLOR_BLACK      'b'\r
+#define ENGINE_COLOR_UNKNOWN    ' '\r
+\r
+char GetEngineColor( int which )\r
+{\r
+    char result = ENGINE_COLOR_UNKNOWN;\r
+\r
+    if( which == 0 || which == 1 ) {\r
+        ChessProgramState * cps;\r
+\r
+        switch (gameMode) {\r
+        case MachinePlaysBlack:\r
+        case IcsPlayingBlack:\r
+            result = ENGINE_COLOR_BLACK;\r
+            break;\r
+        case MachinePlaysWhite:\r
+        case IcsPlayingWhite:\r
+            result = ENGINE_COLOR_WHITE;\r
+            break;\r
+        case AnalyzeMode:\r
+        case AnalyzeFile:\r
+            result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+            break;\r
+        case TwoMachinesPlay:\r
+            cps = (which == 0) ? &first : &second;\r
+            result = cps->twoMachinesColor[0];\r
+            result = result == 'w' ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+            break;\r
+        }\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+char GetActiveEngineColor()\r
+{\r
+    char result = ENGINE_COLOR_UNKNOWN;\r
+\r
+    if( gameMode == TwoMachinesPlay ) {\r
+        result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+static int IsEnginePondering( int which )\r
+{\r
+    int result = FALSE;\r
+\r
+    switch (gameMode) {\r
+    case MachinePlaysBlack:\r
+    case IcsPlayingBlack:\r
+        if( WhiteOnMove(forwardMostMove) ) result = TRUE;\r
+        break;\r
+    case MachinePlaysWhite:\r
+    case IcsPlayingWhite:\r
+        if( ! WhiteOnMove(forwardMostMove) ) result = TRUE;\r
+        break;\r
+    case TwoMachinesPlay:\r
+        if( GetActiveEngineColor() != ENGINE_COLOR_UNKNOWN ) {\r
+            if( GetEngineColor( which ) != GetActiveEngineColor() ) result = TRUE;\r
+        }\r
+        break;\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+static VOID PositionControlSet( HWND hDlg, int x, int y, int clientWidth, int memoHeight, int idColor, int idEngineLabel, int idNPS, int idMemo, int idStateIcon, int idStateData )\r
+{\r
+    int label_x = x + ICON_SIZE + H_MARGIN;\r
+    int label_h = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
+    int label_y = y + ICON_SIZE - label_h;\r
+    int nps_w = GetControlWidth( hDlg, IDC_Engine1_NPS );\r
+    int nps_x = clientWidth - H_MARGIN - nps_w;\r
+    int state_data_w = GetControlWidth( hDlg, IDC_StateData1 );\r
+    int state_data_x = nps_x - H_MARGIN - state_data_w;\r
+    int state_icon_x = state_data_x - ICON_SIZE - 2;\r
+    int max_w = clientWidth - 2*H_MARGIN;\r
+    int memo_y = y + ICON_SIZE + LABEL_V_DISTANCE;\r
+\r
+    SetControlPos( hDlg, idColor, x, y, ICON_SIZE, ICON_SIZE );\r
+    SetControlPos( hDlg, idEngineLabel, label_x, label_y, state_icon_x - label_x, label_h );\r
+    SetControlPos( hDlg, idStateIcon, state_icon_x, y, ICON_SIZE, ICON_SIZE );\r
+    SetControlPos( hDlg, idStateData, state_data_x, label_y, state_data_w, label_h );\r
+    SetControlPos( hDlg, idNPS, nps_x, label_y, nps_w, label_h );\r
+    SetControlPos( hDlg, idMemo, x, memo_y, max_w, memoHeight );\r
+}\r
+\r
+static VOID ResizeWindowControls( HWND hDlg, int mode )\r
+{\r
+    RECT rc;\r
+    int headerHeight = GetHeaderHeight();\r
+    int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
+    int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN;\r
+    int labelDeltaY = ICON_SIZE - labelHeight;\r
+    int clientWidth;\r
+    int clientHeight;\r
+    int maxControlWidth;\r
+    int npsWidth;\r
+\r
+    /* Initialize variables */\r
+    GetClientRect( hDlg, &rc );\r
+\r
+    clientWidth = rc.right - rc.left;\r
+    clientHeight = rc.bottom - rc.top;\r
+\r
+    maxControlWidth = clientWidth - 2*H_MARGIN;\r
+\r
+    npsWidth = GetControlWidth( hDlg, IDC_Engine1_NPS );\r
+\r
+    /* Resize controls */\r
+    if( mode == 0 ) {\r
+        /* One engine */\r
+        PositionControlSet( hDlg, H_MARGIN, V_MARGIN, \r
+            clientWidth, \r
+            clientHeight - V_MARGIN - LABEL_V_DISTANCE - headerHeight- V_MARGIN,\r
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );\r
+\r
+        /* Hide controls for the second engine */\r
+        HideControl( hDlg, IDC_Color2 );\r
+        HideControl( hDlg, IDC_EngineLabel2 );\r
+        HideControl( hDlg, IDC_StateIcon2 );\r
+        HideControl( hDlg, IDC_StateData2 );\r
+        HideControl( hDlg, IDC_Engine2_NPS );\r
+        HideControl( hDlg, IDC_EngineMemo2 );\r
+        SendDlgItemMessage( hDlg, IDC_EngineMemo2, WM_SETTEXT, 0, (LPARAM) "" );\r
+        /* TODO: we should also hide/disable them!!! what about tab stops?!?! */\r
+    }\r
+    else {\r
+        /* Two engines */\r
+        int memo_h = (clientHeight - headerHeight*2 - V_MARGIN*2 - LABEL_V_DISTANCE*2 - SPLITTER_SIZE) / 2;\r
+        int header1_y = V_MARGIN;\r
+        int header2_y = V_MARGIN + headerHeight + LABEL_V_DISTANCE + memo_h + SPLITTER_SIZE;\r
+\r
+        PositionControlSet( hDlg, H_MARGIN, header1_y, clientWidth, memo_h,\r
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );\r
+\r
+        PositionControlSet( hDlg, H_MARGIN, header2_y, clientWidth, memo_h,\r
+            IDC_Color2, IDC_EngineLabel2, IDC_Engine2_NPS, IDC_EngineMemo2, IDC_StateIcon2, IDC_StateData2 );\r
+    }\r
+\r
+    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE );\r
+    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE );\r
+}\r
+\r
+static VOID SetDisplayMode( int mode )\r
+{\r
+    if( windowMode != mode ) {\r
+        windowMode = mode;\r
+\r
+        ResizeWindowControls( engineOutputDialog, mode );\r
+    }\r
+}\r
+\r
+static VOID VerifyDisplayMode()\r
+{\r
+    int mode;\r
+\r
+    /* Get proper mode for current game */\r
+    switch( gameMode ) {\r
+    case AnalyzeMode:\r
+    case AnalyzeFile:\r
+    case MachinePlaysWhite:\r
+    case MachinePlaysBlack:\r
+    case IcsPlayingWhite:\r
+    case IcsPlayingBlack:\r
+        mode = 0;\r
+        break;\r
+    case TwoMachinesPlay:\r
+        mode = 1;\r
+        break;\r
+    default:\r
+        /* Do not change */\r
+        return;\r
+    }\r
+\r
+    SetDisplayMode( mode );\r
+}\r
+\r
+static VOID InsertIntoMemo( HWND hMemo, char * text )\r
+{\r
+    SendMessage( hMemo, EM_SETSEL, 0, 0 );\r
+\r
+    SendMessage( hMemo, EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) text );\r
+}\r
+\r
+static VOID SetIcon( HWND hControl, HICON hIcon )\r
+{\r
+    if( hIcon != NULL ) {\r
+        SendMessage( hControl, STM_SETICON, (WPARAM) hIcon, 0 );\r
+    }\r
+}\r
+\r
+static VOID SetEngineColorIcon( HWND hControl, int which )\r
+{\r
+    char color = GetEngineColor(which);\r
+    HICON hicon = NULL;\r
+\r
+    if( color == ENGINE_COLOR_BLACK )\r
+        hicon = hiColorBlack;\r
+    else if( color == ENGINE_COLOR_WHITE )\r
+        hicon = hiColorWhite;\r
+    else\r
+        hicon = hiColorUnknown;\r
+\r
+    SetIcon( hControl, hicon );\r
+}\r
+\r
+static SetEngineState( int which, int state, char * state_data )\r
+{\r
+    int x_which = 1 - which;\r
+    HWND hStateIcon = GetDlgItem( engineOutputDialog, which == 0 ? IDC_StateIcon1 : IDC_StateIcon2 );\r
+    HWND hStateData = GetDlgItem( engineOutputDialog, which == 0 ? IDC_StateData1 : IDC_StateData2 );\r
+\r
+    if( engineState[ which ] != state ) {\r
+        engineState[ which ] = state;\r
+\r
+        switch( state ) {\r
+        case STATE_THINKING:\r
+            SetIcon( hStateIcon, hiThinking );\r
+            if( engineState[ x_which ] == STATE_THINKING ) {\r
+                SetEngineState( x_which, STATE_IDLE, "" );\r
+            }\r
+            break;\r
+        case STATE_PONDERING:\r
+            SetIcon( hStateIcon, hiPondering );\r
+            break;\r
+        case STATE_ANALYZING:\r
+            SetIcon( hStateIcon, hiAnalyzing );\r
+            break;\r
+        default:\r
+            SetIcon( hStateIcon, hiClear );\r
+            break;\r
+        }\r
+    }\r
+\r
+    if( state_data != 0 ) {\r
+        SetWindowText( hStateData, state_data );\r
+    }\r
+}\r
+\r
+#define MAX_NAME_LENGTH 32\r
+\r
+static VOID UpdateControls( EngineOutputData * ed )\r
+{\r
+    BOOL isPondering = FALSE;\r
+\r
+    char s_label[MAX_NAME_LENGTH + 32];\r
+    \r
+    char * name = ed->name;\r
+\r
+    /* Label */\r
+    if( name == 0 || *name == '\0' ) {\r
+        name = "?";\r
+    }\r
+\r
+    strncpy( s_label, name, MAX_NAME_LENGTH );\r
+    s_label[ MAX_NAME_LENGTH-1 ] = '\0';\r
+\r
+#ifdef SHOW_PONDERING\r
+    if( IsEnginePondering( ed->which ) ) {\r
+        char buf[8];\r
+\r
+        buf[0] = '\0';\r
+\r
+        if( ed->hint != 0 && *ed->hint != '\0' ) {\r
+            strncpy( buf, ed->hint, sizeof(buf) );\r
+            buf[sizeof(buf)-1] = '\0';\r
+        }\r
+        else if( ed->pv != 0 && *ed->pv != '\0' ) {\r
+            char * sep = strchr( ed->pv, ' ' );\r
+            int buflen = sizeof(buf);\r
+\r
+            if( sep != NULL ) {\r
+                buflen = sep - ed->pv + 1;\r
+                if( buflen > sizeof(buf) ) buflen = sizeof(buf);\r
+            }\r
+\r
+            strncpy( buf, ed->pv, buflen );\r
+            buf[ buflen-1 ] = '\0';\r
+        }\r
+\r
+        SetEngineState( ed->which, STATE_PONDERING, buf );\r
+    }\r
+    else if( gameMode == TwoMachinesPlay ) {\r
+        SetEngineState( ed->which, STATE_THINKING, "" );\r
+    }\r
+    else if( gameMode == AnalyzeMode || gameMode == AnalyzeFile ) {\r
+        char buf[64];\r
+        int time_secs = ed->time / 100;\r
+        int time_mins = time_secs / 60;\r
+\r
+        buf[0] = '\0';\r
+\r
+        if( ed->an_move_index != 0 && ed->an_move_count != 0 && *ed->hint != '\0' ) {\r
+            char mov[16];\r
+\r
+            strncpy( mov, ed->hint, sizeof(mov) );\r
+            mov[ sizeof(mov)-1 ] = '\0';\r
+\r
+            sprintf( buf, "%d/%d: %s [%02d:%02d:%02d]", ed->an_move_index, ed->an_move_count, mov, time_mins / 60, time_mins % 60, time_secs % 60 );\r
+        }\r
+\r
+        SetEngineState( ed->which, STATE_ANALYZING, buf );\r
+    }\r
+    else {\r
+        SetEngineState( ed->which, STATE_IDLE, "" );\r
+    }\r
+#endif\r
+\r
+    SetWindowText( ed->hLabel, s_label );\r
+\r
+    s_label[0] = '\0';\r
+\r
+    if( ed->time > 0 && ed->nodes > 0 ) {\r
+        unsigned long nps_100 = ed->nodes / ed->time;\r
+\r
+        if( nps_100 < 100000 ) {\r
+            sprintf( s_label, "NPS: %lu", nps_100 * 100 );\r
+        }\r
+        else {\r
+            sprintf( s_label, "NPS: %.1fk", nps_100 / 10.0 );\r
+        }\r
+    }\r
+\r
+    SetWindowText( ed->hLabelNPS, s_label );\r
+\r
+    /* Memo */\r
+    if( ed->pv != 0 && *ed->pv != '\0' ) {\r
+        char s_nodes[24];\r
+        char s_score[16];\r
+        char s_time[24];\r
+        char buf[256];\r
+        int buflen;\r
+        int time_secs = ed->time / 100;\r
+        int time_cent = ed->time % 100;\r
+\r
+        /* Nodes */\r
+        if( ed->nodes < 1000000 ) {\r
+            sprintf( s_nodes, "%lu", ed->nodes );\r
+        }\r
+        else {\r
+            sprintf( s_nodes, "%.1fM", ed->nodes / 1000000.0 );\r
+        }\r
+\r
+        /* Score */\r
+        if( ed->score > 0 ) {\r
+            sprintf( s_score, "+%.2f", ed->score / 100.0 );\r
+        }\r
+        else {\r
+            sprintf( s_score, "%.2f", ed->score / 100.0 );\r
+        }\r
+\r
+        /* Time */\r
+        sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent );\r
+\r
+        /* Put all together... */\r
+        sprintf( buf, "%3d\t%s\t%s\t%s\t", ed->depth, s_score, s_nodes, s_time );\r
+\r
+        /* Add PV */\r
+        buflen = strlen(buf);\r
+\r
+        strncpy( buf + buflen, ed->pv, sizeof(buf) - buflen );\r
+\r
+        buf[ sizeof(buf) - 3 ] = '\0';\r
+\r
+        strcat( buf + buflen, "\r\n" );\r
+\r
+        /* Update memo */\r
+        InsertIntoMemo( ed->hMemo, buf );\r
+    }\r
+\r
+    /* Colors */\r
+    SetEngineColorIcon( ed->hColorIcon, ed->which );\r
+}\r
+\r
+LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )\r
+{\r
+    static SnapData sd;\r
+\r
+    switch (message) {\r
+    case WM_INITDIALOG:\r
+        if( engineOutputDialog == NULL ) {\r
+            engineOutputDialog = hDlg;\r
+\r
+            RestoreWindowPlacement( hDlg, &wpEngineOutput ); /* Restore window placement */\r
+\r
+            ResizeWindowControls( hDlg, windowMode );\r
+\r
+            SetEngineState( 0, STATE_IDLE, "" );\r
+            SetEngineState( 1, STATE_IDLE, "" );\r
+        }\r
+\r
+        return FALSE;\r
+\r
+    case WM_COMMAND:\r
+        switch (LOWORD(wParam)) {\r
+        case IDOK:\r
+          EndDialog(hDlg, TRUE);\r
+          return TRUE;\r
+\r
+        case IDCANCEL:\r
+          EndDialog(hDlg, FALSE);\r
+          return TRUE;\r
+\r
+        default:\r
+          break;\r
+        }\r
+\r
+        break;\r
+\r
+    case WM_GETMINMAXINFO:\r
+        {\r
+            MINMAXINFO * mmi = (MINMAXINFO *) lParam;\r
+        \r
+            mmi->ptMinTrackSize.x = 100;\r
+            mmi->ptMinTrackSize.y = 160;\r
+        }\r
+        break;\r
+\r
+    case WM_CLOSE:\r
+        EngineOutputPopDown();\r
+        break;\r
+\r
+    case WM_SIZE:\r
+        ResizeWindowControls( hDlg, windowMode );\r
+        break;\r
+\r
+    case WM_ENTERSIZEMOVE:\r
+        return OnEnterSizeMove( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_SIZING:\r
+        return OnSizing( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_MOVING:\r
+        return OnMoving( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_EXITSIZEMOVE:\r
+        return OnExitSizeMove( &sd, hDlg, wParam, lParam );\r
+    }\r
+\r
+    return FALSE;\r
+}\r
+\r
+VOID EngineOutputPopUp()\r
+{\r
+  FARPROC lpProc;\r
+\r
+  if( needInit ) {\r
+      InitializeEngineOutput();\r
+  }\r
+  \r
+  CheckMenuItem(GetMenu(hwndMain), IDM_ShowEngineOutput, MF_CHECKED);\r
+\r
+  if( engineOutputDialog ) {\r
+    SendMessage( engineOutputDialog, WM_INITDIALOG, 0, 0 );\r
+\r
+    if( ! engineOutputDialogUp ) {\r
+        ShowWindow(engineOutputDialog, SW_SHOW);\r
+    }\r
+  }\r
+  else {\r
+    lpProc = MakeProcInstance( (FARPROC) EngineOutputProc, hInst );\r
+\r
+    /* Note to self: dialog must have the WS_VISIBLE style set, otherwise it's not shown! */\r
+    CreateDialog( hInst, MAKEINTRESOURCE(DLG_EngineOutput), hwndMain, (DLGPROC)lpProc );\r
+\r
+    FreeProcInstance(lpProc);\r
+  }\r
+\r
+  engineOutputDialogUp = TRUE;\r
+  ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output
+}\r
+\r
+VOID EngineOutputPopDown()\r
+{\r
+  CheckMenuItem(GetMenu(hwndMain), IDM_ShowEngineOutput, MF_UNCHECKED);\r
+\r
+  if( engineOutputDialog ) {\r
+      ShowWindow(engineOutputDialog, SW_HIDE);\r
+  }\r
+\r
+  engineOutputDialogUp = FALSE;\r
+  ShowThinkingEvent(); // [HGM] thinking: might need to shut off thinking output
+}\r
+\r
+BOOL EngineOutputIsUp()\r
+{\r
+    return engineOutputDialogUp;\r
+}\r
+\r
+VOID EngineOutputUpdate( FrontEndProgramStats * stats )\r
+{\r
+    EngineOutputData ed;\r
+    BOOL clearMemo = FALSE;\r
+    int which;\r
+    int depth;\r
+\r
+    if( stats == 0 ) {\r
+        SetEngineState( 0, STATE_IDLE, "" );\r
+        SetEngineState( 1, STATE_IDLE, "" );\r
+        return;\r
+    }\r
+\r
+    which = stats->which;\r
+    depth = stats->depth;\r
+\r
+    if( which < 0 || which > 1 || depth < 0 || stats->time < 0 || stats->pv == 0 ) {\r
+        return;\r
+    }\r
+\r
+    if( engineOutputDialog == NULL ) {\r
+        return;\r
+    }\r
+\r
+    VerifyDisplayMode();\r
+\r
+    ed.which = which;\r
+    ed.depth = depth;\r
+    ed.nodes = stats->nodes;\r
+    ed.score = stats->score;\r
+    ed.time = stats->time;\r
+    ed.pv = stats->pv;\r
+    ed.hint = stats->hint;\r
+    ed.an_move_index = stats->an_move_index;\r
+    ed.an_move_count = stats->an_move_count;\r
+\r
+    /* Get target control */\r
+    if( which == 0 ) {\r
+        ed.hColorIcon = GetDlgItem( engineOutputDialog, IDC_Color1 );\r
+        ed.hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel1 );\r
+        ed.hStateIcon = GetDlgItem( engineOutputDialog, IDC_StateIcon1 );\r
+        ed.hStateData = GetDlgItem( engineOutputDialog, IDC_StateData1 );\r
+        ed.hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine1_NPS );\r
+        ed.hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo1 );\r
+        ed.name = first.tidy;\r
+    }\r
+    else {\r
+        ed.hColorIcon = GetDlgItem( engineOutputDialog, IDC_Color2 );\r
+        ed.hLabel = GetDlgItem( engineOutputDialog, IDC_EngineLabel2 );\r
+        ed.hStateIcon = GetDlgItem( engineOutputDialog, IDC_StateIcon2 );\r
+        ed.hStateData = GetDlgItem( engineOutputDialog, IDC_StateData2 );\r
+        ed.hLabelNPS = GetDlgItem( engineOutputDialog, IDC_Engine2_NPS );\r
+        ed.hMemo  = GetDlgItem( engineOutputDialog, IDC_EngineMemo2 );\r
+        ed.name = second.tidy;\r
+    }\r
+\r
+    /* Clear memo if needed */\r
+    if( lastDepth[which] > depth || (lastDepth[which] == depth && depth <= 1) ) {\r
+        clearMemo = TRUE;\r
+    }\r
+\r
+    if( lastForwardMostMove[which] != forwardMostMove ) {\r
+        clearMemo = TRUE;\r
+    }\r
+\r
+    if( clearMemo ) {\r
+        SendMessage( ed.hMemo, WM_SETTEXT, 0, (LPARAM) "" );\r
+    }\r
+\r
+    /* Update */\r
+    lastDepth[which] = depth;\r
+    lastForwardMostMove[which] = forwardMostMove;\r
+\r
+    if( ed.pv != 0 && ed.pv[0] == ' ' ) {\r
+        if( strncmp( ed.pv, " no PV", 6 ) == 0 ) { /* Hack on hack! :-O */\r
+            ed.pv = "";\r
+        }\r
+    }\r
+\r
+    UpdateControls( &ed );\r
+}\r
index 139a984..a70f16b 100644 (file)
@@ -86,7 +86,7 @@
 \r
 #include "wsnap.h"\r
 \r
-void InitEngineUCI( const char * iniDir, ChessProgramState * cps );\r
+//void InitEngineUCI( const char * iniDir, ChessProgramState * cps );\r
 \r
   int myrandom(void);\r
   void mysrandom(unsigned int seed);\r
@@ -598,8 +598,8 @@ InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)
 \r
   InitBackEnd1();\r
 \r
-  InitEngineUCI( installDir, &first );\r
-  InitEngineUCI( installDir, &second );\r
+//  InitEngineUCI( installDir, &first ); // [HGM] incorporated in InitBackEnd1()\r
+//  InitEngineUCI( installDir, &second );\r
 \r
   /* Create a main window for this application instance. */\r
   hwnd = CreateWindow(szAppName, szTitle,\r
@@ -1173,6 +1173,8 @@ ArgDescriptor argDescriptors[] = {
   { "flipBlack", ArgBoolean, (LPVOID) &appData.upsideDown, TRUE },\r
   { "allWhite", ArgBoolean, (LPVOID) &appData.allWhite, TRUE },\r
   { "alphaRank", ArgBoolean, (LPVOID) &appData.alphaRank, FALSE },\r
+  { "firstAlphaRank", ArgBoolean, (LPVOID) &first.alphaRank, FALSE },\r
+  { "secondAlphaRank", ArgBoolean, (LPVOID) &second.alphaRank, FALSE },\r
   { "testClaims", ArgBoolean, (LPVOID) &appData.testClaims, TRUE },\r
   { "checkMates", ArgBoolean, (LPVOID) &appData.checkMates, TRUE },\r
   { "materialDraws", ArgBoolean, (LPVOID) &appData.materialDraws, TRUE },\r
@@ -1182,6 +1184,10 @@ ArgDescriptor argDescriptors[] = {
   { "autoKibitz", ArgTrue, (LPVOID) &appData.autoKibitz, FALSE },\r
   { "engineDebugOutput", ArgInt, (LPVOID) &appData.engineComments, FALSE },\r
   { "userName", ArgString, (LPVOID) &appData.userName, FALSE },\r
+  { "rewindIndex", ArgInt, (LPVOID) &appData.rewindIndex, FALSE },\r
+  { "sameColorGames", ArgInt, (LPVOID) &appData.sameColorGames, FALSE },\r
+  { "smpCores", ArgInt, (LPVOID) &appData.smpCores, TRUE },\r
+  { "egtFormats", ArgString, (LPVOID) &appData.egtFormats, TRUE },\r
 \r
 #ifdef ZIPPY\r
   { "zippyTalk", ArgBoolean, (LPVOID) &appData.zippyTalk, FALSE },\r
@@ -1922,7 +1928,8 @@ InitAppData(LPSTR lpCmdLine)
   appData.firstNPS  = -1; // [HGM] nps: use wall-clock time\r
   appData.secondNPS = -1;\r
   appData.engineComments = 1;\r
-\r
+  appData.smpCores = 1; // [HGM] SMP: max nr of cores\r
+  appData.egtFormats = "";\r
 \r
 #ifdef ZIPPY\r
   appData.zippyTalk = ZIPPY_TALK;\r
@@ -2365,6 +2372,12 @@ enum {
     PM_WH = (int) WhiteNightrider, \r
     PM_WA = (int) WhiteAngel, \r
     PM_WC = (int) WhiteMarshall, \r
+    PM_WAB = (int) WhiteCardinal, \r
+    PM_WD = (int) WhiteDragon, \r
+    PM_WL = (int) WhiteLance, \r
+    PM_WS = (int) WhiteCobra, \r
+    PM_WV = (int) WhiteFalcon, \r
+    PM_WSG = (int) WhiteSilver, \r
     PM_WG = (int) WhiteGrasshopper, \r
     PM_WK = (int) WhiteKing,\r
     PM_BP = (int) BlackPawn, \r
@@ -2382,6 +2395,12 @@ enum {
     PM_BA = (int) BlackAngel, \r
     PM_BC = (int) BlackMarshall, \r
     PM_BG = (int) BlackGrasshopper, \r
+    PM_BAB = (int) BlackCardinal,\r
+    PM_BD = (int) BlackDragon,\r
+    PM_BL = (int) BlackLance,\r
+    PM_BS = (int) BlackCobra,\r
+    PM_BV = (int) BlackFalcon,\r
+    PM_BSG = (int) BlackSilver,\r
     PM_BK = (int) BlackKing\r
 };\r
 \r
@@ -2480,13 +2499,12 @@ static void CreatePieceMaskFromFont( HDC hdc_window, HDC hdc, int index )
     POINT pt;\r
     int backColor = whitePieceColor; \r
     int foreColor = blackPieceColor;\r
-    int shapeIndex = index < 6 ? index+6 : index;\r
     \r
-    if( index < 6 && appData.fontBackColorWhite != appData.fontForeColorWhite ) {\r
+    if( index < (int)BlackPawn && appData.fontBackColorWhite != appData.fontForeColorWhite ) {\r
         backColor = appData.fontBackColorWhite;\r
         foreColor = appData.fontForeColorWhite;\r
     }\r
-    else if( index >= 6 && appData.fontBackColorBlack != appData.fontForeColorBlack ) {\r
+    else if( index >= (int)BlackPawn && appData.fontBackColorBlack != appData.fontForeColorBlack ) {\r
         backColor = appData.fontBackColorBlack;\r
         foreColor = appData.fontForeColorBlack;\r
     }\r
@@ -2516,7 +2534,11 @@ static void CreatePieceMaskFromFont( HDC hdc_window, HDC hdc, int index )
 \r
     SelectObject( hdc, GetStockObject(WHITE_BRUSH) );\r
     /* Step 3: the area outside the piece is filled with white */\r
-    FloodFill( hdc, 0, 0, chroma );\r
+//    FloodFill( hdc, 0, 0, chroma );\r
+    ExtFloodFill( hdc, 0, 0, 0, FLOODFILLSURFACE );\r
+    ExtFloodFill( hdc, 0, squareSize-1, 0, FLOODFILLSURFACE ); // [HGM] fill from all 4 corners, for if piece too big\r
+    ExtFloodFill( hdc, squareSize-1, 0, 0, FLOODFILLSURFACE );\r
+    ExtFloodFill( hdc, squareSize-1, squareSize-1, 0, FLOODFILLSURFACE );\r
     SelectObject( hdc, GetStockObject(BLACK_BRUSH) );\r
     /* \r
         Step 4: this is the tricky part, the area inside the piece is filled with black,\r
@@ -2524,7 +2546,23 @@ static void CreatePieceMaskFromFont( HDC hdc_window, HDC hdc, int index )
         There should be a better way to do this... if we could create a region or path\r
         from the fill operation we would be fine for example.\r
     */\r
-    FloodFill( hdc, squareSize / 2, squareSize / 2, RGB(0xFF,0xFF,0xFF) );\r
+//    FloodFill( hdc, squareSize / 2, squareSize / 2, RGB(0xFF,0xFF,0xFF) );\r
+    ExtFloodFill( hdc, squareSize / 2, squareSize / 2, RGB(0xFF,0xFF,0xFF), FLOODFILLBORDER );\r
+\r
+    {   /* [HGM] shave off edges of mask, in an attempt to correct for the fact that FloodFill does not work correctly under Win XP */\r
+        HDC dc2 = CreateCompatibleDC( hdc_window );\r
+        HBITMAP bm2 = CreateCompatibleBitmap( hdc_window, squareSize, squareSize );\r
+\r
+        SelectObject( dc2, bm2 );\r
+        BitBlt( dc2, 0, 0, squareSize, squareSize, hdc, 0, 0, SRCCOPY ); // make copy\r
+        BitBlt( hdc, 0, 1, squareSize-2, squareSize-2, dc2, 1, 1, SRCPAINT );\r
+        BitBlt( hdc, 2, 1, squareSize-2, squareSize-2, dc2, 1, 1, SRCPAINT );\r
+        BitBlt( hdc, 1, 0, squareSize-2, squareSize-2, dc2, 1, 1, SRCPAINT );\r
+        BitBlt( hdc, 1, 2, squareSize-2, squareSize-2, dc2, 1, 1, SRCPAINT );\r
+\r
+        DeleteDC( dc2 );\r
+        DeleteObject( bm2 );\r
+    }\r
 \r
     SetTextColor( hdc, 0 );\r
     /* \r
@@ -2610,6 +2648,7 @@ static int TranslatePieceToFontPiece( int piece )
         return PM_WQ;\r
     case WhiteKing:\r
         return PM_WK;\r
+\r
     case BlackAngel:\r
         return PM_BA;\r
     case BlackMarshall:\r
@@ -2630,6 +2669,19 @@ static int TranslatePieceToFontPiece( int piece )
         return PM_BG;\r
     case BlackMan:\r
         return PM_BM;\r
+    case BlackSilver:\r
+        return PM_BSG;\r
+    case BlackLance:\r
+        return PM_BL;\r
+    case BlackFalcon:\r
+        return PM_BV;\r
+    case BlackCobra:\r
+        return PM_BS;\r
+    case BlackCardinal:\r
+        return PM_BAB;\r
+    case BlackDragon:\r
+        return PM_BD;\r
+\r
     case WhiteAngel:\r
         return PM_WA;\r
     case WhiteMarshall:\r
@@ -2650,6 +2702,18 @@ static int TranslatePieceToFontPiece( int piece )
         return PM_WG;\r
     case WhiteMan:\r
         return PM_WM;\r
+    case WhiteSilver:\r
+        return PM_WSG;\r
+    case WhiteLance:\r
+        return PM_WL;\r
+    case WhiteFalcon:\r
+        return PM_WV;\r
+    case WhiteCobra:\r
+        return PM_WS;\r
+    case WhiteCardinal:\r
+        return PM_WAB;\r
+    case WhiteDragon:\r
+        return PM_WD;\r
     }\r
 \r
     return 0;\r
@@ -2682,7 +2746,7 @@ void CreatePiecesFromFont()
             DeleteObject( hPieceFont );\r
         }\r
         else {\r
-            for( i=0; i<12; i++ ) {\r
+            for( i=0; i<=(int)BlackKing; i++ ) {\r
                 hPieceMask[i] = NULL;\r
                 hPieceFace[i] = NULL;\r
             }\r
@@ -2747,7 +2811,7 @@ void CreatePiecesFromFont()
 \r
             /* Create bitmaps */\r
             hfont_old = SelectObject( hdc, hPieceFont );\r
-\r
+#if 0\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WP );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WN );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WB );\r
@@ -2760,7 +2824,7 @@ void CreatePiecesFromFont()
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BR );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BQ );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BK );\r
-#ifdef FAIRY\r
+\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WA );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WC );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WF );\r
@@ -2771,6 +2835,12 @@ void CreatePiecesFromFont()
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WO );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WG );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_WM );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WSG );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WV );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WAB );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WD );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WL );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_WS );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BA );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BC );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BF );\r
@@ -2781,8 +2851,17 @@ void CreatePiecesFromFont()
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BO );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BG );\r
             CreatePieceMaskFromFont( hdc_window, hdc, PM_BM );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BSG );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BV );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BAB );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BD );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BL );\r
+            CreatePieceMaskFromFont( hdc_window, hdc, PM_BS );\r
+#else\r
+           for(i=(int)WhitePawn; i<(int)EmptySquare; i++) /* [HGM] made a loop for this */\r
+               if(PieceToChar((ChessSquare)i) != '.')     /* skip unused pieces         */\r
+                   CreatePieceMaskFromFont( hdc_window, hdc, i );\r
 #endif\r
-\r
             SelectObject( hdc, hfont_old );\r
 \r
             fontBitmapSquareSize = squareSize;\r
@@ -2900,9 +2979,10 @@ ResizeBoard(int newSizeX, int newSizeY, int flags)
   if (IsIconic(hwndMain)) return;\r
   if (recurse > 0) return;\r
   recurse++;\r
-  while (newSize > 0 &&\r
-        (newSizeX < sizeInfo[newSize].cliWidth ||\r
-         newSizeY < sizeInfo[newSize].cliHeight)) {\r
+  while (newSize > 0) {\r
+       InitDrawingSizes(newSize, 0);\r
+       if(newSizeX >= sizeInfo[newSize].cliWidth ||\r
+          newSizeY >= sizeInfo[newSize].cliHeight) break;\r
     newSize--;\r
   } \r
   boardSize = newSize;\r
@@ -3135,6 +3215,7 @@ InitDrawingSizes(BoardSize boardSize, int flags)
     }\r
   }\r
 \r
+  fontBitmapSquareSize = 0; /* [HGM] render: make sure pieces will be recreated, as we might need others now */\r
   // Orthodox Chess pieces\r
   pieceBitmap[0][WhitePawn] = DoLoadBitmap(hInst, "p", squareSize, "s");\r
   pieceBitmap[0][WhiteKnight] = DoLoadBitmap(hInst, "n", squareSize, "s");\r
@@ -3945,7 +4026,10 @@ DrawBoardOnDC(HDC hdc, Board board, HDC tmphdc)
 \r
   /* [AS] Initialize background textures if needed */\r
   if( liteBackTexture != NULL || darkBackTexture != NULL ) {\r
-      if( backTextureSquareSize != squareSize ) {\r
+      static int backTextureBoardSize; /* [HGM] boardsize: also new texture if board format changed */\r
+      if( backTextureSquareSize != squareSize \r
+       || backTextureBoardSize != BOARD_WIDTH+BOARD_SIZE*BOARD_HEIGHT) {\r
+         backTextureBoardSize = BOARD_WIDTH+BOARD_SIZE*BOARD_HEIGHT;\r
           backTextureSquareSize = squareSize;\r
           RebuildTextureSquareInfo();\r
       }\r
@@ -3987,9 +4071,9 @@ DrawBoardOnDC(HDC hdc, Board board, HDC tmphdc)
             }\r
       }\r
       if(column == BOARD_LEFT-1 ) /* left align */\r
-            DisplayHoldingsCount(hdc, x, y, 0, (int) board[row][column]);\r
+            DisplayHoldingsCount(hdc, x, y, flipView, (int) board[row][column]);\r
       else if( column == BOARD_RGHT) /* right align */\r
-            DisplayHoldingsCount(hdc, x, y, 1, (int) board[row][column]);\r
+            DisplayHoldingsCount(hdc, x, y, !flipView, (int) board[row][column]);\r
       else\r
       if (appData.monoMode) {\r
         if (piece == EmptySquare) {\r
@@ -4357,7 +4441,6 @@ HDCDrawPosition(HDC hdc, BOOLEAN repaint, Board board)
         boardRect.right - boardRect.left,\r
         boardRect.bottom - boardRect.top,\r
         tmphdc, boardRect.left, boardRect.top, SRCCOPY);\r
-\r
   if(saveDiagFlag) { \r
     BITMAP b; int i, j, m, w, wb, fac=0; char pData[1000000]; \r
     BITMAPINFOHEADER bih; int color[16], nrColors=0;\r
@@ -4586,7 +4669,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
   BOOLEAN needsRedraw = FALSE;\r
   BOOLEAN saveAnimate;\r
   BOOLEAN forceFullRepaint = IsFullRepaintPreferrable(); /* [AS] */\r
-  static BOOLEAN sameAgain = FALSE;\r
+  static BOOLEAN sameAgain = FALSE, promotionChoice = FALSE;\r
   ChessMove moveType;\r
 \r
   if (recursive) {\r
@@ -4614,6 +4697,25 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 \r
   switch (message) {\r
   case WM_LBUTTONDOWN:\r
+    if(promotionChoice) { // we are waiting for a click to indicate promotion piece\r
+       promotionChoice = FALSE; // only one chance: if click not OK it is interpreted as cancel\r
+       if(appData.debugMode) fprintf(debugFP, "promotion click, x=%d, y=%d\n", x, y);\r
+       if(gameInfo.holdingsWidth && \r
+               (WhiteOnMove(currentMove) \r
+                       ? x == BOARD_WIDTH-1 && y < gameInfo.holdingsSize && y > 0\r
+                       : x == 0 && y >= BOARD_HEIGHT - gameInfo.holdingsSize && y < BOARD_HEIGHT-1) ) {\r
+           // click in right holdings, for determining promotion piece\r
+           ChessSquare p = boards[currentMove][y][x];\r
+           if(appData.debugMode) fprintf(debugFP, "square contains %d\n", (int)p);\r
+           if(p != EmptySquare) {\r
+               FinishMove(WhitePromotionQueen, fromX, fromY, toX, toY, ToLower(PieceToChar(p)));\r
+               fromX = fromY = -1;\r
+               break;\r
+           }\r
+       }\r
+       DrawPosition(FALSE, boards[currentMove]);\r
+       break;\r
+    }\r
     ErrorPopDown();\r
     sameAgain = FALSE;\r
     if (y == -2) {\r
@@ -4670,6 +4772,12 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         /* [HGM] <popupFix> UserMoveEvent requires two calls now,\r
            to make sure move is legal before showing promotion popup */\r
         moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR);\r
+       if(moveType == AmbiguousMove) { /* [HGM] Edit-Position move executed */\r
+               fromX = fromY = -1; \r
+               ClearHighlights();\r
+               DrawPosition(FALSE, boards[currentMove]);\r
+               break; \r
+       } else \r
         if(moveType != ImpossibleMove) {\r
           /* [HGM] We use PromotionToKnight in Shogi to indicate frorced promotion */\r
           if (moveType == WhitePromotionKnight || moveType == BlackPromotionKnight ||\r
@@ -4686,6 +4794,16 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                   DrawPosition(forceFullRepaint || FALSE, NULL);\r
                   /* [HGM] <popupFix> Popup calls FinishMove now.\r
                      If promotion to Q is legal, all are legal! */\r
+                 if(gameInfo.variant == VariantSuper)\r
+                 { ChessSquare p = boards[currentMove][fromY][fromX], q = boards[currentMove][toY][toX];\r
+                   // kludge to temporarily execute move on display, wthout promotng yet\r
+                   promotionChoice = TRUE;\r
+                   boards[currentMove][fromY][fromX] = EmptySquare; // move Pawn to 8th rank\r
+                   boards[currentMove][toY][toX] = p;\r
+                   DrawPosition(FALSE, boards[currentMove]);\r
+                   boards[currentMove][fromY][fromX] = p; // take back, but display stays\r
+                   boards[currentMove][toY][toX] = q;\r
+                 } else\r
                   PromotionPopup(hwnd);\r
           } else {       /* not a promotion */\r
              if (appData.animate || appData.highlightLastMove) {\r
@@ -4694,6 +4812,7 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
                  ClearHighlights();\r
              }\r
              FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR);\r
+            fromX = fromY = -1;\r
              if (appData.animate && !appData.highlightLastMove) {\r
                   ClearHighlights();\r
                   DrawPosition(forceFullRepaint || FALSE, NULL);\r
@@ -4758,6 +4877,12 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
       saveAnimate = appData.animate; /* sorry, Hawk :) */\r
       appData.animate = appData.animate && !appData.animateDragging;\r
       moveType = UserMoveTest(fromX, fromY, toX, toY, NULLCHAR);\r
+      if(moveType == AmbiguousMove) { /* [HGM] Edit-Position move executed */\r
+               fromX = fromY = -1; \r
+               ClearHighlights();\r
+               DrawPosition(FALSE, boards[currentMove]);\r
+               break; \r
+      } else \r
       if(moveType != ImpossibleMove) {\r
           /* [HGM] use move type to determine if move is promotion.\r
              Knight is Shogi kludge for mandatory promotion, Queen means choice */\r
@@ -4768,6 +4893,17 @@ MouseEvent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
           else \r
           if (moveType == WhitePromotionQueen || moveType == BlackPromotionQueen ) {\r
                DrawPosition(forceFullRepaint || FALSE, NULL);\r
+                 if(gameInfo.variant == VariantSuper)\r
+                 { ChessSquare p = boards[currentMove][fromY][fromX], q = boards[currentMove][toY][toX];\r
+                   // kludge to temporarily execute move on display, wthout promotng yet\r
+                   promotionChoice = TRUE;\r
+                   boards[currentMove][fromY][fromX] = EmptySquare; // move Pawn to 8th rank\r
+                   boards[currentMove][toY][toX] = p;\r
+                   DrawPosition(FALSE, boards[currentMove]);\r
+                   boards[currentMove][fromY][fromX] = p; // take back, but display stays\r
+                   boards[currentMove][toY][toX] = q;\r
+                   break;\r
+                 } else\r
                PromotionPopup(hwnd); /* [HGM] Popup now calls FinishMove */\r
         } else FinishMove(moveType, fromX, fromY, toX, toY, NULLCHAR);\r
       }\r
@@ -4960,7 +5096,7 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     CenterWindow(hDlg, GetWindow(hDlg, GW_OWNER));\r
     ShowWindow(GetDlgItem(hDlg, PB_King), \r
       (!appData.testLegality || gameInfo.variant == VariantSuicide ||\r
-       gameInfo.variant == VariantGiveaway) ?\r
+       gameInfo.variant == VariantGiveaway || gameInfo.variant == VariantSuper ) ?\r
               SW_SHOW : SW_HIDE);\r
     /* [HGM] Only allow C & A promotions if these pieces are defined */\r
     ShowWindow(GetDlgItem(hDlg, PB_Archbishop),\r
@@ -4988,6 +5124,9 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
     ShowWindow(GetDlgItem(hDlg, IDC_No), \r
        gameInfo.variant == VariantShogi ?\r
               SW_SHOW : SW_HIDE);\r
+    ShowWindow(GetDlgItem(hDlg, IDC_Centaur), \r
+       gameInfo.variant == VariantSuper ?\r
+              SW_SHOW : SW_HIDE);\r
     return TRUE;\r
 \r
   case WM_COMMAND: /* message: received a command */\r
@@ -4998,7 +5137,7 @@ Promotion(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       DrawPosition(FALSE, NULL);\r
       return TRUE;\r
     case PB_King:\r
-      promoChar = PieceToChar(BlackKing);\r
+      promoChar = gameInfo.variant == VariantSuper ? PieceToChar(BlackSilver) : PieceToChar(BlackKing);\r
       break;\r
     case PB_Queen:\r
       promoChar = gameInfo.variant == VariantShogi ? '+' : PieceToChar(BlackQueen);\r
@@ -5052,7 +5191,8 @@ PromotionPopup(HWND hwnd)
 VOID\r
 ToggleShowThinking()\r
 {\r
-  ShowThinkingEvent(!appData.showThinking);\r
+  appData.showThinking = !appData.showThinking;\r
+  ShowThinkingEvent();
 }\r
 \r
 VOID\r
@@ -5366,7 +5506,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
         }\r
         else {\r
             EngineOutputPopUp();\r
-        }\r
+        }
         break;\r
 \r
     /* [AS] User adjudication */\r
@@ -5962,6 +6102,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
 \r
   /* [AS] Snapping */\r
   case WM_ENTERSIZEMOVE:\r
+    if(appData.debugMode) { fprintf(debugFP, "size-move\n"); }\r
     if (hwnd == hwndMain) {\r
       doingSizing = TRUE;\r
       lastSizing = 0;\r
@@ -5970,15 +6111,18 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
     break;\r
 \r
   case WM_SIZING:\r
+    if(appData.debugMode) { fprintf(debugFP, "sizing\n"); }\r
     if (hwnd == hwndMain) {\r
       lastSizing = wParam;\r
     }\r
     break;\r
 \r
   case WM_MOVING:\r
+    if(appData.debugMode) { fprintf(debugFP, "moving\n"); }\r
       return OnMoving( &sd, hwnd, wParam, lParam );\r
 \r
   case WM_EXITSIZEMOVE:\r
+    if(appData.debugMode) { fprintf(debugFP, "exit size-move, size = %d\n", squareSize); }\r
     if (hwnd == hwndMain) {\r
       RECT client;\r
       doingSizing = FALSE;\r
@@ -5986,6 +6130,7 @@ WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
       GetClientRect(hwnd, &client);\r
       ResizeBoard(client.right, client.bottom, lastSizing);\r
       lastSizing = 0;\r
+      if(appData.debugMode) { fprintf(debugFP, "square size = %d\n", squareSize); }\r
     }\r
     return OnExitSizeMove( &sd, hwnd, wParam, lParam );\r
     break;\r
index 265791a..2aaee4a 100644 (file)
-/*\r
- * WinBoard.h -- Definitions for Windows NT front end to XBoard\r
- *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
- * Enhancements Copyright 1992-97 Free Software Foundation, Inc.\r
- *\r
- * The following terms apply to Digital Equipment Corporation's copyright\r
- * interest in XBoard:\r
- * ------------------------------------------------------------------------\r
- * All Rights Reserved\r
- *\r
- * Permission to use, copy, modify, and distribute this software and its\r
- * documentation for any purpose and without fee is hereby granted,\r
- * provided that the above copyright notice appear in all copies and that\r
- * both that copyright notice and this permission notice appear in\r
- * supporting documentation, and that the name of Digital not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission.\r
- *\r
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
- * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- * ------------------------------------------------------------------------\r
- *\r
- * The following terms apply to the enhanced version of XBoard distributed\r
- * by the Free Software Foundation:\r
- * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
-#include "resource.h"\r
-#include <dlgs.h>\r
-\r
-/* Types */\r
-typedef struct {\r
-  char faceName[LF_FACESIZE];\r
-  float pointSize;\r
-  BYTE bold, italic, underline, strikeout;\r
-} MyFontParams;\r
-\r
-typedef struct {\r
-  char *def;\r
-  MyFontParams mfp;\r
-  LOGFONT lf;\r
-  HFONT hf;\r
-} MyFont;\r
-\r
-typedef struct {\r
-    COLORREF color;\r
-    int effects;\r
-    char *name;\r
-} MyColorizeAttribs;\r
-\r
-typedef struct {\r
-  char* name;\r
-  void* data;\r
-} MySound;\r
-\r
-typedef struct {\r
-    COLORREF color;\r
-    int effects;\r
-    MySound sound;\r
-} MyTextAttribs;\r
-\r
-/* Functions */\r
-\r
-BOOL InitApplication(HINSTANCE);\r
-BOOL InitInstance(HINSTANCE, int, LPSTR);\r
-LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);\r
-LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);\r
-LRESULT CALLBACK BoardSizeDlg(HWND, UINT, WPARAM, LPARAM);\r
-LRESULT CALLBACK ButtonProc(HWND, UINT, WPARAM, LPARAM);\r
-VOID InitAppData(LPSTR);\r
-VOID InitDrawingColors(VOID);\r
-VOID InitDrawingSizes(BoardSize boardSize, int flags);\r
-VOID InitMenuChecks(VOID);\r
-VOID ICSInitScript(VOID);\r
-BOOL CenterWindow(HWND hwndChild, HWND hwndParent);\r
-VOID ResizeEditPlusButtons(HWND hDlg, HWND hText, int sizeX, int sizeY, int newSizeX, int newSizeY);\r
-VOID PromotionPopup(HWND hwnd);\r
-FILE *OpenFileDialog(HWND hWnd, char *write, char *defName, char *defExt, \r
-                    char *nameFilt, char *dlgTitle, UINT *number,\r
-                    char fileTitle[MSG_SIZ], char fileName[MSG_SIZ]);\r
-VOID InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);\r
-DWORD InputThread(LPVOID arg);\r
-DWORD NonOvlInputThread(LPVOID arg);\r
-DWORD SocketInputThread(LPVOID arg);\r
-BOOL ChangeColor(HWND hwnd, COLORREF *which);\r
-VOID ChangeBoardSize(BoardSize newSize);\r
-BOOL APIENTRY MyCreateFont(HWND hwnd, MyFont *font);\r
-VOID ErrorPopDown(VOID);\r
-VOID EnsureOnScreen(int *x, int *y);\r
-typedef char GetFunc(void *getClosure);\r
-VOID ParseArgs(GetFunc get, void *cl);\r
-HBITMAP \r
-DoLoadBitmap(HINSTANCE hinst, char *piece, int squareSize, char *suffix);\r
-COLORREF ParseColorName(char *name);\r
-void ParseAttribs(COLORREF *color, int *effects, char* argValue);\r
-VOID CreateFontInMF(MyFont *mf);\r
-VOID ChangedConsoleFont();\r
-VOID ParseFontName(char *name, MyFontParams *mfp);\r
-void InitComboStrings(HANDLE hwndCombo, char **cd);\r
-BOOLEAN MyLoadSound(MySound *ms);\r
-BOOLEAN MyPlaySound(MySound *ms);\r
-VOID ExitArgError(char *msg, char *badArg);\r
-\r
-/* Constants */\r
-\r
-#define CLOCK_FONT 0\r
-#define MESSAGE_FONT 1\r
-#define COORD_FONT 2\r
-#define CONSOLE_FONT 3\r
-#define COMMENT_FONT 4\r
-#define EDITTAGS_FONT 5\r
-#define MOVEHISTORY_FONT 6\r
-#define NUM_FONTS 7\r
-\r
-/* Positions of some menu items.  Origin is zero and separator lines count. */\r
-/* It's gross that these are needed. */\r
-#define ACTION_POS 2    /* Posn of "Action" on menu bar */\r
-#define OPTIONS_POS 4   /* Posn of "Options" on menu bar */\r
-#define ICS_POS 4       /* Posn of "ICS " on Options menu */\r
-#define SOUNDS_POS 6     /* Posn of "Sounds" on Options menu */\r
-/* end grossness */\r
-\r
-extern MyFont *font[NUM_SIZES][NUM_FONTS];\r
-\r
-#define WM_USER_Input                 (WM_USER + 4242)\r
-#define WM_USER_Mouseleave            (WM_USER + 4243)\r
-#define WM_USER_GetConsoleBackground  (WM_USER + 4244)\r
-\r
-#define CLOCK_TIMER_ID        51\r
-#define LOAD_GAME_TIMER_ID    52\r
-#define ANALYSIS_TIMER_ID     53\r
-#define MOUSE_TIMER_ID        54\r
-#define DELAYED_TIMER_ID      55\r
-\r
-#define SOLID_PIECE           0\r
-#define OUTLINE_PIECE         1\r
-#define WHITE_PIECE           2\r
-\r
-#define COPY_TMP "wbcopy.tmp"\r
-#define PASTE_TMP "wbpaste.tmp"\r
-\r
-/* [AS] Layout management */\r
-typedef struct {\r
-    Boolean visible;\r
-    int x;\r
-    int y;\r
-    int width;\r
-    int height;\r
-} WindowPlacement;\r
-\r
-VOID InitWindowPlacement( WindowPlacement * wp );\r
-\r
-VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp );\r
-\r
-VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, WindowPlacement * pwpChild );\r
+/*
+ * WinBoard.h -- Definitions for Windows NT front end to XBoard
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+ * Enhancements Copyright 1992-97 Free Software Foundation, Inc.
+ *
+ * The following terms apply to Digital Equipment Corporation's copyright
+ * interest in XBoard:
+ * ------------------------------------------------------------------------
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * ------------------------------------------------------------------------
+ *
+ * The following terms apply to the enhanced version of XBoard distributed
+ * by the Free Software Foundation:
+ * ------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ------------------------------------------------------------------------
+ */
+#include "resource.h"
+#include <dlgs.h>
+
+/* Types */
+typedef struct {
+  char faceName[LF_FACESIZE];
+  float pointSize;
+  BYTE bold, italic, underline, strikeout;
+} MyFontParams;
+
+typedef struct {
+  char *def;
+  MyFontParams mfp;
+  LOGFONT lf;
+  HFONT hf;
+} MyFont;
+
+typedef enum { 
+  SizeTiny, SizeTeeny, SizeDinky, SizePetite, SizeSlim, SizeSmall,
+  SizeMediocre, SizeMiddling, SizeAverage, SizeModerate, SizeMedium,
+  SizeBulky, SizeLarge, SizeBig, SizeHuge, SizeGiant, SizeColossal,
+  SizeTitanic, NUM_SIZES 
+} BoardSize;
+
+typedef struct {
+    COLORREF color;
+    int effects;
+    char *name;
+} MyColorizeAttribs;
+
+typedef struct {
+  char* name;
+  void* data;
+} MySound;
+
+typedef struct {
+    COLORREF color;
+    int effects;
+    MySound sound;
+} MyTextAttribs;
+
+/* Functions */
+
+BOOL InitApplication(HINSTANCE);
+BOOL InitInstance(HINSTANCE, int, LPSTR);
+LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK BoardSizeDlg(HWND, UINT, WPARAM, LPARAM);
+LRESULT CALLBACK ButtonProc(HWND, UINT, WPARAM, LPARAM);
+VOID InitAppData(LPSTR);
+VOID InitDrawingColors(VOID);
+VOID InitDrawingSizes(BoardSize boardSize, int flags);
+VOID InitMenuChecks(VOID);
+VOID ICSInitScript(VOID);
+BOOL CenterWindow(HWND hwndChild, HWND hwndParent);
+VOID ResizeEditPlusButtons(HWND hDlg, HWND hText, int sizeX, int sizeY, int newSizeX, int newSizeY);
+VOID PromotionPopup(HWND hwnd);
+FILE *OpenFileDialog(HWND hWnd, char *write, char *defName, char *defExt, 
+                    char *nameFilt, char *dlgTitle, UINT *number,
+                    char fileTitle[MSG_SIZ], char fileName[MSG_SIZ]);
+VOID InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+DWORD InputThread(LPVOID arg);
+DWORD NonOvlInputThread(LPVOID arg);
+DWORD SocketInputThread(LPVOID arg);
+BOOL ChangeColor(HWND hwnd, COLORREF *which);
+VOID ChangeBoardSize(BoardSize newSize);
+BOOL APIENTRY MyCreateFont(HWND hwnd, MyFont *font);
+VOID ErrorPopDown(VOID);
+VOID EnsureOnScreen(int *x, int *y);
+typedef char GetFunc(void *getClosure);
+VOID ParseArgs(GetFunc get, void *cl);
+HBITMAP 
+DoLoadBitmap(HINSTANCE hinst, char *piece, int squareSize, char *suffix);
+COLORREF ParseColorName(char *name);
+void ParseAttribs(COLORREF *color, int *effects, char* argValue);
+VOID CreateFontInMF(MyFont *mf);
+VOID ChangedConsoleFont();
+VOID ParseFontName(char *name, MyFontParams *mfp);
+void InitComboStrings(HANDLE hwndCombo, char **cd);
+BOOLEAN MyLoadSound(MySound *ms);
+BOOLEAN MyPlaySound(MySound *ms);
+VOID ExitArgError(char *msg, char *badArg);
+
+/* Constants */
+
+#define CLOCK_FONT 0
+#define MESSAGE_FONT 1
+#define COORD_FONT 2
+#define CONSOLE_FONT 3
+#define COMMENT_FONT 4
+#define EDITTAGS_FONT 5
+#define MOVEHISTORY_FONT 6
+#define NUM_FONTS 7
+
+/* Positions of some menu items.  Origin is zero and separator lines count. */
+/* It's gross that these are needed. */
+#define ACTION_POS 2    /* Posn of "Action" on menu bar */
+#define OPTIONS_POS 4   /* Posn of "Options" on menu bar */
+#define ICS_POS 4       /* Posn of "ICS " on Options menu */
+#define SOUNDS_POS 6     /* Posn of "Sounds" on Options menu */
+/* end grossness */
+
+extern MyFont *font[NUM_SIZES][NUM_FONTS];
+
+#define WM_USER_Input                 (WM_USER + 4242)
+#define WM_USER_Mouseleave            (WM_USER + 4243)
+#define WM_USER_GetConsoleBackground  (WM_USER + 4244)
+
+#define CLOCK_TIMER_ID        51
+#define LOAD_GAME_TIMER_ID    52
+#define ANALYSIS_TIMER_ID     53
+#define MOUSE_TIMER_ID        54
+#define DELAYED_TIMER_ID      55
+
+#define SOLID_PIECE           0
+#define OUTLINE_PIECE         1
+#define WHITE_PIECE           2
+
+#define COPY_TMP "wbcopy.tmp"
+#define PASTE_TMP "wbpaste.tmp"
+
+/* [AS] Layout management */
+typedef struct {
+    Boolean visible;
+    int x;
+    int y;
+    int width;
+    int height;
+} WindowPlacement;
+
+VOID InitWindowPlacement( WindowPlacement * wp );
+
+VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp );
+
+VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, WindowPlacement * pwpChild );
index 5e2eb0a..5b69f1c 100644 (file)
-;
-; WinBoard 4.2.7 Save Settings file
-;
-; You can edit the values of options that are already set in this file,
-; but if you add other options, the next Save Settings will not save them.
-; Use a shortcut, an @indirection file, or a .bat file instead.
-;
-/whitePieceColor=#ffffcc
-/blackPieceColor=#202020
-/lightSquareColor=#c8c365
-/darkSquareColor=#77a26d
-/highlightSquareColor=#ffff00
-/premoveHighlightColor=#ff0000
-/movesPerSession=40
-/timeDelay=1
-/timeControl="5"
-/timeIncrement=-1
-/saveGameFile=""
-/autoSaveGames=false
-/monoMode=false
-/showCoords=false
-/showThinking=false
-/ponderNextMove=true
-/periodicUpdates=true
-/popupExitMessage=true
-/popupMoveErrors=false
-/size=tiny /clockFont="Arial:9 b"
-/size=teeny /clockFont="Arial:9 b"
-/size=dinky /clockFont="Arial:10 b"
-/size=petite /clockFont="Arial:10 b"
-/size=slim /clockFont="Arial:12 b"
-/size=small /clockFont="Arial:14 b"
-/size=mediocre /clockFont="Arial:14 b"
-/size=middling /clockFont="Arial:14 b"
-/size=average /clockFont="Arial:15 b"
-/size=moderate /clockFont="Arial:16 b"
-/size=medium /clockFont="Arial:16 b"
-/size=bulky /clockFont="Arial:17 b"
-/size=large /clockFont="Arial:19 b"
-/size=big /clockFont="Arial:20 b"
-/size=huge /clockFont="Arial:21 b"
-/size=giant /clockFont="Arial:22 b"
-/size=colossal /clockFont="Arial:23 b"
-/size=titanic /clockFont="Arial:24 b"
-/size=tiny /messageFont="Small Fonts:6"
-/size=teeny /messageFont="Small Fonts:6"
-/size=dinky /messageFont="Small Fonts:7"
-/size=petite /messageFont="Small Fonts:7"
-/size=slim /messageFont="Arial:8 b"
-/size=small /messageFont="Arial:9 b"
-/size=mediocre /messageFont="Arial:9 b"
-/size=middling /messageFont="Arial:9 b"
-/size=average /messageFont="Arial:10 b"
-/size=moderate /messageFont="Arial:10 b"
-/size=medium /messageFont="Arial:10 b"
-/size=bulky /messageFont="Arial:10 b"
-/size=large /messageFont="Arial:10 b"
-/size=big /messageFont="Arial:11 b"
-/size=huge /messageFont="Arial:11 b"
-/size=giant /messageFont="Arial:11 b"
-/size=colossal /messageFont="Arial:12 b"
-/size=titanic /messageFont="Arial:12 b"
-/size=tiny /coordFont="Small Fonts:4"
-/size=teeny /coordFont="Small Fonts:4"
-/size=dinky /coordFont="Small Fonts:5"
-/size=petite /coordFont="Small Fonts:5"
-/size=slim /coordFont="Small Fonts:6"
-/size=small /coordFont="Small Fonts:7"
-/size=mediocre /coordFont="Small Fonts:7"
-/size=middling /coordFont="Small Fonts:7"
-/size=average /coordFont="Arial:7 b"
-/size=moderate /coordFont="Arial:7 b"
-/size=medium /coordFont="Arial:7 b"
-/size=bulky /coordFont="Arial:7 b"
-/size=large /coordFont="Arial:7 b"
-/size=big /coordFont="Arial:8 b"
-/size=huge /coordFont="Arial:8 b"
-/size=giant /coordFont="Arial:8 b"
-/size=colossal /coordFont="Arial:9 b"
-/size=titanic /coordFont="Arial:9 b"
-/size=tiny /tagsFont="Courier New:8"
-/size=teeny /tagsFont="Courier New:8"
-/size=dinky /tagsFont="Courier New:8"
-/size=petite /tagsFont="Courier New:8"
-/size=slim /tagsFont="Courier New:8"
-/size=small /tagsFont="Courier New:8"
-/size=mediocre /tagsFont="Courier New:8"
-/size=middling /tagsFont="Courier New:8"
-/size=average /tagsFont="Courier New:8"
-/size=moderate /tagsFont="Courier New:8"
-/size=medium /tagsFont="Courier New:8"
-/size=bulky /tagsFont="Courier New:8"
-/size=large /tagsFont="Courier New:8"
-/size=big /tagsFont="Courier New:8"
-/size=huge /tagsFont="Courier New:8"
-/size=giant /tagsFont="Courier New:8"
-/size=colossal /tagsFont="Courier New:8"
-/size=titanic /tagsFont="Courier New:8"
-/size=tiny /commentFont="Arial:9"
-/size=teeny /commentFont="Arial:9"
-/size=dinky /commentFont="Arial:9"
-/size=petite /commentFont="Arial:9"
-/size=slim /commentFont="Arial:9"
-/size=small /commentFont="Arial:9"
-/size=mediocre /commentFont="Arial:9"
-/size=middling /commentFont="Arial:9"
-/size=average /commentFont="Arial:9"
-/size=moderate /commentFont="Arial:9"
-/size=medium /commentFont="Arial:9"
-/size=bulky /commentFont="Arial:9"
-/size=large /commentFont="Arial:9"
-/size=big /commentFont="Arial:9"
-/size=huge /commentFont="Arial:9"
-/size=giant /commentFont="Arial:9"
-/size=colossal /commentFont="Arial:9"
-/size=titanic /commentFont="Arial:9"
-/size=tiny /icsFont="Courier New:8"
-/size=teeny /icsFont="Courier New:8"
-/size=dinky /icsFont="Courier New:8"
-/size=petite /icsFont="Courier New:8"
-/size=slim /icsFont="Courier New:8"
-/size=small /icsFont="Courier New:8"
-/size=mediocre /icsFont="Courier New:8"
-/size=middling /icsFont="Courier New:8"
-/size=average /icsFont="Courier New:8"
-/size=moderate /icsFont="Courier New:8"
-/size=medium /icsFont="Courier New:8"
-/size=bulky /icsFont="Courier New:8"
-/size=large /icsFont="Courier New:8"
-/size=big /icsFont="Courier New:8"
-/size=huge /icsFont="Courier New:8"
-/size=giant /icsFont="Courier New:8"
-/size=colossal /icsFont="Courier New:8"
-/size=titanic /icsFont="Courier New:8"
-/boardSize=giant
-/alwaysOnTop=false
-/autoCallFlag=false
-/autoComment=false
-/autoObserve=false
-/autoFlipView=true
-/autoRaiseBoard=true
-/alwaysPromoteToQueen=false
-/oldSaveStyle=false
-/quietPlay=false
-/getMoveList=true
-/testLegality=true
-/premove=true
-/premoveWhite=false
-/premoveWhiteText=""
-/premoveBlack=false
-/premoveBlackText=""
-/icsAlarm=true
-/icsAlarmTime=5000
-/animateMoving=true
-/animateSpeed=10
-/animateDragging=true
-/blindfold=false
-/highlightLastMove=true
-/highlightDragging=false
-/colorizeMessages=true
-/colorShout="#209000"
-/colorSShout="b #289808"
-/colorChannel1="#2020e0"
-/colorChannel="b #4040ff"
-/colorKibitz="b #ff00ff"
-/colorTell="b #ff0000"
-/colorChallenge="bi #ff0000"
-/colorRequest="bi #ff0000"
-/colorSeek="#980808"
-/colorNormal="#000000"
-/colorBackground=#ffffff
-/soundShout=""
-/soundSShout=""
-/soundChannel1=""
-/soundChannel=""
-/soundKibitz=""
-/soundTell=""
-/soundChallenge=""
-/soundRequest=""
-/soundSeek=""
-/soundMove=""
-/soundBell="$"
-/soundIcsWin=""
-/soundIcsLoss=""
-/soundIcsDraw=""
-/soundIcsUnfinished=""
-/soundIcsAlarm=""
-/comPortSettings=9600,7,Space,1,None
-/x=0
-/y=2
-/icsX=-2147483648
-/icsY=-2147483648
-/icsW=-2147483648
-/icsH=-2147483648
-/analysisX=-2147483648
-/analysisY=-2147483648
-/analysisW=-2147483648
-/analysisH=-2147483648
-/commentX=-2147483648
-/commentY=-2147483648
-/commentW=-2147483648
-/commentH=-2147483648
-/tagsX=-2147483648
-/tagsY=-2147483648
-/tagsW=-2147483648
-/tagsH=-2147483648
-/gameListX=-2147483648
-/gameListY=-2147483648
-/gameListW=-2147483648
-/gameListH=-2147483648
-/saveSettingsOnExit=true
-/icsMenu={-
-&Who,who,0,1
-Playe&rs,players,0,1
-&Games,games,0,1
-&Sought,sought,0,1
-|&Tell (name),tell,1,0
-M&essage (name),message,1,0
--
-&Finger (name),finger,1,1
-&Vars (name),vars,1,1
-&Observe (name),observe,1,1
-&Match (name),match,1,1
-Pl&ay (name),play,1,1
-}
-/icsNames={chessclub.com /icsport=5000 /icshelper=timestamp
-freechess.org /icsport=5000 /icshelper=timeseal
-global.chessparlor.com /icsport=6000 /icshelper=timeseal
-chessanytime.com /icsport=5000
-chess.net /icsport=5000
-zics.org /icsport=5000
-jogo.cex.org.br /icsport=5000
-ajedrez.cec.uchile.cl /icsport=5000
-fly.cc.fer.hr /icsport=7890
-freechess.nl /icsport=5000 /icshelper=timeseal
-jeu.echecs.com /icsport=5000
-chess.unix-ag.uni-kl.de /icsport=5000 /icshelper=timeseal
-chess.mds.mdh.se /icsport=5000
-}
-/firstChessProgramNames={GNUChess
-"GNUChes5 xboard"
-}
-/secondChessProgramNames={GNUChess
-"GNUChes5 xboard"
-}
-/showButtonBar=true
-/firstScoreAbs=false
-/secondScoreAbs=false
-/pgnExtendedInfo=false
-/hideThinkingFromHuman=false
-/liteBackTextureFile=""
-/darkBackTextureFile=""
-/liteBackTextureMode=1
-/darkBackTextureMode=1
-/renderPiecesWithFont=""
-/fontPieceToCharTable=""
-/fontPieceBackColorWhite=#000000
-/fontPieceForeColorWhite=#000000
-/fontPieceBackColorBlack=#000000
-/fontPieceForeColorBlack=#000000
-/fontPieceSize=80
-/overrideLineGap=1
-/adjudicateLossThreshold=0
-/delayBeforeQuit=0
-/delayAfterQuit=0
-/pgnEventHeader="Computer Chess Game"
+;\r
+; WinBoard 4.3.15k Save Settings file\r
+;\r
+; You can edit the values of options that are already set in this file,\r
+; but if you add other options, the next Save Settings will not save them.\r
+; Use a shortcut, an @indirection file, or a .bat file instead.\r
+;\r
+/whitePieceColor=#ffffcc\r
+/blackPieceColor=#202020\r
+/lightSquareColor=#c8c365\r
+/darkSquareColor=#77a26d\r
+/highlightSquareColor=#ffff00\r
+/premoveHighlightColor=#ff0000\r
+/movesPerSession=40\r
+/timeDelay=1\r
+/timeControl="5"\r
+/timeIncrement=-1\r
+/saveGameFile=""\r
+/autoSaveGames=false\r
+/monoMode=false\r
+/showCoords=false\r
+/showThinking=false\r
+/ponderNextMove=true\r
+/periodicUpdates=true\r
+/popupExitMessage=true\r
+/popupMoveErrors=false\r
+/size=tiny /clockFont="Arial:9 b"\r
+/size=teeny /clockFont="Arial:9 b"\r
+/size=dinky /clockFont="Arial:10 b"\r
+/size=petite /clockFont="Arial:10 b"\r
+/size=slim /clockFont="Arial:12 b"\r
+/size=small /clockFont="Arial:14 b"\r
+/size=mediocre /clockFont="Arial:14 b"\r
+/size=middling /clockFont="Arial:14 b"\r
+/size=average /clockFont="Arial:15 b"\r
+/size=moderate /clockFont="Arial:16 b"\r
+/size=medium /clockFont="Arial:16 b"\r
+/size=bulky /clockFont="Arial:17 b"\r
+/size=large /clockFont="Arial:19 b"\r
+/size=big /clockFont="Arial:20 b"\r
+/size=huge /clockFont="Arial:21 b"\r
+/size=giant /clockFont="Arial:22 b"\r
+/size=colossal /clockFont="Arial:23 b"\r
+/size=titanic /clockFont="Arial:24 b"\r
+/size=tiny /messageFont="Small Fonts:6"\r
+/size=teeny /messageFont="Small Fonts:6"\r
+/size=dinky /messageFont="Small Fonts:7"\r
+/size=petite /messageFont="Small Fonts:7"\r
+/size=slim /messageFont="Arial:8 b"\r
+/size=small /messageFont="Arial:9 b"\r
+/size=mediocre /messageFont="Arial:9 b"\r
+/size=middling /messageFont="Arial:9 b"\r
+/size=average /messageFont="Arial:10 b"\r
+/size=moderate /messageFont="Arial:10 b"\r
+/size=medium /messageFont="Arial:10 b"\r
+/size=bulky /messageFont="Arial:10 b"\r
+/size=large /messageFont="Arial:10 b"\r
+/size=big /messageFont="Arial:11 b"\r
+/size=huge /messageFont="Arial:11 b"\r
+/size=giant /messageFont="Arial:11 b"\r
+/size=colossal /messageFont="Arial:12 b"\r
+/size=titanic /messageFont="Arial:12 b"\r
+/size=tiny /coordFont="Small Fonts:4"\r
+/size=teeny /coordFont="Small Fonts:4"\r
+/size=dinky /coordFont="Small Fonts:5"\r
+/size=petite /coordFont="Small Fonts:5"\r
+/size=slim /coordFont="Small Fonts:6"\r
+/size=small /coordFont="Small Fonts:7"\r
+/size=mediocre /coordFont="Small Fonts:7"\r
+/size=middling /coordFont="Small Fonts:7"\r
+/size=average /coordFont="Arial:7 b"\r
+/size=moderate /coordFont="Arial:7 b"\r
+/size=medium /coordFont="Arial:7 b"\r
+/size=bulky /coordFont="Arial:7 b"\r
+/size=large /coordFont="Arial:7 b"\r
+/size=big /coordFont="Arial:8 b"\r
+/size=huge /coordFont="Arial:8 b"\r
+/size=giant /coordFont="Arial:8 b"\r
+/size=colossal /coordFont="Arial:9 b"\r
+/size=titanic /coordFont="Arial:9 b"\r
+/size=tiny /tagsFont="Courier New:8"\r
+/size=teeny /tagsFont="Courier New:8"\r
+/size=dinky /tagsFont="Courier New:8"\r
+/size=petite /tagsFont="Courier New:8"\r
+/size=slim /tagsFont="Courier New:8"\r
+/size=small /tagsFont="Courier New:8"\r
+/size=mediocre /tagsFont="Courier New:8"\r
+/size=middling /tagsFont="Courier New:8"\r
+/size=average /tagsFont="Courier New:8"\r
+/size=moderate /tagsFont="Courier New:8"\r
+/size=medium /tagsFont="Courier New:8"\r
+/size=bulky /tagsFont="Courier New:8"\r
+/size=large /tagsFont="Courier New:8"\r
+/size=big /tagsFont="Courier New:8"\r
+/size=huge /tagsFont="Courier New:8"\r
+/size=giant /tagsFont="Courier New:8"\r
+/size=colossal /tagsFont="Courier New:8"\r
+/size=titanic /tagsFont="Courier New:8"\r
+/size=tiny /commentFont="Arial:9"\r
+/size=teeny /commentFont="Arial:9"\r
+/size=dinky /commentFont="Arial:9"\r
+/size=petite /commentFont="Arial:9"\r
+/size=slim /commentFont="Arial:9"\r
+/size=small /commentFont="Arial:9"\r
+/size=mediocre /commentFont="Arial:9"\r
+/size=middling /commentFont="Arial:9"\r
+/size=average /commentFont="Arial:9"\r
+/size=moderate /commentFont="Arial:9"\r
+/size=medium /commentFont="Arial:9"\r
+/size=bulky /commentFont="Arial:9"\r
+/size=large /commentFont="Arial:9"\r
+/size=big /commentFont="Arial:9"\r
+/size=huge /commentFont="Arial:9"\r
+/size=giant /commentFont="Arial:9"\r
+/size=colossal /commentFont="Arial:9"\r
+/size=titanic /commentFont="Arial:9"\r
+/size=tiny /icsFont="Courier New:8"\r
+/size=teeny /icsFont="Courier New:8"\r
+/size=dinky /icsFont="Courier New:8"\r
+/size=petite /icsFont="Courier New:8"\r
+/size=slim /icsFont="Courier New:8"\r
+/size=small /icsFont="Courier New:8"\r
+/size=mediocre /icsFont="Courier New:8"\r
+/size=middling /icsFont="Courier New:8"\r
+/size=average /icsFont="Courier New:8"\r
+/size=moderate /icsFont="Courier New:8"\r
+/size=medium /icsFont="Courier New:8"\r
+/size=bulky /icsFont="Courier New:8"\r
+/size=large /icsFont="Courier New:8"\r
+/size=big /icsFont="Courier New:8"\r
+/size=huge /icsFont="Courier New:8"\r
+/size=giant /icsFont="Courier New:8"\r
+/size=colossal /icsFont="Courier New:8"\r
+/size=titanic /icsFont="Courier New:8"\r
+/size=tiny /moveHistoryFont="MS Sans Serif:8"\r
+/size=teeny /moveHistoryFont="MS Sans Serif:8"\r
+/size=dinky /moveHistoryFont="MS Sans Serif:8"\r
+/size=petite /moveHistoryFont="MS Sans Serif:8"\r
+/size=slim /moveHistoryFont="MS Sans Serif:8"\r
+/size=small /moveHistoryFont="MS Sans Serif:8"\r
+/size=mediocre /moveHistoryFont="MS Sans Serif:8"\r
+/size=middling /moveHistoryFont="MS Sans Serif:8"\r
+/size=average /moveHistoryFont="MS Sans Serif:8"\r
+/size=moderate /moveHistoryFont="MS Sans Serif:8"\r
+/size=medium /moveHistoryFont="MS Sans Serif:8"\r
+/size=bulky /moveHistoryFont="MS Sans Serif:8"\r
+/size=large /moveHistoryFont="MS Sans Serif:8"\r
+/size=big /moveHistoryFont="MS Sans Serif:8"\r
+/size=huge /moveHistoryFont="MS Sans Serif:8"\r
+/size=giant /moveHistoryFont="MS Sans Serif:8"\r
+/size=colossal /moveHistoryFont="MS Sans Serif:8"\r
+/size=titanic /moveHistoryFont="MS Sans Serif:8"\r
+/boardSize=bulky\r
+/alwaysOnTop=false\r
+/autoCallFlag=false\r
+/autoComment=false\r
+/autoObserve=false\r
+/autoFlipView=true\r
+/autoRaiseBoard=true\r
+/alwaysPromoteToQueen=false\r
+/oldSaveStyle=false\r
+/quietPlay=false\r
+/getMoveList=true\r
+/testLegality=true\r
+/premove=true\r
+/premoveWhite=false\r
+/premoveWhiteText=""\r
+/premoveBlack=false\r
+/premoveBlackText=""\r
+/icsAlarm=true\r
+/icsAlarmTime=5000\r
+/animateMoving=true\r
+/animateSpeed=10\r
+/animateDragging=true\r
+/blindfold=false\r
+/highlightLastMove=true\r
+/highlightDragging=false\r
+/colorizeMessages=true\r
+/colorShout="#209000"\r
+/colorSShout="b #289808"\r
+/colorChannel1="#2020e0"\r
+/colorChannel="b #4040ff"\r
+/colorKibitz="b #ff00ff"\r
+/colorTell="b #ff0000"\r
+/colorChallenge="bi #ff0000"\r
+/colorRequest="bi #ff0000"\r
+/colorSeek="#980808"\r
+/colorNormal="#000000"\r
+/colorBackground=#ffffff\r
+/soundShout=""\r
+/soundSShout=""\r
+/soundChannel1=""\r
+/soundChannel=""\r
+/soundKibitz=""\r
+/soundTell=""\r
+/soundChallenge=""\r
+/soundRequest=""\r
+/soundSeek=""\r
+/soundMove=""\r
+/soundBell="$"\r
+/soundIcsWin=""\r
+/soundIcsLoss=""\r
+/soundIcsDraw=""\r
+/soundIcsUnfinished=""\r
+/soundIcsAlarm=""\r
+/comPortSettings=9600,7,Space,1,None\r
+/x=10\r
+/y=30\r
+/icsX=-2147483648\r
+/icsY=-2147483648\r
+/icsW=-2147483648\r
+/icsH=-2147483648\r
+/analysisX=-2147483648\r
+/analysisY=-2147483648\r
+/analysisW=-2147483648\r
+/analysisH=-2147483648\r
+/commentX=-2147483648\r
+/commentY=-2147483648\r
+/commentW=-2147483648\r
+/commentH=-2147483648\r
+/tagsX=-2147483648\r
+/tagsY=-2147483648\r
+/tagsW=-2147483648\r
+/tagsH=-2147483648\r
+/gameListX=-2147483648\r
+/gameListY=-2147483648\r
+/gameListW=-2147483648\r
+/gameListH=-2147483648\r
+/saveSettingsOnExit=true\r
+/icsMenu={-\r
+&Who,who,0,1\r
+Playe&rs,players,0,1\r
+&Games,games,0,1\r
+&Sought,sought,0,1\r
+|&Tell (name),tell,1,0\r
+M&essage (name),message,1,0\r
+-\r
+&Finger (name),finger,1,1\r
+&Vars (name),vars,1,1\r
+&Observe (name),observe,1,1\r
+&Match (name),match,1,1\r
+Pl&ay (name),play,1,1\r
+}\r
+/icsNames={chessclub.com /icsport=5000 /icshelper=timestamp\r
+freechess.org /icsport=5000 /icshelper=timeseal\r
+global.chessparlor.com /icsport=6000 /icshelper=timeseal\r
+chessanytime.com /icsport=5000\r
+chess.net /icsport=5000\r
+zics.org /icsport=5000\r
+jogo.cex.org.br /icsport=5000\r
+ajedrez.cec.uchile.cl /icsport=5000\r
+fly.cc.fer.hr /icsport=7890\r
+freechess.nl /icsport=5000 /icshelper=timeseal\r
+jeu.echecs.com /icsport=5000\r
+chess.unix-ag.uni-kl.de /icsport=5000 /icshelper=timeseal\r
+chess.mds.mdh.se /icsport=5000\r
+}\r
+/firstChessProgramNames={GNUChess\r
+"GNUChes5 xboard"\r
+}\r
+/secondChessProgramNames={GNUChess\r
+"GNUChes5 xboard"\r
+}\r
+/showButtonBar=true\r
+/pgnExtendedInfo=false\r
+/hideThinkingFromHuman=false\r
+/liteBackTextureFile=""\r
+/darkBackTextureFile=""\r
+/liteBackTextureMode=1\r
+/darkBackTextureMode=1\r
+/renderPiecesWithFont=""\r
+/fontPieceToCharTable=""\r
+/fontPieceBackColorWhite=#000000\r
+/fontPieceForeColorWhite=#000000\r
+/fontPieceBackColorBlack=#000000\r
+/fontPieceForeColorBlack=#000000\r
+/fontPieceSize=80\r
+/overrideLineGap=1\r
+/adjudicateLossThreshold=0\r
+/delayBeforeQuit=0\r
+/delayAfterQuit=0\r
+/pgnEventHeader="Computer Chess Game"\r
+/defaultFrcPosition=-1\r
+/gameListTags="eprd"\r
+/saveOutOfBookInfo=true\r
+/showEvalInMoveHistory=true\r
+/evalHistColorWhite=#ffffb0\r
+/evalHistColorBlack=#ad5d3d\r
+/highlightMoveWithArrow=false\r
+/highlightArrowColor=#ffff80\r
+/stickyWindows=true\r
+/adjudicateDrawMoves=0\r
+/autoDisplayComment=true\r
+/autoDisplayTags=true\r
+/polyglotDir=""\r
+/usePolyglotBook=false\r
+/polyglotBook=""\r
+/defaultHashSize=64\r
+/defaultCacheSizeEGTB=4\r
+/defaultPathEGTB="c:\egtb"\r
+/moveHistoryUp=false\r
+/moveHistoryX=136\r
+/moveHistoryY=224\r
+/moveHistoryW=346\r
+/moveHistoryH=237\r
+/evalGraphUp=false\r
+/evalGraphX=136\r
+/evalGraphY=224\r
+/evalGraphW=332\r
+/evalGraphH=148\r
+/engineOutputUp=false\r
+/engineOutputX=136\r
+/engineOutputY=224\r
+/engineOutputW=407\r
+/engineOutputH=297\r
+/boardWidth=-1\r
+/boardHeight=-1\r
+/holdingsSize=-1\r
+/matchPause=10000\r
+/flipBlack=false\r
+/allWhite=false\r
+/testClaims=false\r
+/checkMates=false\r
+/materialDraws=false\r
+/trivialDraws=false\r
+/ruleMoves=51\r
+/repeatsToDraw=6\r
+/smpCores=1\r
+/egtFormats=""\r
+/timeOddsMode=0\r
index 9584a49..eb7ee05 100644 (file)
@@ -51,7 +51,7 @@ BEGIN
     LTEXT           "(""WinBoard_F"")",IDC_STATIC,88,4,71,8\r
 END\r
 \r
-DLG_TimeControl DIALOG DISCARDABLE  6, 18, 174, 98\r
+DLG_TimeControl DIALOG DISCARDABLE  6, 18, 174, 134\r
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Time Control"\r
 FONT 8, "MS Sans Serif"\r
@@ -68,8 +68,13 @@ BEGIN
     LTEXT           "minutes +",405,44,58,34,8,NOT WS_GROUP\r
     EDITTEXT        OPT_TCInc,78,56,26,12,ES_AUTOHSCROLL\r
     LTEXT           "seconds per move",408,108,58,62,8,NOT WS_GROUP\r
-    PUSHBUTTON      "OK",IDOK,64,80,50,14,WS_GROUP\r
-    PUSHBUTTON      "Cancel",IDCANCEL,120,80,50,14\r
+    LTEXT           "Time-Odds Factors:",IDC_STATIC,6,78,150,8,NOT WS_GROUP\r
+    EDITTEXT        OPT_TCOdds1,47,92,26,12,ES_AUTOHSCROLL | WS_GROUP\r
+    LTEXT           "Engine #1:",IDC_STATIC,6,94,41,8,NOT WS_GROUP\r
+    EDITTEXT        OPT_TCOdds2,124,92,26,12,ES_AUTOHSCROLL\r
+    LTEXT           "Engine #2:",IDC_STATIC,83,94,41,8,NOT WS_GROUP\r
+    PUSHBUTTON      "OK",IDOK,64,116,50,14,WS_GROUP\r
+    PUSHBUTTON      "Cancel",IDCANCEL,120,116,50,14\r
 END\r
 \r
 DLG_LoadOptions DIALOG DISCARDABLE  10, 18, 136, 55\r
@@ -191,10 +196,11 @@ BEGIN
     PUSHBUTTON      "&Rook",PB_Rook,49,23,40,14,NOT WS_TABSTOP\r
     PUSHBUTTON      "&Bishop",PB_Bishop,94,23,40,14,NOT WS_TABSTOP\r
     PUSHBUTTON      "K&night",PB_Knight,139,23,40,14,NOT WS_TABSTOP\r
-    PUSHBUTTON      "&King",PB_King,94,4,40,14,NOT WS_TABSTOP\r
+    PUSHBUTTON      "&King",PB_King,4,4,40,14,NOT WS_TABSTOP\r
     PUSHBUTTON      "&Cancel",IDCANCEL,139,4,40,14,WS_GROUP\r
     LTEXT           "      YES",IDC_Yes,6,25,36,10\r
     LTEXT           "       NO",IDC_No,141,25,36,10\r
+    LTEXT           "C&entaur",IDC_Centaur,12,6,25,10\r
 END\r
 \r
 ABOUTBOX2 DIALOG DISCARDABLE  22, 17, 281, 223\r
@@ -659,7 +665,7 @@ BEGIN
                     54,50,10\r
     CONTROL         "&Falcon",OPT_VariantFalcon,"Button",BS_AUTORADIOBUTTON,134,\r
                     64,50,10\r
-    CONTROL         "&3checks",OPT_Variant3Checks,"Button",BS_AUTORADIOBUTTON,134,\r
+    CONTROL         "su&per",OPT_VariantSuper,"Button",BS_AUTORADIOBUTTON,134,\r
                     74,50,10\r
     CONTROL         "&nocastle",OPT_VariantNocastle,"Button",BS_AUTORADIOBUTTON,134,\r
                     84,50,10\r
@@ -788,7 +794,7 @@ BEGIN
     ICON            IDI_TRANS_14,IDC_StateIcon2,164,84,20,20\r
 END\r
 \r
-DLG_EnginePlayOptions DIALOG DISCARDABLE  0, 0, 208, 177\r
+DLG_EnginePlayOptions DIALOG DISCARDABLE  0, 0, 208, 202\r
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\r
 CAPTION "Engine Options"\r
 FONT 8, "MS Sans Serif"\r
@@ -828,8 +834,14 @@ BEGIN
     LTEXT           "-move rule",IDC_STATIC,142,117,35,8\r
     EDITTEXT        IDC_DrawRepeats,120,130,20,14,ES_AUTOHSCROLL\r
     LTEXT           "-fold repeats",IDC_STATIC,142,134,50,8\r
-    DEFPUSHBUTTON   "OK",IDOK,98,160,50,14\r
-    PUSHBUTTON      "Cancel",IDCANCEL,154,160,50,14\r
+    CONTROL         "Engine #1 Score is Absolute",\r
+                    IDC_ScoreAbs1,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,10,156,120,10\r
+    CONTROL         "Engine #2 Score is Absolute",\r
+                    IDC_ScoreAbs2,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,10,168,120,10\r
+    DEFPUSHBUTTON   "OK",IDOK,98,185,50,14\r
+    PUSHBUTTON      "Cancel",IDCANCEL,154,185,50,14\r
 END\r
 \r
 DLG_OptionsUCI DIALOG DISCARDABLE  0, 0, 228, 124\r
@@ -851,6 +863,12 @@ BEGIN
                     WS_TABSTOP,2,80,49,10\r
     EDITTEXT        IDC_BookFile,62,76,140,14,ES_AUTOHSCROLL\r
     PUSHBUTTON      "...",IDC_BrowseForBook,206,76,17,14\r
+    LTEXT           "Max nr of CPUs:",IDC_STATIC,106,26,52,8\r
+    EDITTEXT        IDC_Cores,162,22,40,14,ES_AUTOHSCROLL\r
+    CONTROL         "First has Own Book",IDC_OwnBook1,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,2,94,100,10\r
+    CONTROL         "Second has Own Book",IDC_OwnBook2,"Button",BS_AUTOCHECKBOX | \r
+                    WS_TABSTOP,2,107,100,10\r
     DEFPUSHBUTTON   "OK",IDOK,118,106,50,14\r
     PUSHBUTTON      "Cancel",IDCANCEL,174,106,50,14\r
 END\r
@@ -1938,6 +1956,8 @@ SL58W                   BITMAP  MOVEABLE PURE   "shogibitmaps\\sl58w.bmp"
 SK58W                   BITMAP  MOVEABLE PURE   "shogibitmaps\\sk58w.bmp"\r
 SW58W                   BITMAP  MOVEABLE PURE   "shogibitmaps\\sw58w.bmp"\r
 \r
+KING45C                 BITMAP  MOVEABLE PURE   "shogibitmaps\\king.bmp"\r
+AMAZON50C               BITMAP  MOVEABLE PURE   "shogibitmaps\\bamazon.bmp"\r
 \r
 #ifdef APSTUDIO_INVOKED\r
 /////////////////////////////////////////////////////////////////////////////\r
index b2bbf0a..0941cce 100644 (file)
@@ -214,11 +214,17 @@ GeneralOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       appData.popupMoveErrors      = IS_CHECKED(OPT_PopupMoveErrors);\r
       appData.showButtonBar        = IS_CHECKED(OPT_ShowButtonBar);\r
       appData.showCoords           = IS_CHECKED(OPT_ShowCoordinates);\r
-      ShowThinkingEvent(             IS_CHECKED(OPT_ShowThinking));\r
-      appData.testLegality         = IS_CHECKED(OPT_TestLegality);\r
-      appData.hideThinkingFromHuman= IS_CHECKED(OPT_HideThinkFromHuman);\r
+      // [HGM] thinking: next three moved up\r
       appData.saveExtendedInfoInPGN= IS_CHECKED(OPT_SaveExtPGN);\r
+      appData.hideThinkingFromHuman= IS_CHECKED(OPT_HideThinkFromHuman);\r
       appData.showEvalInMoveHistory= IS_CHECKED(OPT_ExtraInfoInMoveHistory);\r
+#if 0\r
+      ShowThinkingEvent(             IS_CHECKED(OPT_ShowThinking));\r
+#else\r
+      appData.showThinking         = IS_CHECKED(OPT_ShowThinking);\r
+      ShowThinkingEvent(); // [HGM] thinking: tests four options\r
+#endif\r
+      appData.testLegality         = IS_CHECKED(OPT_TestLegality);\r
       appData.highlightMoveWithArrow=IS_CHECKED(OPT_HighlightMoveArrow);\r
 \r
 #undef IS_CHECKED\r
@@ -778,7 +784,7 @@ VariantWhichRadio(HWND hDlg)
          (IsDlgButtonChecked(hDlg, OPT_VariantCylinder) ? VariantCylinder :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantFalcon) ? VariantFalcon :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantCRC) ? VariantCapaRandom :\r
-         (IsDlgButtonChecked(hDlg, OPT_Variant3Checks) ? Variant3Check :\r
+         (IsDlgButtonChecked(hDlg, OPT_VariantSuper) ? VariantSuper :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantBerolina) ? VariantBerolina :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantJanus) ? VariantJanus :\r
          (IsDlgButtonChecked(hDlg, OPT_VariantWildcastle) ? VariantWildCastle :\r
@@ -859,7 +865,8 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       CheckDlgButton(hDlg, OPT_VariantCylinder, TRUE);\r
       break;\r
     case Variant3Check:\r
-      CheckDlgButton(hDlg, OPT_Variant3Checks, TRUE);\r
+    case VariantSuper:\r
+      CheckDlgButton(hDlg, OPT_VariantSuper, TRUE);\r
       break;\r
     case VariantBerolina:\r
       CheckDlgButton(hDlg, OPT_VariantBerolina, TRUE);\r
@@ -899,6 +906,18 @@ NewVariantDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
       EndDialog(hDlg, TRUE);\r
 \r
       v = VariantWhichRadio(hDlg);\r
+      if(!appData.noChessProgram) { char *name = VariantName(v), buf[MSG_SIZ];\r
+       if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) {\r
+           /* [HGM] in protocol 2 we check if variant is suported by engine */\r
+           sprintf(buf, "Variant %s not supported by %s", name, first.tidy);\r
+           DisplayError(buf, 0);\r
+           return TRUE; /* treat as "Cancel" if first engine does not support it */\r
+       } else\r
+       if (second.initDone && second.protocolVersion > 1 && StrStr(second.variants, name) == NULL) {\r
+           sprintf(buf, "Warning: second engine (%s) does not support this!", second.tidy);\r
+           DisplayError(buf, 0);   /* use of second engine is optional; only warn user */\r
+       }\r
+      }\r
 \r
       gameInfo.variant = v;\r
       appData.variant = VariantName(v);\r
@@ -2584,8 +2603,8 @@ LRESULT CALLBACK
 TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
   char buf[MSG_SIZ];\r
-  int mps, increment;\r
-  BOOL ok;\r
+  int mps, increment, odds1, odds2;\r
+  BOOL ok, ok2;\r
 \r
   switch (message) {\r
   case WM_INITDIALOG: /* message: initialize dialog box */\r
@@ -2609,6 +2628,8 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
        SetDlgItemText(hDlg, OPT_TCTime2, appData.timeControl);\r
        SetDlgItemInt(hDlg, OPT_TCInc, appData.timeIncrement, FALSE);\r
       }\r
+      SetDlgItemInt(hDlg, OPT_TCOdds1, 1, FALSE);\r
+      SetDlgItemInt(hDlg, OPT_TCOdds2, 1, FALSE);\r
       SetTimeControlEnables(hDlg);\r
     }\r
     return TRUE;\r
@@ -2646,9 +2667,18 @@ TimeControl(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
          return FALSE;\r
        }\r
       }\r
+      odds1 = GetDlgItemInt(hDlg, OPT_TCOdds1, &ok, FALSE);\r
+      odds2 = GetDlgItemInt(hDlg, OPT_TCOdds2, &ok2, FALSE);\r
+      if (!ok || !ok2 || odds1 <= 0 || odds2 <= 0) {\r
+         MessageBox(hDlg, "Invalid time-odds factor",\r
+                    "Option Error", MB_OK|MB_ICONEXCLAMATION);\r
+         return FALSE;\r
+      }\r
       appData.timeControl = strdup(buf);\r
       appData.movesPerSession = mps;\r
       appData.timeIncrement = increment;\r
+      appData.firstTimeOdds  = first.timeOdds  = odds1;\r
+      appData.secondTimeOdds = second.timeOdds = odds2;\r
       Reset(TRUE, TRUE);\r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r
@@ -2707,6 +2737,9 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
     CHECK_BOX(IDC_MaterialDraws, appData.materialDraws);\r
     CHECK_BOX(IDC_TrivialDraws, appData.trivialDraws);\r
 \r
+    CHECK_BOX(IDC_ScoreAbs1, appData.firstScoreIsAbsolute);\r
+    CHECK_BOX(IDC_ScoreAbs2, appData.secondScoreIsAbsolute);\r
+\r
     SetDlgItemInt( hDlg, IDC_EpDrawMoveCount, appData.adjudicateDrawMoves, TRUE );\r
     SendDlgItemMessage( hDlg, IDC_EpDrawMoveCount, EM_SETSEL, 0, -1 );\r
 \r
@@ -2727,8 +2760,13 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
       /* Read changed options from the dialog box */\r
       PeriodicUpdatesEvent(          IS_CHECKED(IDC_EpPeriodicUpdates));\r
       PonderNextMoveEvent(           IS_CHECKED(IDC_EpPonder));\r
+      appData.hideThinkingFromHuman= IS_CHECKED(IDC_EpHideThinkingHuman); // [HGM] thinking: moved up\r
+#if 0\r
       ShowThinkingEvent(             IS_CHECKED(IDC_EpShowThinking));\r
-      appData.hideThinkingFromHuman= IS_CHECKED(IDC_EpHideThinkingHuman);\r
+#else\r
+      appData.showThinking   = IS_CHECKED(IDC_EpShowThinking);\r
+      ShowThinkingEvent(); // [HGM] thinking: tests all options that need thinking output\r
+#endif\r
       appData.testClaims    = IS_CHECKED(IDC_TestClaims);\r
       appData.checkMates    = IS_CHECKED(IDC_DetectMates);\r
       appData.materialDraws = IS_CHECKED(IDC_MaterialDraws);\r
@@ -2739,6 +2777,9 @@ LRESULT CALLBACK EnginePlayOptionsDialog(HWND hDlg, UINT message, WPARAM wParam,
       appData.ruleMoves = GetDlgItemInt(hDlg, IDC_RuleMoves, NULL, FALSE );\r
       appData.drawRepeats = (int) GetDlgItemInt(hDlg, IDC_DrawRepeats, NULL, FALSE );\r
 \r
+      appData.firstScoreIsAbsolute  = IS_CHECKED(IDC_ScoreAbs1);\r
+      appData.secondScoreIsAbsolute = IS_CHECKED(IDC_ScoreAbs2);\r
+\r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r
 \r
@@ -2816,6 +2857,7 @@ static BOOL BrowseForFolder( const char * title, char * path )
 LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)\r
 {\r
   char buf[MAX_PATH];\r
+  int oldCores;\r
 \r
   switch (message) {\r
   case WM_INITDIALOG: /* message: initialize dialog box */\r
@@ -2830,6 +2872,11 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
     SetDlgItemInt( hDlg, IDC_SizeOfEGTB, appData.defaultCacheSizeEGTB, TRUE );\r
     CheckDlgButton( hDlg, IDC_UseBook, (BOOL) appData.usePolyglotBook );\r
     SetDlgItemText( hDlg, IDC_BookFile, appData.polyglotBook );\r
+    // [HGM] smp: input field for nr of cores:\r
+    SetDlgItemInt( hDlg, IDC_Cores, appData.smpCores, TRUE );\r
+    // [HGM] book: tick boxes for own book use\r
+    CheckDlgButton( hDlg, IDC_OwnBook1, (BOOL) appData.firstHasOwnBookUCI );\r
+    CheckDlgButton( hDlg, IDC_OwnBook2, (BOOL) appData.secondHasOwnBookUCI );\r
 \r
     SendDlgItemMessage( hDlg, IDC_PolyglotDir, EM_SETSEL, 0, -1 );\r
 \r
@@ -2847,7 +2894,15 @@ LRESULT CALLBACK UciOptionsDialog(HWND hDlg, UINT message, WPARAM wParam, LPARAM
       GetDlgItemText( hDlg, IDC_BookFile, buf, sizeof(buf) );\r
       appData.polyglotBook = strdup(buf);\r
       appData.usePolyglotBook = (Boolean) IsDlgButtonChecked( hDlg, IDC_UseBook );\r
-\r
+      // [HGM] smp: get nr of cores:\r
+      oldCores = appData.smpCores;\r
+      appData.smpCores = GetDlgItemInt(hDlg, IDC_Cores, NULL, FALSE );\r
+      if(appData.smpCores != oldCores) NewSettingEvent(FALSE, "cores", appData.smpCores);\r
+      // [HGM] book: read tick boxes for own book use\r
+      appData.firstHasOwnBookUCI  = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook1 );\r
+      appData.secondHasOwnBookUCI = (Boolean) IsDlgButtonChecked( hDlg, IDC_OwnBook2 );\r
+\r
+      if(gameMode == BeginningOfGame) Reset(TRUE, TRUE);\r
       EndDialog(hDlg, TRUE);\r
       return TRUE;\r
 \r
index ca74313..54718f3 100644 (file)
--- a/xboard.c
+++ b/xboard.c
@@ -192,7 +192,13 @@ extern char *getenv();
 #include "childio.h"\r
 #include "xgamelist.h"\r
 #include "xhistory.h"\r
-#include "xedittags.h"\r
+#include "xedittags.h"
+
+// must be moved to xengineoutput.h
+void EngineOutputProc P((Widget w, XEvent *event,
+                       String *prms, Cardinal *nprms));
+void EngineOutputPopDown();\r
+\r
 \r
 #ifdef __EMX__\r
 #ifndef HAVE_USLEEP\r
@@ -385,6 +391,8 @@ void ShowCoordsProc P((Widget w, XEvent *event, String *prms,
                       Cardinal *nprms));\r
 void ShowThinkingProc P((Widget w, XEvent *event, String *prms,\r
                         Cardinal *nprms));\r
+void HideThinkingProc P((Widget w, XEvent *event, String *prms,\r
+                        Cardinal *nprms));\r
 void TestLegalityProc P((Widget w, XEvent *event, String *prms,\r
                          Cardinal *nprms));\r
 void InfoProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
@@ -409,7 +417,17 @@ static void DragPieceMove P((int x, int y));
 static void DragPieceEnd P((int x, int y));\r
 static void DrawDragPiece P((void));\r
 char *ModeToWidgetName P((GameMode mode));\r
-\r
+void EngineOutputUpdate( FrontEndProgramStats * stats );\r
+void ShuffleMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
+void EngineMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
+void UciMenuProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
+void TimeControlProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
+void NewVariantProc P((Widget w, XEvent *event, String *prms, Cardinal *nprms));\r
+void ShufflePopDown P(());\r
+void EnginePopDown P(());\r
+void UciPopDown P(());\r
+void TimeControlPopDown P(());\r
+void NewVariantPopDown P(());\r
 /*\r
 * XBoard depends on Xt R4 or higher\r
 */\r
@@ -422,7 +440,7 @@ Pixel lightSquareColor, darkSquareColor, whitePieceColor, blackPieceColor,
   jailSquareColor, highlightSquareColor, premoveHighlightColor;\r
 GC lightSquareGC, darkSquareGC, jailSquareGC, lineGC, wdPieceGC, wlPieceGC,\r
   bdPieceGC, blPieceGC, wbPieceGC, bwPieceGC, coordGC, highlineGC,\r
-  wjPieceGC, bjPieceGC, prelineGC;\r
+  wjPieceGC, bjPieceGC, prelineGC, countGC;\r
 Pixmap iconPixmap, wIconPixmap, bIconPixmap, xMarkPixmap;\r
 Widget shellWidget, layoutWidget, formWidget, boardWidget, messageWidget, \r
   whiteTimerWidget, blackTimerWidget, titleWidget, widgetList[16], \r
@@ -431,19 +449,21 @@ Widget shellWidget, layoutWidget, formWidget, boardWidget, messageWidget,
   ICSInputShell, fileNameShell, askQuestionShell;\r
 XSegment gridSegments[(BOARD_SIZE + 1) * 2];\r
 XSegment jailGridSegments[(BOARD_SIZE + 3) * 2];\r
-Font clockFontID, coordFontID;\r
-XFontStruct *clockFontStruct, *coordFontStruct;\r
+Font clockFontID, coordFontID, countFontID;\r
+XFontStruct *clockFontStruct, *coordFontStruct, *countFontStruct;\r
 XtAppContext appContext;\r
 char *layoutName;\r
 char *oldICSInteractionTitle;\r
 \r
 FileProc fileProc;\r
-char *fileOpenMode;\r
+char *fileOpenMode;
+char installDir[] = "."; // [HGM] UCI: needed for UCI; probably needs run-time initializtion\r
 \r
 Position commentX = -1, commentY = -1;\r
 Dimension commentW, commentH;\r
 \r
-int squareSize, smallLayout = 0, tinyLayout = 0,\r
+int squareSize, smallLayout = 0, tinyLayout = 0,
+  marginW, marginH, // [HGM] for run-time resizing\r
   fromX = -1, fromY = -1, toX, toY, commentUp = False, analysisUp = False,\r
   ICSInputBoxUp = False, askQuestionUp = False,\r
   filenameUp = False, promotionUp = False, pmFromX = -1, pmFromY = -1,\r
@@ -501,7 +521,9 @@ static Pixmap xpmMask[BlackKing + 1];
 SizeDefaults sizeDefaults[] = SIZE_DEFAULTS;\r
 \r
 MenuItem fileMenu[] = {\r
-    {"Reset Game", ResetProc},\r
+    {"New Game", ResetProc},\r
+    {"New Shuffle Game ...", ShuffleMenuProc},\r
+    {"New Variant ...", NewVariantProc},      // [HGM] variant: not functional yet\r
     {"----", NothingProc},\r
     {"Load Game", LoadGameProc},\r
     {"Load Next Game", LoadNextGameProc},\r
@@ -539,8 +561,11 @@ MenuItem modeMenu[] = {
     {"Edit Position", EditPositionProc},\r
     {"Training", TrainingProc},\r
     {"----", NothingProc},\r
+    {"Show Engine Output", EngineOutputProc},\r
+    {"Show Evaluation Graph", NothingProc}, // [HGM] evalgr: not functional yet\r
     {"Show Game List", ShowGameListProc},\r
-    {"Show Move List", HistoryShowProc},\r
+    {"Show Move History", HistoryShowProc}, // [HGM] hist: activate 4.2.7 code\r
+    {"----", NothingProc},\r
     {"Edit Tags", EditTagsProc},\r
     {"Edit Comment", EditCommentProc},\r
     {"ICS Input Box", IcsInputBoxProc},\r
@@ -577,7 +602,13 @@ MenuItem stepMenu[] = {
     {NULL, NULL}\r
 };    \r
 \r
-MenuItem optionsMenu[] = {\r
+MenuItem optionsMenu[] = {
+    {"Flip View", FlipViewProc},\r
+    {"----", NothingProc},    \r
+    {"Adjudications ...", EngineMenuProc},    \r
+    {"Engine Settings ...", UciMenuProc},    \r
+    {"Time Control ...", TimeControlProc},    \r
+    {"----", NothingProc},    \r
     {"Always Queen", AlwaysQueenProc},\r
     {"Animate Dragging", AnimateDraggingProc},\r
     {"Animate Moving", AnimateMovingProc},\r
@@ -589,7 +620,6 @@ MenuItem optionsMenu[] = {
     {"Auto Save", AutosaveProc},\r
     {"Blindfold", BlindfoldProc},\r
     {"Flash Moves", FlashMovesProc},\r
-    {"Flip View", FlipViewProc},\r
     {"Get Move List", GetMoveListProc},\r
 #if HIGHDRAG\r
     {"Highlight Dragging", HighlightDraggingProc},\r
@@ -605,7 +635,7 @@ MenuItem optionsMenu[] = {
     {"Premove", PremoveProc},\r
     {"Quiet Play", QuietPlayProc},\r
     {"Show Coords", ShowCoordsProc},\r
-    {"Show Thinking", ShowThinkingProc},\r
+    {"Hide Thinking", HideThinkingProc},\r
     {"Test Legality", TestLegalityProc},\r
     {NULL, NULL}\r
 };\r
@@ -777,9 +807,9 @@ XtResource clientResources[] = {
     { "secondHost", "secondHost", XtRString, sizeof(String),\r
        XtOffset(AppDataPtr, secondHost), XtRString, SECOND_HOST },\r
     { "firstDirectory", "firstDirectory", XtRString, sizeof(String),\r
-       XtOffset(AppDataPtr, firstDirectory), XtRString, FIRST_DIRECTORY },\r
+       XtOffset(AppDataPtr, firstDirectory), XtRString, "." },\r
     { "secondDirectory", "secondDirectory", XtRString, sizeof(String),\r
-       XtOffset(AppDataPtr, secondDirectory), XtRString, SECOND_DIRECTORY },\r
+       XtOffset(AppDataPtr, secondDirectory), XtRString, "." },\r
     { "bitmapDirectory", "bitmapDirectory", XtRString,\r
        sizeof(String), XtOffset(AppDataPtr, bitmapDirectory),\r
        XtRString, "" },\r
@@ -892,7 +922,7 @@ XtResource clientResources[] = {
        (XtPointer) 0 },\r
     { "showThinking", "showThinking", XtRBoolean, sizeof(Boolean),\r
        XtOffset(AppDataPtr, showThinking), XtRImmediate,\r
-       (XtPointer) False },\r
+       (XtPointer) True },\r
     { "ponderNextMove", "ponderNextMove", XtRBoolean, sizeof(Boolean),\r
        XtOffset(AppDataPtr, ponderNextMove), XtRImmediate,\r
        (XtPointer) True },\r
@@ -1149,16 +1179,16 @@ XtResource clientResources[] = {
        XtRImmediate, (XtPointer) False },\r
     { "hideThinkingFromHuman", "hideThinkingFromHuman", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, hideThinkingFromHuman),\r
-       XtRImmediate, (XtPointer) False },\r
+       XtRImmediate, (XtPointer) True },\r
     { "adjudicateLossThreshold", "adjudicateLossThreshold", XtRInt,\r
        sizeof(int), XtOffset(AppDataPtr, adjudicateLossThreshold),\r
        XtRImmediate, (XtPointer) 0},\r
     { "pgnEventHeader", "pgnEventHeader", XtRString,\r
         sizeof(String), XtOffset(AppDataPtr, pgnEventHeader),\r
        XtRImmediate, (XtPointer) "Computer Chess Game" },    \r
-    { "defaultFrcPosition", "defaultFrcPosition", XtRInt,\r
-        sizeof(int), XtOffset(AppDataPtr, defaultFrcPosition),\r
-       XtRImmediate, (XtPointer) -1 },    \r
+    { "defaultFrcPosition", "defaultFrcPositon", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, defaultFrcPosition),\r
+       XtRImmediate, (XtPointer) -1},\r
 \r
     // [HGM] 4.3.xx options\r
     { "boardWidth", "boardWidth", XtRInt,\r
@@ -1187,13 +1217,13 @@ XtResource clientResources[] = {
        XtRImmediate, (XtPointer) False},\r
     { "testClaims", "testClaims", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, testClaims),\r
-       XtRImmediate, (XtPointer) False},\r
+       XtRImmediate, (XtPointer) True},\r
     { "checkMates", "checkMates", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, checkMates),\r
-       XtRImmediate, (XtPointer) False},\r
+       XtRImmediate, (XtPointer) True},\r
     { "materialDraws", "materialDraws", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, materialDraws),\r
-       XtRImmediate, (XtPointer) False},\r
+       XtRImmediate, (XtPointer) True},\r
     { "trivialDraws", "trivialDraws", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, trivialDraws),\r
        XtRImmediate, (XtPointer) False},\r
@@ -1241,7 +1271,54 @@ XtResource clientResources[] = {
        XtRImmediate, (XtPointer) 0},\r
     { "suppressLoadMoves", "suppressLoadMoves", XtRBoolean,\r
        sizeof(Boolean), XtOffset(AppDataPtr, suppressLoadMoves),\r
+       XtRImmediate, (XtPointer) False},
+    { "userName", "userName", XtRString,\r
+       sizeof(String), XtOffset(AppDataPtr, userName),\r
+       XtRImmediate, (XtPointer) 0},\r
+    { "egtFormats", "egtFormats", XtRString,\r
+       sizeof(String), XtOffset(AppDataPtr, egtFormats),\r
+       XtRImmediate, (XtPointer) 0},\r
+    { "rewindIndex", "rewindIndex", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, rewindIndex),\r
+       XtRImmediate, (XtPointer) 0},\r
+    { "sameColorGames", "sameColorGames", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, sameColorGames),\r
+       XtRImmediate, (XtPointer) 0},\r
+    { "smpCores", "smpCores", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, smpCores),\r
+       XtRImmediate, (XtPointer) 1},\r
+
+    // [HGM] Winboard_x UCI options\r
+    { "firstIsUCI", "firstIsUCI", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, firstIsUCI),\r
+       XtRImmediate, (XtPointer) False},\r
+    { "secondIsUCI", "secondIsUCI", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, secondIsUCI),\r
        XtRImmediate, (XtPointer) False},\r
+    { "firstHasOwnBookUCI", "firstHasOwnBookUCI", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, firstHasOwnBookUCI),\r
+       XtRImmediate, (XtPointer) True},\r
+    { "secondHasOwnBookUCI", "secondHasOwnBookUCI", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, secondHasOwnBookUCI),\r
+       XtRImmediate, (XtPointer) True},\r
+    { "usePolyglotBook", "usePolyglotBook", XtRBoolean,\r
+       sizeof(Boolean), XtOffset(AppDataPtr, usePolyglotBook),\r
+       XtRImmediate, (XtPointer) False},\r
+    { "defaultHashSize", "defaultHashSize", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, defaultHashSize),\r
+       XtRImmediate, (XtPointer) 64},\r
+    { "defaultCacheSizeEGTB", "defaultCacheSizeEGTB", XtRInt,\r
+       sizeof(int), XtOffset(AppDataPtr, defaultCacheSizeEGTB),\r
+       XtRImmediate, (XtPointer) 4},\r
+    { "polyglotDir", "polyglotDir", XtRString,\r
+        sizeof(String), XtOffset(AppDataPtr, polyglotDir),\r
+       XtRImmediate, (XtPointer) "." },\r
+    { "polyglotBook", "polyglotBook", XtRString,\r
+        sizeof(String), XtOffset(AppDataPtr, polyglotBook),\r
+       XtRImmediate, (XtPointer) "" },    \r
+    { "defaultPathEGTB", "defaultPathEGTB", XtRString,\r
+       sizeof(String), XtOffset(AppDataPtr, defaultPathEGTB),\r
+       XtRImmediate, (XtPointer) "/usr/local/share/egtb"},\r
 };\r
 \r
 XrmOptionDescRec shellOptions[] = {\r
@@ -1539,6 +1616,20 @@ XrmOptionDescRec shellOptions[] = {
     { "-hideThinkingFromHuman", "hideThinkingFromHuman", XrmoptionSepArg, NULL },\r
     { "-adjudicateLossThreshold", "adjudicateLossThreshold", XrmoptionSepArg, NULL },\r
     { "-pgnEventHeader", "pgnEventHeader", XrmoptionSepArg, NULL },\r
+    { "-firstIsUCI", "firstIsUCI", XrmoptionSepArg, NULL },\r
+    { "-secondIsUCI", "secondIsUCI", XrmoptionSepArg, NULL },\r
+    { "-fUCI", "firstIsUCI", XrmoptionNoArg, "True" },\r
+    { "-sUCI", "secondIsUCI", XrmoptionNoArg, "True" },\r
+    { "-firstHasOwnBookUCI", "firstHasOwnBookUCI", XrmoptionSepArg, NULL },\r
+    { "-secondHasOwnBookUCI", "secondHasOwnBookUCI", XrmoptionSepArg, NULL },\r
+    { "-fNoOwnBookUCI", "firstHasOwnBookUCI", XrmoptionNoArg, "False" },\r
+    { "-sNoOwnBookUCI", "secondHasOwnBookUCI", XrmoptionNoArg, "False" },\r
+    { "-polyglotDir", "polyglotDir", XrmoptionSepArg, NULL },\r
+    { "-usePolyglotBook", "usePolyglotBook", XrmoptionSepArg, NULL },\r
+    { "-polyglotBook", "polyglotBook", XrmoptionSepArg, NULL },\r
+    { "-defaultHashSize", "defaultHashSize", XrmoptionSepArg, NULL },\r
+    { "-defaultCacheSizeEGTB", "defaultCacheSizeEGTB", XrmoptionSepArg, NULL },\r
+    { "-defaultPathEGTB", "defaultPathEGTB", XrmoptionSepArg, NULL },\r
     { "-defaultFrcPosition", "defaultFrcPosition", XrmoptionSepArg, NULL },\r
     // [HGM] I am sure AS added many more options, but we have to fish them out, from the list in winboard.c\r
 \r
@@ -1572,6 +1663,11 @@ XrmOptionDescRec shellOptions[] = {
     { "-serverMoves", "serverMoves", XrmoptionSepArg, NULL }, \r
     { "-serverPause", "serverPause", XrmoptionSepArg, NULL }, \r
     { "-suppressLoadMoves", "suppressLoadMoves", XrmoptionSepArg, NULL }, \r
+    { "-egtFormats", "egtFormats", XrmoptionSepArg, NULL }, \r
+    { "-userName", "userName", XrmoptionSepArg, NULL }, \r
+    { "-smpCores", "smpCores", XrmoptionSepArg, NULL }, \r
+    { "-sameColorGames", "sameColorGames", XrmoptionSepArg, NULL }, \r
+    { "-rewindIndex", "rewindIndex", XrmoptionSepArg, NULL }, \r
 };\r
 \r
 \r
@@ -1614,6 +1710,7 @@ XtActionsRec boardActions[] = {
     { "EditGameProc", EditGameProc },\r
     { "EditPositionProc", EditPositionProc },\r
     { "TrainingProc", EditPositionProc },\r
+    { "EngineOutputProc", EngineOutputProc}, // [HGM] Winboard_x engine-output window\r
     { "ShowGameListProc", ShowGameListProc },\r
     { "ShowMoveListProc", HistoryShowProc},\r
     { "EditTagsProc", EditCommentProc },\r
@@ -1667,6 +1764,7 @@ XtActionsRec boardActions[] = {
     { "QuietPlayProc", QuietPlayProc },\r
     { "ShowCoordsProc", ShowCoordsProc },\r
     { "ShowThinkingProc", ShowThinkingProc },\r
+    { "HideThinkingProc", HideThinkingProc },\r
     { "TestLegalityProc", TestLegalityProc },\r
     { "InfoProc", InfoProc },\r
     { "ManProc", ManProc },\r
@@ -1687,6 +1785,12 @@ XtActionsRec boardActions[] = {
     { "GameListPopDown", (XtActionProc) GameListPopDown },\r
     { "PromotionPopDown", (XtActionProc) PromotionPopDown },\r
     { "HistoryPopDown", (XtActionProc) HistoryPopDown },\r
+    { "EngineOutputPopDown", (XtActionProc) EngineOutputPopDown },\r
+    { "ShufflePopDown", (XtActionProc) ShufflePopDown },\r
+    { "EnginePopDown", (XtActionProc) EnginePopDown },\r
+    { "UciPopDown", (XtActionProc) UciPopDown },\r
+    { "TimeControlPopDown", (XtActionProc) TimeControlPopDown },\r
+    { "NewVariantPopDown", (XtActionProc) NewVariantPopDown },\r
 };\r
      \r
 char globalTranslations[] =\r
@@ -1977,10 +2081,76 @@ BoardToTop()
 \r
 #ifdef IDSIZES\r
   // eventually, all layout determining code should go into a subroutine, but until then IDSIZE remains undefined\r
-#else\r
+#else
+#define BoardSize int\r
 void InitDrawingSizes(BoardSize boardSize, int flags)\r
-{ // [HGM] Dummy routine to be able to link with backend files from 4.3.xx, which call it\r
-  ;\r
+{   // [HGM] resize is functional now, but for board format changes only (nr of ranks, files)\r
+    Dimension timerWidth, boardWidth, boardHeight, w, h, sep, bor, wr, hr;
+    Arg args[16];
+    XtGeometryResult gres;\r
+    int i;
+
+    if(!formWidget) return;\r
+
+    /*\r
+     * Enable shell resizing.\r
+     */\r
+    shellArgs[0].value = (XtArgVal) &w;\r
+    shellArgs[1].value = (XtArgVal) &h;\r
+    XtGetValues(shellWidget, shellArgs, 2);\r
+
+    shellArgs[4].value = 2*w; shellArgs[2].value = 10;\r
+    shellArgs[5].value = 2*h; shellArgs[3].value = 10;\r
+    XtSetValues(shellWidget, &shellArgs[2], 4);
+\r
+    XtSetArg(args[0], XtNdefaultDistance, &sep);\r    XtGetValues(formWidget, args, 1);
+\r
+    boardWidth = lineGap + BOARD_WIDTH * (squareSize + lineGap);\r
+    boardHeight = lineGap + BOARD_HEIGHT * (squareSize + lineGap);
+    CreateGrid();\r
+
+    XtSetArg(args[0], XtNwidth, boardWidth);\r
+    XtSetArg(args[1], XtNheight, boardHeight);\r
+    XtSetValues(boardWidget, args, 2);\r
+\r
+    timerWidth = (boardWidth - sep) / 2;\r
+    XtSetArg(args[0], XtNwidth, timerWidth);\r
+    XtSetValues(whiteTimerWidget, args, 1);\r
+    XtSetValues(blackTimerWidget, args, 1);\r
+\r
+    XawFormDoLayout(formWidget, False);\r
+
+    if (appData.titleInWindow) {\r
+       i = 0;\r
+       XtSetArg(args[i], XtNborderWidth, &bor); i++;\r
+       XtSetArg(args[i], XtNheight, &h);  i++;\r
+       XtGetValues(titleWidget, args, i);\r
+       if (smallLayout) {\r
+           w = boardWidth - 2*bor;\r
+       } else {\r
+           XtSetArg(args[0], XtNwidth, &w);\r
+           XtGetValues(menuBarWidget, args, 1);\r
+           w = boardWidth - w - sep - 2*bor - 2; // WIDTH_FUDGE\r
+       }\r
+\r
+       gres = XtMakeResizeRequest(titleWidget, w, h, &wr, &hr);\r
+       if (gres != XtGeometryYes && appData.debugMode) {\r
+           fprintf(stderr,\r
+                   "%s: titleWidget geometry error %d %d %d %d %d\n",\r
+                   programName, gres, w, h, wr, hr);\r
+       }\r
+    }\r
+\r
+    XawFormDoLayout(formWidget, True);\r
+
+    /*\r
+     * Inhibit shell resizing.\r
+     */
+    shellArgs[0].value = w = (XtArgVal) boardWidth + marginW;\r
+    shellArgs[1].value = h = (XtArgVal) boardHeight + marginH;\r
+    shellArgs[4].value = shellArgs[2].value = w;\r
+    shellArgs[5].value = shellArgs[3].value = h;\r
+    XtSetValues(shellWidget, &shellArgs[0], 6);\r
 }\r
 #endif\r
 \r
@@ -1997,7 +2167,51 @@ main(argc, argv)
     XtGeometryResult gres;\r
     char *p;\r
     XrmDatabase xdb;\r
-    int forceMono = False;\r
+    int forceMono = False;
+#define INDIRECTION\r
+#ifdef INDIRECTION
+    // [HGM] before anything else, expand any indirection files amongst options
+    char *argvCopy[1000]; // 1000 seems enough
+    char newArgs[10000];  // holds actual characters
+    int k = 0;
+
+    srandom(time(0)); // [HGM] book: make random truly random
+
+    j = 0;
+    for(i=0; i<argc; i++) {
+       if(j >= 1000-2) { printf("too many arguments\n"); exit(-1); }
+//fprintf(stderr, "arg %s\n", argv[i]);
+       if(argv[i][0] != '@') argvCopy[j++] = argv[i]; else {
+           char c;
+           FILE *f = fopen(argv[i]+1, "rb");
+           if(f == NULL) { fprintf(stderr, "ignore %s\n", argv[i]); continue; } // do not expand non-existing
+           argvCopy[j++] = newArgs + k; // get ready for first argument from file
+           while((c = fgetc(f)) != EOF) { // each line of file inserts 1 argument in the list
+               if(c == '\n') {
+                   if(j >= 1000-2) { printf("too many arguments\n"); exit(-1); }
+                   newArgs[k++] = 0;  // terminate current arg
+                   if(k >= 10000-1) { printf("too long arguments\n"); exit(-1); }
+                   argvCopy[j++] = newArgs + k; // get ready for next
+               } else {
+                   if(k >= 10000-1) { printf("too long arguments\n"); exit(-1); }
+                   newArgs[k++] = c;
+               }
+           }
+           newArgs[k] = 0;
+           j--;
+           fclose(f);
+       }
+    }
+    argvCopy[j] = NULL;
+    argv = argvCopy;
+    argc = j;
+#if 0
+    if(appData.debugMode,1) { // OK, appData is not initialized here yet...
+       for(i=0; i<argc; i++) fprintf(stderr, "argv[%2d] = '%s'\n", i, argv[i]);
+    }
+#endif
+#endif
+
 \r
     setbuf(stdout, NULL);\r
     setbuf(stderr, NULL);\r
@@ -2046,9 +2260,6 @@ main(argc, argv)
        appData.NrRanks > BOARD_SIZE   )\r
         DisplayFatalError("Recompile with BOARD_SIZE > 12, to support this size", 0, 2);\r
 \r
-    /* [HGM] The following line must be moved to the "New Shuffle Game" menu as soon as there is one! */\r
-    if(appData.defaultFrcPosition != -1) shuffleOpenings = TRUE;\r
-\r
 #if !HIGHDRAG\r
     /* This feature does not work; animation needs a rewrite */\r
     appData.highlightDragging = FALSE;\r
@@ -2180,6 +2391,9 @@ main(argc, argv)
     coordFontID = XLoadFont(xDisplay, appData.coordFont);\r
     coordFontStruct = XQueryFont(xDisplay, coordFontID);\r
     appData.font = FindFont(appData.font, fontPxlSize);\r
+    countFontID = XLoadFont(xDisplay, appData.coordFont); // [HGM] holdings\r
+    countFontStruct = XQueryFont(xDisplay, countFontID);\r
+//    appData.font = FindFont(appData.font, fontPxlSize);\r
 \r
     xdb = XtDatabase(xDisplay);\r
     XrmPutStringResource(&xdb, "*font", appData.font);\r
@@ -2314,36 +2528,54 @@ main(argc, argv)
                            formArgs, XtNumber(formArgs));\r
     XtSetArg(args[0], XtNdefaultDistance, &sep);\r
     XtGetValues(formWidget, args, 1);\r
-    \r
+\r
     j = 0;\r
     widgetList[j++] = menuBarWidget = CreateMenuBar(menuBar);\r
+    XtSetArg(args[0], XtNtop,    XtChainTop);\r
+    XtSetArg(args[1], XtNbottom, XtChainTop);
+    XtSetValues(menuBarWidget, args, 2);\r
 \r
     widgetList[j++] = whiteTimerWidget =\r
       XtCreateWidget("whiteTime", labelWidgetClass,\r
                     formWidget, timerArgs, XtNumber(timerArgs));\r
     XtSetArg(args[0], XtNfont, clockFontStruct);\r
-    XtSetValues(whiteTimerWidget, args, 1);\r
+    XtSetArg(args[1], XtNtop,    XtChainTop);\r
+    XtSetArg(args[2], XtNbottom, XtChainTop);
+    XtSetValues(whiteTimerWidget, args, 3);\r
     \r
     widgetList[j++] = blackTimerWidget =\r
       XtCreateWidget("blackTime", labelWidgetClass,\r
                     formWidget, timerArgs, XtNumber(timerArgs));\r
     XtSetArg(args[0], XtNfont, clockFontStruct);\r
-    XtSetValues(blackTimerWidget, args, 1);\r
+    XtSetArg(args[1], XtNtop,    XtChainTop);\r
+    XtSetArg(args[2], XtNbottom, XtChainTop);
+    XtSetValues(blackTimerWidget, args, 3);\r
     \r
     if (appData.titleInWindow) {\r
        widgetList[j++] = titleWidget = \r
          XtCreateWidget("title", labelWidgetClass, formWidget,\r
                         titleArgs, XtNumber(titleArgs));\r
+       XtSetArg(args[0], XtNtop,    XtChainTop);\r
+       XtSetArg(args[1], XtNbottom, XtChainTop);
+       XtSetValues(titleWidget, args, 2);\r
     }\r
 \r
     if (appData.showButtonBar) {\r
       widgetList[j++] = buttonBarWidget = CreateButtonBar(buttonBar);\r
+      XtSetArg(args[0], XtNleft,  XtChainRight); // [HGM] glue to right window edge\r
+      XtSetArg(args[1], XtNright, XtChainRight); //       for good run-time sizing
+      XtSetArg(args[2], XtNtop,    XtChainTop);\r
+      XtSetArg(args[3], XtNbottom, XtChainTop);
+      XtSetValues(buttonBarWidget, args, 4);\r
     }\r
 \r
     widgetList[j++] = messageWidget =\r
       XtCreateWidget("message", labelWidgetClass, formWidget,\r
-                    messageArgs, XtNumber(messageArgs));\r
-    \r
+                    messageArgs, XtNumber(messageArgs));
+    XtSetArg(args[0], XtNtop,    XtChainTop);\r
+    XtSetArg(args[1], XtNbottom, XtChainTop);
+    XtSetValues(messageWidget, args, 2);\r
+\r
     widgetList[j++] = boardWidget =\r
       XtCreateWidget("board", widgetClass, formWidget, boardArgs,\r
                     XtNumber(boardArgs));\r
@@ -2438,7 +2670,11 @@ main(argc, argv)
     }\r
     i = 0;\r
     XtSetArg(args[0], XtNfromVert, messageWidget);\r
-    XtSetValues(boardWidget, args, 1);\r
+    XtSetArg(args[1], XtNtop,    XtChainTop);\r
+    XtSetArg(args[2], XtNbottom, XtChainBottom);
+    XtSetArg(args[3], XtNleft,   XtChainLeft);\r
+    XtSetArg(args[4], XtNright,  XtChainRight);
+    XtSetValues(boardWidget, args, 5);\r
 \r
     XtRealizeWidget(shellWidget);\r
 \r
@@ -2448,6 +2684,7 @@ main(argc, argv)
      * The value "2" is probably larger than needed.\r
      */\r
     XawFormDoLayout(formWidget, False);\r
+
 #define WIDTH_FUDGE 2\r
     i = 0;\r
     XtSetArg(args[i], XtNborderWidth, &bor);  i++;\r
@@ -2478,6 +2715,9 @@ main(argc, argv)
              programName, gres, w, h, wr, hr);\r
     }\r
     /* !! end hack */\r
+    XtSetArg(args[0], XtNleft,  XtChainLeft);  // [HGM] glue ends for good run-time sizing\r
+    XtSetArg(args[1], XtNright, XtChainRight);
+    XtSetValues(messageWidget, args, 2);\r
 \r
     if (appData.titleInWindow) {\r
        i = 0;\r
@@ -2623,8 +2863,8 @@ main(argc, argv)
        XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Coords"),\r
                    args, 1);\r
     }\r
-    if (appData.showThinking) {\r
-       XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Thinking"),\r
+    if (appData.hideThinkingFromHuman) {\r
+       XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Hide Thinking"),\r
                    args, 1);\r
     }\r
     if (appData.testLegality) {\r
@@ -2659,8 +2899,10 @@ main(argc, argv)
     XtGetValues(shellWidget, shellArgs, 2);\r
     shellArgs[4].value = shellArgs[2].value = w;\r
     shellArgs[5].value = shellArgs[3].value = h;\r
-    XtSetValues(shellWidget, &shellArgs[2], 4);\r
-    \r
+    XtSetValues(shellWidget, &shellArgs[2], 4);
+    marginW =  w - boardWidth; // [HGM] needed to set new shellWidget size when we resize board\r
+    marginH =  h - boardHeight;\r
+\r
     CatchDeleteWindow(shellWidget, "QuitProc");\r
 \r
     CreateGCs();\r
@@ -2830,7 +3072,7 @@ Enables icsEnables[] = {
     { "menuHelp.Book", False },\r
     { "menuStep.Move Now", False },\r
     { "menuOptions.Periodic Updates", False }, \r
-    { "menuOptions.Show Thinking", False },\r
+    { "menuOptions.Hide Thinking", False },\r
     { "menuOptions.Ponder Next Move", False },\r
 #endif\r
     { NULL, False }\r
@@ -2859,7 +3101,7 @@ Enables ncpEnables[] = {
     { "menuOptions.ICS Alarm", False },\r
     { "menuOptions.Move Sound", False },\r
     { "menuOptions.Quiet Play", False },\r
-    { "menuOptions.Show Thinking", False },\r
+    { "menuOptions.Hide Thinking", False },\r
     { "menuOptions.Periodic Updates", False }, \r
     { "menuOptions.Ponder Next Move", False },\r
     { "menuHelp.Hint", False },\r
@@ -3121,6 +3363,12 @@ void CreateGCs()
     coordGC = XtGetGC(shellWidget, value_mask, &gc_values);\r
     XSetFont(xDisplay, coordGC, coordFontID);\r
     \r
+    // [HGM] make font for holdings counts (white on black0
+    gc_values.foreground = XWhitePixel(xDisplay, xScreen);\r
+    gc_values.background = XBlackPixel(xDisplay, xScreen);\r
+    countGC = XtGetGC(shellWidget, value_mask, &gc_values);\r
+    XSetFont(xDisplay, countGC, countFontID);\r
+    \r
     if (appData.monoMode) {\r
        gc_values.foreground = XWhitePixel(xDisplay, xScreen);\r
        gc_values.background = XWhitePixel(xDisplay, xScreen);\r
@@ -4207,20 +4455,20 @@ static int SquareColor(row, column)
 \r
     if (gameInfo.variant == VariantXiangqi) {\r
         if (column >= 3 && column <= 5 && row >= 0 && row <= 2) {\r
-            square_color = 0;\r
-        } else if (column >= 3 && column <= 5 && row >= 7 && row <= 9) {\r
             square_color = 1;\r
+        } else if (column >= 3 && column <= 5 && row >= 7 && row <= 9) {\r
+            square_color = 0;\r
         } else if (row <= 4) {\r
-            square_color = 1;\r
-        } else {\r
             square_color = 0;\r
+        } else {\r
+            square_color = 1;\r
         }\r
     } else {\r
         square_color = ((column + row) % 2) == 1;\r
     }\r
 \r
     /* [hgm] holdings: next line makes all holdings squares light */\r
-    if(column < BOARD_LEFT || column >= BOARD_RGHT) square_color = 0;\r
+    if(column < BOARD_LEFT || column >= BOARD_RGHT) square_color = 1;\r
  \r
     return square_color;\r
 }\r
@@ -4236,6 +4484,17 @@ void DrawSquare(row, column, piece, do_flash)
     DrawFunc drawfunc;\r
     int flash_delay;\r
 \r
+    if(gameInfo.variant == VariantShogi) { // [HGM] shogi: in shogi Q is used for Lance
+       if(piece == WhiteQueen) piece = WhiteLance; else
+       if(piece == BlackQueen) piece = BlackLance;
+    }
+#ifdef GOTHIC
+    else if(gameInfo.variant == VariantGothic) { // [HGM] shogi: in Gothic Chancelor has alternative look
+       if(piece == WhiteMarshall) piece = WhiteSilver; else
+       if(piece == BlackMarshall) piece = BlackSilver;
+    }
+#endif
+
     /* Calculate delay in milliseconds (2-delays per complete flash) */\r
     flash_delay = 500 / appData.flashRate;\r
        \r
@@ -4251,11 +4510,40 @@ void DrawSquare(row, column, piece, do_flash)
   \r
     square_color = SquareColor(row, column);\r
     \r
-    if ( // [HGM] holdings: next 5 lines blank out area between board and holdings\r
+    if ( // [HGM] holdings: blank out area between board and holdings\r
                  column == BOARD_LEFT-1 ||  column == BOARD_RGHT\r
               || (column == BOARD_LEFT-2 && row < BOARD_HEIGHT-gameInfo.holdingsSize)\r
                  || (column == BOARD_RGHT+1 && row >= gameInfo.holdingsSize) ) {\r
-                       BlankSquare(x, y, 2, EmptySquare, xBoardWindow);\r
+                       BlankSquare(x, y, 2, EmptySquare, xBoardWindow);
+\r
+                       // [HGM] print piece counts next to holdings
+                       string[1] = NULLCHAR;\r
+                       if (column == (flipView ? BOARD_LEFT-1 : BOARD_RGHT) && piece > 1 ) {\r
+                           string[0] = '0' + piece;\r
+                           XTextExtents(countFontStruct, string, 1, &direction, \r
+                                &font_ascent, &font_descent, &overall);\r
+                           if (appData.monoMode) {\r
+                               XDrawImageString(xDisplay, xBoardWindow, countGC,\r
+                                                x + squareSize - overall.width - 2, \r
+                                                y + font_ascent + 1, string, 1);\r
+                           } else {\r
+                               XDrawString(xDisplay, xBoardWindow, countGC,\r
+                                           x + squareSize - overall.width - 2, \r
+                                           y + font_ascent + 1, string, 1);\r
+                           }\r
+                       }\r
+                       if (column == (flipView ? BOARD_RGHT : BOARD_LEFT-1) && piece > 1) {\r
+                           string[0] = '0' + piece;\r
+                           XTextExtents(countFontStruct, string, 1, &direction, \r
+                                        &font_ascent, &font_descent, &overall);\r
+                           if (appData.monoMode) {\r
+                               XDrawImageString(xDisplay, xBoardWindow, countGC,\r
+                                                x + 2, y + font_ascent + 1, string, 1);\r
+                           } else {\r
+                               XDrawString(xDisplay, xBoardWindow, countGC,\r
+                                           x + 2, y + font_ascent + 1, string, 1);\r
+                           }       \r
+                       }   \r
     } else {\r
            if (piece == EmptySquare || appData.blindfold) {\r
                        BlankSquare(x, y, square_color, piece, xBoardWindow);\r
@@ -4278,8 +4566,9 @@ void DrawSquare(row, column, piece, do_flash)
        }\r
        \r
     string[1] = NULLCHAR;\r
-    if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)) {\r
-       string[0] = 'a' + column;\r
+    if (appData.showCoords && row == (flipView ? BOARD_HEIGHT-1 : 0)
+               && column >= BOARD_LEFT && column < BOARD_RGHT) {\r
+       string[0] = 'a' + column - BOARD_LEFT;\r
        XTextExtents(coordFontStruct, string, 1, &direction, \r
                     &font_ascent, &font_descent, &overall);\r
        if (appData.monoMode) {\r
@@ -4292,7 +4581,7 @@ void DrawSquare(row, column, piece, do_flash)
                        y + squareSize - font_descent - 1, string, 1);\r
        }\r
     }\r
-    if (appData.showCoords && column == (flipView ? BOARD_WIDTH-1 : 0)) {\r
+    if (appData.showCoords && column == (flipView ? BOARD_RGHT-1 : BOARD_LEFT)) {\r
        string[0] = ONE + row;\r
        XTextExtents(coordFontStruct, string, 1, &direction, \r
                     &font_ascent, &font_descent, &overall);\r
@@ -4469,7 +4758,7 @@ void XDrawPosition(w, repaint, board)
     } else {\r
        if (lineGap > 0)\r
          XDrawSegments(xDisplay, xBoardWindow, lineGC,\r
-                       gridSegments, (BOARD_SIZE + 1) * 2);\r
+                       gridSegments, BOARD_HEIGHT + BOARD_WIDTH + 2);\r
        \r
        for (i = 0; i < BOARD_HEIGHT; i++)\r
          for (j = 0; j < BOARD_WIDTH; j++) {\r
@@ -6820,14 +7109,37 @@ void ShowThinkingProc(w, event, prms, nprms)
 {\r
     Arg args[16];\r
 \r
-    ShowThinkingEvent(!appData.showThinking);\r
-\r
+    appData.showThinking = !appData.showThinking; // [HGM] thinking: tken out of ShowThinkingEvent
+    ShowThinkingEvent();\r
+#if 0
+    // [HGM] thinking: currently no suc menu item; replaced by Hide Thinking (From Human)\r
     if (appData.showThinking) {\r
        XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);\r
     } else {\r
        XtSetArg(args[0], XtNleftBitmap, None);\r
     }\r
     XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Show Thinking"),\r
+               args, 1);
+#endif\r
+}\r
+\r
+void HideThinkingProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+    Arg args[16];\r
+\r
+    appData.hideThinkingFromHuman = !appData.hideThinkingFromHuman; // [HGM] thinking: tken out of ShowThinkingEvent
+    ShowThinkingEvent();\r
+\r
+    if (appData.hideThinkingFromHuman) {\r
+       XtSetArg(args[0], XtNleftBitmap, xMarkPixmap);\r
+    } else {\r
+       XtSetArg(args[0], XtNleftBitmap, None);\r
+    }\r
+    XtSetValues(XtNameToWidget(menuBarWidget, "menuOptions.Hide Thinking"),\r
                args, 1);\r
 }\r
 \r
@@ -6889,10 +7201,12 @@ void AboutProc(w, event, prms, nprms)
 #else\r
     char *zippy = "";\r
 #endif\r
-    sprintf(buf, "%s%s\n\n%s\n%s\n\n%s%s\n%s",\r
+    sprintf(buf, "%s%s\n\n%s\n%s\n%s\n%s\n\n%s%s\n%s",\r
            programVersion, zippy,\r
            "Copyright 1991 Digital Equipment Corporation",\r
-           "Enhancements Copyright 1992-2001 Free Software Foundation",\r
+           "Enhancements Copyright 1992-2001 Free Software Foundation",
+           "Enhancements Copyright 2005 Alessandro Scotti",\r
+           "Enhancements Copyright 2007-2008 H.G.Muller",\r
            PRODUCT, " is free software and carries NO WARRANTY;",\r
            "see the file COPYING for more information.");\r
     ErrorPopUp("About XBoard", buf, FALSE);\r
@@ -6981,6 +7295,17 @@ void DisplayTitle(text)
     } else if (appData.cmailGameName[0] != NULLCHAR) {\r
        sprintf(icon, "%s", "CMail");\r
        sprintf(title, "%s: %s", programName, "CMail");\r
+#ifdef GOTHIC
+    // [HGM] license: This stuff should really be done in back-end, but WinBoard already had a pop-up for it
+    } else if (gameInfo.variant == VariantGothic) {\r
+       strcpy(icon, programName);\r
+       strcpy(title, GOTHIC);\r
+#endif
+#ifdef FALCON
+    } else if (gameInfo.variant == VariantFalcon) {\r
+       strcpy(icon, programName);\r
+       strcpy(title, FALCON);\r
+#endif
     } else if (appData.noChessProgram) {\r
        strcpy(icon, programName);\r
        strcpy(title, programName);\r
@@ -7658,14 +7983,16 @@ int StartChildProcess(cmdLine, dir, pr)
     SetUpChildIO(to_prog, from_prog);\r
 \r
     if ((pid = fork()) == 0) {\r
-       /* Child process */\r
-       dup2(to_prog[0], 0);\r
-       dup2(from_prog[1], 1);\r
-       close(to_prog[0]);\r
-       close(to_prog[1]);\r
+       /* Child process */
+       // [HGM] PSWBTM: made order resistant against case where fd of created pipe was 0 or 1\r
+       close(to_prog[1]);     // first close the unused pipe ends\r
        close(from_prog[0]);\r
-       close(from_prog[1]);\r
-       dup2(1, fileno(stderr)); /* force stderr to the pipe */\r
+       dup2(to_prog[0], 0);   // to_prog was created first, nd is the only one to use 0 or 1\r
+       dup2(from_prog[1], 1);\r
+       if(to_prog[0] >= 2) close(to_prog[0]); // if 0 or 1, the dup2 already cosed the original\r
+       close(from_prog[1]);                   // and closing again loses one of the pipes!\r
+       if(fileno(stderr) >= 2) // better safe than sorry...
+               dup2(1, fileno(stderr)); /* force stderr to the pipe */\r
 \r
        if (dir[0] != NULLCHAR && chdir(dir) != 0) {\r
            perror(dir);\r
@@ -8727,5 +9054,7 @@ DrawDragPiece ()
 void\r
 SetProgramStats( FrontEndProgramStats * stats )\r
 {\r
-  // [HR] TODO\r
+  // [HR] TODO
+  // [HGM] done, but perhaps backend should call this directly?\r
+    EngineOutputUpdate( stats );\r
 }\r
index 03e2d5c..88b463b 100644 (file)
--- a/xboard.h
+++ b/xboard.h
-/*\r
- * xboard.h -- Parameter definitions for X front end\r
- * $Id: xboard.h,v 2.1 2003/10/27 19:21:00 mann Exp $\r
- *\r
- * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.\r
- * Enhancements Copyright 1992-95 Free Software Foundation, Inc.\r
- *\r
- * The following terms apply to Digital Equipment Corporation's copyright\r
- * interest in XBoard:\r
- * ------------------------------------------------------------------------\r
- * All Rights Reserved\r
- *\r
- * Permission to use, copy, modify, and distribute this software and its\r
- * documentation for any purpose and without fee is hereby granted,\r
- * provided that the above copyright notice appear in all copies and that\r
- * both that copyright notice and this permission notice appear in\r
- * supporting documentation, and that the name of Digital not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission.\r
- *\r
- * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING\r
- * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL\r
- * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR\r
- * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,\r
- * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\r
- * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- * ------------------------------------------------------------------------\r
- *\r
- * The following terms apply to the enhanced version of XBoard distributed\r
- * by the Free Software Foundation:\r
- * ------------------------------------------------------------------------\r
- * This program is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * This program is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with this program; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
- * ------------------------------------------------------------------------\r
- */\r
-\r
-#include <stdio.h>\r
-\r
-#define ICS_LOGON    ".icsrc"\r
-#define INFOFILE     "xboard.info"\r
-#define MANPAGE      "xboard.6"\r
-#define CLOCK_FONT   "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*"\r
-#define COORD_FONT   "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*"\r
-#define DEFAULT_FONT "-*-helvetica-medium-r-normal--*-*-*-*-*-*-*-*"\r
-#define COLOR_SHOUT             "green"\r
-#define COLOR_SSHOUT            "green,black,1"\r
-#define COLOR_CHANNEL1          "cyan"\r
-#define COLOR_CHANNEL           "cyan,black,1"\r
-#define COLOR_KIBITZ            "magenta,black,1"\r
-#define COLOR_TELL              "yellow,black,1"\r
-#define COLOR_CHALLENGE         "red,black,1"\r
-#define COLOR_REQUEST           "red"\r
-#define COLOR_SEEK              "blue"\r
-#define COLOR_NORMAL            "default"\r
-\r
-typedef struct {\r
-    char *name;\r
-    int squareSize;\r
-    int lineGap;\r
-    int clockFontPxlSize;\r
-    int coordFontPxlSize;\r
-    int fontPxlSize;\r
-    int smallLayout;\r
-    int tinyLayout;\r
-    int minScreenSize;\r
-} SizeDefaults;\r
-\r
-#define SIZE_DEFAULTS \\r
-{ { "Titanic",  129, 4, 34, 14, 14, 0, 0, 1200 }, \\r
-  { "Colossal", 116, 4, 34, 14, 14, 0, 0, 1200 }, \\r
-  { "Giant",    108, 3, 34, 14, 14, 0, 0, 1024 }, \\r
-  { "Huge",     95, 3, 34, 14, 14, 0, 0, 1024 }, \\r
-  { "Big",      87, 3, 34, 14, 14, 0, 0, 864 }, \\r
-  { "Large",    80, 3, 34, 14, 14, 0, 0, 864 }, \\r
-  { "Bulky",    72, 3, 34, 12, 14, 0, 0, 864 }, \\r
-  { "Medium",   64, 3, 34, 12, 14, 0, 0, 768 }, \\r
-  { "Moderate", 58, 3, 34, 12, 14, 0, 0, 768 }, \\r
-  { "Average",  54, 2, 30, 11, 12, 0, 0, 600 }, \\r
-  { "Middling", 49, 2, 24, 10, 12, 0, 0, 600 }, \\r
-  { "Mediocre", 45, 2, 20, 10, 12, 1, 0, 600 }, \\r
-  { "Small",    40, 2, 20, 10, 12, 1, 0, 480 }, \\r
-  { "Slim",     37, 2, 20, 10, 12, 1, 0, 480 }, \\r
-  { "Petite",   33, 1, 15, 9,  11, 1, 0, 480 }, \\r
-  { "Dinky",    29, 1, 15, 9,  11, 1, 0, 480 }, \\r
-  { "Teeny",    25, 1, 12, 8,  11, 1, 1, 480 }, \\r
-  { "Tiny",     21, 1, 12, 8,  11, 1, 1, 0 }, \\r
-  { NULL, 0, 0, 0, 0, 0, 0 } }\r
-\r
-#define BORDER_X_OFFSET 3\r
-#define BORDER_Y_OFFSET 27\r
-#define FIRST_CHESS_PROGRAM    "./fmax"\r
-#define SECOND_CHESS_PROGRAM   "./fmax"\r
-#define FIRST_DIRECTORY                "./Fairy-Max"\r
-#define SECOND_DIRECTORY       "./Fairy-Max"\r
-\r
-/* Default to no flashing (the "usual" XBoard behavior) */\r
-#define FLASH_COUNT    0               /* Number of times to flash */\r
-#define FLASH_RATE     5               /* Flashes per second */\r
-\r
-/* Default delay per character (in msec) while sending login script */\r
-#define MS_LOGIN_DELAY  0\r
-\r
-typedef int (*FileProc) P((FILE *f, int n, char *title));\r
-void CatchDeleteWindow(Widget w, String procname);\r
-\r
-#define TOPLEVEL 1 /* preference item; 1 = make popup windows toplevel */\r
-\r
+/*
+ * xboard.h -- Parameter definitions for X front end
+ * $Id: xboard.h,v 2.1 2003/10/27 19:21:00 mann Exp $
+ *
+ * Copyright 1991 by Digital Equipment Corporation, Maynard, Massachusetts.
+ * Enhancements Copyright 1992-95 Free Software Foundation, Inc.
+ *
+ * The following terms apply to Digital Equipment Corporation's copyright
+ * interest in XBoard:
+ * ------------------------------------------------------------------------
+ * All Rights Reserved
+ *
+ * Permission to use, copy, modify, and distribute this software and its
+ * documentation for any purpose and without fee is hereby granted,
+ * provided that the above copyright notice appear in all copies and that
+ * both that copyright notice and this permission notice appear in
+ * supporting documentation, and that the name of Digital not be
+ * used in advertising or publicity pertaining to distribution of the
+ * software without specific, written prior permission.
+ *
+ * DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
+ * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
+ * DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ * ------------------------------------------------------------------------
+ *
+ * The following terms apply to the enhanced version of XBoard distributed
+ * by the Free Software Foundation:
+ * ------------------------------------------------------------------------
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * ------------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+
+#define ICS_LOGON    ".icsrc"
+#define INFOFILE     "xboard.info"
+#define MANPAGE      "xboard.6"
+#define CLOCK_FONT   "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*"
+#define COORD_FONT   "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*"
+#define DEFAULT_FONT "-*-helvetica-medium-r-normal--*-*-*-*-*-*-*-*"
+#define COLOR_SHOUT             "green"
+#define COLOR_SSHOUT            "green,black,1"
+#define COLOR_CHANNEL1          "cyan"
+#define COLOR_CHANNEL           "cyan,black,1"
+#define COLOR_KIBITZ            "magenta,black,1"
+#define COLOR_TELL              "yellow,black,1"
+#define COLOR_CHALLENGE         "red,black,1"
+#define COLOR_REQUEST           "red"
+#define COLOR_SEEK              "blue"
+#define COLOR_NORMAL            "default"
+
+typedef struct {
+    char *name;
+    int squareSize;
+    int lineGap;
+    int clockFontPxlSize;
+    int coordFontPxlSize;
+    int fontPxlSize;
+    int smallLayout;
+    int tinyLayout;
+    int minScreenSize;
+} SizeDefaults;
+
+#define SIZE_DEFAULTS \
+{ { "Titanic",  129, 4, 34, 14, 14, 0, 0, 1200 }, \
+  { "Colossal", 116, 4, 34, 14, 14, 0, 0, 1200 }, \
+  { "Giant",    108, 3, 34, 14, 14, 0, 0, 1024 }, \
+  { "Huge",     95, 3, 34, 14, 14, 0, 0, 1024 }, \
+  { "Big",      87, 3, 34, 14, 14, 0, 0, 864 }, \
+  { "Large",    80, 3, 34, 14, 14, 0, 0, 864 }, \
+  { "Bulky",    72, 3, 34, 12, 14, 0, 0, 864 }, \
+  { "Medium",   64, 3, 34, 12, 14, 0, 0, 768 }, \
+  { "Moderate", 58, 3, 34, 12, 14, 0, 0, 768 }, \
+  { "Average",  54, 2, 30, 11, 12, 0, 0, 600 }, \
+  { "Middling", 49, 2, 24, 10, 12, 0, 0, 600 }, \
+  { "Mediocre", 45, 2, 20, 10, 12, 1, 0, 600 }, \
+  { "Small",    40, 2, 20, 10, 12, 1, 0, 480 }, \
+  { "Slim",     37, 2, 20, 10, 12, 1, 0, 480 }, \
+  { "Petite",   33, 1, 15, 9,  11, 1, 0, 480 }, \
+  { "Dinky",    29, 1, 15, 9,  11, 1, 0, 480 }, \
+  { "Teeny",    25, 1, 12, 8,  11, 1, 1, 480 }, \
+  { "Tiny",     21, 1, 12, 8,  11, 1, 1, 0 }, \
+  { NULL, 0, 0, 0, 0, 0, 0 } }
+
+#define BORDER_X_OFFSET 3
+#define BORDER_Y_OFFSET 27
+#define FIRST_CHESS_PROGRAM    "./fmax"
+#define SECOND_CHESS_PROGRAM   "./fmax"
+
+/* Default to no flashing (the "usual" XBoard behavior) */
+#define FLASH_COUNT    0               /* Number of times to flash */
+#define FLASH_RATE     5               /* Flashes per second */
+
+/* Default delay per character (in msec) while sending login script */
+#define MS_LOGIN_DELAY  0
+
+typedef int (*FileProc) P((FILE *f, int n, char *title));
+void CatchDeleteWindow(Widget w, String procname);
+
+#define TOPLEVEL 1 /* preference item; 1 = make popup windows toplevel */
+
index b6e9634..0e0c270 100644 (file)
@@ -1,3 +1,5 @@
+@setfilename xboard.info
+
 @ifinfo
 @format
 INFO-DIR-SECTION Games
@@ -119,7 +121,9 @@ for white and the right button (or shift+middle) for black.  When you
 are playing a bughouse game on an Internet Chess Server, a list of the
 offboard pieces that each player has available is shown in the window
 title after the player's name; in addition, the piece menus show the
-number of pieces available of each type.
+number of pieces available of each type. From version 4.3.14 on, it is
+also possible in crazyhouse, bughouse or shogi to dag and drop pieces
+to the board from the holdings squares displayed next to the board.
 
 All other XBoard commands are available from the menu bar. The most
 frequently used commands also have shortcut keys or on-screen buttons.
@@ -144,15 +148,35 @@ feature to work.
 @cindex File Menu
 @cindex Menu, File
 @table @asis
-@item Reset
-@cindex Reset, Menu Item
+@item New Game
+@cindex New Game, Menu Item
 Resets XBoard and the chess engine to the beginning of a new chess
 game. The @kbd{r} key is a keyboard equivalent. In Internet Chess
 Server mode, clears the current state of XBoard, then
 resynchronizes with the ICS by sending a refresh command. If you want to
 stop playing, observing, or examining an ICS game, use an
-appropriate command from the Action menu, not @samp{Reset}.
+appropriate command from the Action menu, not @samp{New Game}.
 @xref{Action Menu}.
+@item New Shuffle Game
+@cindex New Shuffle Game, Menu Item
+Similar to @samp{New Game}, but allows you to specify a particular initial position 
+(according to a standardized numbering system)
+in chess variants which use randomized opening positions (e.g. Chess960).
+The selected opening position will persistently be chosen on any following
+New Game command until you use this menu to select another. Selecting
+position number -1 will produce a newly randomized position on any new game.
+Using this menu item in variants that normally do not shuffle their opening position
+does cause these variants to become shuffle variants until you use the
+@samp{New Shuffle Game} menu to explicitly switch the randomization off,
+or select a new variant.
+@item New Variant
+@cindex New variant, Menu Item
+Allows you to select a new chess variant in non-ICS mode. 
+(In ICS play, the ICS is responsible for deciding which variant will be played,
+and XBoard adapts autmatically.) If you play with an engine, the engine must
+be able to play the selected variant, or the command will be ignored.
+XBoard supports all major variants, such as xiangqi, shogi, chess, chess960,
+Capablanca Chess, shatranj, crazyhous, bughouse.
 @item Load Game
 @cindex Load Game, Menu Item
 Plays a game from a record file. The @kbd{g} key is a keyboard equivalent.
@@ -385,6 +409,15 @@ selecting @samp{Load Game} from the File menu).  While XBoard is in
 @cindex Show Game List, Menu Item
 Shows or hides the list of games generated by the last @samp{Load Game}
 command.
+@item Show Move History
+@cindex Show Move History, Menu Item
+Shows or hides a list of moves of the current game.
+This list allows you to move the display to any earlier position in the game
+by clicking on the corresponding move.
+@item Show Engine Output
+@cindex Show Engine Output, Menu Item
+Shows or hides a window in which the thinking output of any loaded engines
+is displayed.
 @item Edit Tags
 @cindex Edit Tags, Menu Item
 Lets you edit the PGN (portable game notation)
@@ -602,6 +635,54 @@ depending on whether it is your opponent's move or yours.
 @cindex Menu, Options
 @cindex Options Menu
 @table @asis
+@item Flip View
+@cindex Flip View, Menu Item
+Inverts your view of the chess board for the duration of the
+current game. Starting a new game returns the board to normal.
+The @kbd{v} key is a keyboard equivalent.
+@item Adjudications
+@cindex Adjudications, Menu Item
+Pops up a sub-menu where you can enable or disable various adjudications
+that XBoard can perform in engine-engine games.
+You can instruct XBoard to detect and terminate the game on checkmate
+or stalemate, even if the engines would not do so, to verify engine
+result claims (forfeiting engines that make false claims), rather than
+naively following the engine, to declare draw on posititions
+which can never be won for lack of mating material, (e.g. KBK),
+or which are impossble to win unless the opponent seeks its own demise 
+(e.g. KBKN).
+For these adjudications to work, @samp{Test Legality} should be switched on.
+It is also possible to insruct XBoard to enforce a 50-move or 3-fold-repeat
+rule and automtically declare draw (after a user-adjustable number of moves
+or repeats) even if the engines are prepared to go on.
+It is also possible to have XBoard declare draw on games that seem to drag on 
+forever, or adjudicate a loss if both engines agree (for 3 cosecutive moves) that one
+of them is behind more than a user-adjustable score threshold.
+For the latter adjudication to work, XBoard should be able to properly understand
+the engine's scores. To faclitate the latter, you can inform xboard here if
+the engines report scores from the viewpoint of white, or from that of their own color.
+@item Engine Settings
+@citem Engine Settings, Menu Item
+Pops up a sub-menu where you can set some engine parameters common to most engines,
+such as hash-table size, tablebase cache size, maximum number of processors
+that SMP engines can use, and where to find the Polyglot adapter needed
+to run UCI engines under XBoard. The feature tht allows setting of these parameters on
+engines is new since XBoard 4.3.15, so not many WinBoard engines respond
+to it yet, but UCI engines should.
+It is also possible to specify a GUI opening book here, i.e. an opening
+book that XBoard consults for any position a playing engine gets in.
+It then forces the engine to play the book move, rather than to think up its own,
+if that position is found in the book.
+The book can switched on and off independently for either engine.
+@item Time Control
+@cindex Time Control, Menu Item
+Pops up a sub-menu where you can set the time-control parameters interactively.
+Allows you to select classical or incremental time controls,
+set the moves per session, session duration, and time increment.
+Also allows specification of time-odds factors for one or both engines.
+If an engine is given a time-odds factor N, all time quota it gets, 
+be it at the beginning of a session or through the time increment or
+fixed time per move, will be divided by N.
 @item Always Queen
 @cindex Always Queen, Menu Item
 If this option is off, XBoard brings up a dialog
@@ -684,11 +765,6 @@ the pieces are invisible.
 If this option is on, whenever a move is completed, the moved piece flashes.
 The number of times to flash is set by the flashCount command-line
 option; it defaults to 3 if Flash Moves is first turned on from the menu.
-@item Flip View
-@cindex Flip View, Menu Item
-Inverts your view of the chess board for the duration of the
-current game. Starting a new game returns the board to normal.
-The @kbd{v} key is a keyboard equivalent.
 
 If you are playing a game on an ICS, the board is always
 oriented at the start of the game so that your pawns move from
@@ -799,9 +875,9 @@ by shouts from other ICS users while playing.
 @cindex Show Coords, Menu Item
 If this option is on, XBoard displays algebraic coordinates
 along the board's left and bottom edges.
-@item Show Thinking
-@cindex Show Thinking, Menu Item
-If this option is set, the chess engine's notion of the score and best
+@item Hide Thinking
+@cindex Hide Thinking, Menu Item
+If this option is off, the chess engine's notion of the score and best
 line of play from the current position is displayed as it is
 thinking. The score indicates how many pawns ahead (or if negative,
 behind) the chess engine thinks it is. In matches between two
@@ -944,9 +1020,11 @@ true or false (@samp{XBoard*longOptionName: true}).
 
 @menu
 * Chess engine options::        Controlling the chess engine.
+* WB + UCI Engine Settings::    Setting some very common engine parameters
 * ICS options::                 Connecting to and using ICS.
 * Load and Save options::       Input/output options.
 * User interface options::      Look and feel options.
+* Adjudication options::        Control adjudcation of engine-engine games.
 * Other options::               Miscellaneous.
 @end menu
 
@@ -1000,14 +1078,58 @@ when searching for a move to make. Without this option, the chess
 engine chooses its search depth based on the number of moves and
 amount of time remaining until the next time control.  With the option,
 the engine will cut off its search early if it reaches the specified depth.
+@item -firstNPS number
+@itemx -secondNPS number
+@cindex firstNPS, option
+@cindex secondNPS, option
+Tells the chess engine to use an internal time standard based on its node count, 
+rather then wall-clock time, to make its timing decisions. 
+The time in virtual seconds should be obtained by dividing the node count 
+through the given number, like the number was a rate in nodes per second. 
+Xboard will manage the clocks in accordance with this, relying on the number 
+of nodes reported by the engine in its thinking output. If the given number equals zero, 
+it can obviously not be used to convert nodes to seconds, and the time reported 
+by the engine is used to decrement the XBoard clock in stead. The engine is supposed to 
+report in CPU time it uses, rather than wall-clock time, in this mode. This option 
+can provide fairer conditions for engine-engine matches on heavily loaded machines, 
+or with very fast games (where the wall clock is too inaccurate). 
+@code{showThinking} must be on for this option to work. Default: -1 (off).
+Not many engines might support this yet!
+@item -firstTimeOdds factor
+@itemx -secondTimeOdds factor
+@cindex firstTimeOdds, option
+@cindex secondTimeOdds, option
+Reduces the time given to the mentioned engine by the given factor. 
+If pondering is off, the effect is indistinguishable from what would happen 
+if the engine was running on an n-times slower machine. Default: 1.
+@item -timeOddsMode mode
+@cindex timeOddsMode, option
+This option determines how the case is handled where both engines have a time-odds handicap. 
+If mode=1, the engine that gets the most time will always get the nominal time, 
+as specified by the time-control options, and its opponent's time is renormalized accordingly. 
+If mode=0, both play with reduced time. Default: 0.
+@item -hideThinkingFromHuman true/false
+Controls the Hide Thinking option. @xref{Options Menu}. Default: true.
+(Relaces the Show-Thinking option of older xboard versions.)
 @item -thinking/-xthinking or -showThinking true/false
 @cindex thinking, option
 @cindex showThinking, option
-Sets the Show Thinking option. @xref{Options Menu}. Default: false.
+Forces the engine to send thinking output to xboard. 
+Used to be the only way to control if thinking output was displayed 
+in older xboard versions,
+but as the thinking output in xboard 4.3 is also used for several other
+purposes (adjudication, storing in PGN file) the display of it is now controlled
+by the new option Hide Thinking. @xref{Options Menu}. Default: false.
+(But if xboard needs the thinking output for some purpose,
+it makes the engine send it despite the setting of this option.)
 @item -ponder/-xponder or -ponderNextMove true/false
 @cindex ponder, option
 @cindex ponderNextMove, option
 Sets the Ponder Next Move menu option. @xref{Options Menu}. Default: true.
+@item -smpCores number
+@citem smpCores, option
+Specifies the maxmum nmber of CPUs an SMP engine is allowed to use.
+Only works for engines that support the WinBoard-protocol cores feature.
 @item -mg or -matchGames n
 @cindex mg, option
 @cindex matchGames, option
@@ -1027,17 +1149,24 @@ displays the match score and exits. Default: 0 (do not run a match).
 @cindex matchMode, option
 Setting @code{matchMode} to true is equivalent to setting
 @code{matchGames} to 1.
+@item -sameColorGames n
+@cinex sameColorGames, option
+Automatically runs an n-game match between two chess engines,
+without alternating colors.
+Otherwise the same applies as for the @samp{-matchGames} option,
+over which it takes precedence if both are specified. (See there.)
+Default: 0 (do not run a match).
 @item -fcp or -firstChessProgram program
 @cindex fcp, option
 @cindex firstChessProgram, option
 Name of first chess engine.
-Default: @file{gnuchessx}.
+Default: @file{Fairy-Max}.
 @item -scp or -secondChessProgram program
 @cindex scp, option
 @cindex secondChessProgram, option
 Name of second chess engine, if needed.
 A second chess engine is started only in Two Machines (match) mode.
-Default: @file{gnuchessx}.
+Default: @file{Fairy-Max}.
 @item -fb/-xfb or -firstPlaysBlack true/false
 @cindex fb, option
 @cindex firstPlaysBlack, option
@@ -1133,6 +1262,80 @@ protocol to use.  By default, version-number is 2.  In version 1, the
 "protover" command is not sent to the engine; since version 1 is a
 subset of version 2, nothing else changes.  Other values for
 version-number are not supported.
+@item -firstScoreAbs true/false
+@itemx -secondScoreAbs true/false
+@cindex firstScoreAbs, option
+@cindex secondScoreAbs, option
+If this option is set, the score reported by the engine is taken to be 
+that in favor of white, even when the engine plays black. 
+Important when XBoard uses the score for adjudications, or in PGN reporting. 
+@end table
+
+
+
+@node UCI + WB Engine Settings
+@cindex Engine Settings
+@cindex Settings, Engine
+@table @asis
+@item -fUCI or -firstIsUCI true/false
+@itemx -sUCI or -secondIsUCI true/false
+@cindex fUCI, option
+@cindex sUCI, option
+@cindex firstIsUCI, option
+@cindex secondIsUCI, option
+Indicates if the mentioned engine executable file is an UCI engine, 
+and should be run with the aid of the Polyglot adapter rather than directly. 
+Xboard will then pass the other UCI options and engine name to Polyglot 
+through a .ini temporary file ceated for the purpose.
+@item -PolyglotDir filename
+@cindex PolyglotDir, option
+Gives the name of the directory in which the Polyglot adapter for UCI engines expects its files.
+Default: "/usr/local/share/polyglot".
+@item -usePolyglotBook true/false
+@cindex usePolyglotBook, option
+Specifies if the Polygot book should be used.
+@item -PolyglotBook filename
+@cindex PolyglotBook, option
+Gives the filename of the opening book that Polyglot should use. 
+From XBoard 4.3.15 on, native WinBoard engines will also use the opening book specified here, 
+provided the @code{usePolyglotBook} option is set to true,
+and the option @code{firstHasOwnBookUCI} or @code{secondHasOwnBookUCI} applying to the engine
+is set to false.
+The engine will be kept in force mode as long as the current position is in book, 
+and XBoard will select the book moves for it. Default "".
+@item -fNoOwnBookUCI or -firstHasOwnBookUCI true/false
+@itemx -sNoOwnBookUCI or -secondHasOwnBookUCI true/false
+@cindex fNoOwnBookUCI, option
+@cindex sNoOwnBookUCI, option
+@cindex firstHasOwnBookUCI, option
+@cindex secondHasOwnBookUCI, option
+Indicates if the mentioned engine has its own opening book it should play from,
+rather than using the external book through XBoard. Default: false.
+@item -defaultHashSize n
+@cindex defaultHashSize, option
+Sets the size of the hash table to n MegaBytes. Together with the EGTB cache size 
+this number is also used to calculate the memory setting of WinBoard engines, 
+for those that support the memory feature of WinBoard protocol. Default: 64.
+@item -defaultCacheSizeEGTB n
+@cindex defaultCacheSizeEGTB, option
+Sets the size of the EGTB cache to n MegaBytes. Together with the hash-table size 
+this number is also used to calculate the memory setting of WinBoard engines, 
+for those that support the memory feature of WinBoard protocol. Default: 4.
+@item -defaultPathEGTB filename
+@cindex defaultPathEGTB, option
+Gives the name of the directory where the end-game tablebases are installed, for UCI engines.
+Default: "/usr/local/share/egtb".
+@item -egtFormats string
+@cindex egtFormats, option
+Specifies which end-game tables are installed on the computer, and where. 
+The argument is a comma-separated list of format specifications, 
+each specification consisting of a format name, a colon, and a directory path name, 
+e.g. "nalimov:/usr/local/share/egtb". 
+If the name part matches that of a format that the engine requests through a feature command, 
+xboard will relay the path name for this format to the engine through an egtpath command. 
+One egtpath command for each matching format will be sent. 
+Popular formats are "nalimov" DTM tablebases and "scorpio" bitbases.
+Default: "".
 @end table
 
 @node ICS options
@@ -1285,6 +1488,12 @@ Sets the Auto Flag menu option.  @xref{Options Menu}. Default: false.
 @cindex autobs, option
 @cindex autoObserve, option
 Sets the Auto Observe menu option.  @xref{Options Menu}. Default: false.
+@item -autoKibitz
+@cindex autoKibitz, option`
+Enables kibitzing of the engines last thinking output (depth, score, time, speed, PV) 
+before it moved
+to the ICS, in zippy mode. The option @code{showThinking} must be switched on for 
+this option to work.
 @item -moves/-xmoves or -getMoveList true/false
 @cindex moves, option
 @cindex getMoveList, option
@@ -1455,6 +1664,20 @@ The menu is also suppressed if @code{matchMode} is enabled or if the game file
 is a pipe; in these cases the first game in the file is loaded immediately.
 Use the @file{pxboard} shell script provided with XBoard if you
 want to pipe in files containing multiple games and still see the menu.
+If the loadGameIndex specifies an index -1, this triggers auto-increment
+of the index in @code{matchMode}, which means that after every game the
+index is incremented by one, causing each game of the match to be played
+from the next game in the file. Similarly, specifying an index value of -2
+causes the index to be incremented every two games, so that each game
+in the file is used twice (with reversed colors).
+The @code{rewindIndex} option causes the index to be reset to the
+first game of the file when it has reached a specified value.
+@item -rewindIndex n
+@citem rewindIndex, option
+Causes a position file or game file to be rewound to its beginning after n
+positions or games in auto-increment @code{matchMode}. 
+See @code{loadPositionIndex} and @code{loadGameIndex}.
+default: 0 (no rewind).
 @item -td or -timeDelay seconds
 @cindex td, option
 @cindex timeDelay, option
@@ -1484,13 +1707,32 @@ specified position file at startup. The file name @file{-} specifies the
 standard input. If the @code{loadPositionIndex} option is set to N,
 the Nth position found in the file is loaded; otherwise the
 first position is loaded.
+If the loadPositionIndex specifies an index -1, this triggers auto-increment
+of the index in @code{matchMode}, which means that after every game the
+index is incremented by one, causing each game of the match to be played
+from the next position in the file. Similarly, specifying an index value of -2
+causes the index to be incremented every two games, so that each position
+in the file is used twice (with the engines playing opposite colors).
+The @code{rewindIndex} option causes the index to be reset to the
+first position of the file when it has reached a specified value.
 @item -spf or -savePositionFile file
 @cindex spf, option
 @cindex savePositionFile, option
 If this option is set, XBoard appends the final position reached
 in every game played to the specified file. The file name @file{-}
 specifies the standard output.
-@item -oldsave/-xoldsave or -oldSaveStyle true/false
+@item -pgnExtendedInfo true/false
+@cindex pgnExtendedInfo, option`
+If this option is set, WinBoard saves depth, score and time used for each 
+move that the engine found as a comment in the PGN file.
+Default: false.
+@item -pgnEventHeader string
+@cindex pgnEventHeader, option`
+Sets the name used in the PGN event tag to string. 
+Default: "Computer Chess Game".
+@item -saveOutOfBookInfo true/false
+@cindex saveOutOfBookInfo, option`
+Include the information on how the engine(s) game out of its opening book in a special Â‘annotatorÂ’ tag with the PGN file.@item -oldsave/-xoldsave or -oldSaveStyle true/false
 @cindex oldsave, option
 @cindex oldSaveStyle, option
 Sets the Old Save Style menu option.  @xref{Options Menu}.  Default: false.
@@ -1770,6 +2012,61 @@ Number of milliseconds delay between each animation frame when Animate
 Moves is on.
 @end table
 
+@node Adjudication Options
+@section Adjudication Options
+@cindex Options, adjudication
+@table @asis
+@item -adjudicateLossThreshold n
+@cindex adjudicateLossThreshold, option
+If the given value is non-zero, XBoard adjudicates the game as a loss 
+if both engines agree for a duration of 6 consecutive ply that the score 
+is below the given score threshold for that engine. Make sure the score 
+is interpreted properly by XBoard, 
+using @code{-firstScoreAbs} and @code{-secondScoreAbs} if needed. 
+Default: 0 (no adjudiction)
+@item -adjudicateDrawMoves n
+@cindex adjudicateDrawMoves, option
+If the given value is non-zero, XBoard adjudicates the game as a draw 
+if after the given number of moves it was not yet decided. Defaut: 0 (no adjudication)
+@item -checkMates true/false
+@cindex checkMates, option
+If this option is set, XBoard detects all checkmates and stalemates, 
+and ends the game as soon as they occur. 
+Legality-testing must be switched on for this option to work.
+Default: true
+@item -testClaims true/false
+@cindex testClaims, option
+If this option is set, XBoard verifies all result claims made by engines, 
+and those who send false claims will forfeit the game because of it. 
+Legality-testing must be switched on for this option to work. Default: true
+@item -materialDraws true/false
+@cindex materialDraws, option
+If this option is set, XBoard adjudicates games as draws when there is 
+no sufficient material left to inflict a checkmate. 
+This applies to KBKB with like bishops (any number, actually), and to KBK, KNK and KK. 
+Legality-testing must be switched on for this option to work. Default: true
+@item -trivialDraws true/false
+@cindex trivialDraws, option
+If this option is set, XBoard adjudicates games as draws that cannot be 
+usually won without opponent cooperation. This applies to KBKB with unlike bishops, 
+and to KBKN, KNKN, KNNK, KRKR and KQKQ. The draw is called after 6 ply into these end-games, 
+to allow quick mates that can occur in some exceptional positions to be found by the engines. 
+KQKQ does not really belong in this category, and might be taken out in the future. 
+(When bitbase-based adjudications are implemented.) 
+Legality-testing must be on for this option to work. Default: false
+@item -ruleMoves n
+@cindex ruleMoves, option
+If the given value is non-zero, XBoard adjudicates the game as a draw after the given 
+number of consecutive reversible moves. Engine draw claims are always accepted after 50 moves, 
+irrespective of the given value of n.
+@item -repeatsToDraw n
+If the given value is non-zero, xboard adjudicates the game as a draw if a position 
+is repeated the given number of times. Engines draw claims are always accepted after 3 repeats, 
+(on the 3rd occurrence, actually), irrespective of the value of n. 
+Beware that positions that have different castling or en-passant rights do not count 
+as repeats, XBoard is fully e.p. and castling aware!
+@end table
+
 @node Other options
 @section Other Options
 @cindex Options, miscellaneous
@@ -1810,17 +2107,83 @@ kriegspiel    Opponent's pieces are invisible
 atomic        Capturing piece explodes (ICC wild 27)
 3check        Win by giving check 3 times (ICC wild 25)
 shatranj      An ancient precursor of chess (ICC wild 28)
+xiangqi       Chinese Chess (on a 9x10 board)
+shogi         Japanese Chess (on a 9x9 board & piece drops) 
+capablanca    Capablanca Chess (10x8 board, with Archbishop 
+              and Chancellor pieces)
+gothic        similar, with a better initial position
+caparandom    An FRC-like version of Capablanca Chess (10x8) 
+janus         A game with two Archbishops (10x8 board)
+courier       Medieval intermedite between shatranj and 
+              modern Chess (on 12x8 board) 
+falcon        Patented 10x8 variant with two Falcon pieces
+berolina      Pawns capture straight ahead, and move diagonal 
+cylinder      Pieces wrap around the board edge
+knightmate    King moves as Knight, and vice versa 
+super         Superchess (shuffle variant with 4 exo-pieces)
+fairy         A catchall variant in which all piece types 
+              known to XBoard can participate (8x8)
 unknown       Catchall for other unknown variants
 @end example
 
-In the shuffle variants, xboard does not shuffle the pieces, but
-you can do it by hand using Edit Position.  Some variants are
-supported only in ICS mode, including fischerandom, bughouse, and
+In the shuffle variants, XBoard now does shuffle the pieces, although
+you can still do it by hand using Edit Position.  Some variants are
+supported only in ICS mode, including bughouse, and
 kriegspiel.  The winning/drawing conditions in crazyhouse (offboard
 interposition on mate), losers, suicide, giveaway, atomic, and 3check
-are not fully understood.  In crazyhouse, xboard does not yet keep
-track of offboard pieces.  Shatranj is unsupported, but it may be
-usable if you turn off Test Legality.
+are not fully understood.  
+Berolina and cylinder chess can only be played with legality testing off.
+In crazyhouse, XBoard now does keep
+track of offboard pieces.  In shatranj it does implement the baring
+rule when mate detection is switched on.
+@item -boardHeight N
+@cindex boardHeight, option
+Allows you to set a non-standard number of board ranks in any variant. 
+If the height is given as -1, the default height for the variant is used.
+Default: -1
+@item -boardWidth N
+@cindex boardWidth, option
+Allows you to set a non-standard number of board files in any variant. 
+If the width is given as -1, the default width for the variant is used. 
+With a non-standard width, the initial position will always be an empty board, 
+as the usual opening array will not fit.
+Default: -1
+@item -holdingsSize N
+@cindex holdingsSize, option
+Allows you to set a non-standard size for the holdings in any variant. 
+If the size is given as -1, the default holdings size for the variant is used. 
+The first N piece types will go into the holdings on capture, and you will be 
+able to drop them on the board in stead of making a normal move. If size equals 0, 
+there will be no holdings.
+Default: -1
+@item -defaultFrcPosition N
+@cindex defaultFrcPosition, option
+Specifies the number of the opening position in shuffle games like Chess960. 
+A value of -1 means the position is randomly generated by XBoard
+at the beginning of every game.
+Default: -1
+@item -pieceToSquareTable string
+@cindex pieceToSquareTable, option
+The characters that are used to represent the piece types XBoard knows in FEN 
+diagrams and SAN moves. The string argument has to have an even length 
+(or it will be ignored), as white and black pieces have to be given separately 
+(in that order). The last letter for each color will be the King. 
+The letters before that will be PNBRQ and then a whole host of fairy pieces 
+in an order that has not fully crystallized yet (currently FEACWMOHIJGDVSLU, 
+F=Ferz, Elephant, A=Archbishop, C=Chancellor, W=Wazir, M=Commoner, O=Cannon, 
+H=Nightrider). You should list at least all pieces that occur in the variant 
+you are playing. If you have less than 44 characters in the string, the pieces 
+not mentioned will get assigned a period, and you will not be able to distinguish 
+them in FENs. You can also explicitly assign pieces a period, in which case they 
+will not be counted in deciding which captured pieces can go into the holdings.
+A tilde '~' as a piece name does mean this piece is used to represent a promoted 
+Pawn in crazyhouse-like games, i.e. on capture it turns back onto a Pawn. 
+A '+' similarly indicates the piece is a shogi-style promoted piece, that should 
+revert to its non-promoted version on capture (rather than to a Pawn).
+Note that promoted pieces are represented by pieces 11 further in the list.
+You should not have to use this option often: each variant has its own default 
+setting for the piece representation in FEN, which should be sufficient in normal use.
+Default: ""
 @item -debug/-xdebug or -debugMode true/false
 @cindex debug, option
 @cindex debugMode, option
@@ -1836,6 +2199,10 @@ configured and compiled.
 @cindex remoteUser, option
 User name on the remote system when running programs with the
 @code{remoteShell}. The default is your local user name.
+@item -userName username
+@cindex userName, option
+Name under which the Human player will be listed in the PGN file. 
+Default is the login name on your local computer.
 @end table
 
 @node Chess Servers
@@ -2126,32 +2493,35 @@ parsing routines.
 
 The game parser recognizes only algebraic notation.
 
-The internal move legality tester does not look at the game history,
-so in some cases it misses illegal castling or en passant captures.
-It permits castling with the king on the d file because this is possible in
-some "wild 1" games on ICS.  It does not check
-piece drops in bughouse and crazyhouse to see if you actually
-hold the piece you are trying to drop.
-However, if you attempt an illegal move when using
-a chess engine or chess server, XBoard will accept the error message
-that comes back, undo the move, and let you try another.
-
-Fischer Random castling is not understood.  You can probably play
-Fischer Random successfully on ICS by typing castling moves into the ICS
-Interaction window, but they will not be animated correctly, and saved
-games will not be loaded correctly if castling occurs.
-
-FEN positions saved by XBoard
-never include correct information about whether castling is legal or
-how many half-moves have been made since the last irreversible move,
-and sometimes may not correctly indicate when en passant capture is available.
-
-The mate detector does not understand that non-contact mate is not
-really mate in bughouse and crazyhouse.  The only problem this causes
-while playing is minor: a @samp{#} (mate indicator) character will show
-up after a non-contact mating move in the move list; XBoard will
-not assume the game is over at that point.  However, if you are editing
-a game, Edit Game mode will be terminated by a non-contact mate.
+Many of the following points used to be limitations in XBoard 4.2.7 and earlier, 
+but are now fixed:
+The internal move legality tester in XBoard 4.3.xx does look at the game history, 
+and is fully aware of castling or en-passant-capture rights. It permits castling with 
+the king on the d file because this is possible in some "wild 1" games on ICS. 
+The piece-drop menu does not check piece drops in bughouse to see if you actually hold 
+the piece you are trying to drop. But this way of dropping pieces should be considered 
+an obsolete feature, now that pieces can be dropped by dragging them from the holdings 
+to the board. Anyway, if you would attempt an illegal move when using a chess engine or the ICS, 
+WinBoard will accept the error message that comes back, undo the move, and let you try another.
+FEN positions saved by XBoard do include correct information about whether castling or 
+en passant are legal, and also handle the 50-move counter.
+The mate detector does not understand that non-contact mate is not really mate in bughouse. 
+The only problem this causes while playing is minor: a "#" (mate indicator) character will 
+show up after a non-contact mating move in the move list. XBoard will not assume the game 
+is over at that point, not even when the option Detect Mates is on.
+Edit Game mode always uses the rules of the selected variant, 
+which can be a variant that uses piece drops.  
+You can load and edit games that contain piece drops. 
+The (obsolete) piece menus are not active, 
+but you can perform piece drops by dragging pieces from the holdings.
+Edit Position mode does not allow you to edit the crazyhouse holdings properly. 
+You cannot drag pieces to the holding, and using the popup menu to put pieces 
+there does not adapt the holding counts and leads to an inconsistent state. 
+Set up crazyhouse positions by loading / pasting a bFEN, from there you can set the holdings.
+Fischer Random castling is fully understood. 
+You can enter castlings by dragging the King on top of your Rook. 
+You can probably also play Fischer Random successfully on ICS by typing 
+castling moves into the ICS Interaction window.
 
 The menus may not work if your keyboard is in Caps Lock or Num Lock mode.
 This seems to be a problem with the Athena menu widget,
@@ -2191,6 +2561,12 @@ Your detailed description of the problem
 .
 @end example
 
+The WinBoard / XBoard 4.3 line is being developed by H.G. Muller 
+independently of the GNU Savannah xboard project. 
+Bug reports on this version, and suggestions for improvements and additions, 
+are best posted in the WinBoard forum, 
+WinBoard-development section (http://www.open-aurec.com/wbforum). 
+
 If you improve XBoard, please send a message about your changes,
 and we will get in touch with you about merging them in
 to the main line of development.
@@ -2203,7 +2579,7 @@ Also see our Web site at http://savannah.gnu.org/projects/xboard/.
 
 Tim Mann has been responsible for XBoard versions 1.3 and beyond, and
 for WinBoard, a port of XBoard to Microsoft Win32 (Windows NT and
-Windows 95).
+Windows 95). H.G.Muller is responsible for version 4.3.
 
 Mark Williams contributed the initial (WinBoard-only) implementation
 of many new features added to both XBoard and WinBoard in version
@@ -2227,6 +2603,21 @@ responsible for versions 1.0 through 1.2.
 Evan Welsh wrote @code{CMail}.  Patrick Surry helped in designing,
 testing, and documenting CMail.
 
+Allessandro Scotti added many elements to the user interface of WinBoard, 
+including the board textures and font-based rendering, the evaluation-graph, 
+move-history and engine-output window. 
+He was also responsible for adding the UCI support. 
+
+H.G. Muller made WinBoard castling- and e.p.-aware, 
+added variant support with adjustable board sizes, 
+the crazyhouse holdings, and the fairy pieces. 
+In addition he added most of the adjudication options, 
+made WinBoard more robust in dealing with buggy and crashing engines, 
+and extended time control with a time-odds and node-count-based modes.
+Most of the options that initially wre WinBoard only have now been back-ported to XBoard.
+
+Michel van den Bergh provided the code for reading Polyglot opening books.
+
 @node CMail
 @chapter CMail
 @cindex cmail
@@ -2445,6 +2836,30 @@ ftp://ftp.gnu.org/gnu/gnuchess/
 You can use XBoard to play a game against GNU Chess, or to
 interface GNU Chess to an ICS.
 
+@node Fairy-Max
+@section Fairy-Max
+
+Fairy-Max is a derivative from the World's smallest Chess program micro-Max,
+which measures only about 100 lines of source code.
+The main difference with micro-Max is that Fairy-Max loads its move-generator
+tables from a file, so that the rules for piece movement can be easily configured
+to implement unorthodox pieces.
+Fairy-Max can therefore play a lage number of variants, normal Chess being one of those.
+In addition it plas Knightmate, Capablanca and Gothic Chess, Shatranj, Courier Chess,
+Cylinder chess, Berolina Chess, while the user can easily define new variants.
+It can be obtained from:
+
+http://home.hccnet.nl/h.g.muller/dwnldpage.html
+
+@node HoiChess
+@section HoiChess
+
+HoiChess is a not-so-very-strong Chess engine, which comes with a derivative HoiXiangqi,
+able to play Chinese Chess. It can be obtained from the standard Linux repositories
+through:
+
+sudo apt-get install hoichess
+
 @node Crafty
 @section Crafty
 
diff --git a/xengineoutput.c b/xengineoutput.c
new file mode 100644 (file)
index 0000000..72b6e26
--- /dev/null
@@ -0,0 +1,1266 @@
+/*\r
+ * Engine output (PV)\r
+ *\r
+ * Author: Alessandro Scotti (Dec 2005)\r
+ *\r
+ * ------------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+ * ------------------------------------------------------------------------\r
+ */\r
+#include "config.h"
+
+#include <stdio.h>
+#include <ctype.h>
+#include <errno.h>
+#include <sys/types.h>
+
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <string.h>
+#else /* not STDC_HEADERS */
+extern char *getenv();
+# if HAVE_STRING_H
+#  include <string.h>
+# else /* not HAVE_STRING_H */
+#  include <strings.h>
+# endif /* not HAVE_STRING_H */
+#endif /* not STDC_HEADERS */
+
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+#include <X11/Shell.h>
+#include <X11/Xaw/Dialog.h>
+#include <X11/Xaw/Form.h>
+#include <X11/Xaw/List.h>
+#include <X11/Xaw/Label.h>
+#include <X11/Xaw/SimpleMenu.h>
+#include <X11/Xaw/SmeBSB.h>
+#include <X11/Xaw/SmeLine.h>
+#include <X11/Xaw/Box.h>
+#include <X11/Xaw/Paned.h>
+#include <X11/Xaw/MenuButton.h>
+#include <X11/cursorfont.h>
+#include <X11/Xaw/Text.h>
+#include <X11/Xaw/AsciiText.h>
+#include <X11/Xaw/Viewport.h>
+
+#include "common.h"
+#include "frontend.h"
+#include "backend.h"
+#include "xboard.h"
+// Add xengineo.h later
+
+#include <X11/xpm.h>\r
+
+// [HGM] pixmaps of some ICONS used in the engine-outut window
+#include "pixmaps/WHITE_14.xpm"
+#include "pixmaps/BLACK_14.xpm"
+#include "pixmaps/CLEAR_14.xpm"
+#include "pixmaps/UNKNOWN_14.xpm"
+#include "pixmaps/THINKING_14.xpm"
+#include "pixmaps/PONDER_14.xpm"
+#include "pixmaps/ANALYZING_14.xpm"
+
+#ifdef SNAP\r
+#include "wsnap.h"\r
+#endif
+
+#define _LL_ 100
+
+// imports from xboard.c
+extern Widget formWidget, shellWidget, boardWidget, menuBarWidget;
+extern Display *xDisplay;
+extern Window xBoardWindow;
+extern int squareSize;
+extern Pixmap xMarkPixmap, wIconPixmap, bIconPixmap;
+extern char *layoutName;
+
+// temporary kludge to avoid compile errors untill all Windows code has been replaced
+#define HICON int *
+#define HWND  int *
+\r
+// [HGM] define numbers to indicate icons, for referring to them in platform-independent way\r
+#define nColorBlack   1\r
+#define nColorWhite   2\r
+#define nColorUnknown 3\r
+#define nClear        4\r
+#define nPondering    5\r
+#define nThinking     6\r
+#define nAnalyzing    7\r
+\r
+Pixmap icons[8]; // [HGM] this front-end array translates back-end icon indicator to handle\r
+\r
+// [HGM] same for output fields (note that there are two of each type, one per color)\r
+#define nColorIcon 1\r
+#define nStateIcon 2\r
+#define nLabel     3\r
+#define nStateData 4\r
+#define nLabelNPS  5\r
+#define nMemo      6\r
+\r
+Widget outputField[2][7]; // [HGM] front-end array to translate output field to window handle\r
+\r
+void EngineOutputPopDown();\r
+void engineOutputPopUp(char *title, char *text);\r
+int  EngineOutputIsUp();\r
+static void SetEngineColorIcon( int which );\r
+\r
+#define SHOW_PONDERING\r
+\r
+/* Imports from backend.c */\r
+char * SavePart(char *str);\r
+\r
+/* Imports from winboard.c */\r
+//extern HWND engineOutputDialog;\r
+extern Arg layoutArgs[2], formArgs[2], messageArgs[4];\r
+\r
+//extern WindowPlacement wpEngineOutput;\r
+
+Position engineOutputX = -1, engineOutputY = -1;
+Dimension engineOutputW, engineOutputH;
+Widget engineOutputShell;
+int engineOutputDialogUp;
+
+/* Module variables */\r
+#define H_MARGIN            2\r
+#define V_MARGIN            2\r
+#define LABEL_V_DISTANCE    1   /* Distance between label and memo */\r
+#define SPLITTER_SIZE       4   /* Distance between first memo and second label */\r
+\r
+#define ICON_SIZE           14\r
+\r
+#define STATE_UNKNOWN   -1\r
+#define STATE_THINKING   0\r
+#define STATE_IDLE       1\r
+#define STATE_PONDERING  2\r
+#define STATE_ANALYZING  3\r
+\r
+static int  windowMode = 1;\r
+\r
+static int  needInit = TRUE;\r
+\r
+static int  lastDepth[2] = { -1, -1 };\r
+static int  lastForwardMostMove[2] = { -1, -1 };\r
+static int  engineState[2] = { -1, -1 };\r
+\r
+typedef struct {\r
+    char * name;\r
+    int which;\r
+    int depth;\r
+    unsigned long nodes;\r
+    int score;\r
+    int time;\r
+    char * pv;\r
+    char * hint;\r
+    int an_move_index;\r
+    int an_move_count;\r
+} EngineOutputData;\r
+\r
+static VerifyDisplayMode();\r
+static void UpdateControls( EngineOutputData * ed );\r
+static SetEngineState( int which, int state, char * state_data );\r
+
+void ReadIcon(char *pixData[], int iconNr)
+{
+    int r;
+
+       if ((r=XpmCreatePixmapFromData(xDisplay, XtWindow(outputField[0][nColorIcon]),\r
+                                      pixData,\r
+                                      &(icons[iconNr]),\r
+                                      NULL, NULL /*&attr*/)) != 0) {\r
+         fprintf(stderr, "Error %d loading icon image\n", r);\r
+         exit(1); \r
+       }       \r
+}
+
+static void InitializeEngineOutput()\r
+{ int i;
+
+        ReadIcon(WHITE_14,   nColorWhite);\r
+        ReadIcon(BLACK_14,   nColorBlack);\r
+        ReadIcon(UNKNOWN_14, nColorUnknown);\r
+
+        ReadIcon(CLEAR_14,   nClear);\r
+        ReadIcon(PONDER_14,  nPondering);\r
+        ReadIcon(THINK_14,   nThinking);\r
+        ReadIcon(ANALYZE_14, nAnalyzing);\r
+//        icons[nClear]       = wIconPixmap;\r
+//        icons[nPondering]   = bIconPixmap;\r//        icons[nThinking]    = wIconPixmap;\r
+//        icons[nAnalyzing]   = bIconPixmap;\r}
+
+#if 0
+// Windows routines commented out
+\r
+// front end\r
+static HICON LoadIconEx( int id )\r
+{\r
+    return LoadImage( hInst, MAKEINTRESOURCE(id), IMAGE_ICON, ICON_SIZE, ICON_SIZE, 0 );\r
+}\r
+\r
+// [HGM] the platform-dependent way of indicating where output should go is now all\r
+// concentrated here, where a table of platform-dependent handles are initialized.\r
+// This cleanses most other routines of front-end stuff, so they can go into the back end.\r
+static void InitializeEngineOutput()\r
+{\r
+ //   if( needInit ) { // needInit was already tested before call\r
+       // [HGM] made this into a table, rather than separate global variables\r
+        icons[nColorBlack]   = LoadIconEx( IDI_BLACK_14 );\r
+        icons[nColorWhite]   = LoadIconEx( IDI_WHITE_14 );\r
+        icons[nColorUnknown] = LoadIconEx( IDI_UNKNOWN_14 );\r
+        icons[nClear]        = LoadIconEx( IDI_TRANS_14 );\r
+        icons[nPondering]    = LoadIconEx( IDI_PONDER_14 );\r
+        icons[nThinking]     = LoadIconEx( IDI_CLOCK_14 );\r
+        icons[nAnalyzing]    = LoadIconEx( IDI_ANALYZE2_14 );\r
+\r
+       // [HGM] also make a table of handles to output controls\r
+       // Note that engineOutputDialog must be defined first!\r
+        outputField[0][nColorIcon] = GetDlgItem( engineOutputDialog, IDC_Color1 );\r
+        outputField[0][nLabel]     = GetDlgItem( engineOutputDialog, IDC_EngineLabel1 );\r
+        outputField[0][nStateIcon] = GetDlgItem( engineOutputDialog, IDC_StateIcon1 );\r
+        outputField[0][nStateData] = GetDlgItem( engineOutputDialog, IDC_StateData1 );\r
+        outputField[0][nLabelNPS]  = GetDlgItem( engineOutputDialog, IDC_Engine1_NPS );\r
+        outputField[0][nMemo]      = GetDlgItem( engineOutputDialog, IDC_EngineMemo1 );\r
+\r
+        outputField[1][nColorIcon] = GetDlgItem( engineOutputDialog, IDC_Color2 );\r
+        outputField[1][nLabel]     = GetDlgItem( engineOutputDialog, IDC_EngineLabel2 );\r
+        outputField[1][nStateIcon] = GetDlgItem( engineOutputDialog, IDC_StateIcon2 );\r
+        outputField[1][nStateData] = GetDlgItem( engineOutputDialog, IDC_StateData2 );\r
+        outputField[1][nLabelNPS]  = GetDlgItem( engineOutputDialog, IDC_Engine2_NPS );\r
+        outputField[1][nMemo]      = GetDlgItem( engineOutputDialog, IDC_EngineMemo2 );\r
+//        needInit = FALSE;\r
+//    }\r
+}\r
+\r
+// front end\r
+static void SetControlPos( HWND hDlg, int id, int x, int y, int width, int height )\r
+{\r
+    HWND hControl = GetDlgItem( hDlg, id );\r
+\r
+    SetWindowPos( hControl, HWND_TOP, x, y, width, height, SWP_NOZORDER );\r
+}\r
+\r
+#define HIDDEN_X    20000\r
+#define HIDDEN_Y    20000\r
+\r
+// front end\r
+static void HideControl( HWND hDlg, int id )\r
+{\r
+    HWND hControl = GetDlgItem( hDlg, id );\r
+    RECT rc;\r
+\r
+    GetWindowRect( hControl, &rc );\r
+\r
+    /* \r
+        Avoid hiding an already hidden control, because that causes many\r
+        unnecessary WM_ERASEBKGND messages!\r
+    */\r
+    if( rc.left != HIDDEN_X || rc.top != HIDDEN_Y ) {\r
+        SetControlPos( hDlg, id, 20000, 20000, 100, 100 );\r
+    }\r
+}\r
+\r
+// front end, although we might make GetWindowRect front end instead\r
+static int GetControlWidth( HWND hDlg, int id )\r
+{\r
+    RECT rc;\r
+\r
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );\r
+\r
+    return rc.right - rc.left;\r
+}\r
+\r
+// front end?\r
+static int GetControlHeight( HWND hDlg, int id )\r
+{\r
+    RECT rc;\r
+\r
+    GetWindowRect( GetDlgItem( hDlg, id ), &rc );\r
+\r
+    return rc.bottom - rc.top;\r
+}\r
+\r
+static int GetHeaderHeight()\r
+{\r
+    int result = GetControlHeight( engineOutputDialog, IDC_EngineLabel1 );\r
+\r
+    if( result < ICON_SIZE ) result = ICON_SIZE;\r
+\r
+    return result;\r
+}\r
+\r
+// The size calculations should be backend? If setControlPos is a platform-dependent way of doing things,\r
+// a platform-independent wrapper for it should be supplied.\r
+static void PositionControlSet( HWND hDlg, int x, int y, int clientWidth, int memoHeight, int idColor, int idEngineLabel, int idNPS, int idMemo, int idStateIcon, int idStateData )\r
+{\r
+    int label_x = x + ICON_SIZE + H_MARGIN;\r
+    int label_h = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
+    int label_y = y + ICON_SIZE - label_h;\r
+    int nps_w = GetControlWidth( hDlg, IDC_Engine1_NPS );\r
+    int nps_x = clientWidth - H_MARGIN - nps_w;\r
+    int state_data_w = GetControlWidth( hDlg, IDC_StateData1 );\r
+    int state_data_x = nps_x - H_MARGIN - state_data_w;\r
+    int state_icon_x = state_data_x - ICON_SIZE - 2;\r
+    int max_w = clientWidth - 2*H_MARGIN;\r
+    int memo_y = y + ICON_SIZE + LABEL_V_DISTANCE;\r
+\r
+    SetControlPos( hDlg, idColor, x, y, ICON_SIZE, ICON_SIZE );\r
+    SetControlPos( hDlg, idEngineLabel, label_x, label_y, state_icon_x - label_x, label_h );\r
+    SetControlPos( hDlg, idStateIcon, state_icon_x, y, ICON_SIZE, ICON_SIZE );\r
+    SetControlPos( hDlg, idStateData, state_data_x, label_y, state_data_w, label_h );\r
+    SetControlPos( hDlg, idNPS, nps_x, label_y, nps_w, label_h );\r
+    SetControlPos( hDlg, idMemo, x, memo_y, max_w, memoHeight );\r
+}\r
+\r
+// Also here some of the size calculations should go to the back end, and their actual application to a front-end routine\r
+static void ResizeWindowControls( HWND hDlg, int mode )\r
+{\r
+    RECT rc;\r
+    int headerHeight = GetHeaderHeight();\r
+    int labelHeight = GetControlHeight( hDlg, IDC_EngineLabel1 );\r
+    int labelOffset = H_MARGIN + ICON_SIZE + H_MARGIN;\r
+    int labelDeltaY = ICON_SIZE - labelHeight;\r
+    int clientWidth;\r
+    int clientHeight;\r
+    int maxControlWidth;\r
+    int npsWidth;\r
+\r
+    /* Initialize variables */\r
+    GetClientRect( hDlg, &rc );\r
+\r
+    clientWidth = rc.right - rc.left;\r
+    clientHeight = rc.bottom - rc.top;\r
+\r
+    maxControlWidth = clientWidth - 2*H_MARGIN;\r
+\r
+    npsWidth = GetControlWidth( hDlg, IDC_Engine1_NPS );\r
+\r
+    /* Resize controls */\r
+    if( mode == 0 ) {\r
+        /* One engine */\r
+        PositionControlSet( hDlg, H_MARGIN, V_MARGIN, \r
+            clientWidth, \r
+            clientHeight - V_MARGIN - LABEL_V_DISTANCE - headerHeight- V_MARGIN,\r
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );\r
+\r
+        /* Hide controls for the second engine */\r
+        HideControl( hDlg, IDC_Color2 );\r
+        HideControl( hDlg, IDC_EngineLabel2 );\r
+        HideControl( hDlg, IDC_StateIcon2 );\r
+        HideControl( hDlg, IDC_StateData2 );\r
+        HideControl( hDlg, IDC_Engine2_NPS );\r
+        HideControl( hDlg, IDC_EngineMemo2 );\r
+        SendDlgItemMessage( hDlg, IDC_EngineMemo2, WM_SETTEXT, 0, (LPARAM) "" );\r
+        /* TODO: we should also hide/disable them!!! what about tab stops?!?! */\r
+    }\r
+    else {\r
+        /* Two engines */\r
+        int memo_h = (clientHeight - headerHeight*2 - V_MARGIN*2 - LABEL_V_DISTANCE*2 - SPLITTER_SIZE) / 2;\r
+        int header1_y = V_MARGIN;\r
+        int header2_y = V_MARGIN + headerHeight + LABEL_V_DISTANCE + memo_h + SPLITTER_SIZE;\r
+\r
+        PositionControlSet( hDlg, H_MARGIN, header1_y, clientWidth, memo_h,\r
+            IDC_Color1, IDC_EngineLabel1, IDC_Engine1_NPS, IDC_EngineMemo1, IDC_StateIcon1, IDC_StateData1 );\r
+\r
+        PositionControlSet( hDlg, H_MARGIN, header2_y, clientWidth, memo_h,\r
+            IDC_Color2, IDC_EngineLabel2, IDC_Engine2_NPS, IDC_EngineMemo2, IDC_StateIcon2, IDC_StateData2 );\r
+    }\r
+\r
+    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE );\r
+    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE );\r
+}\r
+\r
+// front end. Actual printing of PV lines into the output field\r
+static void InsertIntoMemo( int which, char * text )\r
+{\r
+    SendMessage( outputField[which][nMemo], EM_SETSEL, 0, 0 );\r
+\r
+    SendMessage( outputField[which][nMemo], EM_REPLACESEL, (WPARAM) FALSE, (LPARAM) text );\r
+}\r
+\r
+// front end. Associates an icon with an output field ("control" in Windows jargon).\r
+// [HGM] let it find out the output field from the 'which' number by itself\r
+static void SetIcon( int which, int field, int nIcon )\r
+{\r
+\r
+    if( nIcon != 0 ) {\r
+        SendMessage( outputField[which][field], STM_SETICON, (WPARAM) icons[nIcon], 0 );\r
+    }\r
+}\r
+\r
+// front end wrapper for SetWindowText, taking control number in stead of handle\r
+void DoSetWindowText(int which, int field, char *s_label)\r
+{\r
+    SetWindowText( outputField[which][field], s_label );\r
+}\r
+#endif
+
+void DoSetWindowText(int which, int field, char *s_label)\r
+{ \r
+       Arg arg;\r
+\r
+       XtSetArg(arg, XtNlabel, (XtArgVal) s_label);\r
+       XtSetValues(outputField[which][field], &arg, 1);\r
+}\r
+
+static void InsertIntoMemo( int which, char * text )\r
+{
+       Arg arg; XawTextBlock t; Widget edit;
+
+       t.ptr = text; t.firstPos = 0; t.length = strlen(text); t.format = XawFmt8Bit;\r
+       edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");\r
+       XawTextReplace(edit, 0, 0, &t);
+//     XtSetArg(arg, XtNstring, (XtArgVal) text);\r
+//     XtSetValues(outputField[which][nMemo], &arg, 1);\r
+}\r
+
+static void SetIcon( int which, int field, int nIcon )
+{
+    Arg arg;
+\r
+    if( nIcon != 0 ) {\r
+       XtSetArg(arg, XtNleftBitmap, (XtArgVal) icons[nIcon]);\r
+       XtSetValues(outputField[which][field], &arg, 1);\r
+    }\r
+}
+
+void DoClearMemo(int which)\r\r    Arg args[16];\r
+    int j;\r
+    Widget edit;\r
+
+       edit = XtNameToWidget(engineOutputShell, which ? "*form2.text" : "*form.text");\r
+       XtCallActionProc(edit, "select-all", NULL, NULL, 0);\r
+       XtCallActionProc(edit, "kill-selection", NULL, NULL, 0);\r
+}
+\r
+// The following routines are mutated clones of the commentPopUp routines\r
+\r
+void PositionControlSet(which, form, bw_width)\r
+     int which;\r
+     Widget form;\r
+     Dimension bw_width;\r{\r
+    Arg args[16];\r
+    Widget edit, NameWidget, ColorWidget, ModeWidget, MoveWidget, NodesWidget;\r
+    int j, mutable=1;\r
+    j = 0;\r
+    XtSetArg(args[j], XtNborderWidth, (XtArgVal) 0); j++;
+    XtSetArg(args[j], XtNlabel,     (XtArgVal) ""); j++;\r
+    XtSetArg(args[j], XtNtop,       XtChainTop); j++;\r
+    XtSetArg(args[j], XtNbottom,    XtChainTop); j++;\r
+    XtSetArg(args[j], XtNleft,      XtChainLeft); j++;\r    XtSetArg(args[j], XtNright,     XtChainLeft); j++;\r    XtSetArg(args[j], XtNheight,    (XtArgVal) 16); j++;\r
+    XtSetArg(args[j], XtNwidth,     (XtArgVal) 17); j++;\r
+    outputField[which][nColorIcon] = ColorWidget =
+      XtCreateManagedWidget("Color", labelWidgetClass,\r
+                    form, args, j);\r
+
+    j = 0;\r
+    XtSetArg(args[j], XtNborderWidth, (XtArgVal) 0); j++;
+    XtSetArg(args[j], XtNjustify,   (XtArgVal) XtJustifyLeft); j++;
+    XtSetArg(args[j], XtNfromHoriz, (XtArgVal) ColorWidget); j++;\r
+    XtSetArg(args[j], XtNtop,       XtChainTop); j++;\r
+    XtSetArg(args[j], XtNbottom,    XtChainTop); j++;\r
+    XtSetArg(args[j], XtNleft,      XtChainLeft); j++;\r    XtSetArg(args[j], XtNheight,    (XtArgVal) 16); j++;\r
+    XtSetArg(args[j], XtNwidth,     (XtArgVal) bw_width/2 - 57); j++;\r
+    outputField[which][nLabel] = NameWidget =
+      XtCreateManagedWidget("Engine", labelWidgetClass,\r
+                    form, args, j);\r
+
+    j = 0;\r
+    XtSetArg(args[j], XtNborderWidth, (XtArgVal) 0); j++;
+    XtSetArg(args[j], XtNlabel,     (XtArgVal) ""); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, (XtArgVal) NameWidget); j++;\r
+    XtSetArg(args[j], XtNtop,       XtChainTop); j++;\r
+    XtSetArg(args[j], XtNbottom,    XtChainTop); j++;\r
+    XtSetArg(args[j], XtNheight,    (XtArgVal) 16); j++;\r
+    XtSetArg(args[j], XtNwidth,     (XtArgVal) 20); j++;\r
+    outputField[which][nStateIcon] = ModeWidget =
+      XtCreateManagedWidget("Mode", labelWidgetClass,\r
+                    form, args, j);\r
+
+    j = 0;\r
+    XtSetArg(args[j], XtNborderWidth, (XtArgVal) 0); j++;
+    XtSetArg(args[j], XtNjustify,   (XtArgVal) XtJustifyLeft); j++;
+    XtSetArg(args[j], XtNlabel,     (XtArgVal) ""); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, (XtArgVal) ModeWidget); j++;\r
+    XtSetArg(args[j], XtNtop,       XtChainTop); j++;\r
+    XtSetArg(args[j], XtNbottom,    XtChainTop); j++;\r
+    XtSetArg(args[j], XtNright,     XtChainRight); j++;\r    XtSetArg(args[j], XtNheight,    (XtArgVal) 16); j++;\r
+    XtSetArg(args[j], XtNwidth,     (XtArgVal) bw_width/2 - 102); j++;\r
+    outputField[which][nStateData] = MoveWidget =
+      XtCreateManagedWidget("Move", labelWidgetClass,\r
+                    form, args, j);\r
+
+    j = 0;\r
+    XtSetArg(args[j], XtNborderWidth, (XtArgVal) 0); j++;
+    XtSetArg(args[j], XtNjustify,   (XtArgVal) XtJustifyRight); j++;\r
+    XtSetArg(args[j], XtNlabel,     (XtArgVal) "NPS"); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, (XtArgVal) MoveWidget); j++;\r
+    XtSetArg(args[j], XtNtop,       XtChainTop); j++;\r
+    XtSetArg(args[j], XtNbottom,    XtChainTop); j++;\r
+    XtSetArg(args[j], XtNleft,      XtChainRight); j++;\r    XtSetArg(args[j], XtNright,     XtChainRight); j++;\r    XtSetArg(args[j], XtNheight,    (XtArgVal) 16); j++;\r
+    XtSetArg(args[j], XtNwidth,     (XtArgVal) 100); j++;\r
+    outputField[which][nLabelNPS] = NodesWidget =
+      XtCreateManagedWidget("Nodes", labelWidgetClass,\r
+                    form, args, j);\r
+
+    // create "text" within "form"
+    j = 0;\r
+    if (mutable) {\r
+       XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+       XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    }\r
+    XtSetArg(args[j], XtNstring, "");  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth, bw_width);  j++; /*force wider than buttons*/\r
+#if 0\r
+    XtSetArg(args[j], XtNscrollVertical, XawtextScrollWhenNeeded);  j++;\r
+#else\r
+    /* !!Work around an apparent bug in XFree86 4.0.1 (X11R6.4.3) */\r
+    XtSetArg(args[j], XtNscrollVertical, XawtextScrollAlways);  j++;\r
+    XtSetArg(args[j], XtNscrollHorizontal, XawtextScrollWhenNeeded);  j++;\r#endif\r
+//    XtSetArg(args[j], XtNautoFill, True);  j++;\r
+//    XtSetArg(args[j], XtNwrap, XawtextWrapWord); j++;\r
+    outputField[which][nMemo] = edit =\r
+      XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, j);\r
+\r
+    j = 0;\r
+    XtSetArg(args[j], XtNfromVert, ColorWidget); j++;\r
+//    XtSetArg(args[j], XtNresizable, (XtArgVal) True); j++;\r
+    XtSetValues(edit, args, j);\r
+}\r
+\r
+Widget EngineOutputCreate(name, text)\r
+     char *name, *text;\r
+{\r
+    Arg args[16];\r
+    Widget shell, layout, form, form2, edit;
+    Dimension bw_width, bw_height;\r
+    int j;\r
+\r
+    // get board width
+    j = 0;\r
+    XtSetArg(args[j], XtNwidth,  &bw_width);  j++;\r    XtSetArg(args[j], XtNheight, &bw_height);  j++;\r    XtGetValues(boardWidget, args, j);\r
+\r
+    // define form within layout within shell.
+    j = 0;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    shell =\r
+      XtCreatePopupShell(name, transientShellWidgetClass,\r
+                        shellWidget, args, j);\r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, shell,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+    // divide window vertically into two equal parts, by creating two forms
+    form =\r
+      XtCreateManagedWidget("form", formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+    form2 =\r
+      XtCreateManagedWidget("form2", formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+    j = 0;\r    XtSetArg(args[j], XtNfromVert,  (XtArgVal) form); j++;\r    XtSetValues(form2, args, j);\r
+    // make sure width is known in advance, for better placement of child widgets
+    j = 0;\r    XtSetArg(args[j], XtNwidth,     (XtArgVal) bw_width-16); j++;\r    XtSetArg(args[j], XtNheight,    (XtArgVal) bw_height/2); j++;\r    XtSetValues(shell, args, j);\r
+
+    // fill up both forms with control elements
+    PositionControlSet(0, form,  bw_width);
+    PositionControlSet(1, form2, bw_width);
+\r
+    XtRealizeWidget(shell);\r
+
+    if (engineOutputX == -1) {\r
+       int xx, yy;\r
+       Window junk;\r
+       Dimension pw_height;\r
+       Dimension ew_height;\r
+#if 0\r
+       j = 0;\r
+       XtSetArg(args[j], XtNheight, &ew_height);  j++;\r
+       XtGetValues(edit, args, j);\r
+\r
+       j = 0;\r
+       XtSetArg(args[j], XtNheight, &pw_height);  j++;\r
+       XtGetValues(shell, args, j);\r
+       engineOutputH = pw_height + (lines - 1) * ew_height;\r
+       engineOutputW = bw_width - 16;
+#else
+       engineOutputH = bw_height/2;\r   engineOutputW = bw_width-16;\r#endif
+\r
+       XSync(xDisplay, False);\r
+#ifdef NOTDEF\r
+       /* This code seems to tickle an X bug if it is executed too soon\r
+          after xboard starts up.  The coordinates get transformed as if\r
+          the main window was positioned at (0, 0).\r
+          */\r
+       XtTranslateCoords(shellWidget,\r
+                         (bw_width - engineOutputW) / 2, 0 - engineOutputH / 2,\r
+                         &engineOutputX, &engineOutputY);\r
+#else  /*!NOTDEF*/\r
+        XTranslateCoordinates(xDisplay, XtWindow(shellWidget),\r
+                             RootWindowOfScreen(XtScreen(shellWidget)),\r
+                             (bw_width - engineOutputW) / 2, 0 - engineOutputH / 2,\r
+                             &xx, &yy, &junk);\r
+       engineOutputX = xx;\r
+       engineOutputY = yy;\r
+#endif /*!NOTDEF*/\r
+       if (engineOutputY < 0) engineOutputY = 0; /*avoid positioning top offscreen*/\r
+    }\r
+    j = 0;\r
+    XtSetArg(args[j], XtNheight, engineOutputH);  j++;\r    XtSetArg(args[j], XtNwidth, engineOutputW);  j++;\r
+    XtSetArg(args[j], XtNx, engineOutputX);  j++;\r
+    XtSetArg(args[j], XtNy, engineOutputY);  j++;\r
+    XtSetValues(shell, args, j);\r
+//    XtSetKeyboardFocus(shell, edit);\r
+\r
+    return shell;\r
+}\r
+\r
+void ResizeWindowControls(shell, mode)
+       Widget shell;
+       int mode;
+{
+    Widget form1, form2;
+    Arg args[16];
+    int j;
+    Dimension ew_height, tmp;
+
+    form1 = XtNameToWidget(shell, "*form");\r
+    form2 = XtNameToWidget(shell, "*form2");
+
+    j = 0;
+    XtSetArg(args[j], XtNheight, (XtArgVal) &ew_height); j++;\r    XtGetValues(form1, args, j);
+    j = 0;
+    XtSetArg(args[j], XtNheight, (XtArgVal) &tmp); j++;\r    XtGetValues(form2, args, j);
+    ew_height += tmp; // total height
+\r
+    if(mode==0) {\r
+       j = 0;
+       XtSetArg(args[j], XtNheight, (XtArgVal) 5); j++;\r
+       XtSetValues(form2, args, j);
+       j = 0;
+       XtSetArg(args[j], XtNheight, (XtArgVal) (ew_height-5)); j++;\r
+       XtSetValues(form1, args, j);
+    } else {
+       j = 0;
+       XtSetArg(args[j], XtNheight, (XtArgVal) (ew_height/2)); j++;\r
+       XtSetValues(form1, args, j);
+       j = 0;
+       XtSetArg(args[j], XtNheight, (XtArgVal) (ew_height/2)); j++;\r
+       XtSetValues(form2, args, j);
+    }\r
+}
+
+#if 0\r
+void EngineOutputCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Arg args[16];\r
+    int j;\r
+\r
+    j = 0;\r
+    XtSetArg(args[j], XtNlabel, &name);  j++;\r
+    XtGetValues(w, args, j);\r
+\r
+    if (strcmp(name, "close") == 0) {\r
+       EngineOutputPopDown();\r
+    } else if (strcmp(name, "edit") == 0) {\r
+       EngineOutputPopDown();\r
+       EditCommentEvent();\r
+    }\r
+}\r
+#endif
+\r
+#if 0\r
+// This seems pure front end\r
+LRESULT CALLBACK EngineOutputProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam )\r
+{\r
+    static SnapData sd;\r
+\r
+    switch (message) {\r
+    case WM_INITDIALOG:\r
+        if( engineOutputDialog == NULL ) {\r
+            engineOutputDialog = hDlg;\r
+\r
+            RestoreWindowPlacement( hDlg, &wpEngineOutput ); /* Restore window placement */\r
+\r
+            ResizeWindowControls( hDlg, windowMode );\r
+\r
+            SetEngineState( 0, STATE_IDLE, "" );\r
+            SetEngineState( 1, STATE_IDLE, "" );\r
+        }\r
+\r
+        return FALSE;\r
+\r
+    case WM_COMMAND:\r
+        switch (LOWORD(wParam)) {\r
+        case IDOK:\r
+          EndDialog(hDlg, TRUE);\r
+          return TRUE;\r
+\r
+        case IDCANCEL:\r
+          EndDialog(hDlg, FALSE);\r
+          return TRUE;\r
+\r
+        default:\r
+          break;\r
+        }\r
+\r
+        break;\r
+\r
+    case WM_GETMINMAXINFO:\r
+        {\r
+            MINMAXINFO * mmi = (MINMAXINFO *) lParam;\r
+        \r
+            mmi->ptMinTrackSize.x = 100;\r
+            mmi->ptMinTrackSize.y = 160;\r
+        }\r
+        break;\r
+\r
+    case WM_CLOSE:\r
+        EngineOutputPopDown();\r
+        break;\r
+\r
+    case WM_SIZE:\r
+        ResizeWindowControls( hDlg, windowMode );\r
+        break;\r
+\r
+    case WM_ENTERSIZEMOVE:\r
+        return OnEnterSizeMove( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_SIZING:\r
+        return OnSizing( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_MOVING:\r
+        return OnMoving( &sd, hDlg, wParam, lParam );\r
+\r
+    case WM_EXITSIZEMOVE:\r
+        return OnExitSizeMove( &sd, hDlg, wParam, lParam );\r
+    }\r
+\r
+    return FALSE;\r
+}\r
+#endif
+\r
+void EngineOutputPopUp(title, text)\r
+     char *title, *text;\r
+{\r
+    Arg args[16];\r
+    int j;\r
+    Widget edit;\r
+\r
+    if (engineOutputShell == NULL) {\r
+       engineOutputShell =\r
+         EngineOutputCreate(title, text);\r
+       XtRealizeWidget(engineOutputShell);\r
+       CatchDeleteWindow(engineOutputShell, "EngineOutputPopDown");\r
+       if( needInit ) {\r
+           InitializeEngineOutput();\r
+           needInit = FALSE;\r  }\r
+        SetEngineColorIcon( 0 );\r
+        SetEngineColorIcon( 1 );\r
+        SetEngineState( 0, STATE_IDLE, "" );\r
+        SetEngineState( 1, STATE_IDLE, "" );\r
+    } else {
+       edit = XtNameToWidget(engineOutputShell, "*form.text");\r
+       j = 0;\r
+       XtSetArg(args[j], XtNstring, text); j++;\r
+       XtSetValues(edit, args, j);\r
+       j = 0;\r
+       XtSetArg(args[j], XtNiconName, (XtArgVal) title);   j++;\r
+       XtSetArg(args[j], XtNtitle, (XtArgVal) title);      j++;\r
+       XtSetValues(engineOutputShell, args, j);\r
+    }\r
+\r
+    XtPopup(engineOutputShell, XtGrabNone);\r
+    XSync(xDisplay, False);\r
+\r
+    j=0;
+    XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
+    XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Engine Output"),
+               args, j);
+
+    engineOutputDialogUp = True;\r
+    ShowThinkingEvent(); // [HGM] thinking: might need to prompt engine for thinking output
+}\r
+
+#if 0\r
+// front end\r
+void EngineOutputPopUp()\r
+{\r
+  FARPROC lpProc;\r
+  \r
+  CheckMenuItem(GetMenu(hwndMain), IDM_ShowEngineOutput, MF_CHECKED);\r
+\r
+  if( engineOutputDialog ) {\r
+    SendMessage( engineOutputDialog, WM_INITDIALOG, 0, 0 );\r
+\r
+    if( ! engineOutputDialogUp ) {\r
+        ShowWindow(engineOutputDialog, SW_SHOW);\r
+    }\r
+  }\r
+  else {\r
+    lpProc = MakeProcInstance( (FARPROC) EngineOutputProc, hInst );\r
+\r
+    /* Note to self: dialog must have the WS_VISIBLE style set, otherwise it's not shown! */\r
+    CreateDialog( hInst, MAKEINTRESOURCE(DLG_EngineOutput), hwndMain, (DLGPROC)lpProc );\r
+\r
+    FreeProcInstance(lpProc);\r
+  }\r
+\r
+  // [HGM] displaced to after creation of dialog, to allow initialization of output fields\r
+  if( needInit ) {\r
+      InitializeEngineOutput();\r
+      needInit = FALSE;\r
+  }\r
+\r
+  engineOutputDialogUp = TRUE;\r
+}\r
+#endif
+\r
+void EngineOutputPopDown()\r
+{\r
+    Arg args[16];\r
+    int j;\r
+\r
+    if (!engineOutputDialogUp) return;\r
+    j = 0;\r
+    XtSetArg(args[j], XtNx, &engineOutputX); j++;\r
+    XtSetArg(args[j], XtNy, &engineOutputY); j++;\r
+    XtSetArg(args[j], XtNwidth, &engineOutputW); j++;\r
+    XtSetArg(args[j], XtNheight, &engineOutputH); j++;\r
+    XtGetValues(engineOutputShell, args, j);\r
+    XtPopdown(engineOutputShell);\r
+    XSync(xDisplay, False);
+    j=0;
+    XtSetArg(args[j], XtNleftBitmap, None); j++;
+    XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Engine Output"),
+               args, j);
+\r
+    engineOutputDialogUp = False;\r
+    ShowThinkingEvent(); // [HGM] thinking: might need to shut off thinking output
+}\r
+\r
+#if 0
+// front end\r
+void EngineOutputPopDown()\r
+{\r
+  CheckMenuItem(GetMenu(hwndMain), IDM_ShowEngineOutput, MF_UNCHECKED);\r
+\r
+  if( engineOutputDialog ) {\r
+      ShowWindow(engineOutputDialog, SW_HIDE);\r
+  }\r
+\r
+  engineOutputDialogUp = FALSE;\r
+}\r
+\r
+// front end. [HGM] Takes handle of output control from table, so only number is passed\r
+void DoClearMemo(int which)\r
+{\r
+        SendMessage( outputField[which][nMemo], WM_SETTEXT, 0, (LPARAM) "" );\r
+}\r
+#endif
+
+//------------------------ pure back-end routines -------------------------------\r
+\r
+\r
+// back end, due to front-end wrapper for SetWindowText, and new SetIcon arguments\r
+static SetEngineState( int which, int state, char * state_data )\r
+{\r
+    int x_which = 1 - which;\r
+\r
+    if( engineState[ which ] != state ) {\r
+        engineState[ which ] = state;\r
+\r
+        switch( state ) {\r
+        case STATE_THINKING:\r
+            SetIcon( which, nStateIcon, nThinking );\r
+            if( engineState[ x_which ] == STATE_THINKING ) {\r
+                SetEngineState( x_which, STATE_IDLE, "" );\r
+            }\r
+            break;\r
+        case STATE_PONDERING:\r
+            SetIcon( which, nStateIcon, nPondering );\r
+            break;\r
+        case STATE_ANALYZING:\r
+            SetIcon( which, nStateIcon, nAnalyzing );\r
+            break;\r
+        default:\r
+            SetIcon( which, nStateIcon, nClear );\r
+            break;\r
+        }\r
+    }\r
+\r
+    if( state_data != 0 ) {\r
+        DoSetWindowText( which, nStateData, state_data );\r
+    }\r
+}\r
+\r
+// back end, now the front-end wrapper ClearMemo is used, and ed no longer contains handles.\r
+void EngineOutputUpdate( FrontEndProgramStats * stats )\r
+{\r
+    EngineOutputData ed;\r
+    int clearMemo = FALSE;\r
+    int which;\r
+    int depth;\r
+\r
+    if( stats == 0 ) {\r
+        SetEngineState( 0, STATE_IDLE, "" );\r
+        SetEngineState( 1, STATE_IDLE, "" );\r
+        return;\r
+    }\r
+\r
+    which = stats->which;\r
+    depth = stats->depth;\r
+\r
+    if( which < 0 || which > 1 || depth < 0 || stats->time < 0 || stats->pv == 0 ) {\r
+        return;\r
+    }\r
+\r
+    if( engineOutputShell == NULL ) {\r
+        return;\r
+    }\r
+\r
+    VerifyDisplayMode();\r
+\r
+    ed.which = which;\r
+    ed.depth = depth;\r
+    ed.nodes = stats->nodes;\r
+    ed.score = stats->score;\r
+    ed.time = stats->time;\r
+    ed.pv = stats->pv;\r
+    ed.hint = stats->hint;\r
+    ed.an_move_index = stats->an_move_index;\r
+    ed.an_move_count = stats->an_move_count;\r
+\r
+    /* Get target control. [HGM] this is moved to front end, which get them from a table */\r
+    if( which == 0 ) {\r
+        ed.name = first.tidy;\r
+    }\r
+    else {\r
+        ed.name = second.tidy;\r
+    }\r
+\r
+    /* Clear memo if needed */\r
+    if( lastDepth[which] > depth || (lastDepth[which] == depth && depth <= 1) ) {\r
+        clearMemo = TRUE;\r
+    }\r
+\r
+    if( lastForwardMostMove[which] != forwardMostMove ) {\r
+        clearMemo = TRUE;\r
+    }\r
+\r
+    if( clearMemo ) DoClearMemo(which);\r
+\r
+    /* Update */\r
+    lastDepth[which] = depth;\r
+    lastForwardMostMove[which] = forwardMostMove;\r
+\r
+    if( ed.pv != 0 && ed.pv[0] == ' ' ) {\r
+        if( strncmp( ed.pv, " no PV", 6 ) == 0 ) { /* Hack on hack! :-O */\r
+            ed.pv = "";\r
+        }\r
+    }\r
+\r
+    UpdateControls( &ed );\r
+}\r
+\r
+#define ENGINE_COLOR_WHITE      'w'\r
+#define ENGINE_COLOR_BLACK      'b'\r
+#define ENGINE_COLOR_UNKNOWN    ' '\r
+\r
+// pure back end\r
+char GetEngineColor( int which )\r
+{\r
+    char result = ENGINE_COLOR_UNKNOWN;\r
+\r
+    if( which == 0 || which == 1 ) {\r
+        ChessProgramState * cps;\r
+\r
+        switch (gameMode) {\r
+        case MachinePlaysBlack:\r
+        case IcsPlayingBlack:\r
+            result = ENGINE_COLOR_BLACK;\r
+            break;\r
+        case MachinePlaysWhite:\r
+        case IcsPlayingWhite:\r
+            result = ENGINE_COLOR_WHITE;\r
+            break;\r
+        case AnalyzeMode:\r
+        case AnalyzeFile:\r
+            result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+            break;\r
+        case TwoMachinesPlay:\r
+            cps = (which == 0) ? &first : &second;\r
+            result = cps->twoMachinesColor[0];\r
+            result = result == 'w' ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+            break;\r
+        }\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+// pure back end\r
+char GetActiveEngineColor()\r
+{\r
+    char result = ENGINE_COLOR_UNKNOWN;\r
+\r
+    if( gameMode == TwoMachinesPlay ) {\r
+        result = WhiteOnMove(forwardMostMove) ? ENGINE_COLOR_WHITE : ENGINE_COLOR_BLACK;\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+// pure back end\r
+static int IsEnginePondering( int which )\r
+{\r
+    int result = FALSE;\r
+\r
+    switch (gameMode) {\r
+    case MachinePlaysBlack:\r
+    case IcsPlayingBlack:\r
+        if( WhiteOnMove(forwardMostMove) ) result = TRUE;\r
+        break;\r
+    case MachinePlaysWhite:\r
+    case IcsPlayingWhite:\r
+        if( ! WhiteOnMove(forwardMostMove) ) result = TRUE;\r
+        break;\r
+    case TwoMachinesPlay:\r
+        if( GetActiveEngineColor() != ENGINE_COLOR_UNKNOWN ) {\r
+            if( GetEngineColor( which ) != GetActiveEngineColor() ) result = TRUE;\r
+        }\r
+        break;\r
+    }\r
+\r
+    return result;\r
+}\r
+\r
+// back end\r
+static void SetDisplayMode( int mode )\r
+{\r
+    if( windowMode != mode ) {\r
+        windowMode = mode;\r
+\r
+        ResizeWindowControls( engineOutputShell, mode );\r
+    }\r
+}\r
+\r
+// pure back end\r
+static VerifyDisplayMode()\r
+{\r
+    int mode;\r
+\r
+    /* Get proper mode for current game */\r
+    switch( gameMode ) {\r
+    case AnalyzeMode:\r
+    case AnalyzeFile:\r
+    case MachinePlaysWhite:\r
+    case MachinePlaysBlack:\r
+    case IcsPlayingWhite:\r
+    case IcsPlayingBlack:\r
+        mode = 0;\r
+        break;\r
+    case TwoMachinesPlay:\r
+        mode = 1;\r
+        break;\r
+    default:\r
+        /* Do not change */\r
+        return;\r
+    }\r
+\r
+    SetDisplayMode( mode );\r
+}\r
+\r
+// back end. Determine what icon to se in the color-icon field, and print it\r
+static void SetEngineColorIcon( int which )\r
+{\r
+    char color = GetEngineColor(which);\r
+    int nicon = 0;\r
+\r
+    if( color == ENGINE_COLOR_BLACK )\r
+        nicon = nColorBlack;\r
+    else if( color == ENGINE_COLOR_WHITE )\r
+        nicon = nColorWhite;\r
+    else\r
+        nicon = nColorUnknown;\r
+\r
+    SetIcon( which, nColorIcon, nicon );\r
+}\r
+\r
+#define MAX_NAME_LENGTH 32\r
+\r
+// pure back end, now SetWindowText is called via wrapper DoSetWindowText\r
+static void UpdateControls( EngineOutputData * ed )\r
+{\r
+    int isPondering = FALSE;\r
+\r
+    char s_label[MAX_NAME_LENGTH + 32];\r
+    \r
+    char * name = ed->name;\r
+\r
+    /* Label */\r
+    if( name == 0 || *name == '\0' ) {\r
+        name = "?";\r
+    }\r
+\r
+    strncpy( s_label, name, MAX_NAME_LENGTH );\r
+    s_label[ MAX_NAME_LENGTH-1 ] = '\0';\r
+\r
+#ifdef SHOW_PONDERING\r
+    if( IsEnginePondering( ed->which ) ) {\r
+        char buf[8];\r
+\r
+        buf[0] = '\0';\r
+\r
+        if( ed->hint != 0 && *ed->hint != '\0' ) {\r
+            strncpy( buf, ed->hint, sizeof(buf) );\r
+            buf[sizeof(buf)-1] = '\0';\r
+        }\r
+        else if( ed->pv != 0 && *ed->pv != '\0' ) {\r
+            char * sep = strchr( ed->pv, ' ' );\r
+            int buflen = sizeof(buf);\r
+\r
+            if( sep != NULL ) {\r
+                buflen = sep - ed->pv + 1;\r
+                if( buflen > sizeof(buf) ) buflen = sizeof(buf);\r
+            }\r
+\r
+            strncpy( buf, ed->pv, buflen );\r
+            buf[ buflen-1 ] = '\0';\r
+        }\r
+\r
+        SetEngineState( ed->which, STATE_PONDERING, buf );\r
+    }\r
+    else if( gameMode == TwoMachinesPlay ) {\r
+        SetEngineState( ed->which, STATE_THINKING, "" );\r
+    }\r
+    else if( gameMode == AnalyzeMode || gameMode == AnalyzeFile ) {\r
+        char buf[64];\r
+        int time_secs = ed->time / 100;\r
+        int time_mins = time_secs / 60;\r
+\r
+        buf[0] = '\0';\r
+\r
+        if( ed->an_move_index != 0 && ed->an_move_count != 0 && *ed->hint != '\0' ) {\r
+            char mov[16];\r
+\r
+            strncpy( mov, ed->hint, sizeof(mov) );\r
+            mov[ sizeof(mov)-1 ] = '\0';\r
+\r
+            sprintf( buf, "%d/%d: %s [%02d:%02d:%02d]", ed->an_move_index, ed->an_move_count, mov, time_mins / 60, time_mins % 60, time_secs % 60 );\r
+        }\r
+\r
+        SetEngineState( ed->which, STATE_ANALYZING, buf );\r
+    }\r
+    else {\r
+        SetEngineState( ed->which, STATE_IDLE, "" );\r
+    }\r
+#endif\r
+\r
+    DoSetWindowText( ed->which, nLabel, s_label );\r
+\r
+    s_label[0] = '\0';\r
+\r
+    if( ed->time > 0 && ed->nodes > 0 ) {\r
+        unsigned long nps_100 = ed->nodes / ed->time;\r
+\r
+        if( nps_100 < 100000 ) {\r
+            sprintf( s_label, "NPS: %lu", nps_100 * 100 );\r
+        }\r
+        else {\r
+            sprintf( s_label, "NPS: %.1fk", nps_100 / 10.0 );\r
+        }\r
+    }\r
+\r
+    DoSetWindowText( ed->which, nLabelNPS, s_label );\r
+\r
+    /* Memo */\r
+    if( ed->pv != 0 && *ed->pv != '\0' ) {\r
+        char s_nodes[24];\r
+        char s_score[16];\r
+        char s_time[24];\r
+        char buf[256];\r
+        int buflen;\r
+        int time_secs = ed->time / 100;\r
+        int time_cent = ed->time % 100;\r
+\r
+        /* Nodes */\r
+        if( ed->nodes < 1000000 ) {\r
+            sprintf( s_nodes, "%lu", ed->nodes );\r
+        }\r
+        else {\r
+            sprintf( s_nodes, "%.1fM", ed->nodes / 1000000.0 );\r
+        }\r
+\r
+        /* Score */\r
+        if( ed->score > 0 ) {\r
+            sprintf( s_score, "+%.2f", ed->score / 100.0 );\r
+        } else\r
+            sprintf( s_score, "%.2f", ed->score / 100.0 );\r
+\r
+        /* Time */\r
+        sprintf( s_time, "%d:%02d.%02d", time_secs / 60, time_secs % 60, time_cent );\r
+\r
+        /* Put all together... */\r
+        sprintf( buf, "%3d  %s  %s\t%s\t", ed->depth, s_score, s_nodes, s_time );\r
+\r
+        /* Add PV */\r
+        buflen = strlen(buf);\r
+\r
+        strncpy( buf + buflen, ed->pv, sizeof(buf) - buflen );\r
+\r
+        buf[ sizeof(buf) - 3 ] = '\0';\r
+\r
+        strcat( buf + buflen, "\n" );\r
+\r
+        /* Update memo */\r
+        InsertIntoMemo( ed->which, buf );\r
+    }\r
+\r
+    /* Colors */\r
+    SetEngineColorIcon( ed->which );\r
+}\r
+\r
+// back end\r
+int EngineOutputIsUp()\r
+{\r
+    return engineOutputDialogUp;\r
+}\r
+
+void
+EngineOutputProc(w, event, prms, nprms)
+     Widget w;
+     XEvent *event;
+     String *prms;
+     Cardinal *nprms;
+{
+  if (engineOutputDialogUp) {
+    EngineOutputPopDown();
+  } else {
+    EngineOutputPopUp("engine output","This feature is experimental");
+  }
+//  ToNrEvent(currentMove);
+}
+\r
index 7f02ab8..5640fee 100644 (file)
@@ -90,7 +90,7 @@ struct History{
 
 struct History *hist=0;
 String dots=" ... ";
-
+Position gameHistoryX, gameHistoryY;
 void
 HistoryPopDown(w, client_data, call_data)
      Widget w;
@@ -98,20 +98,26 @@ HistoryPopDown(w, client_data, call_data)
 {
   Arg args[16];
   int j;
-  if(hist)
-
-  XtPopdown(hist->sh);
-  hist->Up=False;
+  if(hist) {
+    // [HGM] remember old position
+    j = 0;
+    XtSetArg(args[j], XtNx, &gameHistoryX);  j++;\r
+    XtSetArg(args[j], XtNy, &gameHistoryY);  j++;\r
+    XtGetValues(hist->sh, args, j);\r
 
+    XtPopdown(hist->sh);
+    hist->Up=False;
+  }
   j=0;
   XtSetArg(args[j], XtNleftBitmap, None); j++;
-  XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move List"),
+  XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move History"),
                args, j);
 }
 
 void HistoryMoveProc(Widget w, XtPointer closure, XtPointer call_data)
 {
     int to;
+
     XawListReturnStruct *R = (XawListReturnStruct *) call_data;
     if (w == hist->mvn || w == hist->mvw) {
       to=2*R->list_index-1;
@@ -445,6 +451,12 @@ Widget HistoryCreate()
       strcpy(hist->black[i],"");
      }
    
+  // [HGM] remember old position
+  j = 0;
+  XtSetArg(args[j], XtNx, &gameHistoryX);  j++;\r
+  XtSetArg(args[j], XtNy, &gameHistoryY);  j++;\r
+  XtGetValues(hist->sh, args, j);\r
+
     return hist->sh;
 }
 
@@ -456,9 +468,16 @@ HistoryPopUp()
 
   if(!hist) HistoryCreate();
   XtPopup(hist->sh, XtGrabNone);
+
+  // [HGM] restore old position
+  j = 0;
+  XtSetArg(args[j], XtNx, gameHistoryX);  j++;\r
+  XtSetArg(args[j], XtNy, gameHistoryY);  j++;\r
+  XtSetValues(hist->sh, args, j);\r
+
   j=0;
   XtSetArg(args[j], XtNleftBitmap, xMarkPixmap); j++;
-  XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move List"),
+  XtSetValues(XtNameToWidget(menuBarWidget, "menuMode.Show Move History"),
                args, j);
   hist->Up=True;
 }
diff --git a/xoptions.c b/xoptions.c
new file mode 100644 (file)
index 0000000..1165a09
--- /dev/null
@@ -0,0 +1,1401 @@
+/*\r
+ * xoptions.c -- Move list window, part of X front end for XBoard\r
+ *\r
+ * Copyright 2000 Free Software Foundation, Inc.\r
+ *\r
+ * The following terms apply to the enhanced version of XBoard distributed\r
+ * by the Free Software Foundation:\r
+ * ------------------------------------------------------------------------\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\r
+ * ------------------------------------------------------------------------\r
+ *\r
+ * See the file ChangeLog for a revision history.\r
+ */\r
+\r
+// [HGM] this file is the counterpart of woptions.c, containing xboard popup menus\r
+// similar to those of WinBoard, to set the most common options interactively.\r
+\r
+#include "config.h"\r
+\r
+#include <stdio.h>\r
+#include <ctype.h>\r
+#include <errno.h>\r
+#include <sys/types.h>\r
+\r
+#if STDC_HEADERS\r
+# include <stdlib.h>\r
+# include <string.h>\r
+#else /* not STDC_HEADERS */\r
+extern char *getenv();\r
+# if HAVE_STRING_H\r
+#  include <string.h>\r
+# else /* not HAVE_STRING_H */\r
+#  include <strings.h>\r
+# endif /* not HAVE_STRING_H */\r
+#endif /* not STDC_HEADERS */\r
+\r
+#if HAVE_UNISTD_H\r
+# include <unistd.h>\r
+#endif\r
+\r
+#include <X11/Intrinsic.h>\r
+#include <X11/StringDefs.h>\r
+#include <X11/Shell.h>\r
+#include <X11/Xaw/Dialog.h>\r
+#include <X11/Xaw/Form.h>\r
+#include <X11/Xaw/List.h>\r
+#include <X11/Xaw/Label.h>\r
+#include <X11/Xaw/SimpleMenu.h>\r
+#include <X11/Xaw/SmeBSB.h>\r
+#include <X11/Xaw/SmeLine.h>\r
+#include <X11/Xaw/Box.h>\r
+#include <X11/Xaw/Paned.h>\r
+#include <X11/Xaw/MenuButton.h>\r
+#include <X11/cursorfont.h>\r
+#include <X11/Xaw/Text.h>\r
+#include <X11/Xaw/AsciiText.h>\r
+#include <X11/Xaw/Viewport.h>\r
+#include <X11/Xaw/Toggle.h>\r
+\r
+#include "common.h"\r
+#include "backend.h"\r
+#include "xboard.h"\r
+\r
+extern Widget formWidget, shellWidget, boardWidget, menuBarWidget;\r
+extern Display *xDisplay;\r
+extern int squareSize;\r
+extern Pixmap xMarkPixmap;\r
+extern char *layoutName;\r
+extern Window xBoardWindow;\r
+extern Arg layoutArgs[2], formArgs[2];\r
+Pixel timerForegroundPixel, timerBackgroundPixel;\r
+\r
+// [HGM] the following code for makng menu popups was cloned from the FileNamePopUp routines\r
+\r
+static Widget previous = NULL;\r
+\r
+void SetFocus(Widget w, XtPointer data, XEvent *event, Boolean *b)\r
+{\r
+    Arg args;\r
+\r
+    if(previous) {\r
+       XtSetArg(args, XtNdisplayCaret, False);\r
+       XtSetValues(previous, &args, 1);\r
+    }\r
+    XtSetArg(args, XtNdisplayCaret, True);\r
+    XtSetValues(w, &args, 1);\r
+    XtSetKeyboardFocus((Widget) data, w);\r
+    previous = w;\r
+}\r
+\r
+//--------------------------- New Shuffle Game --------------------------------------------\r
+extern int shuffleOpenings;\r
+extern int startedFromPositionFile;\r
+int shuffleUp;\r
+Widget shuffleShell;\r
+\r
+void ShufflePopDown()\r
+{\r
+    if (!shuffleUp) return;\r
+    XtPopdown(shuffleShell);\r
+    XtDestroyWidget(shuffleShell);\r
+    shuffleUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+void ShuffleCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Widget w2;\r
+    Arg args[16];\r
+    char buf[80];\r
+    \r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "cancel") == 0) {\r
+        ShufflePopDown();\r
+        return;\r
+    }\r
+    if (strcmp(name, "off") == 0) {\r
+        ShufflePopDown();\r
+       shuffleOpenings = False; // [HGM] should be moved to New Variant menu, once we have it!\r
+       ResetGameEvent();\r
+       AnalysisPopDown();\r
+        return;\r
+    }\r
+    if (strcmp(name, "random") == 0) {\r
+       sprintf(buf, "%d", rand());\r
+       XtSetArg(args[0],XtNvalue, buf); // erase bad (non-numeric) value\r
+       XtSetValues(XtParent(w), args, 1);\r
+        return;\r
+    }\r
+    if (strcmp(name, "ok") == 0) {\r
+       int nr; String name;\r
+        name = XawDialogGetValueString(w2 = XtParent(w));\r
+       if(sscanf(name ,"%d",&nr) != 1) {\r
+           sprintf(buf, "%d", appData.defaultFrcPosition);\r
+           XtSetArg(args[0],XtNvalue, buf); // erase bad (non-numeric) value\r
+           XtSetValues(w2, args, 1);\r
+           return;\r
+       }\r
+       appData.defaultFrcPosition = nr;\r
+       shuffleOpenings = True;\r
+        ShufflePopDown();\r
+       ResetGameEvent();\r
+       AnalysisPopDown();\r
+        return;\r
+    }\r
+}\r
+\r
+void ShufflePopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, dialog, edit;\r
+    Window root, child;\r
+    int x, y, i;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    \r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+    XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;\r
+    shuffleShell = popup =\r
+      XtCreatePopupShell("New Shuffle Game", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    sprintf(def, "%d\n", appData.defaultFrcPosition);\r
+    i = 0;\r
+    XtSetArg(args[i], XtNlabel, "Start-position number:"); i++;\r
+    XtSetArg(args[i], XtNvalue, def); i++;\r
+    XtSetArg(args[i], XtNborderWidth, 0); i++;\r
+    dialog = XtCreateManagedWidget("Shuffle", dialogWidgetClass,\r
+                                  layout, args, i);\r
+    \r
+//    XtSetArg(args[0], XtNeditType, XawtextEdit);  // [HGM] can't get edit to work decently\r
+//    XtSetArg(args[1], XtNuseStringInPlace, False);\r
+//    XtSetValues(dialog, args, 2);\r
+\r
+    XawDialogAddButton(dialog, "ok", ShuffleCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, "cancel", ShuffleCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, "random", ShuffleCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, "off", ShuffleCallback, (XtPointer) dialog);\r
+    \r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "ShufflePopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    shuffleUp = True;\r
+    \r
+    edit = XtNameToWidget(dialog, "*value");\r
+\r
+    XtSetKeyboardFocus(popup, edit);\r
+}\r
+\r
+void ShuffleMenuProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+//    if (gameMode == AnalyzeMode || gameMode == AnalyzeFile) {\r
+//     Reset(FALSE, TRUE);\r
+//    }\r
+    ShufflePopUp();\r
+}\r
+\r
+//--------------------------- Time-Control Menu Popup ----------------------------------\r
+int TimeControlUp;\r
+Widget TimeControlShell;\r
+int tcInc;\r
+Widget tcMess1, tcMess2, tcData, tcTime, tcOdds1, tcOdds2;\r
+int tcIncrement, tcMoves;\r
+\r
+void TimeControlPopDown()\r
+{\r
+    if (!TimeControlUp) return;\r
+    XtPopdown(TimeControlShell);\r
+    XtDestroyWidget(TimeControlShell);\r
+    TimeControlUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+void TimeControlCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name, txt;\r
+    Widget w2;\r
+    Arg args[16];\r
+    char buf[80];\r
+    int j;\r
+\r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "classical") == 0) {\r
+       if(!tcInc) return;\r
+       j=0;\r
+       XtSetArg(args[j], XtNlabel, "minutes for each"); j++;\r
+       XtSetValues(tcMess1, args, j);\r
+       j=0;\r
+       XtSetArg(args[j], XtNlabel, "moves"); j++;\r
+       XtSetValues(tcMess2, args, j);\r
+       j=0;\r
+       XtSetArg(args[j], XtNstring, &name); j++;\r
+       XtGetValues(tcData, args, j);\r
+       tcIncrement = 0; sscanf(name, "%d", &tcIncrement);\r
+       sprintf(buf, "%d", tcMoves);\r
+       j=0;\r
+       XtSetArg(args[j], XtNstring, buf); j++;\r
+       XtSetValues(tcData, args, j);\r
+       tcInc = False;\r
+        return;\r
+    }\r
+    if (strcmp(name, "incremental") == 0) {\r
+       if(tcInc) return;\r
+       j=0;\r
+       XtSetArg(args[j], XtNlabel, "minutes, plus"); j++;\r
+       XtSetValues(tcMess1, args, j);\r
+       j=0;\r
+       XtSetArg(args[j], XtNlabel, "sec/move"); j++;\r
+       XtSetValues(tcMess2, args, j);\r
+       j=0;\r
+       XtSetArg(args[j], XtNstring, &name); j++;\r
+       XtGetValues(tcData, args, j);\r
+       tcMoves = appData.movesPerSession; sscanf(name, "%d", &tcMoves);\r
+       sprintf(buf, "%d", tcIncrement);\r
+       j=0;\r
+       XtSetArg(args[j], XtNstring, buf); j++;\r
+       XtSetValues(tcData, args, j);\r
+       tcInc = True;\r
+        return;\r
+    }\r
+    if (strcmp(name, " OK ") == 0) {\r
+       int inc, mps, tc, ok;\r
+       XtSetArg(args[0], XtNstring, &txt);\r
+       XtGetValues(tcData, args, 1);\r
+       if(tcInc) {\r
+           ok = sscanf(txt, "%d", &inc); mps = 0;\r
+           if(!ok && txt[0] == 0) { inc = 0; ok = 1; } // accept empty string as zero\r
+           ok &= (inc >= 0);\r
+       } else {\r
+           ok = sscanf(txt, "%d", &mps); inc = -1;\r
+           ok &= (mps > 0);\r
+       }\r
+       if(ok != 1) {\r
+           XtSetArg(args[0], XtNstring, ""); // erase any offending input\r
+           XtSetValues(tcData, args, 1);\r
+           return;\r
+       }\r
+       XtSetArg(args[0], XtNstring, &txt);\r
+       XtGetValues(tcTime, args, 1);\r
+       if(!ParseTimeControl(txt, inc, mps)) {\r
+           XtSetArg(args[0], XtNstring, ""); // erase any offending input\r
+           XtSetValues(tcTime, args, 1);\r
+           DisplayError("Bad Time-Control String", 0);\r
+           return;\r
+       }\r
+       appData.movesPerSession = mps;\r
+       appData.timeIncrement = inc;\r
+       appData.timeControl = strdup(txt);\r
+       XtSetArg(args[0], XtNstring, &txt);\r
+       XtGetValues(tcOdds1, args, 1);\r
+       appData.firstTimeOdds = first.timeOdds \r
+               = (sscanf(txt, "%d", &j) == 1 && j > 0) ? j : 1;\r
+       XtGetValues(tcOdds2, args, 1);\r
+       appData.secondTimeOdds = second.timeOdds \r
+               = (sscanf(txt, "%d", &j) == 1 && j > 0) ? j : 1;\r
+\r
+       Reset(True, True);\r
+        TimeControlPopDown();\r
+        return;\r
+    }\r
+}\r
+\r
+void TimeControlPopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, mess;\r
+    Window root, child;\r
+    int x, y, i, j;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    \r
+    tcInc = (appData.timeIncrement >= 0);\r
+    tcMoves = appData.movesPerSession; tcIncrement = appData.timeIncrement;\r
+    if(!tcInc) tcIncrement = 0;\r
+    sprintf(def, "%d", tcInc ? tcIncrement : tcMoves);\r
+\r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+//    XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;\r
+    TimeControlShell = popup =\r
+      XtCreatePopupShell("TimeControl Menu", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    form =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+  \r
+    j = 0;\r
+//    XtSetArg(args[j], XtNwidth,     (XtArgVal) 300); j++;\r
+//    XtSetArg(args[j], XtNheight,    (XtArgVal) 85); j++;\r
+    XtSetValues(popup, args, j);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, appData.timeControl);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  85);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcTime = XtCreateManagedWidget("TC", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(tcTime, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, tcInc ? "   minutes, plus   " : "minutes for each"); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcTime); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+  //  XtSetArg(args[j], XtNwidth,  100);  j++;\r
+  //  XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess1 = XtCreateManagedWidget("TCtext", labelWidgetClass, form, args, j);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcMess1); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, def);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  40);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcData = XtCreateManagedWidget("MPS", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(tcData, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, tcInc ? "sec/move" : "moves     "); j++;\r
+    XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcData); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  80);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess2 = XtCreateManagedWidget("MPStext", labelWidgetClass,\r
+                                  form, args, j);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, tcTime); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, "1");  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  40);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcOdds1 = XtCreateManagedWidget("Odds1", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(tcOdds1, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, tcTime); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcOdds1); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, "1");  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  40);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcOdds2 = XtCreateManagedWidget("Odds2", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(tcOdds2, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, "Engine #1 and #2 Time-Odds Factors"); j++;\r
+    XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromVert, tcTime); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcOdds2); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  200);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    mess = XtCreateManagedWidget("Oddstext", labelWidgetClass,\r
+                                  form, args, j);\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, tcOdds1);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    b_clas= XtCreateManagedWidget("classical", commandWidgetClass,\r
+                                  form, args, j);   \r
+    XtAddCallback(b_clas, XtNcallback, TimeControlCallback, (XtPointer) 0);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, tcOdds1);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, b_clas);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    b_inc = XtCreateManagedWidget("incremental", commandWidgetClass,\r
+                                  form, args, j);   \r
+    XtAddCallback(b_inc, XtNcallback, TimeControlCallback, (XtPointer) 0);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, tcOdds1);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcData);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_ok= XtCreateManagedWidget(" OK ", commandWidgetClass,\r
+                                  form, args, j);   \r
+    XtAddCallback(b_ok, XtNcallback, TimeControlCallback, (XtPointer) 0);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, tcOdds1);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, b_ok);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_cancel= XtCreateManagedWidget("cancel", commandWidgetClass,\r
+                                  form, args, j);   \r
+    XtAddCallback(b_cancel, XtNcallback, TimeControlPopDown, (XtPointer) 0);\r
+\r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "TimeControlPopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    TimeControlUp = True;\r
+    \r
+    previous = NULL;\r
+    SetFocus(tcTime, popup, (XEvent*) NULL, False);\r
+//    XtSetKeyboardFocus(popup, tcTime);\r
+}\r
+\r
+void TimeControlProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+   TimeControlPopUp();\r
+}\r
+\r
+//--------------------------- Engine-Options Menu Popup ----------------------------------\r
+int EngineUp;\r
+Widget EngineShell;\r
+extern int adjudicateLossThreshold;\r
+\r
+Widget engDrawMoves, engThreshold, engRule, engRepeat;\r
+\r
+void EnginePopDown()\r
+{\r
+    if (!EngineUp) return;\r
+    XtPopdown(EngineShell);\r
+    XtDestroyWidget(EngineShell);\r
+    EngineUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+int ReadToggle(Widget w)\r
+{\r
+    Arg args; Boolean res;\r
+\r
+    XtSetArg(args, XtNstate, &res);\r
+    XtGetValues(w, &args, 1);\r
+\r
+    return res;\r
+}\r
+\r
+Widget w1, w2, w3, w4, w5, w6, w7, w8;\r
+\r
+void EngineCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Widget s2;\r
+    Arg args[16];\r
+    char buf[80];\r
+    int j;\r
+    \r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "OK") == 0) {\r
+       // read all switches\r
+       appData.periodicUpdates = ReadToggle(w1);\r
+//     appData.hideThinkingFromHuman = ReadToggle(w2);\r
+       appData.firstScoreIsAbsolute  = ReadToggle(w3);\r
+       appData.secondScoreIsAbsolute = ReadToggle(w4);\r
+       appData.testClaims    = ReadToggle(w5);\r
+       appData.checkMates    = ReadToggle(w6);\r
+       appData.materialDraws = ReadToggle(w7);\r
+       appData.trivialDraws  = ReadToggle(w8);\r
+\r
+       // adjust setting in other menu for duplicates \r
+       // (perhaps duplicates should be removed from general Option Menu?)\r
+//     XtSetArg(args[0], XtNleftBitmap, appData.showThinking ? xMarkPixmap : None);\r
+//     XtSetValues(XtNameToWidget(menuBarWidget,\r
+//                                "menuOptions.Show Thinking"), args, 1);\r
+\r
+       // read out numeric controls, simply ignore bad formats for now\r
+       XtSetArg(args[0], XtNstring, &name);\r
+       XtGetValues(engDrawMoves, args, 1);\r
+       if(sscanf(name, "%d", &j) == 1) appData.adjudicateDrawMoves = j;\r
+       XtGetValues(engThreshold, args, 1);\r
+       if(sscanf(name, "%d", &j) == 1) \r
+               adjudicateLossThreshold = appData.adjudicateLossThreshold = -j; // inverted!\r
+       XtGetValues(engRule, args, 1);\r
+       if(sscanf(name, "%d", &j) == 1) appData.ruleMoves = j;\r
+       XtGetValues(engRepeat, args, 1);\r
+       if(sscanf(name, "%d", &j) == 1) appData.drawRepeats = j;\r
+\r
+        EnginePopDown();\r
+       ShowThinkingEvent(); // [HGM] thinking: score adjudication might need thinking output\r
+        return;\r
+    }\r
+}\r
+\r
+void EnginePopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, form, edit, b_ok, b_cancel, b_clas, b_inc, s1; \r
+    Window root, child;\r
+    int x, y, i, j, width;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    \r
+    tcInc = (appData.timeIncrement >= 0);\r
+    tcMoves = appData.movesPerSession; tcIncrement = appData.timeIncrement;\r
+    if(!tcInc) tcIncrement = 0;\r
+    sprintf(def, "%d", tcInc ? tcIncrement : tcMoves);\r
+\r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+//    XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;\r
+    EngineShell = popup =\r
+      XtCreatePopupShell("Adjudications", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    form =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+  \r
+    j = 0;\r
+//    XtSetArg(args[j], XtNwidth,     (XtArgVal) 250); j++;\r
+//    XtSetArg(args[j], XtNheight,    (XtArgVal) 400); j++;\r
+//    XtSetValues(popup, args, j);\r
+\r
+    j = 0;\r
+//    XtSetArg(args[j], XtNwidth,       (XtArgVal) 250); j++;\r
+//    XtSetArg(args[j], XtNheight,      (XtArgVal) 20); j++;\r
+    XtSetArg(args[j], XtNleft,        (XtArgVal) XtChainLeft); j++;\r
+    XtSetArg(args[j], XtNright,       (XtArgVal) XtChainRight); j++;\r
+    XtSetArg(args[j], XtNstate,       appData.periodicUpdates); j++;\r
+//    XtSetArg(args[j], XtNjustify,     (XtArgVal) XtJustifyLeft); j++;\r
+    w1 = XtCreateManagedWidget("Periodic Updates (Analysis Mode)", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j], XtNwidth,       (XtArgVal) &width);\r
+    XtGetValues(w1, &args[j], 1);\r
+\r
+//    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) w1);\r
+//    XtSetArg(args[j-3], XtNstate,       appData.hideThinkingFromHuman);\r
+//    w2 = XtCreateManagedWidget("Hide Thinking from Human", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j], XtNwidth,       (XtArgVal) width); j++;\r
+    XtSetArg(args[j-2], XtNstate,     appData.firstScoreIsAbsolute);\r
+    XtSetArg(args[j], XtNfromVert,    (XtArgVal) w1); j++;\r
+    w3 = XtCreateManagedWidget("Engine #1 Score is Absolute", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) w3);\r
+    XtSetArg(args[j-3], XtNstate,       appData.secondScoreIsAbsolute);\r
+    w4 = XtCreateManagedWidget("Engine #2 Score is Absolute", toggleWidgetClass, form, args, j);\r
+\r
+    s1 = XtCreateManagedWidget("\nEngine-Engine Adjudications:", labelWidgetClass, form, args, 3);\r
+\r
+    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) s1);\r
+    XtSetArg(args[j-3], XtNstate,       appData.testClaims);\r
+    w5 = XtCreateManagedWidget("Verify Engine Result Claims", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) w5);\r
+    XtSetArg(args[j-3], XtNstate,       appData.checkMates);\r
+    w6 = XtCreateManagedWidget("Detect All Mates", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) w6);\r
+    XtSetArg(args[j-3], XtNstate,       appData.materialDraws);\r
+    w7 = XtCreateManagedWidget("Draw when Insuff. Mating Material", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[j-1], XtNfromVert,  (XtArgVal) w7);\r
+    XtSetArg(args[j-3], XtNstate,       appData.trivialDraws);\r
+    w8 = XtCreateManagedWidget("Adjudicate Trivial Draws", toggleWidgetClass, form, args, j);\r
+\r
+    XtSetArg(args[0], XtNfromVert,  (XtArgVal) w4);\r
+    XtSetArg(args[1], XtNborderWidth, (XtArgVal) 0);\r
+    XtSetValues(s1, args, 2);\r
+\r
+    sprintf(def, "%d", appData.adjudicateDrawMoves);\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, w8); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, def);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  60);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    engDrawMoves = XtCreateManagedWidget("Length", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(engDrawMoves, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, " moves maximum, then draw"); j++;\r
+    XtSetArg(args[j], XtNjustify,     (XtArgVal) XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromVert, w8); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, engDrawMoves); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  170);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess1 = XtCreateManagedWidget("TCtext", labelWidgetClass, form, args, j);\r
+\r
+    sprintf(def, "%d", -appData.adjudicateLossThreshold); // inverted!\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, engDrawMoves); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, def);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  60);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    engThreshold = XtCreateManagedWidget("Threshold", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(engThreshold, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, "-centiPawn lead is win"); j++;\r
+    XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromVert, engDrawMoves); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, engThreshold); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  150);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess2 = XtCreateManagedWidget("MPStext", labelWidgetClass, form, args, j);\r
+\r
+    sprintf(def, "%d", appData.ruleMoves);\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, engThreshold); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, def);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  30);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    engRule = XtCreateManagedWidget("Rule", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(engRule, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, "-move rule applied"); j++;\r
+    XtSetArg(args[j], XtNjustify,     (XtArgVal) XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromVert, engThreshold); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, engRule); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  130);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess1 = XtCreateManagedWidget("TCtext", labelWidgetClass, form, args, j);\r
+\r
+    sprintf(def, "%d", appData.drawRepeats);\r
+    j= 0;\r
+    XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+    XtSetArg(args[j], XtNfromVert, engRule); j++;\r
+    XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+    XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+    XtSetArg(args[j], XtNstring, def);  j++;\r
+    XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNresizable, True);  j++;\r
+    XtSetArg(args[j], XtNwidth,  30);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    engRepeat = XtCreateManagedWidget("Repeats", asciiTextWidgetClass, form, args, j);\r
+    XtAddEventHandler(engRepeat, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+\r
+    j= 0;\r
+    XtSetArg(args[j], XtNlabel, "-fold repeat is draw"); j++;\r
+    XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;\r
+    XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+    XtSetArg(args[j], XtNfromVert, engRule); j++;\r
+    XtSetArg(args[j], XtNfromHoriz, engRepeat); j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+//    XtSetArg(args[j], XtNwidth,  130);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20);  j++;\r
+    tcMess2 = XtCreateManagedWidget("MPStext", labelWidgetClass, form, args, j);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, engRepeat);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, tcMess2);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_ok= XtCreateManagedWidget("OK", commandWidgetClass, form, args, j);   \r
+    XtAddCallback(b_ok, XtNcallback, EngineCallback, (XtPointer) 0);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, engRepeat);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, b_ok);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_cancel= XtCreateManagedWidget("cancel", commandWidgetClass,\r
+                                  form, args, j);   \r
+    XtAddCallback(b_cancel, XtNcallback, EnginePopDown, (XtPointer) 0);\r
+\r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "EnginePopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    EngineUp = True;\r
+    \r
+    previous = NULL;\r
+    SetFocus(engThreshold, popup, (XEvent*) NULL, False);\r
+}\r
+\r
+void EngineMenuProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+   EnginePopUp();\r
+}\r
+\r
+//--------------------------- New-Variant Menu PopUp -----------------------------------\r
+struct NewVarButton {\r
+  char   *name;\r
+  char *color;\r
+  Widget handle;\r
+  VariantClass variant;\r
+};\r
+\r
+struct NewVarButton buttonDesc[] = {\r
+    {"normal",            "#FFFFFF", 0, VariantNormal},\r
+    {"FRC",               "#FFFFFF", 0, VariantFischeRandom},\r
+    {"wild castle",       "#FFFFFF", 0, VariantWildCastle},\r
+    {"no castle",         "#FFFFFF", 0, VariantNoCastle},\r
+    {"knightmate",        "#FFFFFF", 0, VariantKnightmate},\r
+    {"berolina",          "#FFFFFF", 0, VariantBerolina},\r
+    {"cylinder",          "#FFFFFF", 0, VariantCylinder},\r
+    {"shatranj",          "#FFFFFF", 0, VariantShatranj},\r
+    {"atomic",            "#FFFFFF", 0, VariantAtomic},\r
+    {"two kings",         "#FFFFFF", 0, VariantTwoKings},\r
+    {"3-checks",          "#FFFFFF", 0, Variant3Check},\r
+    {"suicide",           "#FFFFBF", 0, VariantSuicide},\r
+    {"give-away",         "#FFFFBF", 0, VariantGiveaway},\r
+    {"losers",            "#FFFFBF", 0, VariantLosers},\r
+    {"fairy",             "#BFBFBF", 0, VariantFairy},\r
+    {"Superchess",        "#FFBFBF", 0, VariantSuper},\r
+    {"crazyhouse",        "#FFBFBF", 0, VariantCrazyhouse},\r
+    {"bughouse",          "#FFBFBF", 0, VariantBughouse},\r
+    {"shogi (9x9)",       "#BFFFFF", 0, VariantShogi},\r
+    {"xiangqi (9x10)",    "#BFFFFF", 0, VariantXiangqi},\r
+    {"courier (12x8)",    "#BFFFBF", 0, VariantCourier},\r
+    {"janus (10x8)",      "#BFBFFF", 0, VariantJanus},\r
+    {"Capablanca (10x8)", "#BFBFFF", 0, VariantCapablanca},\r
+    {"CRC (10x8)",        "#BFBFFF", 0, VariantCapaRandom},\r
+#ifdef GOTHIC\r
+    {"Gothic (10x8)",     "#BFBFFF", 0, VariantGothic},\r
+#endif\r
+#ifdef FALCON\r
+    {"Falcon (10x8)",     "#BFBFFF", 0, VariantFalcon},\r
+#endif\r
+    {NULL,                0, 0, (VariantClass) 0}\r
+};\r
+\r
+int NewVariantUp;\r
+Widget NewVariantShell;\r
+\r
+void NewVariantPopDown()\r
+{\r
+    if (!NewVariantUp) return;\r
+    XtPopdown(NewVariantShell);\r
+    XtDestroyWidget(NewVariantShell);\r
+    NewVariantUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+void NewVariantCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Widget w2;\r
+    Arg args[16];\r
+    char buf[80];\r
+    VariantClass v;\r
+    \r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "  OK  ") == 0) {\r
+       int nr = (int) XawToggleGetCurrent(buttonDesc[0].handle) - 1;\r
+       if(nr < 0) return;\r
+       v = buttonDesc[nr].variant;\r
+       if(!appData.noChessProgram) { \r
+           char *name = VariantName(v), buf[MSG_SIZ];\r
+           if (first.protocolVersion > 1 && StrStr(first.variants, name) == NULL) {\r
+               /* [HGM] in protocol 2 we check if variant is suported by engine */\r
+               sprintf(buf, "Variant %s not supported by %s", name, first.tidy);\r
+               DisplayError(buf, 0);\r
+//             NewVariantPopDown();\r
+               return; /* ignore OK if first engine does not support it */\r
+           } else\r
+           if (second.initDone && second.protocolVersion > 1 && StrStr(second.variants, name) == NULL) {\r
+               sprintf(buf, "Warning: second engine (%s) does not support this!", second.tidy);\r
+               DisplayError(buf, 0);   /* use of second engine is optional; only warn user */\r
+           }\r
+       }\r
+\r
+       gameInfo.variant = v;\r
+       appData.variant = VariantName(v);\r
+\r
+       shuffleOpenings = FALSE; /* [HGM] shuffle: possible shuffle reset when we switch */\r
+       startedFromPositionFile = FALSE; /* [HGM] loadPos: no longer valid in new variant */\r
+       appData.pieceToCharTable = NULL;\r
+       Reset(True, True);\r
+        NewVariantPopDown();\r
+        return;\r
+    }\r
+}\r
+\r
+void NewVariantPopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, dialog, edit, form, last = NULL, b_ok, b_cancel;\r
+    Window root, child;\r
+    int x, y, i, j;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    XrmValue vFrom, vTo;\r
+\r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+//    XtSetArg(args[i], XtNwidth, 250); i++;\r
+//    XtSetArg(args[i], XtNheight, 300); i++;\r
+    NewVariantShell = popup =\r
+      XtCreatePopupShell("NewVariant Menu", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    form =\r
+      XtCreateManagedWidget("form", formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+  \r
+    for(i = 0; buttonDesc[i].name != NULL; i++) {\r
+       Pixel buttonColor;\r
+       if (!appData.monoMode) {\r
+           vFrom.addr = (caddr_t) buttonDesc[i].color;\r
+           vFrom.size = strlen(buttonDesc[i].color);\r
+           XtConvert(shellWidget, XtRString, &vFrom, XtRPixel, &vTo);\r
+           if (vTo.addr == NULL) {\r
+               buttonColor = (Pixel) -1;\r
+           } else {\r
+               buttonColor = *(Pixel *) vTo.addr;\r
+           }\r
+       }\r
+    \r
+       j = 0;\r
+       XtSetArg(args[j], XtNradioGroup, last); j++;\r
+       XtSetArg(args[j], XtNwidth, 125); j++;\r
+//     XtSetArg(args[j], XtNheight, 16); j++;\r
+       XtSetArg(args[j], XtNfromVert, i == 15 ? NULL : last); j++;\r
+       XtSetArg(args[j], XtNfromHoriz, i < 15 ? NULL : buttonDesc[i-15].handle); j++;\r
+       XtSetArg(args[j], XtNradioData, i+1); j++;\r
+       XtSetArg(args[j], XtNbackground, buttonColor); j++;\r
+       XtSetArg(args[j], XtNstate, gameInfo.variant == buttonDesc[i].variant); j++;\r
+       buttonDesc[i].handle = last =\r
+           XtCreateManagedWidget(buttonDesc[i].name, toggleWidgetClass, form, args, j);\r
+    }\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, buttonDesc[12].handle);  j++;\r
+    XtSetArg(args[j], XtNfromHoriz, buttonDesc[12].handle);  j++;\r
+    XtSetArg(args[j], XtNheight, 35); j++;\r
+//    XtSetArg(args[j], XtNwidth, 60); j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_cancel= XtCreateManagedWidget("CANCEL", commandWidgetClass, form, args, j);   \r
+    XtAddCallback(b_cancel, XtNcallback, NewVariantPopDown, (XtPointer) 0);\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromHoriz, b_cancel);  j++;\r
+    XtSetArg(args[j], XtNfromVert, buttonDesc[12].handle);  j++;\r
+    XtSetArg(args[j], XtNheight, 35); j++;\r
+//    XtSetArg(args[j], XtNwidth, 60); j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    b_ok= XtCreateManagedWidget("  OK  ", commandWidgetClass, form, args, j);   \r
+    XtAddCallback(b_ok, XtNcallback, NewVariantCallback, (XtPointer) 0);\r
+\r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "NewVariantPopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    NewVariantUp = True;\r
+}\r
+\r
+void NewVariantProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+   NewVariantPopUp();\r
+}\r
+\r
+//--------------------------- UCI Menu Popup ------------------------------------------\r
+int UciUp;\r
+Widget UciShell;\r
+\r
+struct UciControl {\r
+  char *name;\r
+  Widget handle;\r
+  void *ptr;\r
+};\r
+\r
+struct UciControl controlDesc[] = {\r
+  {"maximum nr of CPUs:", 0, &appData.smpCores},\r
+  {"Polyglot Directory:", 0, &appData.polyglotDir},\r
+  {"Hash Size (MB):",     0, &appData.defaultHashSize},\r
+  {"EGTB Path:",          0, &appData.defaultPathEGTB},\r
+  {"EGTB Cache (MB):",    0, &appData.defaultCacheSizeEGTB},\r
+  {"Polyglot Book:",      0, &appData.polyglotBook},\r
+  {NULL, 0, NULL},\r
+};\r
+\r
+void UciPopDown()\r
+{\r
+    if (!UciUp) return;\r
+    XtPopdown(UciShell);\r
+    XtDestroyWidget(UciShell);\r
+    UciUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+void UciCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Arg args[16];\r
+    char buf[80];\r
+    int oldCores = appData.smpCores, ponder = 0;\r
+    \r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "OK") == 0) {\r
+       int nr, i, j; String name;\r
+       for(i=0; i<6; i++) {\r
+           XtSetArg(args[0], XtNstring, &name);\r
+           XtGetValues(controlDesc[i].handle, args, 1);\r
+           if(i&1) {\r
+               if(name)\r
+                   *(char**) controlDesc[i].ptr = strdup(name);\r
+           } else {\r
+               if(sscanf(name, "%d", &j) == 1) \r
+                   *(int*) controlDesc[i].ptr = j;\r
+           }\r
+       }\r
+       XtSetArg(args[0], XtNstate, &appData.usePolyglotBook);\r
+       XtGetValues(w1, args, 1);\r
+       XtSetArg(args[0], XtNstate, &appData.firstHasOwnBookUCI);\r
+       XtGetValues(w2, args, 1);\r
+       XtSetArg(args[0], XtNstate, &appData.secondHasOwnBookUCI);\r
+       XtGetValues(w3, args, 1);\r
+       XtSetArg(args[0], XtNstate, &ponder);\r
+       XtGetValues(w4, args, 1);\r
+\r
+       // adjust setting in other menu for duplicates \r
+       // (perhaps duplicates should be removed from general Option Menu?)\r
+       XtSetArg(args[0], XtNleftBitmap, ponder ? xMarkPixmap : None);\r
+       XtSetValues(XtNameToWidget(menuBarWidget,\r
+                                  "menuOptions.Ponder Next Move"), args, 1);\r
+\r
+       // make sure changes are sent to first engine by re-initializing it\r
+       // if it was already started pre-emptively at end of previous game\r
+       if(gameMode == BeginningOfGame) Reset(True, True); else {\r
+           // Some changed setting need immediate sending always.\r
+           PonderNextMoveEvent(ponder);\r
+           if(oldCores != appData.smpCores)\r
+               NewSettingEvent(False, "cores", appData.smpCores);\r
+      }\r
+      UciPopDown();\r
+      return;\r
+    }\r
+}\r
+\r
+void UciPopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, dialog, edit, form, b_ok, b_cancel, last = NULL, new, upperLeft;\r
+    Window root, child;\r
+    int x, y, i, j;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    \r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+//    XtSetArg(args[i], XtNwidth, 300); i++;\r
+    UciShell = popup =\r
+      XtCreatePopupShell("Engine Settings", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    \r
+    form =\r
+      XtCreateManagedWidget("form", formWidgetClass, layout,\r
+                           formArgs, XtNumber(formArgs));\r
+  \r
+    j = 0;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+//    XtSetArg(args[j], XtNheight, 20); j++;\r
+    for(i = 0; controlDesc[i].name != NULL; i++) {\r
+       j = 3;\r
+       XtSetArg(args[j], XtNfromVert, last); j++;\r
+//     XtSetArg(args[j], XtNwidth, 130); j++;\r
+       XtSetArg(args[j], XtNjustify, XtJustifyLeft); j++;\r
+       XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+       XtSetArg(args[j], XtNborderWidth, 0); j++;\r
+       new = XtCreateManagedWidget(controlDesc[i].name, labelWidgetClass, form, args, j);\r
+       if(i==0) upperLeft = new;\r
+\r
+       j = 4;\r
+       XtSetArg(args[j], XtNborderWidth, 1); j++;\r
+       XtSetArg(args[j], XtNeditType, XawtextEdit);  j++;\r
+       XtSetArg(args[j], XtNuseStringInPlace, False);  j++;\r
+       XtSetArg(args[j], XtNdisplayCaret, False);  j++;\r
+       XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+       XtSetArg(args[j], XtNresizable, True);  j++;\r
+       XtSetArg(args[j], XtNwidth, i&1 ? 245 : 50); j++;\r
+       if(i&1) {\r
+           XtSetArg(args[j], XtNstring, * (char**) controlDesc[i].ptr ? \r
+                                        * (char**) controlDesc[i].ptr : ""); j++;\r
+       } else {\r
+           sprintf(def, "%d", * (int*) controlDesc[i].ptr);\r
+           XtSetArg(args[j], XtNstring, def); j++;\r
+       }\r
+       XtSetArg(args[j], XtNfromHoriz, upperLeft); j++;\r
+       controlDesc[i].handle = last =\r
+           XtCreateManagedWidget("text", asciiTextWidgetClass, form, args, j);\r
+       XtAddEventHandler(last, ButtonPressMask, False, SetFocus, (XtPointer) popup);\r
+    }\r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromHoriz, controlDesc[0].handle);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainTop);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainRight);  j++;\r
+    XtSetArg(args[j], XtNstate, appData.ponderNextMove);  j++;\r
+    w4 = XtCreateManagedWidget("Ponder", toggleWidgetClass, form, args, j);   \r
+\r
+    j=0;\r
+    XtSetArg(args[j], XtNfromVert, last);  j++;\r
+    XtSetArg(args[j], XtNbottom, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNtop, XtChainBottom);  j++;\r
+    XtSetArg(args[j], XtNleft, XtChainLeft);  j++;\r
+    XtSetArg(args[j], XtNright, XtChainLeft);  j++;\r
+    b_ok = XtCreateManagedWidget("OK", commandWidgetClass, form, args, j);   \r
+    XtAddCallback(b_ok, XtNcallback, UciCallback, (XtPointer) 0);\r
+\r
+    XtSetArg(args[j], XtNfromHoriz, b_ok);  j++;\r
+    b_cancel = XtCreateManagedWidget("cancel", commandWidgetClass, form, args, j);   \r
+    XtAddCallback(b_cancel, XtNcallback, UciPopDown, (XtPointer) 0);\r
+\r
+    j = 5;\r
+    XtSetArg(args[j], XtNfromHoriz, upperLeft);  j++;\r
+    XtSetArg(args[j], XtNstate, appData.usePolyglotBook);  j++;\r
+    w1 = XtCreateManagedWidget(" use book ", toggleWidgetClass, form, args, j);   \r
+//    XtAddCallback(w1, XtNcallback, UciCallback, (XtPointer) 0);\r
+\r
+    j = 5;\r
+    XtSetArg(args[j], XtNfromHoriz, w1);  j++;\r
+    XtSetArg(args[j], XtNstate, appData.firstHasOwnBookUCI);  j++;\r
+    w2 = XtCreateManagedWidget("own book 1", toggleWidgetClass, form, args, j);   \r
+//    XtAddCallback(w2, XtNcallback, UciCallback, (XtPointer) 0);\r
+\r
+    j = 5;\r
+    XtSetArg(args[j], XtNfromHoriz, w2);  j++;\r
+    XtSetArg(args[j], XtNstate, appData.secondHasOwnBookUCI);  j++;\r
+    w3 = XtCreateManagedWidget("own book 2", toggleWidgetClass, form, args, j);   \r
+//    XtAddCallback(w3, XtNcallback, UciCallback, (XtPointer) 0);\r
+\r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "UciPopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    UciUp = True;\r
+\r
+    previous = NULL;\r
+    SetFocus(controlDesc[2].handle, popup, (XEvent*) NULL, False);\r
+//    XtSetKeyboardFocus(popup, controlDesc[1].handle);\r
+}\r
+\r
+void UciMenuProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+   UciPopUp();\r
+}\r
+\r
+//--------------------------- General Popup for Cloning ----------------------------------\r
+#if 0\r
+int XXXUp;\r
+Widget XXXShell;\r
+\r
+void XXXPopDown()\r
+{\r
+    if (!XXXUp) return;\r
+    XtPopdown(XXXShell);\r
+    XtDestroyWidget(XXXShell);\r
+    XXXUp = False;\r
+    ModeHighlight();\r
+}\r
+\r
+void XXXCallback(w, client_data, call_data)\r
+     Widget w;\r
+     XtPointer client_data, call_data;\r
+{\r
+    String name;\r
+    Widget w2;\r
+    Arg args[16];\r
+    char buf[80];\r
+    \r
+    XtSetArg(args[0], XtNlabel, &name);\r
+    XtGetValues(w, args, 1);\r
+    \r
+    if (strcmp(name, "cancel") == 0) {\r
+        XXXPopDown();\r
+        return;\r
+    }\r
+    if (strcmp(name, "ok") == 0) {\r
+       int nr; String name;\r
+        name = XawDialogGetValueString(w2 = XtParent(w));\r
+       if(sscanf(name ,"%d",&nr) != 1) {\r
+           sprintf(buf, "%d", appData.defaultFrcPosition);\r
+           XtSetArg(args[0],XtNvalue, buf); // erase bad (non-numeric) value\r
+           XtSetValues(w2, args, 1);\r
+           return;\r
+       }\r
+        XXXPopDown();\r
+        return;\r
+    }\r
+}\r
+\r
+void XXXPopUp()\r
+{\r
+    Arg args[16];\r
+    Widget popup, layout, dialog, edit;\r
+    Window root, child;\r
+    int x, y, i;\r
+    int win_x, win_y;\r
+    unsigned int mask;\r
+    char def[80];\r
+    \r
+    i = 0;\r
+    XtSetArg(args[i], XtNresizable, True); i++;\r
+    XtSetArg(args[i], XtNwidth, DIALOG_SIZE); i++;\r
+    XXXShell = popup =\r
+      XtCreatePopupShell("XXX Menu", transientShellWidgetClass,\r
+                        shellWidget, args, i);\r
+    \r
+    layout =\r
+      XtCreateManagedWidget(layoutName, formWidgetClass, popup,\r
+                           layoutArgs, XtNumber(layoutArgs));\r
+  \r
+    sprintf(def, "%d\n", appData.defaultFrcPosition);\r
+    i = 0;\r
+    XtSetArg(args[i], XtNlabel, ""); i++;\r
+    XtSetArg(args[i], XtNvalue, def); i++;\r
+    XtSetArg(args[i], XtNborderWidth, 0); i++;\r
+    dialog = XtCreateManagedWidget("XXX", dialogWidgetClass,\r
+                                  layout, args, i);\r
+    \r
+    XawDialogAddButton(dialog, "ok", XXXCallback, (XtPointer) dialog);\r
+    XawDialogAddButton(dialog, "cancel", XXXCallback, (XtPointer) dialog);\r
+    \r
+    XtRealizeWidget(popup);\r
+    CatchDeleteWindow(popup, "XXXPopDown");\r
+    \r
+    XQueryPointer(xDisplay, xBoardWindow, &root, &child,\r
+                 &x, &y, &win_x, &win_y, &mask);\r
+    \r
+    XtSetArg(args[0], XtNx, x - 10);\r
+    XtSetArg(args[1], XtNy, y - 30);\r
+    XtSetValues(popup, args, 2);\r
+    \r
+    XtPopup(popup, XtGrabExclusive);\r
+    XXXUp = True;\r
+    \r
+    edit = XtNameToWidget(dialog, "*value");\r
+\r
+    previous = NULL;\r
+    SetFocus(engThreshold, popup, (XEvent*) NULL, False);\r
+}\r
+\r
+void XXXMenuProc(w, event, prms, nprms)\r
+     Widget w;\r
+     XEvent *event;\r
+     String *prms;\r
+     Cardinal *nprms;\r
+{\r
+   XXXPopUp();\r
+}\r
+#endif\r
+\r
diff --git a/zippy.c b/zippy.c
index c788318..f75ecb2 100644 (file)
--- a/zippy.c
+++ b/zippy.c
@@ -873,7 +873,11 @@ int ZippyMatch(buf, i)
     if (looking_at(buf, i, "Challenge: * (*) *(*) * * * * Loaded from *")) {\r
        /* note: star_match[2] can include "[white] " or "[black] "\r
           before our own name. */\r
-       ZippyHandleChallenge(star_match[4], star_match[8],\r
+       if(star_match[8] == NULL || star_match[8][0] == 0) // [HGM] chessd: open-source ICS has file on next line\r
+            ZippyHandleChallenge(star_match[4], star_match[5],\r
+                            star_match[6], star_match[7],\r
+                            StripHighlightAndTitle(star_match[0]));\r
+       else ZippyHandleChallenge(star_match[4], star_match[8],\r
                             star_match[6], star_match[7],\r
                             StripHighlightAndTitle(star_match[0]));\r
        return TRUE;\r