--- /dev/null
+Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
+Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
+Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
+UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
--- /dev/null
+ GNU GENERAL PUBLIC LICENSE\r
+ Version 2, June 1991\r
+\r
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+ Preamble\r
+\r
+ The licenses for most software are designed to take away your\r
+freedom to share and change it. By contrast, the GNU General Public\r
+License is intended to guarantee your freedom to share and change free\r
+software--to make sure the software is free for all its users. This\r
+General Public License applies to most of the Free Software\r
+Foundation's software and to any other program whose authors commit to\r
+using it. (Some other Free Software Foundation software is covered by\r
+the GNU Library General Public License instead.) You can apply it to\r
+your programs, too.\r
+\r
+ When we speak of free software, we are referring to freedom, not\r
+price. Our General Public Licenses are designed to make sure that you\r
+have the freedom to distribute copies of free software (and charge for\r
+this service if you wish), that you receive source code or can get it\r
+if you want it, that you can change the software or use pieces of it\r
+in new free programs; and that you know you can do these things.\r
+\r
+ To protect your rights, we need to make restrictions that forbid\r
+anyone to deny you these rights or to ask you to surrender the rights.\r
+These restrictions translate to certain responsibilities for you if you\r
+distribute copies of the software, or if you modify it.\r
+\r
+ For example, if you distribute copies of such a program, whether\r
+gratis or for a fee, you must give the recipients all the rights that\r
+you have. You must make sure that they, too, receive or can get the\r
+source code. And you must show them these terms so they know their\r
+rights.\r
+\r
+ We protect your rights with two steps: (1) copyright the software, and\r
+(2) offer you this license which gives you legal permission to copy,\r
+distribute and/or modify the software.\r
+\r
+ Also, for each author's protection and ours, we want to make certain\r
+that everyone understands that there is no warranty for this free\r
+software. If the software is modified by someone else and passed on, we\r
+want its recipients to know that what they have is not the original, so\r
+that any problems introduced by others will not reflect on the original\r
+authors' reputations.\r
+\r
+ Finally, any free program is threatened constantly by software\r
+patents. We wish to avoid the danger that redistributors of a free\r
+program will individually obtain patent licenses, in effect making the\r
+program proprietary. To prevent this, we have made it clear that any\r
+patent must be licensed for everyone's free use or not licensed at all.\r
+\r
+ The precise terms and conditions for copying, distribution and\r
+modification follow.\r
+\f\r
+ GNU GENERAL PUBLIC LICENSE\r
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+ 0. This License applies to any program or other work which contains\r
+a notice placed by the copyright holder saying it may be distributed\r
+under the terms of this General Public License. The "Program", below,\r
+refers to any such program or work, and a "work based on the Program"\r
+means either the Program or any derivative work under copyright law:\r
+that is to say, a work containing the Program or a portion of it,\r
+either verbatim or with modifications and/or translated into another\r
+language. (Hereinafter, translation is included without limitation in\r
+the term "modification".) Each licensee is addressed as "you".\r
+\r
+Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope. The act of\r
+running the Program is not restricted, and the output from the Program\r
+is covered only if its contents constitute a work based on the\r
+Program (independent of having been made by running the Program).\r
+Whether that is true depends on what the Program does.\r
+\r
+ 1. You may copy and distribute verbatim copies of the Program's\r
+source code as you receive it, in any medium, provided that you\r
+conspicuously and appropriately publish on each copy an appropriate\r
+copyright notice and disclaimer of warranty; keep intact all the\r
+notices that refer to this License and to the absence of any warranty;\r
+and give any other recipients of the Program a copy of this License\r
+along with the Program.\r
+\r
+You may charge a fee for the physical act of transferring a copy, and\r
+you may at your option offer warranty protection in exchange for a fee.\r
+\r
+ 2. You may modify your copy or copies of the Program or any portion\r
+of it, thus forming a work based on the Program, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+ a) You must cause the modified files to carry prominent notices\r
+ stating that you changed the files and the date of any change.\r
+\r
+ b) You must cause any work that you distribute or publish, that in\r
+ whole or in part contains or is derived from the Program or any\r
+ part thereof, to be licensed as a whole at no charge to all third\r
+ parties under the terms of this License.\r
+\r
+ c) If the modified program normally reads commands interactively\r
+ when run, you must cause it, when started running for such\r
+ interactive use in the most ordinary way, to print or display an\r
+ announcement including an appropriate copyright notice and a\r
+ notice that there is no warranty (or else, saying that you provide\r
+ a warranty) and that users may redistribute the program under\r
+ these conditions, and telling the user how to view a copy of this\r
+ License. (Exception: if the Program itself is interactive but\r
+ does not normally print such an announcement, your work based on\r
+ the Program is not required to print an announcement.)\r
+\f\r
+These requirements apply to the modified work as a whole. If\r
+identifiable sections of that work are not derived from the Program,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works. But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Program, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Program.\r
+\r
+In addition, mere aggregation of another work not based on the Program\r
+with the Program (or with a work based on the Program) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+ 3. You may copy and distribute the Program (or a work based on it,\r
+under Section 2) in object code or executable form under the terms of\r
+Sections 1 and 2 above provided that you also do one of the following:\r
+\r
+ a) Accompany it with the complete corresponding machine-readable\r
+ source code, which must be distributed under the terms of Sections\r
+ 1 and 2 above on a medium customarily used for software interchange; or,\r
+\r
+ b) Accompany it with a written offer, valid for at least three\r
+ years, to give any third party, for a charge no more than your\r
+ cost of physically performing source distribution, a complete\r
+ machine-readable copy of the corresponding source code, to be\r
+ distributed under the terms of Sections 1 and 2 above on a medium\r
+ customarily used for software interchange; or,\r
+\r
+ c) Accompany it with the information you received as to the offer\r
+ to distribute corresponding source code. (This alternative is\r
+ allowed only for noncommercial distribution and only if you\r
+ received the program in object code or executable form with such\r
+ an offer, in accord with Subsection b above.)\r
+\r
+The source code for a work means the preferred form of the work for\r
+making modifications to it. For an executable work, complete source\r
+code means all the source code for all modules it contains, plus any\r
+associated interface definition files, plus the scripts used to\r
+control compilation and installation of the executable. However, as a\r
+special exception, the source code distributed need not include\r
+anything that is normally distributed (in either source or binary\r
+form) with the major components (compiler, kernel, and so on) of the\r
+operating system on which the executable runs, unless that component\r
+itself accompanies the executable.\r
+\r
+If distribution of executable or object code is made by offering\r
+access to copy from a designated place, then offering equivalent\r
+access to copy the source code from the same place counts as\r
+distribution of the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\f\r
+ 4. You may not copy, modify, sublicense, or distribute the Program\r
+except as expressly provided under this License. Any attempt\r
+otherwise to copy, modify, sublicense or distribute the Program is\r
+void, and will automatically terminate your rights under this License.\r
+However, parties who have received copies, or rights, from you under\r
+this License will not have their licenses terminated so long as such\r
+parties remain in full compliance.\r
+\r
+ 5. You are not required to accept this License, since you have not\r
+signed it. However, nothing else grants you permission to modify or\r
+distribute the Program or its derivative works. These actions are\r
+prohibited by law if you do not accept this License. Therefore, by\r
+modifying or distributing the Program (or any work based on the\r
+Program), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Program or works based on it.\r
+\r
+ 6. Each time you redistribute the Program (or any work based on the\r
+Program), the recipient automatically receives a license from the\r
+original licensor to copy, distribute or modify the Program subject to\r
+these terms and conditions. You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties to\r
+this License.\r
+\r
+ 7. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License. If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Program at all. For example, if a patent\r
+license would not permit royalty-free redistribution of the Program by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Program.\r
+\r
+If any portion of this section is held invalid or unenforceable under\r
+any particular circumstance, the balance of the section is intended to\r
+apply and the section as a whole is intended to apply in other\r
+circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system, which is\r
+implemented by public license practices. Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\f\r
+ 8. If the distribution and/or use of the Program is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Program under this License\r
+may add an explicit geographical distribution limitation excluding\r
+those countries, so that distribution is permitted only in or among\r
+countries not thus excluded. In such case, this License incorporates\r
+the limitation as if written in the body of this License.\r
+\r
+ 9. The Free Software Foundation may publish revised and/or new versions\r
+of the General Public License from time to time. Such new versions will\r
+be similar in spirit to the present version, but may differ in detail to\r
+address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number. If the Program\r
+specifies a version number of this License which applies to it and "any\r
+later version", you have the option of following the terms and conditions\r
+either of that version or of any later version published by the Free\r
+Software Foundation. If the Program does not specify a version number of\r
+this License, you may choose any version ever published by the Free Software\r
+Foundation.\r
+\r
+ 10. If you wish to incorporate parts of the Program into other free\r
+programs whose distribution conditions are different, write to the author\r
+to ask for permission. For software which is copyrighted by the Free\r
+Software Foundation, write to the Free Software Foundation; we sometimes\r
+make exceptions for this. Our decision will be guided by the two goals\r
+of preserving the free status of all derivatives of our free software and\r
+of promoting the sharing and reuse of software generally.\r
+\r
+ NO WARRANTY\r
+\r
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\r
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\r
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\r
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\r
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\r
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\r
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\r
+REPAIR OR CORRECTION.\r
+\r
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\r
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\r
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\r
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\r
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\r
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\r
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\r
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\r
+POSSIBILITY OF SUCH DAMAGES.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\f\r
+ How to Apply These Terms to Your New Programs\r
+\r
+ If you develop a new program, and you want it to be of the greatest\r
+possible use to the public, the best way to achieve this is to make it\r
+free software which everyone can redistribute and change under these terms.\r
+\r
+ To do so, attach the following notices to the program. It is safest\r
+to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least\r
+the "copyright" line and a pointer to where the full notice is found.\r
+\r
+ <one line to give the program's name and a brief idea of what it does.>\r
+ Copyright (C) <year> <name of author>\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
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+If the program is interactive, make it output a short notice like this\r
+when it starts in an interactive mode:\r
+\r
+ Gnomovision version 69, Copyright (C) year name of author\r
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\r
+ This is free software, and you are welcome to redistribute it\r
+ under certain conditions; type `show c' for details.\r
+\r
+The hypothetical commands `show w' and `show c' should show the appropriate\r
+parts of the General Public License. Of course, the commands you use may\r
+be called something other than `show w' and `show c'; they could even be\r
+mouse-clicks or menu items--whatever suits your program.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the program, if\r
+necessary. Here is a sample; alter the names:\r
+\r
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program\r
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.\r
+\r
+ <signature of Ty Coon>, 1 April 1989\r
+ Ty Coon, President of Vice\r
+\r
+This General Public License does not permit incorporating your program into\r
+proprietary programs. If your program is a subroutine library, you may\r
+consider it more useful to permit linking proprietary applications with the\r
+library. If this is what you want to do, use the GNU Library General\r
+Public License instead of this License.\r
--- /dev/null
+=========1.4w10UCIb15===========\r
+- Due to refactoring time stamps in Windows would be written twice. \r
+This has been fixed. \r
+- More refactoring; the number of #ifdef _WIN32's has again been\r
+drastically reduced.\r
+=========1.4w10UCIb14===========\r
+- option to alter priority now also works on windows\r
+(Eric Mullins)\r
+- refactoring so that posix and win32 part share more\r
+code\r
+- a number of potential busy loop scenarios have been eliminated \r
+in the Windows code (Windows uses polling)\r
+- the return value of CreateProcess is now checked\r
+=========1.4w10UCIb13===========\r
+- perft mode exposed.\r
+=========1.4w10UCIb12===========\r
+- Replaced %lld everywhere by S64_FORMAT.\r
+=========1.4w10UCIb11===========\r
+- Crash bug fix (wrong parentheses in instruction that checked for help\r
+option).\r
+=========1.4w10UCIb10===========\r
+- It is now possible to do "make rpm" to make an rpm binary package. \r
+- Trivial bug fixes.\r
+- Documentation added for epd-test functionality (man page).\r
+- Cosmetic cleanups of output of epd-test.\r
+- "polyglot --help" output added.\r
+- Added polyglot book format specification to distribution.\r
+=========1.4w10UCIb9===========\r
+- Trivial cosmetic fixes\r
+- Some engines do not support the "Hash" options.\r
+So we do not send memory=1 in that case. \r
+=========1.4w10UCIb8===========\r
+- Support for egtpath command in xboard protocol\r
+=========1.4w10UCIb7===========\r
+- Debianization: it is now possible to do "make deb" to build a Debian/Ubuntu\r
+package.\r
+=========1.4w10UCIb6===========\r
+- UCI GUI support added. This makes it possible to use PG as a book engine\r
+on GUI's like ChessBase and Arena which normally only support their\r
+own proprietary format. \r
+\r
+- Support for new xboard "cores N" and "memory N" commands. See here\r
+for a complete description\r
+\r
+ http://home.hccnet.nl/h.g.muller/engine-intf.html\r
+\r
+- Some work arounds for engines like Toga which only allow some settings\r
+to be set before the first "isready" command. \r
+\r
+- Autotooled distribution.\r
+\r
+- Proper manual page. The README file is generated automatically from this. \r
+\r
+- More sane naming of README files.\r
+\r
+- If BookLearn is false (the default) PG will open the book read only.\r
+\r
+- Windows and non-Windows log file formats are now the same.\r
+\r
+- Proper ChangeLog (you are reading it!).\r
+=========1.4w10================\r
+fixed analysis output for toga\r
+=========1.4w9=================\r
+fixed bug in 1.4w8\r
+added RepeatPV workaround\r
+ fixed disappearing output in engine-output window while in multipv mode\r
+ when an engine sends its move to polyglot,\r
+ polyglot normally repeats the last pv string(which also contains score,depth and time usage) it got from the engine.\r
+ Some engines however do not send a new pv string just before sending the move and the now old pv string\r
+ find might confuse debugtools that parse the winboard debug files.\r
+ Adding "RepeatPV = false" to the [POLYGLOT] section of the ini file stops this repetition.\r
+ \r
+=========1.4w8=================\r
+fixed multipv output\r
+note that the pv with the worst score will be on top of the engine-output window.\r
+added timestamp in logfile (Jaap Weidemann)\r
+\r
+=========1.4w7=================\r
+compiles under linux/unix again\r
+=========1.4w6=================\r
+access to winboard draw/drawoffer and resign\r
+\r
+ 1:to activate draw offers the engine has \r
+ to define the "UCI_DrawOffers" parameter with the 'option" command at startup. \r
+ 2:to offer a draw or accept a draw offer:just send "info string DrawOffer" to polyglot. \r
+ 3:if winboard sends "draw" polyglot sends "setoption DrawOffer draw" to the engine.\r
+ 4.to resign: send "info string Resign" to polyglot.\r
+ please check the winboard documentation for the draw/drawoffer and resign commands.\r
+ \r
+=========1.4w5:================\r
+Fixed errors in SyncStop handling.\r
+book building: the error message now also contains the game number \r
+added Affinity option:\r
+In the [PolyGlot] section(ini file):\r
+- "Affinity" mask\r
+mask is a bit vector in which each bit represents the processors that a process is allowed to run on.\r
+\r
+some minor bugs fixed\r
+\r
+checks if child did really quit.\r
+\r
+\r
--- /dev/null
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+ The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation. It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions. Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+ It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring. Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+ If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release. If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+ The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+ 1. `cd' to the directory containing the package's source code and type
+ `./configure' to configure the package for your system.
+
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
+
+ 2. Type `make' to compile the package.
+
+ 3. Optionally, type `make check' to run any self-tests that come with
+ the package.
+
+ 4. Type `make install' to install the programs and any data files and
+ documentation.
+
+ 5. You can remove the program binaries and object files from the
+ source code directory by typing `make clean'. To also remove the
+ files that `configure' created (so you can compile the package for
+ a different kind of computer), type `make distclean'. There is
+ also a `make maintainer-clean' target, but that is intended mainly
+ for the package's developers. If you use it, you may have to get
+ all sorts of other programs in order to regenerate files that came
+ with the distribution.
+
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about. Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+ You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment. Here
+is an example:
+
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+ *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory. To do this, you can use GNU `make'. `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script. `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+ You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files. If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+ In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files. Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+ If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System). The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+ For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option. TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+ CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+ OS KERNEL-OS
+
+ See the file `config.sub' for the possible values of each field. If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+ If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+ If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists. Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'. However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost. In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'. For example:
+
+ ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+ Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+ Print the version of Autoconf used to generate the `configure'
+ script, and exit.
+
+`--cache-file=FILE'
+ Enable the cache: use and save the results of the tests in FILE,
+ traditionally `config.cache'. FILE defaults to `/dev/null' to
+ disable caching.
+
+`--config-cache'
+`-C'
+ Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+ Do not print messages saying which checks are being made. To
+ suppress all normal output, redirect it to `/dev/null' (any error
+ messages will still be shown).
+
+`--srcdir=DIR'
+ Look for the package's source code in directory DIR. Usually
+ `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options. Run
+`configure --help' for more details.
+
--- /dev/null
+#AM_CPPFLAGS=-DDEBUG
+#AM_CXXFLAGS=-g
+
+bin_PROGRAMS = polyglot
+polyglot_SOURCES = adapter.cpp attack.cpp board.cpp book.cpp book_make.cpp book_merge.cpp colour.cpp engine.cpp epd.cpp fen.cpp gui.cpp game.cpp hash.cpp io.cpp line.cpp list.cpp main.cpp move.cpp move_do.cpp move_gen.cpp move_legal.cpp option.cpp parse.cpp pgn.cpp piece.cpp pipe.cpp posix.cpp random.cpp san.cpp search.cpp square.cpp uci.cpp uci2uci.cpp util.cpp adapter.h colour.h hash.h move_gen.h piece.h uci2uci.h attack.h config.h gui.h io.h move.h pipe.h posix.h uci.h board.h engine.h line.h move_legal.h random.h util.h book.h epd.h list.h option.h san.h book_make.h fen.h main.h parse.h search.h book_merge.h game.h move_do.h pgn.h square.h
+
+dist_doc_DATA = README README1.3 README1.4 README1.4w README1.4w10UCI book_format.html
+
+man6_MANS = polyglot.man
+
+polyglot.man: polyglot.pod
+ pod2man -c "" -r "" -s 6 polyglot.pod > polyglot.man
+
+README: polyglot.man
+ groff -t -e -mandoc -Tascii polyglot.man| col -bx > README
+
+deb:
+ dpkg-buildpackage
+
+rpm:
+ make dist
+ rpmbuild -ta polyglot-@VERSION@.tar.gz
+
+EXTRA_DIST=makefile.gcc polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules
+
--- /dev/null
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in 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.
+
+@SET_MAKE@
+
+#AM_CPPFLAGS=-DDEBUG
+#AM_CXXFLAGS=-g
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = polyglot$(EXEEXT)
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \
+ ChangeLog INSTALL NEWS TODO config.guess config.sub depcomp \
+ install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man6dir)" \
+ "$(DESTDIR)$(docdir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_polyglot_OBJECTS = adapter.$(OBJEXT) attack.$(OBJEXT) \
+ board.$(OBJEXT) book.$(OBJEXT) book_make.$(OBJEXT) \
+ book_merge.$(OBJEXT) colour.$(OBJEXT) engine.$(OBJEXT) \
+ epd.$(OBJEXT) fen.$(OBJEXT) gui.$(OBJEXT) game.$(OBJEXT) \
+ hash.$(OBJEXT) io.$(OBJEXT) line.$(OBJEXT) list.$(OBJEXT) \
+ main.$(OBJEXT) move.$(OBJEXT) move_do.$(OBJEXT) \
+ move_gen.$(OBJEXT) move_legal.$(OBJEXT) option.$(OBJEXT) \
+ parse.$(OBJEXT) pgn.$(OBJEXT) piece.$(OBJEXT) pipe.$(OBJEXT) \
+ posix.$(OBJEXT) random.$(OBJEXT) san.$(OBJEXT) \
+ search.$(OBJEXT) square.$(OBJEXT) uci.$(OBJEXT) \
+ uci2uci.$(OBJEXT) util.$(OBJEXT)
+polyglot_OBJECTS = $(am_polyglot_OBJECTS)
+polyglot_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(polyglot_SOURCES)
+DIST_SOURCES = $(polyglot_SOURCES)
+man6dir = $(mandir)/man6
+NROFF = nroff
+MANS = $(man6_MANS)
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+dist_docDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(dist_doc_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+polyglot_SOURCES = adapter.cpp attack.cpp board.cpp book.cpp book_make.cpp book_merge.cpp colour.cpp engine.cpp epd.cpp fen.cpp gui.cpp game.cpp hash.cpp io.cpp line.cpp list.cpp main.cpp move.cpp move_do.cpp move_gen.cpp move_legal.cpp option.cpp parse.cpp pgn.cpp piece.cpp pipe.cpp posix.cpp random.cpp san.cpp search.cpp square.cpp uci.cpp uci2uci.cpp util.cpp adapter.h colour.h hash.h move_gen.h piece.h uci2uci.h attack.h config.h gui.h io.h move.h pipe.h posix.h uci.h board.h engine.h line.h move_legal.h random.h util.h book.h epd.h list.h option.h san.h book_make.h fen.h main.h parse.h search.h book_merge.h game.h move_do.h pgn.h square.h
+dist_doc_DATA = README README1.3 README1.4 README1.4w README1.4w10UCI book_format.html
+man6_MANS = polyglot.man
+EXTRA_DIST = makefile.gcc polyglot.man polyglot.pod polyglot.spec debian/changelog debian/control debian/docs debian/README debian/compat debian/copyright debian/files debian/polyglot.substvars debian/rules
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+polyglot$(EXEEXT): $(polyglot_OBJECTS) $(polyglot_DEPENDENCIES)
+ @rm -f polyglot$(EXEEXT)
+ $(CXXLINK) $(polyglot_OBJECTS) $(polyglot_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adapter.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/attack.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/board.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/book.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/book_make.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/book_merge.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/colour.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/engine.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/epd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gui.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/io.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/line.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_do.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_gen.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/move_legal.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/option.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pgn.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/piece.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pipe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/random.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/san.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/square.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uci.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uci2uci.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
+
+.cpp.o:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+install-man6: $(man6_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man6dir)" || $(MKDIR_P) "$(DESTDIR)$(man6dir)"
+ @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.6*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 6*) ;; \
+ *) ext='6' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man6dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man6dir)/$$inst"; \
+ done
+uninstall-man6:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.6*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 6*) ;; \
+ *) ext='6' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man6dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man6dir)/$$inst"; \
+ done
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+ @list='$(dist_doc_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(dist_docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
+ $(dist_docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(docdir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man6dir)" "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA install-man
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man6
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-dist_docDATA \
+ uninstall-man
+
+uninstall-man: uninstall-man6
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
+ clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \
+ dist-gzip dist-lzma dist-shar dist-tarZ dist-zip distcheck \
+ distclean distclean-compile distclean-generic distclean-hdr \
+ distclean-tags distcleancheck distdir distuninstallcheck dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-man6 install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS uninstall-dist_docDATA \
+ uninstall-man uninstall-man6
+
+
+polyglot.man: polyglot.pod
+ pod2man -c "" -r "" -s 6 polyglot.pod > polyglot.man
+
+README: polyglot.man
+ groff -t -e -mandoc -Tascii polyglot.man| col -bx > README
+
+deb:
+ dpkg-buildpackage
+
+rpm:
+ make dist
+ rpmbuild -ta polyglot-@VERSION@.tar.gz
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
--- /dev/null
+POLYGLOT(6) POLYGLOT(6)
+
+
+
+NAME
+ PolyGlot - Winboard protocol to UCI protocol adapter
+ - book engine for Polyglot books
+ - a collection of utilities for creating opening books
+ - a utility for analyzing epd files
+ - a perft counter
+
+SYNOPSIS
+ polyglot [configfile]
+
+ polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply]
+ [-min-game games] [-min-score score] [-only-white] [-only-black] [-uni-
+ form]
+
+ polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
+
+ polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth]
+ [-max-depth depth] [-max-time time] [-depth-delta delta]
+
+ polyglot perft [-fen fen] [-max-depth depth]
+
+DESCRIPTION
+ PolyGlot as adapter and book engine
+
+ PolyGlot is a "UCI adapter". It connects a GUI interface (such as
+ XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
+
+ By specifying an opening book (in PolyGlot book format) chess engines
+ can transparently use such books.
+
+ PolyGlot understands the two main GUI protocols: UCI and xboard. Nor-
+ mally the protocol will be auto detected but this can be overridden in
+ the configuration file.
+
+ In xboard mode PolyGlot fully translates between the xboard and UCI
+ protocols. In addition it tries to solve known problems with other
+ adapters. For instance, it detects and reports draws by fifty-move
+ rule, repetition, etc ... It also supports Chess960.
+
+ When in UCI mode PolyGlot mostly passes commands from the GUI to the
+ engine and vice versa, except that it will play book moves on behalf of
+ the engine when the occasion arises.
+
+ Book making utilities
+
+ PolyGlot supports the "PolyGlot opening book format". This is the
+ defacto standard non-proprietary opening book format. It is fully docu-
+ mented here
+
+ http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
+
+ Roughly speaking a PolyGlot opening book is a collection of triples
+ (position, move, weight). A "position" is represented by a 64-bit
+ Zobrist hash key. The weight is proportional to the probability the
+ move should be played.
+
+ Other opening book formats such as ChessBase's .ctg format and Arena's
+ .abk format are undocumented and proprietary. They can only be used by
+ their own GUIs.
+
+ PolyGlot can compile a pgn file into a binary PolyGlot book and fur-
+ thermore it can merge two such binary books into a third one.
+
+ Epd test mode
+
+ In epd test mode, PolyGlot will search positions in an epd file and
+ record the number of times the right best move was found. The argu-
+ ments specify when to stop the search in any given position.
+
+ Perft counts
+
+ A perft count is the number of legal move sequence in a given position
+ up to a given depth. PolyGlot can perform such perft counts. It is how-
+ ever much slower than other more dedicated programs.
+
+OPTIONS
+ When invoked without options or with a config file as argument PolyGlot
+ acts as an adapter. The config file format is documented below. The
+ default config file is "polyglot.ini".
+
+ When invoked as
+
+ polyglot make-book
+
+ PolyGlot supports the following options
+
+ -pgn (default: "book.pgn")
+ Input file in pgn format.
+
+ -bin (default: "book.bin")
+ Output file in PolyGlot format.
+
+ -max-ply (default: 1024)
+ Specifies the maximum ply-depth of lines included in the book.
+
+ -min-game (default: 3)
+ Specifies the minimum number of games that have to contain this
+ move for it to be included in the book.
+
+ -min-score (default: 0.0)
+ Specifies the minimum score (or weight) this move should have
+ received for it to be included in the book. The score is
+ 2*(wins)+(draws), globally scaled to fit into 16 bits.
+
+ -only-white
+ Include only moves for white in the book.
+
+ -only-black
+ Include only moves for black in the book.
+
+ -uniform
+ Set all weights to 1. In other words, all moves will be selected
+ with equal probability.
+
+ When invoked as
+
+ polyglot merge-book
+
+ PolyGlot supports the following options
+
+ -in1
+ First input file (in PolyGlot book format).
+
+ -in2
+ Second input file (in PolyGlot book format).
+
+ -out (default: out.bin)
+ Output file (in PolyGlot book format).
+
+ Input files are not symmetrical, "in1" has priority over "in2". In
+ other words when a position occurs both in "in1" and "in2" only the
+ moves and weights from "in1" will be retained in "out".
+
+ When invoked as
+
+ polyglot epd-test
+
+ (possibly with a config file as first argument) PolyGlot supports the
+ following options
+
+ -max-depth (default: 63)
+ Unconditionally stop the search when this depth has been reached.
+
+ -max-time (default: 5.0)
+ Unconditionally stop the seach after this amount of time.
+
+ -depth-delta (default: 3)
+ Stop the search if the best move has been constant for this many
+ depths, on condition that the mininal depth and minimal time have
+ been reached.
+
+ -min-depth (default: 8)
+ Minimal search depth when the search is stopped using
+ "-depth-delta".
+
+ -min-time (default: 1.0)
+ Minimal search time when the search is stopped using
+ "-depth-delta".
+
+ When invoked as
+
+ polyglot perft
+
+ PolyGlot supports the following options
+
+ -fen (default: starting position)
+ Fen at which to start searching.
+
+ -max-depth (default: 1)
+ Maximum depth to search.
+
+CONFIG FILE FORMAT
+ There should be a different config file for each engine.
+
+ The config file is in the traditional INI format.
+
+ [PolyGLot]
+ option = value
+ ...
+ [Engine]
+ option = value
+ ...
+
+ Lines starting with "#" are ignored.
+
+ NOTE: There can be spaces in option names or values. Do not use
+ quotes. Boolean values are written as "true" or "false".
+
+ [PolyGlot] section
+
+ This section is used by PolyGlot only. The engine is unaware of these
+ options. The list of available options is detailed below.
+
+ EngineName (default: UCI name)
+ This is the name that will appear in the GUI. It is cosmetic only.
+ You can use different names for tweaked versions of the same
+ engine.
+
+ EngineDir (default: ".")
+ Full path of the directory where the engine is installed. You can
+ use "." (without the quotes) if you know that PolyGlot will be
+ launched in the engine directory or the engine is in the "path" and
+ does not need any data file.
+
+ EngineCommand
+ Put here the name of the engine executable file. You can also add
+ command-line arguments. Path searching is used and the current
+ directory will be "EngineDir".
+
+ Log (default: false)
+ Whether PolyGlot should log all transactions with the interface and
+ the engine. This should be necessary only to locate problems.
+
+ LogFile (default: polyglot.log)
+ The name of the log file. Note that it is put where PolyGlot was
+ launched from, not into the engine directory.
+
+ WARNING: Log files are not cleared between sessions, and can become
+ very large. It is safe to remove them though.
+
+ Resign (default: false)
+ Set this to "true" if you want PolyGlot to resign on behalf of the
+ engine.
+
+ NOTE: Some engines display buggy scores from time to time although
+ the best move is correct. Use this option only if you know what
+ you are doing (e.g. you always check the final position of games).
+
+ ResignMoves (default: 3)
+ Number of consecutive moves with "resign" score (see below) before
+ PolyGlot resigns for the engine. Positions with only one legal
+ move are ignored.
+
+ ResignScore (default: 600)
+ This is the score in centipawns that will trigger resign "count-
+ ing".
+
+ ShowPonder (default: true)
+ Show search information during engine pondering. Turning this off
+ might be better for interactive use in some interfaces.
+
+ KibitzMove (default: false)
+ Whether to kibitz when playing a move.
+
+ KibitzPV (default: false)
+ Whether to kibitz when the PV is changed (new iteration or new best
+ move).
+
+ KibitzCommand (default: "tellall")
+ xboard command to use for kibitzing, normally "tellall" for kibitz-
+ ing or "tellothers" for whispering.
+
+ KibitzDelay (default: 5)
+ How many seconds to wait before starting kibitzing. This has an
+ effect only if "KibitzPV" is selected, move kibitzes are always
+ sent regardless of the delay.
+
+ UCI (default: false)
+ If true PolyGlot will not understand xboard commands.
+
+ Book (default: false)
+ Indicates whether a PolyGlot book should be used. This has no
+ effect on the engine own book (which can be controlled with the UCI
+ option "OwnBook" in the [Engine] section). In particular, it is
+ possible to use both a PolyGlot book and an engine book. In that
+ case, the engine book will be used whenever PolyGlot is out of
+ book. Remember that PolyGlot is unaware of whether the engine is
+ itself using a book or not.
+
+ Chess960 (default: false)
+ Play Chess960 (also called Fischer Random Chess or FRC),
+
+ MateScore (default: 10000)
+ Mate score reported to GUI when in xboard mode.
+
+ BookFile (default: book.bin)
+ The name of the (binary) book file. Note that PolyGlot will look
+ for it in the directory it was launched from, not in the engine
+ directory. Of course, full path can be used in which case the cur-
+ rent directory does not matter.
+
+ NOTE: When using PolyGlot with a UCI GUI this parameter can be set
+ via the UCI option "Polyglot BookFile".
+
+ BookRandom (default: true)
+ Select moves according to their weights in the book. If false the
+ move with the highest weight is selected.
+
+ BookLearn (default: false)
+ Record learning information in the opening book. Naturally this
+ requires the opening book to be writable.
+
+ UseNice (default: false)
+ Run the engine at nice level 5, or "NiceValue" if it set. On some
+ operating systems it may be necessary to run the engine at lower
+ priority for it to be responsive to commands from PolyGlot while
+ searching.
+
+ NiceValue (default: 5)
+ Nice levels go from -20 to 20 with 20 being the lowest priority.
+ On Unix only root can set negative nice levels. On Windows the
+ standard Win32 priority levels are mapped in a sensible way to Unix
+ nice levels.
+
+ Affinity (default: -1)
+ This a bit vector in which each bit represents the processors that
+ a process is allowed to run on. This option works only on Windows.
+
+ Work arounds
+
+ Work arounds are identical to options except that they should be used
+ only when necessary. Their purpose is to try to hide problems with
+ various software (not just engines). The default value is always cor-
+ rect for bug-free software.
+
+ IMPORTANT: Any of these work arounds might be removed in future ver-
+ sions of PolyGlot. You are strongly recommended to contact the author
+ of faulty software and truly fix the problem.
+
+ PolyGlot supports the following work arounds:
+
+ UCIVersion (default: 2)
+ The default value of 2 corresponds to UCI+. Use 1 to select plain
+ UCI for engines that have problems with UCI+.
+
+ CanPonder (default: false)
+ PolyGlot now conforms to the documented UCI behaviour: the engine
+ will be allowed to ponder only if it (the engine) declares the
+ "Ponder" UCI option. However some engines which can actually pon-
+ der do not declare the option. This work around lets PolyGlot know
+ that they can ponder.
+
+ SyncStop (default: false)
+ When a ponder miss occurs, Polyglot interrupts the engine and IMME-
+ DIATELY launches a new search. While there should be no problem
+ with this, some engines seem confused and corrupt their search
+ board. "SyncStop" forces PolyGlot to wait for the (now useless)
+ ponder search to finish before launching the new search.
+
+ PromoteWorkAround (default: false)
+ Some engines do not specify a promotion piece, e.g. they send
+ "e7e8" instead of the correct "e7e8q". This work around enables
+ the incorrect form (and of course promotes into a queen).
+
+ RepeatPV (default: true)
+ When true, PolyGlot repeats the last pv string (which also contains
+ score,depth and time usage) it got from the engine. Some engines
+ however do not send a new pv string just before sending the move
+ and the now old pv string might confuse debugtools that parse the
+ winboard debug files.
+
+ [Engine] section
+
+ This section contains engine UCI options. PolyGlot does not understand
+ them, but sends the information to the engine at startup (converted to
+ UCI form). You can add any UCI option that makes sense to the engine
+ (not just the common options about hash-table size and tablebases).
+
+ NOTE: use INI syntax, not UCI. For example "OwnBook = true" is cor-
+ rect. It will be replaced by PolyGlot with "setoption name OwnBook
+ value true" at engine startup.
+
+ Standard UCI options are
+
+ Hash
+ NalimovPath
+ NalimovCache
+ OwnBook
+
+ Hidden options like "Ponder" or "UCI_xxx" are automatic and should not
+ be put in an INI file.
+
+ The other options are engine-specific. Check their name using a UCI
+ GUI or launch the engine in a console and type "uci".
+
+EXAMPLES
+ Compile "games.pgn" into a book "book.bin" retaining all lines of at
+ most 30 plies.
+
+ polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
+
+ Merge books "in1.bin" and "in2.bin" into a book "out.bin".
+
+ polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
+
+ Here is a minimal config file
+
+ [PolyGlot]
+ EngineCommand = fruit
+ [Engine]
+
+EXIT STATUS
+ PolyGlot always returns 0 on exit.
+
+AUTHORS
+ Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
+
+ Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning
+ Yellow")
+
+ Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
+
+ UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
+
+SEE ALSO
+ xboard(6)
+
+
+
+ 2009-01-10 POLYGLOT(6)
--- /dev/null
+\r
+Legal details\r
+-------------\r
+\r
+PolyGlot 1.3 Copyright 2004-2005 Fabien Letouzey.\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 (at\r
+your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful, but\r
+WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+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\r
+USA\r
+\r
+See the file "copying.txt" for details.\r
+\r
+\r
+General\r
+-------\r
+\r
+PolyGlot 1.3 (2005/06/03).\r
+\r
+PolyGlot is a "UCI adapter". It connects a UCI chess engine to an\r
+xboard interface such as WinBoard. UCI2WB is another such adapter\r
+(for Windows).\r
+\r
+PolyGlot tries to solve known problems with other adapters. For\r
+instance, it detects and reports draws by fifty-move rule, repetition,\r
+etc ...\r
+\r
+\r
+Official distribution URL\r
+-------------------------\r
+\r
+The official distribution web site is Leo Dijksman's WBEC Ridderkerk:\r
+http://wbec-ridderkerk.nl/ This is where you should be looking for\r
+PolyGlot updates in the future.\r
+\r
+\r
+Install\r
+-------\r
+\r
+PolyGlot should have its own directory. The INI files for engines\r
+should also be put there. Dirtier solutions are needed when\r
+BookThinker is used though.\r
+\r
+On Windows the files "polyglot.exe" and "cygwin1.dll" (which you can\r
+download from http://wbec-ridderkerk.nl/) are needed. On Linux and\r
+Mac OS X only the file "polyglot_linux" or "polyglot_mac" is required.\r
+\r
+\r
+Compiling\r
+---------\r
+\r
+The distribution comes up with Windows, Linux and Mac OS X binaries.\r
+Compiling is therefore not necessary on those systems unless you want\r
+to make a change in the program. In any case this section describes\r
+the compiling procedure, it is safe to skip it.\r
+\r
+PolyGlot is a POSIX application (Unix compatible), and was developed\r
+on Linux using g++ (the GNU C++ compiler).\r
+\r
+1) Unix\r
+\r
+You should be able to compile it on any POSIX-compliant operating\r
+system (*not* Windows) with the following command line (or similar):\r
+\r
+> g++ -O2 -o polyglot *.cpp\r
+\r
+IMPORTANT: In "io.cpp", the variable "UseCR" should be set to "false".\r
+\r
+A Makefile is provided but might not work on your system ...\r
+\r
+2) Windows\r
+\r
+On Windows, you *must* use Cygnus GCC to compile PolyGlot.\r
+\r
+IMPORTANT: In "io.cpp", the variable "UseCR" should be set to "true".\r
+\r
+\r
+Usage\r
+-----\r
+\r
+PolyGlot acts as an xboard engine. There should be no difference with\r
+a normal chess program as far as the interface (e.g. WinBoard) is\r
+concerned.\r
+\r
+PolyGlot is invoked using "polyglot <INI file>". Note that PolyGlot\r
+will look for the INI file in the current directory. If no <INI file>\r
+is given, "polyglot.ini" is selected.\r
+\r
+To use PolyGlot with XBoard, you would type something like this:\r
+> xboard -fd 'polyglot_dir' -fcp 'polyglot engine.ini'\r
+\r
+Quotes are important when there is a space in the argument.\r
+\r
+\r
+INI file\r
+--------\r
+\r
+There should be a different INI file for each engine. Sections are\r
+composed of "variable = value" lines. See the sample INI files in the\r
+"example" directory.\r
+\r
+NOTE: There can be spaces in variable names or values. Do not use\r
+quotes.\r
+\r
+1) [PolyGlot] section\r
+\r
+This section is used by PolyGlot only. The engine is unaware of these\r
+options. The list of available options is detailed below in this\r
+document.\r
+\r
+2) [Engine] section\r
+\r
+This section contains engine UCI options. PolyGlot does not\r
+understand them, but sends the information to the engine at startup\r
+(converted to UCI form). You can add any UCI option that makes sense\r
+to the engine (not just the common options about hash-table size and\r
+tablebases).\r
+\r
+NOTE: use INI syntax, not UCI. For example "OwnBook = true" is\r
+correct. It will be replaced by PolyGlot with "setoption name OwnBook\r
+value true" at engine startup.\r
+\r
+Standard UCI options are "Hash", "NalimovPath", "NalimovCache" and\r
+"OwnBook". Hidden options like "Ponder" or "UCI_xxx" are automatic\r
+and should not be put in an INI file.\r
+\r
+The other options are engine-specific. Check their name using a UCI\r
+GUI or launch the engine in a console and type "uci".\r
+\r
+\r
+Options\r
+-------\r
+\r
+These should be put in the [PolyGlot] section.\r
+\r
+- "EngineName" (default: UCI name)\r
+\r
+This is the name that will appear in the xboard interface. It is\r
+cosmetic only. You can use different names for tweaked versions of\r
+the same engine.\r
+\r
+If no "Engine Name" is given, the UCI name will be used.\r
+\r
+- "EngineDir" (default: ".")\r
+\r
+Full path of the directory where the engine is installed. You can use\r
+"." (without the quotes) if you know that PolyGlot will be launched in\r
+the engine directory or the engine is in the "path" and does not need\r
+any data file.\r
+\r
+- "EngineCommand"\r
+\r
+Put here the name of the engine executable file. You can also add\r
+command-line arguments. Path searching is used and the current\r
+directory will be "EngineDir".\r
+\r
+NOTE: Unix users are recommended to prepend "./"; this is required on\r
+some secure systems.\r
+\r
+- "Log" (default: false)\r
+\r
+Whether PolyGlot should log all transactions with the interface and\r
+the engine. This should be necessary only to locate problems.\r
+\r
+- "LogFile"\r
+\r
+The name of the log file. Note that it is put where PolyGlot was\r
+launched from, not into the engine directory.\r
+\r
+WARNING: Log files are not cleared between sessions, and can become\r
+very large. It is safe to remove them though.\r
+\r
+- "Resign" (default: false)\r
+\r
+Set this to "true" if you want PolyGlot to resign on behalf of the\r
+engine.\r
+\r
+NOTE: Some engines display buggy scores from time to time although the\r
+best move is correct. Use this option only if you know what you are\r
+doing (e.g. you always check the final position of games).\r
+\r
+- "ResignMoves" (default: 3)\r
+\r
+Number of consecutive moves with "resign" score (see below) before\r
+PolyGlot resigns for the engine. Positions with only one legal move\r
+are ignored.\r
+\r
+- "ResignScore" (default: 600)\r
+\r
+This is the score in centipawns that will trigger resign "counting".\r
+\r
+- "ShowPonder" (*** NEW ***, default: true)\r
+\r
+Show search information during engine pondering. Turning this off\r
+might be better for interactive use in some interfaces.\r
+\r
+- "KibitzMove" (*** NEW ***, default: false)\r
+\r
+Whether to kibitz when playing a move.\r
+\r
+- "KibitzPV" (*** NEW ***, default: false)\r
+\r
+Whether to kibitz when the PV is changed (new iteration or new best move).\r
+\r
+- "KibitzCommand" (*** NEW ***, default: "tellall")\r
+\r
+xboard command to use for kibitzing, normally "tellall" for kibitzing\r
+or "tellothers" for whispering.\r
+\r
+- "KibitzDelay" (*** NEW ***, default: 5)\r
+\r
+How many seconds to wait before starting kibitzing. This has an\r
+affect only if "KibitzPV" is selected, move kibitzes are always sent\r
+regardless of the delay.\r
+\r
+\r
+Work arounds\r
+------------\r
+\r
+Work arounds are identical to options except that they should be used\r
+only when necessary. Their purpose is to try to hide problems with\r
+various software (not just engines). The default value is always\r
+correct for bug-free software.\r
+\r
+IMPORTANT: Any of these work arounds might be removed in future\r
+versions of PolyGlot. You are strongly recommended to contact the\r
+author of faulty software and truly fix the problem.\r
+\r
+In PolyGlot 1.3 there is only one optional work around:\r
+\r
+- "UCIVersion" (default: 2)\r
+\r
+The default value of 2 corresponds to UCI+. Use 1 to select plain\r
+UCI for engines that have problems with UCI+.\r
+\r
+\r
+Opening Book\r
+------------\r
+\r
+*** NEW ***\r
+\r
+PolyGlot 1.3 provides a minimal opening-book implementation.\r
+\r
+New options can be added to the [PolyGlot] section:\r
+\r
+- "Book" (default: false)\r
+\r
+Indicates whether a PolyGlot book should be used. This has no effect\r
+on the engine own book (which can be controlled with the UCI option\r
+"OwnBook" in the [Engine] section). In particular, it is possible to\r
+use both a PolyGlot book and an engine book. In that case, the engine\r
+book will be used whenever PolyGlot is out of book. Remember that\r
+PolyGlot is unaware of whether the engine is itself using a book or\r
+not.\r
+\r
+- "BookFile"\r
+\r
+The name of the (binary) book file. Note that PolyGlot will look for\r
+it in the directory it was launched from, not in the engine directory.\r
+Of course, full path can be used in which case the current directory\r
+does not matter.\r
+\r
+Note that there is no option to control book usage. All parameters\r
+are fixed when compiling a PGN file into a binary book (see below).\r
+This is purposeful and is not likely to change.\r
+\r
+Using a book does not require any additional memory, this can be\r
+important for memory-limited tournaments.\r
+\r
+A default book "fruit.bin" is provided in the archive. Note that this\r
+book is very small and should probably not be used in serious games.\r
+I hope that users will make other books available in the future.\r
+\r
+\r
+Book Making\r
+-----------\r
+\r
+*** NEW ***\r
+\r
+You can compile a PGN file into a binary book using PolyGlot on the\r
+command line. At the moment, only a main (random) book is provided.\r
+It is not yet possible to control opening lines manually. I am\r
+working on it though.\r
+\r
+Usage: "polyglot make-book <options>".\r
+\r
+"make-book" options are:\r
+\r
+- "-pgn"\r
+\r
+Name of the input PGN file. PolyGlot should support any\r
+standard-conforming file. Let me know if you encounter a problem.\r
+\r
+- "-bin"\r
+\r
+Name of the output binary file. I suggest ".bin" as the extension but\r
+in fact PolyGlot does not care.\r
+\r
+- "-max-ply" (default: infinite)\r
+\r
+How many plies (half moves) to read for each game. E.g. if set to\r
+"20", only the first 10 full moves of each game will be scanned.\r
+\r
+- "-min-game" (default: 3)\r
+\r
+How many times must a move be played to be kept in the book. In other\r
+words, moves that were played too rarely will be left out. If you\r
+scan full games "2" seems a minimum, but if you selected lines\r
+manually "1" will make sense.\r
+\r
+Example: "polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30".\r
+\r
+Building a book is usually very fast (a few minutes at most). Note\r
+however that a lot of memory may be required. To reduce memory usage,\r
+select a ply limit.\r
+\r
+\r
+History\r
+-------\r
+\r
+2004/04/30: PolyGlot 1.0\r
+\r
+- first public release.\r
+\r
+2004/10/01: PolyGlot 1.1\r
+\r
+- added "StartupWait" and "PonderWorkAround" ("AutoQuit" was available\r
+ in version 1.0 but not documented).\r
+\r
+- fixed a minor bug that could prevent "AutoQuit" from working with\r
+ some engines.\r
+\r
+2005/01/29: PolyGlot 1.2\r
+\r
+- rewrote engine initialisation and UCI parsing to increase\r
+ UCI-standard compliance\r
+\r
+- added multi-move resign\r
+\r
+- added an internal work around for engines hanging with WinBoard\r
+\r
+2005/06/03: PolyGlot 1.3\r
+\r
+- added opening book\r
+\r
+- added kibitzing\r
+\r
+- added "ShowPonder" option\r
+\r
+\r
+\r
+Known bugs\r
+----------\r
+\r
+*** IMPORTANT ***\r
+\r
+There is a bug (!) in the xboard automaton. The bug is related to\r
+searching in draw positions (e.g. 50-move rule or repetition). I had\r
+only been able to make PolyGlot crash by using analysis mode and\r
+performing manual takebacks. I believe that this bug can only happen\r
+in highly-interactive use (e.g. manual analysis). It is present in\r
+all versions of PolyGlot, including this one.\r
+\r
+I attempted a work around in February. I vaguely remember the change\r
+prevents crashing (not sure) but it is possible that PolyGlot now gets\r
+stuck in some rare case, i.e. it refuses to produce a move. In any\r
+case, the bug cannot occur silently, e.g. in a game that terminated\r
+normally.\r
+\r
+Because of the small expected impact (nobody ever reported it to me)\r
+and because fixing the bug would require a whole redesign of the\r
+xboard module, I have no intention of working on it at the moment (!).\r
+\r
+Make sure to let me know if it appeared in any circounstance, thanks!\r
+In particular if the bug ever occurs during a non-interactive session\r
+(e.g. engine vs. engine game), then I will do something.\r
+\r
+\r
+Thanks\r
+------\r
+\r
+Big thanks go to:\r
+\r
+- Dann Corbit for spending a lot of time compiling, testing, making\r
+ files available, etc ...\r
+\r
+- Leo Dijksman for hosting the PolyGlot distribution on his web site\r
+ (see Links) and also for thorough testing\r
+\r
+- Tord Romstad, Joshua Shriver and George Sobala for compiling and\r
+ testing on Mac OS X\r
+\r
+- users in the WinBoard forum for their feedback and encouraging\r
+ words: Roger Brown, Leo Dijksman, Igor Gorelikov, Mogens Larsen,\r
+ Volker Pittlik, Norm Pollock, Günther Simon and Salvo Spitaleri\r
+ in particular\r
+\r
+\r
+Links\r
+-----\r
+\r
+- Tim Mann's Chess Pages: http://www.tim-mann.org/xboard.html\r
+- Leo Dijksman's WBEC Ridderkerk: http://wbec-ridderkerk.nl/\r
+- Volker Pittlik's Winboard Forum: http://wbforum.volker-pittlik.name/\r
+\r
+\r
+Contact me\r
+----------\r
+\r
+You can contact me at fabien_letouzey@hotmail.com\r
+\r
+If I am not available, you can discuss PolyGlot issues in Volker\r
+Pittlik's Winboard Forum: http://wbforum.volker-pittlik.name/\r
+\r
+In fact for questions regarding specific Windows-only engines, you are\r
+advised to ask directly in the WinBoard forum, as I don't have Windows\r
+myself.\r
+\r
+\r
+The end\r
+-------\r
+\r
+Fabien Letouzey, 2005/06/03.\r
+\r
--- /dev/null
+
+Legal details
+-------------
+
+PolyGlot 1.4 Copyright 2004-2006 Fabien Letouzey.
+
+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
+
+See the file "copying.txt" for details.
+
+
+General
+-------
+
+PolyGlot 1.4 (2006/01/16).
+
+PolyGlot is a "UCI adapter". It connects a UCI chess engine to an
+xboard interface such as WinBoard. UCI2WB is another such adapter
+(for Windows).
+
+PolyGlot tries to solve known problems with other adapters. For
+instance, it detects and reports draws by fifty-move rule, repetition,
+etc ...
+
+
+Official distribution URL
+-------------------------
+
+The official distribution web site is Leo Dijksman's WBEC Ridderkerk:
+http://wbec-ridderkerk.nl/ This is where you should be looking for
+PolyGlot updates in the future.
+
+
+Install
+-------
+
+PolyGlot can be placed in its own directory, or anywhere it can access
+the DLL file from (on Windows).
+
+On Windows the files "polyglot.exe" and "cygwin1.dll" (which you can
+download from http://wbec-ridderkerk.nl/) are needed. On Linux and
+Mac OS X only the file "polyglot_linux" or "polyglot_mac" is required.
+
+
+Compiling
+---------
+
+The distribution comes up with Windows, Linux and Mac OS X binaries.
+Compiling should therefore not be necessary on those systems unless
+you want to make a change in the program. In any case this section
+describes the compiling procedure, it is safe to skip it.
+
+PolyGlot is a POSIX application (Unix compatible), and was developed
+on Linux using g++ (the GNU C++ compiler).
+
+1) Unix
+
+You should be able to compile it on any POSIX-compliant operating
+system (*not* Windows) with the following command line (or similar):
+
+> g++ -O2 -o polyglot *.cpp
+
+IMPORTANT: In "io.cpp", the variable "UseCR" should be set to "false".
+
+A Makefile is provided but might not work on your system ...
+
+2) Windows
+
+On Windows, you *must* use Cygnus GCC to compile PolyGlot.
+
+IMPORTANT: In "io.cpp", the variable "UseCR" should be set to "true".
+
+
+Usage
+-----
+
+PolyGlot acts as an xboard engine. There should be no difference with
+a normal chess program as far as the interface (e.g. WinBoard) is
+concerned.
+
+PolyGlot is invoked using "polyglot ". Note that PolyGlot
+will look for the INI file in the current directory. If no
+is given, "polyglot.ini" is selected.
+
+To use PolyGlot with XBoard, you would type something like this:
+> xboard -fd 'ini_dir' -fcp 'polyglot engine.ini'
+
+Quotes are important when there is a space in the argument.
+
+IMPORTANT: some users seem confused by the concept of "current
+directory". PolyGlot needs to know where to read (INI file) and write
+(log file) files. Although it's possible to specify the full path to
+each file, a better solution is to provide a directory when launching
+PolyGlot, e.g. with the "-fd" XBoard option above. The directory
+should be where the INI file is.
+
+
+INI file
+--------
+
+There should be a different INI file for each engine. Sections are
+composed of "variable = value" lines. See the sample INI files in the
+"example" directory.
+
+NOTE: There can be spaces in variable names or values. Do not use
+quotes.
+
+1) [PolyGlot] section
+
+This section is used by PolyGlot only. The engine is unaware of these
+options. The list of available options is detailed below in this
+document.
+
+2) [Engine] section
+
+This section contains engine UCI options. PolyGlot does not
+understand them, but sends the information to the engine at startup
+(converted to UCI form). You can add any UCI option that makes sense
+to the engine (not just the common options about hash-table size and
+tablebases).
+
+NOTE: use INI syntax, not UCI. For example "OwnBook = true" is
+correct. It will be replaced by PolyGlot with "setoption name OwnBook
+value true" at engine startup.
+
+Standard UCI options are "Hash", "NalimovPath", "NalimovCache" and
+"OwnBook". Hidden options like "Ponder" or "UCI_xxx" are automatic
+and should not be put in an INI file.
+
+The other options are engine-specific. Check their name using a UCI
+GUI or launch the engine in a console and type "uci".
+
+
+Options
+-------
+
+These should be put in the [PolyGlot] section.
+
+- "EngineName" (default: UCI name)
+
+This is the name that will appear in the xboard interface. It is
+cosmetic only. You can use different names for tweaked versions of
+the same engine.
+
+If no "Engine Name" is given, the UCI name will be used.
+
+- "EngineDir" (default: ".")
+
+Full path of the directory where the engine is installed. You can use
+"." (without the quotes) if you know that PolyGlot will be launched in
+the engine directory or the engine is in the "path" and does not need
+any data file.
+
+- "EngineCommand"
+
+Put here the name of the engine executable file. You can also add
+command-line arguments. Path searching is used and the current
+directory will be "EngineDir".
+
+NOTE: Unix users are recommended to prepend "./"; this is required on
+some secure systems.
+
+- "Log" (default: false)
+
+Whether PolyGlot should log all transactions with the interface and
+the engine. This should be necessary only to locate problems.
+
+- "LogFile"
+
+The name of the log file. Note that it is put where PolyGlot was
+launched from, not into the engine directory.
+
+WARNING: Log files are not cleared between sessions, and can become
+very large. It is safe to remove them though.
+
+- "Resign" (default: false)
+
+Set this to "true" if you want PolyGlot to resign on behalf of the
+engine.
+
+NOTE: Some engines display buggy scores from time to time although the
+best move is correct. Use this option only if you know what you are
+doing (e.g. you always check the final position of games).
+
+- "ResignMoves" (default: 3)
+
+Number of consecutive moves with "resign" score (see below) before
+PolyGlot resigns for the engine. Positions with only one legal move
+are ignored.
+
+- "ResignScore" (default: 600)
+
+This is the score in centipawns that will trigger resign "counting".
+
+- "ShowPonder" (default: true)
+
+Show search information during engine pondering. Turning this off
+might be better for interactive use in some interfaces.
+
+- "KibitzMove" (default: false)
+
+Whether to kibitz when playing a move.
+
+- "KibitzPV" (default: false)
+
+Whether to kibitz when the PV is changed (new iteration or new best move).
+
+- "KibitzCommand" (default: "tellall")
+
+xboard command to use for kibitzing, normally "tellall" for kibitzing
+or "tellothers" for whispering.
+
+
+- "KibitzDelay" (default: 5)
+
+How many seconds to wait before starting kibitzing. This has an
+affect only if "KibitzPV" is selected, move kibitzes are always sent
+regardless of the delay.
+
+
+Work arounds
+------------
+
+Work arounds are identical to options except that they should be used
+only when necessary. Their purpose is to try to hide problems with
+various software (not just engines). The default value is always
+correct for bug-free software.
+
+IMPORTANT: Any of these work arounds might be removed in future
+versions of PolyGlot. You are strongly recommended to contact the
+author of faulty software and truly fix the problem.
+
+PolyGlot 1.4 supports the following work arounds:
+
+- "UCIVersion" (default: 2)
+
+The default value of 2 corresponds to UCI+. Use 1 to select plain
+UCI for engines that have problems with UCI+.
+
+- "CanPonder" (*** NEW ***, default: false)
+
+PolyGlot now conforms to the documented UCI behaviour: the engine will
+be allowed to ponder only if it (the engine) declares the "Ponder" UCI
+option. However some engines which can actually ponder do not declare
+the option. This work around lets PolyGlot know that they can ponder.
+
+- "SyncStop" (*** NEW ***, default: false)
+
+When a ponder miss occurs, Polyglot interrupts the engine and
+IMMEDIATELY launches a new search. While there should be no problem
+with this, some engines seem confused and corrupt their search board.
+"SyncStop" forces PolyGlot to wait for the (now useless) ponder search
+to finish before launching the new search.
+
+- "PromoteWorkAround" (*** NEW ***, default: false)
+
+Some engines do not specify a promotion piece, e.g. they send "e7e8"
+instead of the correct "e7e8q". This work around enables the
+incorrect form (and of course promotes into a queen).
+
+
+Opening Book
+------------
+
+PolyGlot 1.4 provides a simplistic opening-book implementation.
+
+The following options can be added to the [PolyGlot] section:
+
+- "Book" (default: false)
+
+Indicates whether a PolyGlot book should be used. This has no effect
+on the engine own book (which can be controlled with the UCI option
+"OwnBook" in the [Engine] section). In particular, it is possible to
+use both a PolyGlot book and an engine book. In that case, the engine
+book will be used whenever PolyGlot is out of book. Remember that
+PolyGlot is unaware of whether the engine is itself using a book or
+not.
+
+- "BookFile"
+
+The name of the (binary) book file. Note that PolyGlot will look for
+it in the directory it was launched from, not in the engine directory.
+Of course, full path can be used in which case the current directory
+does not matter.
+
+Note that there is no option to control book usage. All parameters
+are fixed when compiling a PGN file into a binary book (see below).
+This is purposeful and is not likely to change.
+
+Using a book does not require any additional memory, this can be
+important for memory-limited tournaments.
+
+A default book "fruit.bin" is provided in the archive. Note that this
+book is very small and should probably not be used in serious games.
+I hope that users will make other books available in the future.
+
+
+Book Making
+-----------
+
+You can compile a PGN file into a binary book using PolyGlot on the
+command line. At the moment, only a main (random) book is provided.
+It is not yet possible to control opening lines manually. I am
+working on it though.
+
+Usage: "polyglot make-book ".
+
+"make-book" options are:
+
+- "-pgn"
+
+Name of the input PGN file. PolyGlot should support any
+standard-conforming file. Let me know if you encounter a problem.
+
+- "-bin"
+
+Name of the output binary file. I suggest ".bin" as the extension but
+in fact PolyGlot does not care.
+
+- "-max-ply" (default: infinite)
+
+How many plies (half moves) to read for each game. E.g. if set to
+"20", only the first 10 full moves of each game will be scanned.
+
+- "-min-game" (default: 3)
+
+How many times must a move be played to be kept in the book. In other
+words, moves that were played too rarely will be left out. If you
+scan full games "2" seems a minimum, but if you selected lines
+manually "1" will make sense.
+
+- "-only-white" *** NEW ***
+
+Save only white moves. This allows to use different parameters for
+white and black books, and merge them into a single file with the
+"merge-book" command, see below.
+
+- "-only-black" *** NEW ***
+
+Same for black moves.
+
+- "-uniform" *** NEW ***
+
+By default, a probability is calculated by PolyGlot for each move
+depending on how popular it is (how often it was playing in the
+provided PGN file) and how much it "scored". This option bypasses the
+default mechanism and affects equal probability to all moves. This
+allows more variety of play.
+
+This option is normally used only with hand-selected lines (e.g. "user
+books").
+
+---
+
+Example: "polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30".
+
+Building a book is usually very fast (a few minutes at most). Note
+however that a lot of memory may be required. To reduce memory usage,
+select a ply limit.
+
+
+Book Merging
+------------
+
+*** NEW ***
+
+Usage: "polyglot merge-book -in1 -in2 -out "
+
+Merge two bin files into a single one. has "priority"; this
+means that if a position is present in both input books, data from
+ will be ignored for this position.
+
+The two main applications are:
+
+1) combine a white book and a black book (in which case priority does
+ not matter)
+
+2) combine a "user book" of manually-selected lines with a broader one
+ from a large game set
+
+What follows is an admitedly complicated example of how this can be
+used. DO NOT MAILBOMB ME IF YOU DO NOT UNDERSTAND!
+
+My hope is that at least one advanced user will get what I mean and
+writes a better explanation on a web page or forum thread (yes, that's
+YOU, thanks by the way) ...
+
+---
+
+Imagine that we've got 4 PGN files as follows:
+
+w1.pgn: fixed white lines, all moves manually checked
+w2.pgn: selected games (for random book as with PolyGlot 1.3)
+
+b1.pgn and b2.pgn: same for black
+
+The first step is to build 4 .bin files with appropriate options.
+Lines starting with "> " indicate what is typed on the command line.
+
+> polyglot make-book -min-game 1 -uniform -only-white -pgn w1.pgn -bin w1.bin
+
+I added "-uniform" because it allows randomness in the fixed lines
+(e.g. d4+e4 at 50%). It has no effect if lines are deterministic
+(only one move for a given position).
+
+"-min-game 1" is characteristic for user books. All moves are supposed
+to be safe so there is no reason to filter them with other heuristics.
+
+> polyglot make-book -min-score 50 -only-white -pgn w2.pgn -bin w2.bin
+
+This shows how min-score can actually be different for white and black
+(as with multiple books). I don't use "max-ply" because "min-game"
+default value of 3 will limit depth somewhat. You are of course free
+to use it.
+
+Same for black:
+
+> polyglot make-book -min-game 1 -uniform -only-black -pgn b1.pgn -bin b1.bin
+> polyglot make-book -min-score 40 -only-black -pgn b2.pgn -bin b2.bin
+
+At this point we have 4 .bin files. Notice that different parameters
+were used for white and for black (not to mention that different PGN
+files can be used).
+
+---
+
+Let's now merge the white books.
+
+> polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
+
+Input files are not symmetrical, "in1" has priority over "in2".
+
+"skipped xxx entries." message from PolyGlot means there were some
+position conflicts. This is normal since we want to overwrite some
+random moves with fixed lines instead.
+
+Same for black:
+
+> polyglot merge-book -in1 b1.bin -in2 b2.bin -out b.bin
+
+Now we can finally merge the white and black books.
+
+> polyglot merge-book -in1 w.bin -in2 b.bin -out book.bin
+
+It's important to check that there are no conflicts, otherwise
+something went wrong.
+
+Note that this last operation was only made possible thanks to colour
+filtering, otherwise nearly all positions would lead to conflicts.
+For this reason, it does not make much sense to mix old .bin files
+(which contain moves for both colours).
+
+All these command lines might seem numerous and complicated but they
+can be put together into batch files.
+
+
+Chess 960
+---------
+
+*** NEW ***
+
+PolyGlot now supports Chess 960.
+
+However note that most xboard interfaces like WinBoard do not (except
+perhaps on an Internet chess server)!
+
+Here are pointers to modified XBoard/WinBoard versions that are known
+to work with PolyGlot in Chess960 mode:
+
+http://www.ascotti.org/programming/chess/winboard_x.htm (Windows)
+http://www.glaurungchess.com/xboard-960.tar.bz2 (Unix)
+http://www.milix.net/aice (?)
+
+It is also possible that PolyGlot is useful in combination with
+Arena(!): Arena Chess960 works correctly in xboard mode but it seems
+not compatible with the official UCI standard. With PolyGlot it is
+possible to include Chess960 UCI engines by using the xboard protocol
+instead.
+
+
+History
+-------
+
+2004/04/30: PolyGlot 1.0
+
+- first public release.
+
+2004/10/01: PolyGlot 1.1
+
+- added "StartupWait" and "PonderWorkAround" ("AutoQuit" was available
+ in version 1.0 but not documented).
+
+- fixed a minor bug that could prevent "AutoQuit" from working with
+ some engines.
+
+2005/01/29: PolyGlot 1.2
+
+- rewrote engine initialisation and UCI parsing to increase
+ UCI-standard compliance
+
+- added multi-move resign
+
+- added an internal work around for engines hanging with WinBoard
+
+2005/06/03: PolyGlot 1.3
+
+- added opening book
+
+- added kibitzing
+
+- added "ShowPonder" option
+
+2006/01/16: PolyGlot 1.4
+
+- added Chess960 (requires "fischerandom" xboard variant)
+
+- added "-only-white", "-only-black" and "-uniform" book-making
+ options
+
+- added "merge-book" command
+
+- added "CanPonder", "SyncStop" and "PromoteWorkAround" work arounds
+
+- fixed "Move Now" (the engine was interrupted but the move was
+ ignored)
+
+- fixed an UCI+draw problem that could occur with some engines after a
+ draw by 50 moves or repetition
+
+- fixed pondering behaviour: the engine will ponder only if it
+ declares the "Ponder" UCI option
+
+
+Known problems
+--------------
+
+The addition of Chess960 support lead to a change in internal-move
+representation for castling. This slightly affected the opening-book
+format. I recommend that you recompile books with this version.
+
+Fruit 2.2 and above handle both book formats though.
+
+---
+
+Several users reported engines losing on time. The playing conditions
+always mixed playing on an Internet server with pondering. Early
+log-file analysis did not reveal any misbehaviour by PolyGlot, but I
+have others to study.
+
+It is not yet clear what the source of the problem is, but let me
+state one more time that there is a forever incompatibility between
+the xboard and UCI protocol regarding a complex
+pondering/remaining-time relation. I suspect this might be related to
+the problem described above and if so, it is possible that there is no
+clean solution to it!
+
+In any case I have other log file to study that might reveal
+something, stay tuned!
+
+
+Thanks
+------
+
+Big thanks go to:
+
+- Leo Dijksman for compiling, hosting the PolyGlot distribution on his web site
+ (see Links) and also for thorough testing
+
+- Tord Romstad, Joshua Shriver and George Sobala for compiling and
+ testing on Mac OS X
+
+- all those who reported problems or proposed improvements; I am not
+ well organised enough to provide their names!
+
+
+Links
+-----
+
+- Tim Mann's Chess Pages: http://www.tim-mann.org/xboard.html
+- Leo Dijksman's WBEC Ridderkerk: http://wbec-ridderkerk.nl/
+- Volker Pittlik's Winboard Forum: http://wbforum.volker-pittlik.name/
+
+
+Contact me
+----------
+
+You can contact me at fabien_letouzey@hotmail.com; expect SLOW answer,
+if at all!
+
+If I am not available, you can discuss PolyGlot issues in Volker
+Pittlik's Winboard Forum: http://wbforum.volker-pittlik.name/
+
+In fact for questions regarding specific Windows-only engines, you are
+advised to ask directly in the WinBoard forum, as I don't have Windows
+myself.
+
+
+The end
+-------
+
+Fabien Letouzey, 2006/01/16.
+
--- /dev/null
+=== PolyGlot 1.4W ====\r
+Polyglot 1.4W is a modified polyglot 1.4 from Fabien Letouzy.\r
+Just like polyglot 1.3w(see below) it can be compiled and run under windows without\r
+the need for a cygwin1.dll\r
+\r
+Best\r
+Fonzy\r
+www.geenvis.net\r
+=========1.4w10================\r
+fixed analysis output for toga\r
+=========1.4w9=================\r
+fixed bug in 1.4w8\r
+added RepeatPV workaround\r
+ fixed disappearing output in engine-output window while in multipv mode\r
+ when an engine sends its move to polyglot,\r
+ polyglot normally repeats the last pv string(which also contains score,depth and time usage) it got from the engine.\r
+ Some engines however do not send a new pv string just before sending the move and the now old pv string\r
+ find might confuse debugtools that parse the winboard debug files.\r
+ Adding "RepeatPV = false" to the [POLYGLOT] section of the ini file stops this repetition.\r
+ \r
+=========1.4w8=================\r
+fixed multipv output\r
+note that the pv with the worst score will be on top of the engine-output window.\r
+added timestamp in logfile (Jaap Weidemann)\r
+\r
+=========1.4w7=================\r
+compiles under linux/unix again\r
+=========1.4w6=================\r
+access to winboard draw/drawoffer and resign\r
+\r
+ 1:to activate draw offers the engine has \r
+ to define the "UCI_DrawOffers" parameter with the 'option" command at startup. \r
+ 2:to offer a draw or accept a draw offer:just send "info string DrawOffer" to polyglot. \r
+ 3:if winboard sends "draw" polyglot sends "setoption DrawOffer draw" to the engine.\r
+ 4.to resign: send "info string Resign" to polyglot.\r
+ please check the winboard documentation for the draw/drawoffer and resign commands.\r
+ \r
+=========1.4w5:================\r
+Fixed errors in SyncStop handling.\r
+book building: the error message now also contains the game number \r
+added Affinity option:\r
+In the [PolyGlot] section(ini file):\r
+- "Affinity" mask\r
+mask is a bit vector in which each bit represents the processors that a process is allowed to run on.\r
+\r
+some minor bugs fixed\r
+\r
+checks if child did really quit.\r
+\r
+*********************************************************\r
+=== PolyGlot 1.3W ReadMe ===\r
+\r
+PolyGlot - a UCI-to-WinBoard Adapter for UCI Chess Engines\r
+Designed by Fabien Letouzey and Morning Yellow\r
+Version: 1.3W, Last Modified: Jan. 2006\r
+\r
+PolyGlot 1.3W is the modified version of 1.3 by Fabien Letouzey,\r
+which can be compiled and run under Windows without CygWin.\r
+\r
+The version of 1.3W has the following modifications:\r
+1. Added a module, "pipe.h/pipe.cpp".\r
+2. Removed two modules, "io.h/io.cpp" and "engine.h/engine.cpp".\r
+3. Modified all statements related on these modules.\r
+4. fixed "Move Now" (the bug fixed in PolyGlot 1.4).\r
+\r
+PolyGlot 1.3W can be downloaded from:\r
+http://www.elephantbase.net/download/polyglot.rar\r
+For information of "PolyGlot 1.3", see "readme.txt"\r
+For legal information, see "copying.txt"\r
--- /dev/null
+Description
+===========
+
+This is an enhanced version of Polyglot 1.4w10 which can be used as a book
+engine for Polyglot books on UCI GUIs. It also has some additional features
+(see below).
+
+Some GUIs like ChessBase do not support Winboard engines at all. Other
+GUIs do support the Winboard protocol (like Arena) but you still lose
+the convenience of setting UCI options through the GUI.
+
+This new version of Polyglot is fully backward compatible and will in
+fact under normal circumstances autodetect the protocol.
+
+The following is a minimal polyglot.ini file to make an engine use
+Polyglot books.
+
+[Polyglot]
+EngineCommand = <path to engine>
+[Engine]
+
+By default this does not use any book but you can set the Polyglot book
+in the GUI through the exported UCI option "Polyglot BookFile".
+
+Any normal polyglot.ini file can be used with this version. The UCI
+options you set in the [Engine] section will be honored and the
+results will be shown in the GUI as "defaults".
+
+If you want to override the protocol autodetection (which should
+normally not be necessary) you can put
+
+UCI = true
+
+in the [Polyglot] section.
+
+Just like 1.4w10, this version of Polyglot compiles both under Linux
+and Windows.
+
+Some notes on Arena
+===================
+
+Up to version 1.99b5 Arena contained a bug with drive letters in UCI
+options. This bug has been fixed in 2.00.
+
+If you let Arena autodetect the engine type then it will use Polyglot
+in Winboard mode. So either configure the Polyglot adapter explicitly
+as a UCI engine in the Arena GUI, or else put UCI = true in the
+[Polyglot] section of polyglot.ini.
+
+
--- /dev/null
+Better check for legality of arguments (i.e. stuff after [configfile]).
+Implementation of new wb/xb options
+GUI mode
+Allow buttons in UCI mode
+Set book [none] instead of nothing as it is now.
+Implementation of Marc Lacrosse's utility
\ No newline at end of file
--- /dev/null
+# 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
+
--- /dev/null
+\r
+// adapter.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#ifndef _WIN32\r
+#include <sys/select.h>\r
+#include <sys/types.h> // Mac OS X needs this one\r
+#include <unistd.h>\r
+#endif\r
+\r
+#include "adapter.h"\r
+#include "board.h"\r
+#include "book.h"\r
+#include "colour.h"\r
+#include "engine.h"\r
+#include "fen.h"\r
+#include "game.h"\r
+#include "gui.h"\r
+#include "line.h"\r
+#include "main.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "option.h"\r
+#include "parse.h"\r
+#include "san.h"\r
+#include "uci.h"\r
+#include "util.h"\r
+#include "posix.h"\r
+\r
+\r
+// constants\r
+\r
+static const bool UseDebug = false;\r
+static const bool DelayPong = false;\r
+\r
+static const int StringSize = 4096;\r
+\r
+// types\r
+\r
+struct state_t {\r
+ int state;\r
+ bool computer[ColourNb];\r
+ int exp_move;\r
+ int resign_nb;\r
+ my_timer_t timer[1];\r
+};\r
+\r
+struct xb_t {\r
+ bool has_feature_memory;\r
+ bool has_feature_smp;\r
+ bool has_feature_egt;\r
+ bool analyse;\r
+ bool computer;\r
+ const char * name;\r
+ bool ics;\r
+ bool new_hack; // "new" is a C++ keyword\r
+ bool ponder;\r
+ int ping;\r
+ bool post;\r
+ int proto_ver;\r
+ bool result;\r
+\r
+ int mps;\r
+ double base;\r
+ double inc;\r
+ \r
+ bool time_limit;\r
+ double time_max;\r
+ \r
+ bool depth_limit;\r
+ int depth_max;\r
+ \r
+ double my_time;\r
+ double opp_time;\r
+};\r
+\r
+enum dummy_state_t { WAIT, THINK, PONDER, ANALYSE };\r
+\r
+// variables\r
+\r
+static state_t State[1];\r
+static xb_t XB[1];\r
+\r
+// prototypes\r
+\r
+\r
+static void xboard_step (char string[]);\r
+static void engine_step (char string[]);\r
+\r
+static void comp_move (int move);\r
+static void move_step (int move);\r
+static void board_update ();\r
+\r
+static void mess ();\r
+static void no_mess (int move);\r
+\r
+static void search_update ();\r
+static void search_clear ();\r
+static void update_remaining_time();\r
+static void start_protected_command();\r
+static void end_protected_command();\r
+\r
+static bool active ();\r
+static bool ponder ();\r
+static bool ponder_ok (int ponder_move);\r
+\r
+static void stop_search ();\r
+\r
+static void send_board (int extra_move);\r
+static void send_pv ();\r
+\r
+\r
+static void learn (int result);\r
+\r
+static void adapter_step (); \r
+\r
+// functions\r
+\r
+// adapter_loop()\r
+\r
+void adapter_loop() {\r
+\r
+ // init\r
+\r
+ game_clear(Game);\r
+\r
+ // state\r
+\r
+ State->state = WAIT;\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = true;\r
+\r
+ State->exp_move = MoveNone;\r
+ State->resign_nb = 0;\r
+ my_timer_reset(State->timer);\r
+\r
+ // yes there are engines that do not have the "Hash" option....\r
+ XB->has_feature_memory= uci_option_exist(Uci,"Hash");\r
+ XB->has_feature_smp = uci_thread_option_exist(Uci);\r
+ // TODO: support for other types of table bases\r
+ XB->has_feature_egt = uci_option_exist(Uci,"NalimovPath");\r
+ XB->analyse = false;\r
+ XB->computer = false;\r
+ XB->name = NULL;\r
+ my_string_set(&XB->name,"<empty>");\r
+ XB->ics = false;\r
+ XB->new_hack = true;\r
+ XB->ping = -1;\r
+ XB->ponder = false;\r
+ XB->post = false;\r
+ XB->proto_ver = 1;\r
+ XB->result = false;\r
+\r
+ XB->mps = 0;\r
+ XB->base = 300.0;\r
+ XB->inc = 0.0;\r
+\r
+ XB->time_limit = false;\r
+ XB->time_max = 5.0;\r
+\r
+ XB->depth_limit = false;\r
+ XB->depth_max = 127;\r
+\r
+ XB->my_time = 300.0;\r
+ XB->opp_time = 300.0;\r
+ while (true) adapter_step();\r
+}\r
+\r
+// adapter_step()\r
+\r
+#ifdef _WIN32\r
+static void adapter_step(){ // polling!\r
+ bool xin,ein;\r
+ char string[StringSize];\r
+ if(option_get_bool("UCI")){\r
+ xin=gui_get_non_blocking(GUI,string,StringSize);\r
+ if(xin) uci_gui_step(string);\r
+ ein=engine_get_non_blocking(Engine,string,StringSize);\r
+ if(ein) uci_engine_step(string);\r
+ }else{\r
+ xin=gui_get_non_blocking(GUI,string,StringSize);\r
+ if(xin) xboard_step(string);\r
+ ein=engine_get_non_blocking(Engine,string,StringSize);\r
+ if(ein) engine_step(string);\r
+ }\r
+ if(xin==false && ein==false) Idle();//nobody wants me,lets have a beauty nap\r
+}\r
+#else\r
+static void adapter_step() {\r
+\r
+ fd_set set[1];\r
+ int fd_max;\r
+ int val;\r
+ char string[StringSize];\r
+\r
+ // process buffered lines\r
+\r
+ while (io_line_ready(GUI->io)){\r
+ gui_get(GUI,string,StringSize);\r
+ if(option_get_bool("UCI")){\r
+ uci_gui_step(string);\r
+ }else{\r
+ xboard_step(string); // process available xboard lines\r
+ }\r
+ }\r
+ while (io_line_ready(Engine->io)){\r
+ engine_get(Engine,string,StringSize);\r
+ if(option_get_bool("UCI")){\r
+ uci_engine_step(string); // process available engine lines\r
+ }else{\r
+ engine_step(string);\r
+ }\r
+ }\r
+\r
+ // init\r
+\r
+ FD_ZERO(set);\r
+ fd_max = -1; // HACK\r
+\r
+ // add xboard input\r
+\r
+ ASSERT(GUI->io->in_fd>=0);\r
+\r
+ FD_SET(GUI->io->in_fd,set);\r
+ if (GUI->io->in_fd > fd_max) fd_max = GUI->io->in_fd;\r
+\r
+ // add engine input\r
+\r
+ ASSERT(Engine->io->in_fd>=0);\r
+\r
+ FD_SET(Engine->io->in_fd,set);\r
+ if (Engine->io->in_fd > fd_max) fd_max = Engine->io->in_fd;\r
+\r
+ // wait for something to read (no timeout)\r
+\r
+ ASSERT(fd_max>=0);\r
+\r
+ val = select(fd_max+1,set,NULL,NULL,NULL);\r
+ if (val == -1 && errno != EINTR) my_fatal("adapter_step(): select(): %s\n",strerror(errno));\r
+\r
+ if (val > 0) {\r
+ if (FD_ISSET(GUI->io->in_fd,set)) io_get_update(GUI->io); // read some xboard input\r
+ if (FD_ISSET(Engine->io->in_fd,set)) io_get_update(Engine->io); // read some engine input\r
+ }\r
+}\r
+#endif\r
+\r
+static void xboard_step(char string[]) {\r
+\r
+ int move;\r
+ char move_string[256];\r
+ board_t board[1];\r
+ static bool firsttime=true;\r
+\r
+ if(firsttime){\r
+ if((match(string,"uci"))){\r
+ my_log("POLYGLOT *** Switching to UCI mode ***\n");\r
+ send_uci_options();\r
+ option_set("UCI","true");\r
+ return;\r
+ }else{\r
+ if(!book_is_open() && option_get_bool("Book")){\r
+ // restore old behaviour in xboard mode\r
+ // missing book is fatal\r
+ my_fatal("xboard_step(): can't open file \"%s\": %s\n",\r
+ option_get_string("BookFile"),strerror(errno));\r
+ }\r
+ //uci_send_isready(Uci); // In UCI mode this done by the GUI\r
+ //Grrr...Toga can fixes the number of threads after "isready"\r
+ //So we delay "isready" \r
+ }\r
+ firsttime=false;\r
+ }\r
+ if (false) {\r
+ \r
+ } else if (match(string,"accepted *")) {\r
+\r
+ // ignore\r
+\r
+ } else if (match(string,"analyze")) {\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = false;\r
+\r
+ XB->analyse = true;\r
+ XB->new_hack = false;\r
+ ASSERT(!XB->result);\r
+ XB->result = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"bk")) {\r
+\r
+ if (option_get_bool("Book")) {\r
+ game_get_board(Game,board);\r
+ book_disp(board);\r
+ }\r
+\r
+ } else if (match(string,"black")) {\r
+\r
+ if (colour_is_black(game_turn(Game))) {\r
+\r
+ State->computer[White] = true;\r
+ State->computer[Black] = false;\r
+\r
+ XB->new_hack = true;\r
+ XB->result = false;\r
+\r
+ mess();\r
+ }\r
+\r
+ } else if (match(string,"computer")) {\r
+\r
+ XB->computer = true;\r
+\r
+ } else if (match(string,"draw")) {\r
+ if(uci_option_exist(Uci,"UCI_DrawOffers")){\r
+ my_log("POLYGLOT draw from XB received");\r
+ uci_send_option(Uci,"DrawOffer","%s","draw");}\r
+ } else if (match(string,"easy")) {\r
+\r
+ XB->ponder = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"edit")) {\r
+\r
+ // refuse\r
+\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+\r
+ } else if (match(string,"exit")) {\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = false;\r
+\r
+ XB->analyse = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"force")) {\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"go")) {\r
+\r
+ State->computer[game_turn(Game)] = true;\r
+ State->computer[colour_opp(game_turn(Game))] = false;\r
+\r
+ XB->new_hack = false;\r
+ ASSERT(!XB->result);\r
+ XB->result = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"hard")) {\r
+\r
+ XB->ponder = true;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"hint")) {\r
+\r
+ if (option_get_bool("Book")) {\r
+\r
+ game_get_board(Game,board);\r
+ move = book_move(board,false);\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+ move_to_san(move,board,move_string,256);\r
+ gui_send(GUI,"Hint: %s",move_string);\r
+ }\r
+ }\r
+\r
+ } else if (match(string,"ics *")) {\r
+\r
+ XB->ics = true;\r
+\r
+ } else if (match(string,"level * *:* *")) {\r
+\r
+ XB->mps = atoi(Star[0]);\r
+ XB->base = double(atoi(Star[1])) * 60.0 + double(atoi(Star[2]));\r
+ XB->inc = double(atoi(Star[3]));\r
+\r
+ } else if (match(string,"level * * *")) {\r
+\r
+ XB->mps = atoi(Star[0]);\r
+ XB->base = double(atoi(Star[1])) * 60.0;\r
+ XB->inc = double(atoi(Star[2]));\r
+\r
+ } else if (match(string,"name *")) {\r
+\r
+ my_string_set(&XB->name,Star[0]);\r
+\r
+ } else if (match(string,"new")) {\r
+\r
+ uci_send_isready(Uci);\r
+ my_log("POLYGLOT NEW GAME\n");\r
+\r
+ option_set("Chess960","false");\r
+\r
+ game_clear(Game);\r
+\r
+ if (XB->analyse) {\r
+ State->computer[White] = false;\r
+ State->computer[Black] = false;\r
+ } else {\r
+ State->computer[White] = false;\r
+ State->computer[Black] = true;\r
+ }\r
+\r
+ XB->new_hack = true;\r
+ XB->result = false;\r
+\r
+ XB->depth_limit = false;\r
+\r
+ XB->computer = false;\r
+ my_string_set(&XB->name,"<empty>");\r
+\r
+ board_update();\r
+ mess();\r
+\r
+ uci_send_ucinewgame(Uci);\r
+\r
+ } else if (match(string,"nopost")) {\r
+\r
+ XB->post = false;\r
+\r
+ } else if (match(string,"otim *")) {\r
+\r
+ XB->opp_time = double(atoi(Star[0])) / 100.0;\r
+ if (XB->opp_time < 0.0) XB->opp_time = 0.0;\r
+\r
+ } else if (match(string,"pause")) {\r
+\r
+ // refuse\r
+\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+\r
+ } else if (match(string,"ping *")) {\r
+\r
+ // HACK; TODO: answer only after an engine move\r
+\r
+ if (DelayPong) {\r
+ if (XB->ping >= 0) gui_send(GUI,"pong %d",XB->ping); // HACK: get rid of old ping\r
+ XB->ping = atoi(Star[0]);\r
+ uci_send_isready(Uci);\r
+ } else {\r
+ ASSERT(XB->ping==-1);\r
+ gui_send(GUI,"pong %s",Star[0]);\r
+ }\r
+\r
+ } else if (match(string,"playother")) {\r
+\r
+ State->computer[game_turn(Game)] = false;\r
+ State->computer[colour_opp(game_turn(Game))] = true;\r
+\r
+ XB->new_hack = false;\r
+ ASSERT(!XB->result);\r
+ XB->result = false;\r
+\r
+ mess();\r
+\r
+ } else if (match(string,"post")) {\r
+\r
+ XB->post = true;\r
+\r
+ } else if (match(string,"protover *")) {\r
+\r
+ XB->proto_ver = atoi(Star[0]);\r
+ ASSERT(XB->proto_ver>=2);\r
+\r
+ gui_send(GUI,"feature done=0");\r
+\r
+ gui_send(GUI,"feature analyze=1");\r
+ gui_send(GUI,"feature colors=0");\r
+ gui_send(GUI,"feature draw=1");\r
+ gui_send(GUI,"feature ics=1");\r
+ gui_send(GUI,"feature myname=\"%s\"",option_get_string("EngineName"));\r
+ gui_send(GUI,"feature name=1");\r
+ gui_send(GUI,"feature pause=0");\r
+ gui_send(GUI,"feature ping=1");\r
+ gui_send(GUI,"feature playother=1");\r
+ gui_send(GUI,"feature reuse=1");\r
+ gui_send(GUI,"feature san=0");\r
+ gui_send(GUI,"feature setboard=1");\r
+ gui_send(GUI,"feature sigint=0");\r
+ gui_send(GUI,"feature sigterm=0");\r
+ gui_send(GUI,"feature time=1");\r
+ gui_send(GUI,"feature usermove=1");\r
+ if (XB->has_feature_memory){\r
+ gui_send(GUI,"feature memory=1");\r
+ }\r
+ if (XB->has_feature_smp){\r
+ gui_send(GUI,"feature smp=1");\r
+ }\r
+ if (XB->has_feature_egt){\r
+ // TODO: support for other types of table bases\r
+ gui_send(GUI,"feature egt=\"nalimov\"");\r
+ }\r
+\r
+ if (uci_option_exist(Uci,"UCI_Chess960")) {\r
+ gui_send(GUI,"feature variants=\"normal,fischerandom\"");\r
+ } else {\r
+ gui_send(GUI,"feature variants=\"normal\"");\r
+ }\r
+ gui_send(GUI,"feature done=1"); // moved from engine_step\r
+\r
+ \r
+ //if (Uci->ready) xboard_send(XBoard,"feature done=1");\r
+\r
+ // otherwise "feature done=1" will be sent when the engine is ready\r
+\r
+ } else if (match(string,"quit")) {\r
+ my_log("POLYGLOT *** \"quit\" from GUI ***\n");\r
+ quit();\r
+ } else if (match(string,"random")) {\r
+\r
+ // ignore\r
+\r
+ } else if (match(string,"rating * *")) {\r
+\r
+ // ignore\r
+\r
+ } else if (match(string,"remove")) {\r
+\r
+ if (game_pos(Game) >= 2) {\r
+\r
+ game_goto(Game,game_pos(Game)-2);\r
+\r
+ ASSERT(!XB->new_hack);\r
+ XB->new_hack = false; // HACK?\r
+ XB->result = false;\r
+\r
+ board_update();\r
+ mess();\r
+ }\r
+\r
+ } else if (match(string,"rejected *")) {\r
+\r
+ // ignore\r
+\r
+ } else if (match(string,"reset")) { // protover 3?\r
+\r
+ // refuse\r
+\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+\r
+ } else if (false\r
+ || match(string,"result * {*}")\r
+ || match(string,"result * {* }")\r
+ || match(string,"result * { *}")\r
+ || match(string,"result * { * }")) {\r
+\r
+ my_log("POLYGLOT GAME END\n");\r
+\r
+ XB->result = true;\r
+\r
+ mess();\r
+\r
+ // book learning\r
+\r
+ if (option_get_bool("Book") && option_get_bool("BookLearn")) {\r
+\r
+ if (false) {\r
+ } else if (my_string_equal(Star[0],"1-0")) {\r
+ learn(+1);\r
+ } else if (my_string_equal(Star[0],"0-1")) {\r
+ learn(-1);\r
+ } else if (my_string_equal(Star[0],"1/2-1/2")) {\r
+ learn(0);\r
+ }\r
+ }\r
+ } else if (match(string,"resume")) {\r
+\r
+ // refuse\r
+\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+\r
+ } else if (XB->has_feature_smp && match(string,"cores *")){\r
+ int cores=atoi(Star[0]);\r
+ if(cores>=1){\r
+ // updating the number of cores\r
+ my_log("POLYGLOT setting the number of cores to %d\n",cores);\r
+ start_protected_command();\r
+ uci_set_threads(Uci,cores); \r
+ end_protected_command();\r
+ } else{\r
+ // refuse\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+ }\r
+ } else if (XB->has_feature_egt && match(string,"egtpath * *")){\r
+ char *type=Star[0];\r
+ char *path=Star[1];\r
+ if(!my_string_case_equal(Star[0],"nalimov")){\r
+ // refuse\r
+ gui_send(GUI,"Error (unsupported table base format): %s",string);\r
+ }else if(my_string_empty(path)){\r
+ // refuse\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+ }else{\r
+ // updating NalimovPath\r
+ my_log("POLYGLOT setting the Nalimov path to %s\n",path);\r
+ start_protected_command();\r
+ uci_send_option(Uci,"NalimovPath","%s",path);\r
+ end_protected_command();\r
+ }\r
+ } else if (XB->has_feature_memory && match(string,"memory *")){\r
+ int memory = atoi(Star[0]);\r
+ int nalimov_cache;\r
+ int real_memory;\r
+ if(memory>=1){\r
+ // updating the available memory\r
+ my_log("POLYGLOT setting the amount of memory to %dMb\n",memory);\r
+ if(uci_get_option(Uci,"NalimovCache")>=0){\r
+ nalimov_cache=atoi(Uci->option[uci_get_option(Uci,"NalimovCache")].value);\r
+ }else{\r
+ nalimov_cache=0;\r
+ }\r
+ my_log("POLYGLOT Nalimov Cache is %dMb\n",nalimov_cache);\r
+ real_memory=memory-nalimov_cache;\r
+ if(real_memory>0){\r
+ start_protected_command();\r
+ uci_send_option(Uci,"Hash", "%d", real_memory);\r
+ end_protected_command();\r
+ }\r
+ }else{\r
+ // refuse\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+ }\r
+\r
+ } else if (match(string,"sd *")) {\r
+\r
+ XB->depth_limit = true;\r
+ XB->depth_max = atoi(Star[0]);\r
+\r
+ } else if (match(string,"setboard *")) {\r
+\r
+ my_log("POLYGLOT FEN %s\n",Star[0]);\r
+\r
+ if (!game_init(Game,Star[0])) my_fatal("xboard_step(): bad FEN \"%s\"\n",Star[0]);\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = false;\r
+\r
+ XB->new_hack = true; // HACK?\r
+ XB->result = false;\r
+\r
+ board_update();\r
+ mess();\r
+\r
+ } else if (match(string,"st *")) {\r
+\r
+ XB->time_limit = true;\r
+ XB->time_max = double(atoi(Star[0]));\r
+\r
+ } else if (match(string,"time *")) {\r
+\r
+ XB->my_time = double(atoi(Star[0])) / 100.0;\r
+ if (XB->my_time < 0.0) XB->my_time = 0.0;\r
+\r
+ } else if (match(string,"undo")) {\r
+\r
+ if (game_pos(Game) >= 1) {\r
+\r
+ game_goto(Game,game_pos(Game)-1);\r
+\r
+ ASSERT(!XB->new_hack);\r
+ XB->new_hack = false; // HACK?\r
+ XB->result = false;\r
+\r
+ board_update();\r
+ mess();\r
+ }\r
+\r
+ } else if (match(string,"usermove *")) {\r
+\r
+ game_get_board(Game,board);\r
+ move = move_from_san(Star[0],board);\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+\r
+ XB->new_hack = false;\r
+ ASSERT(!XB->result);\r
+ XB->result = false;\r
+\r
+ move_step(move);\r
+ no_mess(move);\r
+\r
+ } else {\r
+\r
+ gui_send(GUI,"Illegal move: %s",Star[0]);\r
+ }\r
+\r
+ } else if (match(string,"variant *")) {\r
+\r
+ if (my_string_equal(Star[0],"fischerandom")) {\r
+ option_set("Chess960","true");\r
+ } else {\r
+ option_set("Chess960","false");\r
+ }\r
+\r
+ } else if (match(string,"white")) {\r
+\r
+ if (colour_is_white(game_turn(Game))) {\r
+\r
+ State->computer[White] = false;\r
+ State->computer[Black] = true;\r
+\r
+ XB->new_hack = true;\r
+ XB->result = false;\r
+\r
+ mess();\r
+ }\r
+\r
+ } else if (match(string,"xboard")) {\r
+\r
+ // ignore\r
+\r
+ } else if (match(string,".")) { // analyse info\r
+\r
+ if (State->state == ANALYSE) {\r
+ int depth=Uci->best_depth;//HACK: don't clear engine-output window...\r
+\r
+ ASSERT(Uci->searching);\r
+ ASSERT(Uci->pending_nb>=1);\r
+\r
+ if (Uci->root_move != MoveNone && move_is_legal(Uci->root_move,Uci->board)) {\r
+ move_to_san(Uci->root_move,Uci->board,move_string,256);\r
+ gui_send(GUI,"stat01: %.0f "S64_FORMAT" %d %d %d %s",Uci->time*100.0,Uci->node_nb,/*Uci->*/depth,Uci->root_move_nb-(Uci->root_move_pos+1),Uci->root_move_nb,move_string);\r
+ } else {\r
+ gui_send(GUI,"stat01: %.0f "S64_FORMAT" %d %d %d",Uci->time*100.0,Uci->node_nb,/*Uci->*/depth,0,0); // HACK\r
+ }\r
+ }\r
+\r
+ } else if (match(string,"?")) { // move now\r
+\r
+ if (State->state == THINK) {\r
+\r
+ ASSERT(Uci->searching);\r
+ ASSERT(Uci->pending_nb>=1);\r
+\r
+ // HACK: just send "stop" to the engine\r
+\r
+ if (Uci->searching) {\r
+ my_log("POLYGLOT STOP SEARCH\n");\r
+ engine_send(Engine,"stop");\r
+ }\r
+ }\r
+\r
+ } else { // unknown command, maybe a move?\r
+\r
+ game_get_board(Game,board);\r
+ move = move_from_san(string,board);\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+\r
+ XB->new_hack = false;\r
+ ASSERT(!XB->result);\r
+ XB->result = false;\r
+\r
+ move_step(move);\r
+ no_mess(move);\r
+\r
+ } else if (move != MoveNone) {\r
+\r
+ gui_send(GUI,"Illegal move: %s",string);\r
+\r
+ } else {\r
+\r
+ gui_send(GUI,"Error (unknown command): %s",string);\r
+ }\r
+ }\r
+ return;\r
+}\r
+\r
+// engine_step()\r
+\r
+static void engine_step(char string[]) {\r
+\r
+ int event;\r
+ event = uci_parse(Uci,string);\r
+\r
+ // react to events\r
+\r
+ if ((event & EVENT_READY) != 0) {\r
+\r
+ // the engine is now ready\r
+\r
+ if (!Uci->ready) {\r
+ Uci->ready = true;\r
+ // if (XB->proto_ver >= 2) xboard_send(XBoard,"feature done=1");\r
+ }\r
+\r
+ if (!DelayPong && XB->ping >= 0) {\r
+ gui_send(GUI,"pong %d",XB->ping);\r
+ XB->ping = -1;\r
+ }\r
+ }\r
+\r
+ if ((event & EVENT_MOVE) != 0 && State->state == THINK) {\r
+\r
+ // the engine is playing a move\r
+\r
+ // MEGA HACK: estimate remaining time because XBoard won't send it!\r
+\r
+ my_timer_stop(State->timer);\r
+\r
+ XB->my_time -= my_timer_elapsed_real(State->timer);\r
+ XB->my_time += XB->inc;\r
+ if (XB->mps != 0 && (game_move_nb(Game) + 1) % XB->mps == 0) XB->my_time += XB->base;\r
+\r
+ if (XB->my_time < 0.0) XB->my_time = 0.0;\r
+\r
+ // play the engine move\r
+\r
+ comp_move(Uci->best_move);\r
+ }\r
+\r
+ if ((event & EVENT_PV) != 0) {\r
+\r
+ // the engine has sent a new PV\r
+\r
+ send_pv();\r
+ }\r
+ if((event & (EVENT_DRAW|EVENT_RESIGN))!=0){\r
+ my_log("POYGLOT draw offer/resign from engine\n");\r
+ if(uci_option_exist(Uci,"UCI_DrawOffers")){\r
+ if(event & EVENT_DRAW)\r
+ gui_send(GUI,"offer draw");\r
+ else\r
+ gui_send(GUI,"resign");\r
+ }\r
+ }\r
+}\r
+\r
+// comp_move()\r
+\r
+static void comp_move(int move) {\r
+\r
+ board_t board[1];\r
+ char string[256];\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ ASSERT(State->state==THINK);\r
+ ASSERT(!XB->analyse);\r
+\r
+ if(option_get_bool("RepeatPV")==true)\r
+ send_pv(); // to update time and nodes\r
+\r
+ // send the move\r
+\r
+ game_get_board(Game,board);\r
+\r
+ if (move_is_castle(move,board) && option_get_bool("Chess960")) {\r
+ if (!move_to_san(move,board,string,256)) my_fatal("comp_move(): move_to_san() failed\n"); // O-O/O-O-O\r
+ } else {\r
+ if (!move_to_can(move,board,string,256)) my_fatal("comp_move(): move_to_can() failed\n");\r
+ }\r
+\r
+ gui_send(GUI,"move %s",string);\r
+\r
+ // resign?\r
+\r
+ if (option_get_bool("Resign") && Uci->root_move_nb > 1) {\r
+\r
+ if (Uci->best_score <= -abs(option_get_int("ResignScore"))) {\r
+\r
+ State->resign_nb++;\r
+ my_log("POLYGLOT %d move%s with resign score\n",State->resign_nb,(State->resign_nb>1)?"s":"");\r
+\r
+ if (State->resign_nb >= option_get_int("ResignMoves")) {\r
+ my_log("POLYGLOT *** RESIGN ***\n");\r
+ gui_send(GUI,"resign");\r
+ }\r
+\r
+ } else {\r
+\r
+ if (State->resign_nb > 0) my_log("POLYGLOT resign reset (State->resign_nb=%d)\n",State->resign_nb);\r
+ State->resign_nb = 0;\r
+ }\r
+ }\r
+\r
+ // play the move\r
+\r
+ move_step(move);\r
+ no_mess(move);\r
+}\r
+\r
+// move_step()\r
+\r
+static void move_step(int move) {\r
+\r
+ board_t board[1];\r
+ char move_string[256];\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ // log\r
+\r
+ game_get_board(Game,board);\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+\r
+ move_to_san(move,board,move_string,256);\r
+ my_log("POLYGLOT MOVE %s\n",move_string);\r
+\r
+ } else {\r
+\r
+ move_to_can(move,board,move_string,256);\r
+ my_log("POLYGLOT ILLEGAL MOVE \"%s\"\n",move_string);\r
+ board_disp(board);\r
+\r
+ my_fatal("move_step(): illegal move \"%s\"\n",move_string);\r
+ }\r
+\r
+ // play the move\r
+\r
+ game_add_move(Game,move);\r
+ board_update();\r
+}\r
+\r
+// board_update()\r
+\r
+static void board_update() {\r
+\r
+ // handle game end\r
+\r
+ ASSERT(!XB->result);\r
+\r
+ switch (game_status(Game)) {\r
+ case PLAYING:\r
+ break;\r
+ case WHITE_MATES:\r
+ gui_send(GUI,"1-0 {White mates}");\r
+ break;\r
+ case BLACK_MATES:\r
+ gui_send(GUI,"0-1 {Black mates}");\r
+ break;\r
+ case STALEMATE:\r
+ gui_send(GUI,"1/2-1/2 {Stalemate}");\r
+ break;\r
+ case DRAW_MATERIAL:\r
+ gui_send(GUI,"1/2-1/2 {Draw by insufficient material}");\r
+ break;\r
+ case DRAW_FIFTY:\r
+ gui_send(GUI,"1/2-1/2 {Draw by fifty-move rule}");\r
+ break;\r
+ case DRAW_REPETITION:\r
+ gui_send(GUI,"1/2-1/2 {Draw by repetition}");\r
+ break;\r
+ default:\r
+ ASSERT(false);\r
+ break;\r
+ }\r
+}\r
+\r
+// mess()\r
+\r
+static void mess() {\r
+\r
+ // clear state variables\r
+\r
+ State->resign_nb = 0;\r
+ State->exp_move = MoveNone;\r
+ my_timer_reset(State->timer);\r
+\r
+ // abort a possible search\r
+\r
+ stop_search();\r
+\r
+ // calculate the new state\r
+\r
+ if (false) {\r
+ } else if (!active()) {\r
+ State->state = WAIT;\r
+ my_log("POLYGLOT WAIT\n");\r
+ } else if (XB->analyse) {\r
+ State->state = ANALYSE;\r
+ my_log("POLYGLOT ANALYSE\n");\r
+ } else if (State->computer[game_turn(Game)]) {\r
+ State->state = THINK;\r
+ my_log("POLYGLOT THINK\n");\r
+ } else {\r
+ State->state = WAIT;\r
+ my_log("POLYGLOT WAIT\n");\r
+ }\r
+\r
+ search_update();\r
+}\r
+\r
+// no_mess()\r
+\r
+static void no_mess(int move) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ // just received a move, calculate the new state\r
+\r
+ if (false) {\r
+\r
+ } else if (!active()) {\r
+\r
+ stop_search(); // abort a possible search\r
+\r
+ State->state = WAIT;\r
+ State->exp_move = MoveNone;\r
+\r
+ my_log("POLYGLOT WAIT\n");\r
+\r
+ } else if (State->state == WAIT) {\r
+\r
+ ASSERT(State->computer[game_turn(Game)]);\r
+ ASSERT(!State->computer[colour_opp(game_turn(Game))]);\r
+ ASSERT(!XB->analyse);\r
+\r
+ my_log("POLYGLOT WAIT -> THINK\n");\r
+\r
+ State->state = THINK;\r
+ State->exp_move = MoveNone;\r
+\r
+ } else if (State->state == THINK) {\r
+\r
+ ASSERT(!State->computer[game_turn(Game)]);\r
+ ASSERT(State->computer[colour_opp(game_turn(Game))]);\r
+ ASSERT(!XB->analyse);\r
+\r
+ if (ponder() && ponder_ok(Uci->ponder_move)) {\r
+\r
+ my_log("POLYGLOT THINK -> PONDER\n");\r
+\r
+ State->state = PONDER;\r
+ State->exp_move = Uci->ponder_move;\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT THINK -> WAIT\n");\r
+\r
+ State->state = WAIT;\r
+ State->exp_move = MoveNone;\r
+ }\r
+\r
+ } else if (State->state == PONDER) {\r
+\r
+ ASSERT(State->computer[game_turn(Game)]);\r
+ ASSERT(!State->computer[colour_opp(game_turn(Game))]);\r
+ ASSERT(!XB->analyse);\r
+\r
+ if (move == State->exp_move && Uci->searching) {\r
+\r
+ ASSERT(Uci->searching);\r
+ ASSERT(Uci->pending_nb>=1);\r
+\r
+ my_timer_start(State->timer);//also resets\r
+\r
+ my_log("POLYGLOT PONDER -> THINK (*** HIT ***)\n");\r
+ engine_send(Engine,"ponderhit");\r
+\r
+ State->state = THINK;\r
+ State->exp_move = MoveNone;\r
+\r
+ send_pv(); // update display\r
+\r
+ return; // do not launch a new search\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT PONDER -> THINK (miss)\n");\r
+\r
+ stop_search();\r
+\r
+ State->state = THINK;\r
+ State->exp_move = MoveNone;\r
+ }\r
+\r
+ } else if (State->state == ANALYSE) {\r
+\r
+ ASSERT(XB->analyse);\r
+\r
+ my_log("POLYGLOT ANALYSE -> ANALYSE\n");\r
+\r
+ stop_search();\r
+\r
+ } else {\r
+\r
+ ASSERT(false);\r
+ }\r
+\r
+ search_update();\r
+}\r
+\r
+// start_protected_command()\r
+\r
+static void start_protected_command(){\r
+ stop_search();\r
+}\r
+\r
+static void end_protected_command(){\r
+ if(Uci->ready){ // not init faze\r
+ uci_send_isready_sync(Uci); // gobble up spurious "bestmove"\r
+ }\r
+ update_remaining_time();\r
+ search_update(); // relaunch search if necessary\r
+}\r
+\r
+// update_remaining_time()\r
+\r
+static void update_remaining_time(){\r
+ double reduce;\r
+ if(State->timer->running){\r
+ my_timer_stop(State->timer);\r
+ reduce = my_timer_elapsed_real(State->timer);\r
+ my_log("POLYGLOT reducing remaing time by %f seconds\n",reduce);\r
+ XB->my_time -= reduce;\r
+ if(XB->my_time<0.0){\r
+ XB->my_time=0.0;\r
+ }\r
+ }\r
+}\r
+\r
+\r
+// search_update()\r
+\r
+static void search_update() {\r
+\r
+ int move;\r
+ int move_nb;\r
+ board_t board[1];\r
+ int nalimov_cache;\r
+ int real_memory;\r
+\r
+ ASSERT(!Uci->searching);\r
+\r
+\r
+\r
+ \r
+ // launch a new search if needed\r
+\r
+ \r
+\r
+ if (State->state == THINK || State->state == PONDER || State->state == ANALYSE) {\r
+\r
+ // opening book\r
+\r
+ if (State->state == THINK && option_get_bool("Book")) {\r
+\r
+ game_get_board(Game,Uci->board);\r
+\r
+ move = book_move(Uci->board,option_get_bool("BookRandom"));\r
+\r
+ if (move != MoveNone && move_is_legal(move,Uci->board)) {\r
+\r
+ my_log("POLYGLOT *BOOK MOVE*\n");\r
+\r
+ search_clear(); // clears Uci->ponder_move\r
+ Uci->best_move = move;\r
+\r
+ board_copy(board,Uci->board);\r
+ move_do(board,move);\r
+ Uci->ponder_move = book_move(board,false); // expected move = best book move\r
+\r
+ Uci->best_pv[0] = Uci->best_move;\r
+ Uci->best_pv[1] = Uci->ponder_move; // can be MoveNone\r
+ Uci->best_pv[2] = MoveNone;\r
+\r
+ comp_move(Uci->best_move);\r
+\r
+ return;\r
+ }\r
+ }\r
+\r
+ // engine search\r
+\r
+ my_log("POLYGLOT START SEARCH\n");\r
+\r
+ // options\r
+\r
+ uci_send_option(Uci,"UCI_Chess960","%s",option_get_bool("Chess960")?"true":"false");\r
+\r
+ if (option_get_int("UCIVersion") >= 2) {\r
+ uci_send_option(Uci,"UCI_Opponent","none none %s %s",(XB->computer)?"computer":"human",XB->name);\r
+ uci_send_option(Uci,"UCI_AnalyseMode","%s",(XB->analyse)?"true":"false");\r
+ }\r
+\r
+ uci_send_option(Uci,"Ponder","%s",ponder()?"true":"false");\r
+\r
+ // position\r
+\r
+ move = (State->state == PONDER) ? State->exp_move : MoveNone;\r
+ send_board(move); // updates Uci->board global variable\r
+\r
+ // search\r
+\r
+ if (State->state == THINK || State->state == PONDER) {\r
+\r
+ engine_send_queue(Engine,"go");\r
+\r
+ if (XB->time_limit) {\r
+\r
+ // fixed time per move\r
+\r
+ engine_send_queue(Engine," movetime %.0f",XB->time_max*1000.0);\r
+\r
+ } else {\r
+\r
+ // time controls\r
+\r
+ if (colour_is_white(Uci->board->turn)) {\r
+ engine_send_queue(Engine," wtime %.0f btime %.0f",XB->my_time*1000.0,XB->opp_time*1000.0);\r
+ } else {\r
+ engine_send_queue(Engine," wtime %.0f btime %.0f",XB->opp_time*1000.0,XB->my_time*1000.0);\r
+ }\r
+\r
+ if (XB->inc != 0.0) engine_send_queue(Engine," winc %.0f binc %.0f",XB->inc*1000.0,XB->inc*1000.0);\r
+\r
+ if (XB->mps != 0) {\r
+\r
+ move_nb = XB->mps - (Uci->board->move_nb % XB->mps);\r
+ ASSERT(move_nb>=1&&move_nb<=XB->mps);\r
+\r
+ engine_send_queue(Engine," movestogo %d",move_nb);\r
+ }\r
+ }\r
+\r
+ if (XB->depth_limit) engine_send_queue(Engine," depth %d",XB->depth_max);\r
+\r
+ if (State->state == PONDER) engine_send_queue(Engine," ponder");\r
+\r
+ engine_send(Engine,""); // newline\r
+\r
+ } else if (State->state == ANALYSE) {\r
+\r
+ engine_send(Engine,"go infinite");\r
+\r
+ } else {\r
+\r
+ ASSERT(false);\r
+ }\r
+\r
+ // init search info\r
+\r
+ ASSERT(!Uci->searching);\r
+\r
+ search_clear();\r
+\r
+ Uci->searching = true;\r
+ Uci->pending_nb++;\r
+ }\r
+}\r
+\r
+// search_clear()\r
+\r
+static void search_clear() {\r
+\r
+ uci_clear(Uci);\r
+\r
+ // TODO: MOVE ME\r
+\r
+ my_timer_start(State->timer);//also resets\r
+}\r
+\r
+// active()\r
+\r
+static bool active() {\r
+\r
+ // position state\r
+\r
+ if (game_status(Game) != PLAYING) return false; // game ended\r
+\r
+ // xboard state\r
+\r
+ if (XB->analyse) return true; // analysing\r
+ if (!State->computer[White] && !State->computer[Black]) return false; // force mode\r
+ if (XB->new_hack || XB->result) return false; // unstarted or ended game\r
+\r
+ return true; // playing\r
+}\r
+\r
+// ponder()\r
+\r
+static bool ponder() {\r
+\r
+ return XB->ponder && (option_get_bool("CanPonder") || uci_option_exist(Uci,"Ponder"));\r
+}\r
+// ponder_ok()\r
+\r
+static bool ponder_ok(int move) {\r
+ int status;\r
+ board_t board[1];\r
+\r
+ ASSERT(move==MoveNone||move_is_ok(move));\r
+\r
+ // legal ponder move?\r
+\r
+ if (move == MoveNone) return false;\r
+\r
+ game_get_board(Game,board);\r
+ if (!move_is_legal(move,board)) return false;\r
+\r
+ // UCI-legal resulting position?\r
+\r
+ game_add_move(Game,move);\r
+\r
+ game_get_board(Game,board);\r
+ status = game_status(Game);\r
+\r
+ game_rem_move(Game);\r
+\r
+ if (status != PLAYING) return false; // game ended\r
+\r
+ if (option_get_bool("Book") && is_in_book(board)) {\r
+ return false;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// stop_search()\r
+\r
+static void stop_search() {\r
+\r
+ if (Uci->searching) {\r
+\r
+ ASSERT(Uci->searching);\r
+ ASSERT(Uci->pending_nb>=1);\r
+\r
+ my_log("POLYGLOT STOP SEARCH\n");\r
+\r
+/*\r
+ engine_send(Engine,"stop");\r
+ Uci->searching = false;\r
+*/\r
+\r
+ if (option_get_bool("SyncStop")) {\r
+ uci_send_stop_sync(Uci);\r
+ } else {\r
+ uci_send_stop(Uci);\r
+ }\r
+ }\r
+}\r
+\r
+// send_board()\r
+\r
+static void send_board(int extra_move) {\r
+\r
+ char fen[256];\r
+ int start, end;\r
+ board_t board[1];\r
+ int pos;\r
+ int move;\r
+ char string[256];\r
+\r
+ ASSERT(extra_move==MoveNone||move_is_ok(extra_move));\r
+\r
+ ASSERT(!Uci->searching);\r
+\r
+ // init\r
+\r
+ game_get_board(Game,Uci->board);\r
+ if (extra_move != MoveNone) move_do(Uci->board,extra_move);\r
+\r
+ board_to_fen(Uci->board,fen,256);\r
+ my_log("POLYGLOT FEN %s\n",fen);\r
+\r
+ ASSERT(board_can_play(Uci->board));\r
+\r
+ // more init\r
+\r
+ start = 0;\r
+ end = game_pos(Game);\r
+ ASSERT(end>=start);\r
+\r
+ // position\r
+\r
+ game_get_board(Game,board,start);\r
+ board_to_fen(board,string,256);\r
+\r
+ engine_send_queue(Engine,"position");\r
+\r
+ if (my_string_equal(string,StartFen)) {\r
+ engine_send_queue(Engine," startpos");\r
+ } else {\r
+ engine_send_queue(Engine," fen %s",string);\r
+ }\r
+\r
+ // move list\r
+\r
+ if (end > start || extra_move != MoveNone) engine_send_queue(Engine," moves");\r
+\r
+ for (pos = start; pos < end; pos++) { // game moves\r
+\r
+ move = game_move(Game,pos);\r
+\r
+ move_to_can(move,board,string,256);\r
+ engine_send_queue(Engine," %s",string);\r
+\r
+ move_do(board,move);\r
+ }\r
+\r
+ if (extra_move != MoveNone) { // move to ponder on\r
+ move_to_can(extra_move,board,string,256);\r
+ engine_send_queue(Engine," %s",string);\r
+ }\r
+\r
+ // end\r
+\r
+ engine_send(Engine,""); // newline\r
+}\r
+\r
+// send_pv()\r
+\r
+static void send_pv() {\r
+\r
+ char pv_string[StringSize];\r
+ board_t board[1];\r
+ int move;\r
+ char move_string[StringSize];\r
+\r
+ ASSERT(State->state!=WAIT);\r
+\r
+ if (Uci->best_depth == 0) return;\r
+\r
+ // xboard search information\r
+\r
+ if (XB->post) {\r
+\r
+ if (State->state == THINK || State->state == ANALYSE) {\r
+\r
+ line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize);\r
+\r
+ if(Uci->depth==-1) //hack to clear the engine output window\r
+ gui_send(GUI,"%d %+d %.0f "S64_FORMAT" ",0,Uci->best_score,Uci->time*100.0,Uci->node_nb);\r
+\r
+ gui_send(GUI,"%d %+d %.0f "S64_FORMAT" %s",Uci->best_depth,Uci->best_score,Uci->time*100.0,Uci->node_nb,pv_string);\r
+\r
+ } else if (State->state == PONDER && option_get_bool("ShowPonder")) {\r
+\r
+ game_get_board(Game,board);\r
+ move = State->exp_move;\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+ move_to_san(move,board,move_string,256);\r
+ line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize);\r
+ gui_send(GUI,"%d %+d %.0f "S64_FORMAT" (%s) %s",Uci->best_depth,Uci->best_score,Uci->time*100.0,Uci->node_nb,move_string,pv_string);\r
+ }\r
+ }\r
+ }\r
+\r
+ // kibitz\r
+\r
+ if ((Uci->searching && option_get_bool("KibitzPV") && Uci->time >= option_get_double("KibitzDelay"))\r
+ || (!Uci->searching && option_get_bool("KibitzMove"))) {\r
+\r
+ if (State->state == THINK || State->state == ANALYSE) {\r
+\r
+ line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize);\r
+ gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"%s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(Uci->best_score)/100.0,pv_string);\r
+\r
+ } else if (State->state == PONDER) {\r
+\r
+ game_get_board(Game,board);\r
+ move = State->exp_move;\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+ move_to_san(move,board,move_string,256);\r
+ line_to_san(Uci->best_pv,Uci->board,pv_string,StringSize);\r
+ gui_send(GUI,"%s depth=%d time=%.2f node="S64_FORMAT" speed=%.0f score=%+.2f pv=\"(%s) %s\"",option_get_string("KibitzCommand"),Uci->best_depth,Uci->time,Uci->node_nb,Uci->speed,double(Uci->best_score)/100.0,move_string,pv_string);\r
+ }\r
+ }\r
+ }\r
+}\r
+\r
+// learn()\r
+\r
+static void learn(int result) {\r
+\r
+ int pos;\r
+ board_t board[1];\r
+ int move;\r
+\r
+ ASSERT(result>=-1&&result<=+1);\r
+\r
+ ASSERT(XB->result);\r
+ ASSERT(State->computer[White]||State->computer[Black]);\r
+\r
+ // init\r
+\r
+ pos = 0;\r
+\r
+ if (false) {\r
+ } else if (State->computer[White]) {\r
+ pos = 0;\r
+ } else if (State->computer[Black]) {\r
+ pos = 1;\r
+ result = -result;\r
+ } else {\r
+ my_fatal("learn(): unknown side\n");\r
+ }\r
+\r
+ if (false) {\r
+ } else if (result > 0) {\r
+ my_log("POLYGLOT *LEARN WIN*\n");\r
+ } else if (result < 0) {\r
+ my_log("POLYGLOT *LEARN LOSS*\n");\r
+ } else {\r
+ my_log("POLYGLOT *LEARN DRAW*\n");\r
+ }\r
+\r
+ // loop\r
+\r
+ for (; pos < Game->size; pos += 2) {\r
+\r
+ game_get_board(Game,board,pos);\r
+ move = game_move(Game,pos);\r
+\r
+ book_learn_move(board,move,result);\r
+ }\r
+\r
+ book_flush();\r
+}\r
+\r
+// end of adapter.cpp\r
--- /dev/null
+\r
+// adapter.h\r
+\r
+#ifndef ADAPTER_H\r
+#define ADAPTER_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+#include "uci2uci.h"\r
+\r
+// types\r
+\r
+\r
+\r
+\r
+\r
+// functions\r
+\r
+extern void adapter_loop ();\r
+\r
+\r
+#endif // !defined ADAPTER_H\r
+\r
+// end of adapter.h\r
+\r
--- /dev/null
+\r
+// attack.cpp\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "move.h"\r
+#include "attack.h"\r
+#include "piece.h"\r
+#include "util.h"\r
+\r
+// macros\r
+\r
+#define DELTA_INC(delta) (DeltaInc[128+(delta)])\r
+#define DELTA_MASK(delta) (DeltaMask[128+(delta)])\r
+\r
+// "constants"\r
+\r
+const sint8 KnightInc[8+1] = {\r
+ -33, -31, -18, -14, +14, +18, +31, +33, 0\r
+};\r
+\r
+const sint8 BishopInc[4+1] = {\r
+ -17, -15, +15, +17, 0\r
+};\r
+\r
+const sint8 RookInc[4+1] = {\r
+ -16, -1, +1, +16, 0\r
+};\r
+\r
+const sint8 QueenInc[8+1] = {\r
+ -17, -16, -15, -1, +1, +15, +16, +17, 0\r
+};\r
+\r
+const sint8 KingInc[8+1] = {\r
+ -17, -16, -15, -1, +1, +15, +16, +17, 0\r
+};\r
+\r
+// variables\r
+\r
+static sint8 DeltaInc[256];\r
+static uint8 DeltaMask[256];\r
+\r
+// prototypes\r
+\r
+static bool delta_is_ok (int delta);\r
+static bool inc_is_ok (int inc);\r
+\r
+// functions\r
+\r
+// attack_init()\r
+\r
+void attack_init() {\r
+\r
+ int delta;\r
+ int dir, inc, dist;\r
+\r
+ for (delta = -128; delta < +128; delta++) {\r
+ DeltaInc[128+delta] = IncNone;\r
+ DeltaMask[128+delta] = 0;\r
+ }\r
+\r
+ DeltaMask[128-17] |= BlackPawnFlag;\r
+ DeltaMask[128-15] |= BlackPawnFlag;\r
+\r
+ DeltaMask[128+15] |= WhitePawnFlag;\r
+ DeltaMask[128+17] |= WhitePawnFlag;\r
+\r
+ for (dir = 0; dir < 8; dir++) {\r
+ delta = KnightInc[dir];\r
+ ASSERT(delta_is_ok(delta));\r
+ DeltaMask[128+delta] |= KnightFlag;\r
+ }\r
+\r
+ for (dir = 0; dir < 4; dir++) {\r
+ inc = BishopInc[dir];\r
+ ASSERT(inc!=IncNone);\r
+ for (dist = 1; dist < 8; dist++) {\r
+ delta = inc*dist;\r
+ ASSERT(delta_is_ok(delta));\r
+ ASSERT(DeltaInc[128+delta]==IncNone);\r
+ DeltaInc[128+delta] = inc;\r
+ DeltaMask[128+delta] |= BishopFlag;\r
+ }\r
+ }\r
+\r
+ for (dir = 0; dir < 4; dir++) {\r
+ inc = RookInc[dir];\r
+ ASSERT(inc!=IncNone);\r
+ for (dist = 1; dist < 8; dist++) {\r
+ delta = inc*dist;\r
+ ASSERT(delta_is_ok(delta));\r
+ ASSERT(DeltaInc[128+delta]==IncNone);\r
+ DeltaInc[128+delta] = inc;\r
+ DeltaMask[128+delta] |= RookFlag;\r
+ }\r
+ }\r
+\r
+ for (dir = 0; dir < 8; dir++) {\r
+ delta = KingInc[dir];\r
+ ASSERT(delta_is_ok(delta));\r
+ DeltaMask[128+delta] |= KingFlag;\r
+ }\r
+}\r
+\r
+// delta_is_ok()\r
+\r
+static bool delta_is_ok(int delta) {\r
+\r
+ if (delta < -119 || delta > +119) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// inc_is_ok()\r
+\r
+static bool inc_is_ok(int inc) {\r
+\r
+ int dir;\r
+\r
+ for (dir = 0; dir < 8; dir++) {\r
+ if (KingInc[dir] == inc) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// is_in_check()\r
+\r
+bool is_in_check(const board_t * board, int colour) {\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return is_attacked(board,king_pos(board,colour),colour_opp(colour));\r
+}\r
+\r
+// is_attacked()\r
+\r
+bool is_attacked(const board_t * board, int to, int colour) {\r
+\r
+ const uint8 * ptr;\r
+ int from, piece;\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(square_is_ok(to));\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ for (ptr = board->list[colour]; (from=*ptr) != SquareNone; ptr++) {\r
+\r
+ piece = board->square[from];\r
+ ASSERT(colour_equal(piece,colour));\r
+\r
+ if (piece_attack(board,piece,from,to)) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// piece_attack()\r
+\r
+bool piece_attack(const board_t * board, int piece, int from, int to) {\r
+\r
+ int delta;\r
+ int inc, sq;\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(piece_is_ok(piece));\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+\r
+ delta = to - from;\r
+ ASSERT(delta_is_ok(delta));\r
+\r
+ if ((piece & DELTA_MASK(delta)) == 0) return false; // no pseudo-attack\r
+\r
+ if (!piece_is_slider(piece)) return true;\r
+\r
+ inc = DELTA_INC(delta);\r
+ ASSERT(inc_is_ok(inc));\r
+\r
+ for (sq = from+inc; sq != to; sq += inc) {\r
+ ASSERT(square_is_ok(sq));\r
+ if (board->square[sq] != Empty) return false; // blocker\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// is_pinned()\r
+\r
+bool is_pinned(const board_t * board, int from, int to, int colour) {\r
+\r
+ int king;\r
+ int inc;\r
+ int sq, piece;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ king = king_pos(board,colour);\r
+\r
+ inc = DELTA_INC(king-from);\r
+ if (inc == IncNone) return false; // not a line\r
+\r
+ sq = from;\r
+ do sq += inc; while (board->square[sq] == Empty);\r
+\r
+ if (sq != king) return false; // blocker\r
+\r
+ sq = from;\r
+ do sq -= inc; while ((piece=board->square[sq]) == Empty);\r
+\r
+ return square_is_ok(sq)\r
+ && (piece & DELTA_MASK(king-sq)) != 0\r
+ && piece_colour(piece) == colour_opp(colour)\r
+ && DELTA_INC(king-to) != inc;\r
+}\r
+\r
+// end of attack.cpp\r
+\r
--- /dev/null
+\r
+// attack.h\r
+\r
+#ifndef ATTACK_H\r
+#define ATTACK_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int IncNone = 0;\r
+\r
+// "constants"\r
+\r
+extern const sint8 KnightInc[8+1];\r
+extern const sint8 BishopInc[4+1];\r
+extern const sint8 RookInc[4+1];\r
+extern const sint8 QueenInc[8+1];\r
+extern const sint8 KingInc[8+1];\r
+\r
+// functions\r
+\r
+extern void attack_init ();\r
+\r
+extern bool is_in_check (const board_t * board, int colour);\r
+extern bool is_attacked (const board_t * board, int to, int colour);\r
+extern bool piece_attack (const board_t * board, int piece, int from, int to);\r
+\r
+extern bool is_pinned (const board_t * board, int from, int to, int colour);\r
+\r
+#endif // !defined ATTACK_H\r
+\r
+// end of attack.h\r
+\r
--- /dev/null
+\r
+// board.cpp\r
+\r
+// includes\r
+\r
+#include <cstdio>\r
+\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "fen.h"\r
+#include "hash.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseSlowDebug = false;\r
+\r
+// functions\r
+\r
+// board_is_ok()\r
+\r
+bool board_is_ok(const board_t * board) {\r
+\r
+ int sq, piece;\r
+ int colour, pos;\r
+ int king, rook;\r
+\r
+ if (board == NULL) return false;\r
+\r
+ // optional heavy DEBUG mode\r
+\r
+ if (!UseSlowDebug) return true;\r
+\r
+ // squares\r
+\r
+ for (sq = 0; sq < SquareNb; sq++) {\r
+ piece = board->square[sq];\r
+ if (square_is_ok(sq)) {\r
+ pos = board->pos[sq];\r
+ if (piece == Empty) {\r
+ if (pos != -1) return false;\r
+ } else {\r
+ if (pos < 0) return false;\r
+ if (board->list[piece_colour(piece)][pos] != sq) return false;\r
+ }\r
+ } else {\r
+ if (piece != Knight64) return false;\r
+ }\r
+ }\r
+\r
+ // white piece list\r
+\r
+ colour = White;\r
+ pos = 0;\r
+\r
+ if (board->list_size[colour] <= 0 || board->list_size[colour] > 16) return false;\r
+\r
+ sq = board->list[colour][pos];\r
+ if (sq == SquareNone) return false;\r
+ if (board->pos[sq] != pos) return false;\r
+ piece = board->square[sq];\r
+ if (!colour_equal(piece,colour) || !piece_is_king(piece)) return false;\r
+\r
+ for (pos++; pos < board->list_size[colour]; pos++) {\r
+ sq = board->list[colour][pos];\r
+ if (sq == SquareNone) return false;\r
+ if (board->pos[sq] != pos) return false;\r
+ if (!colour_equal(board->square[sq],colour)) return false;\r
+ }\r
+\r
+ sq = board->list[colour][pos];\r
+ if (sq != SquareNone) return false;\r
+\r
+ // black piece list\r
+\r
+ colour = Black;\r
+ pos = 0;\r
+\r
+ if (board->list_size[colour] <= 0 || board->list_size[colour] > 16) return false;\r
+\r
+ sq = board->list[colour][pos];\r
+ if (sq == SquareNone) return false;\r
+ if (board->pos[sq] != pos) return false;\r
+ piece = board->square[sq];\r
+ if (!colour_equal(piece,colour) || !piece_is_king(piece)) return false;\r
+\r
+ for (pos++; pos < board->list_size[colour]; pos++) {\r
+ sq = board->list[colour][pos];\r
+ if (sq == SquareNone) return false;\r
+ if (board->pos[sq] != pos) return false;\r
+ if (!colour_equal(board->square[sq],colour)) return false;\r
+ }\r
+\r
+ sq = board->list[colour][pos];\r
+ if (sq != SquareNone) return false;\r
+\r
+ // TODO: material\r
+\r
+ if (board->number[WhiteKing12] != 1) return false;\r
+ if (board->number[BlackKing12] != 1) return false;\r
+\r
+ if (!colour_is_ok(board->turn)) return false;\r
+\r
+ // castling status\r
+\r
+ if (board->castle[White][SideH] != SquareNone) {\r
+\r
+ king = board->list[White][0];\r
+ if (king < A1 || king > H1) return false;\r
+ if (board->square[king] != WhiteKing256) return false;\r
+\r
+ rook = board->castle[White][SideH];\r
+ if (rook < A1 || rook > H1) return false;\r
+ if (board->square[rook] != WhiteRook256) return false;\r
+\r
+ if (rook <= king) return false;\r
+ }\r
+\r
+ if (board->castle[White][SideA] != SquareNone) {\r
+\r
+ king = board->list[White][0];\r
+ if (king < A1 || king > H1) return false;\r
+ if (board->square[king] != WhiteKing256) return false;\r
+\r
+ rook = board->castle[White][SideA];\r
+ if (rook < A1 || rook > H1) return false;\r
+ if (board->square[rook] != WhiteRook256) return false;\r
+\r
+ if (rook >= king) return false;\r
+ }\r
+\r
+ if (board->castle[Black][SideH] != SquareNone) {\r
+\r
+ king = board->list[Black][0];\r
+ if (king < A8 || king > H8) return false;\r
+ if (board->square[king] != BlackKing256) return false;\r
+\r
+ rook = board->castle[Black][SideH];\r
+ if (rook < A8 || rook > H8) return false;\r
+ if (board->square[rook] != BlackRook256) return false;\r
+\r
+ if (rook <= king) return false;\r
+ }\r
+\r
+ if (board->castle[Black][SideA] != SquareNone) {\r
+\r
+ king = board->list[Black][0];\r
+ if (king < A8 || king > H8) return false;\r
+ if (board->square[king] != BlackKing256) return false;\r
+\r
+ rook = board->castle[Black][SideA];\r
+ if (rook < A8 || rook > H8) return false;\r
+ if (board->square[rook] != BlackRook256) return false;\r
+\r
+ if (rook >= king) return false;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// board_clear()\r
+\r
+void board_clear(board_t * board) {\r
+\r
+ int file, rank, sq;\r
+ int colour, pos;\r
+ int piece;\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ // edge squares\r
+\r
+ for (sq = 0; sq < SquareNb; sq++) {\r
+ board->square[sq] = Knight64; // HACK: uncoloured knight\r
+ board->pos[sq] = -1;\r
+ }\r
+\r
+ // empty squares\r
+\r
+ for (rank = 0; rank < 8; rank++) {\r
+ for (file = 0; file < 8; file++) {\r
+ sq = square_make(file,rank);\r
+ board->square[sq] = Empty;\r
+ }\r
+ }\r
+\r
+ // piece lists\r
+\r
+ for (colour = 0; colour < 3; colour++) {\r
+ for (pos = 0; pos < 32; pos++) { // HACK\r
+ board->list[colour][pos] = SquareNone;\r
+ }\r
+ board->list_size[colour] = 0;\r
+ }\r
+\r
+ // material\r
+\r
+ for (piece = 0; piece < 12; piece++) {\r
+ board->number[piece] = 0;\r
+ }\r
+\r
+ // rest\r
+\r
+ board->turn = ColourNone;\r
+ board->castle[White][SideH] = SquareNone;\r
+ board->castle[White][SideA] = SquareNone;\r
+ board->castle[Black][SideH] = SquareNone;\r
+ board->castle[Black][SideA] = SquareNone;\r
+ board->ep_square = SquareNone;\r
+\r
+ board->ply_nb = 0;\r
+ board->move_nb = 0;\r
+\r
+ board->key = 0;\r
+}\r
+\r
+// board_start()\r
+\r
+void board_start(board_t * board) {\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ if (!board_from_fen(board,StartFen)) ASSERT(false);\r
+}\r
+\r
+// board_copy()\r
+\r
+void board_copy(board_t * dst, const board_t * src) {\r
+\r
+ ASSERT(dst!=NULL);\r
+ ASSERT(board_is_ok(src));\r
+\r
+ *dst = *src;\r
+}\r
+\r
+// board_equal()\r
+\r
+bool board_equal(const board_t * board_1, const board_t * board_2) {\r
+\r
+ int sq_64, sq;\r
+\r
+ ASSERT(board_is_ok(board_1));\r
+ ASSERT(board_is_ok(board_2));\r
+\r
+ // fast comparison\r
+\r
+ if (board_1->key != board_2->key) return false;\r
+\r
+ // slow comparison\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ if (board_1->square[sq] != board_2->square[sq]) return false;\r
+ }\r
+\r
+ if (board_1->turn != board_2->turn) return false;\r
+ if (board_1->castle[White][SideH] != board_2->castle[White][SideH]) return false;\r
+ if (board_1->castle[White][SideA] != board_2->castle[White][SideA]) return false;\r
+ if (board_1->castle[Black][SideH] != board_2->castle[Black][SideH]) return false;\r
+ if (board_1->castle[Black][SideA] != board_2->castle[Black][SideA]) return false;\r
+ if (board_1->ep_square != board_2->ep_square) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// board_init_list()\r
+\r
+void board_init_list(board_t * board) {\r
+\r
+ int sq_64, sq, piece;\r
+ int colour, pos;\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ // init\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ board->pos[sq] = -1;\r
+ }\r
+\r
+ for (piece = 0; piece < 12; piece++) board->number[piece] = 0;\r
+\r
+ // white piece list\r
+\r
+ colour = White;\r
+ pos = 0;\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ piece = board->square[sq];\r
+ ASSERT(pos>=0&&pos<=16);\r
+ if (colour_equal(piece,colour) && piece_is_king(piece)) {\r
+ board->pos[sq] = pos;\r
+ board->list[colour][pos] = sq;\r
+ pos++;\r
+ board->number[piece_to_12(piece)]++;\r
+ }\r
+ }\r
+ ASSERT(pos==1);\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ piece = board->square[sq];\r
+ ASSERT(pos>=0&&pos<=16);\r
+ if (colour_equal(piece,colour) && !piece_is_king(piece)) {\r
+ board->pos[sq] = pos;\r
+ board->list[colour][pos] = sq;\r
+ pos++;\r
+ board->number[piece_to_12(piece)]++;\r
+ }\r
+ }\r
+\r
+ ASSERT(pos>=1&&pos<=16);\r
+ board->list[colour][pos] = SquareNone;\r
+ board->list_size[colour] = pos;\r
+\r
+ // black piece list\r
+\r
+ colour = Black;\r
+ pos = 0;\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ piece = board->square[sq];\r
+ ASSERT(pos>=0&&pos<=16);\r
+ if (colour_equal(piece,colour) && piece_is_king(piece)) {\r
+ board->pos[sq] = pos;\r
+ board->list[colour][pos] = sq;\r
+ pos++;\r
+ board->number[piece_to_12(piece)]++;\r
+ }\r
+ }\r
+ ASSERT(pos==1);\r
+\r
+ for (sq_64 = 0; sq_64 < 64; sq_64++) {\r
+ sq = square_from_64(sq_64);\r
+ piece = board->square[sq];\r
+ ASSERT(pos>=1&&pos<=16);\r
+ if (colour_equal(piece,colour) && !piece_is_king(piece)) {\r
+ board->pos[sq] = pos;\r
+ board->list[colour][pos] = sq;\r
+ pos++;\r
+ board->number[piece_to_12(piece)]++;\r
+ }\r
+ }\r
+\r
+ ASSERT(pos>=1&&pos<=16);\r
+ board->list[colour][pos] = SquareNone;\r
+ board->list_size[colour] = pos;\r
+\r
+ // hash key\r
+\r
+ board->key = hash_key(board);\r
+}\r
+\r
+// board_flags()\r
+\r
+int board_flags(const board_t * board) {\r
+\r
+ int flags;\r
+\r
+ flags = 0;\r
+\r
+ if (board->castle[White][SideH] != SquareNone) flags |= 1 << 0;\r
+ if (board->castle[White][SideA] != SquareNone) flags |= 1 << 1;\r
+ if (board->castle[Black][SideH] != SquareNone) flags |= 1 << 2;\r
+ if (board->castle[Black][SideA] != SquareNone) flags |= 1 << 3;\r
+\r
+ return flags;\r
+}\r
+\r
+// board_can_play()\r
+\r
+bool board_can_play(const board_t * board) {\r
+\r
+ list_t list[1];\r
+ int i, move;\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_moves(list,board);\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+ move = list_move(list,i);\r
+ if (pseudo_is_legal(move,board)) return true;\r
+ }\r
+\r
+ return false; // no legal move\r
+}\r
+\r
+// board_mobility()\r
+\r
+int board_mobility(const board_t * board) {\r
+\r
+ list_t list[1];\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_legal_moves(list,board);\r
+\r
+ return list_size(list);\r
+}\r
+\r
+// board_is_check()\r
+\r
+bool board_is_check(const board_t * board) {\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ return is_in_check(board,board->turn);\r
+}\r
+\r
+// board_is_mate()\r
+\r
+bool board_is_mate(const board_t * board) {\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (!board_is_check(board)) return false;\r
+ if (board_can_play(board)) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// board_is_stalemate()\r
+\r
+bool board_is_stalemate(const board_t * board) {\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (board_is_check(board)) return false;\r
+ if (board_can_play(board)) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// king_pos()\r
+\r
+int king_pos(const board_t * board, int colour) {\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return board->list[colour][0];\r
+}\r
+\r
+// board_disp()\r
+\r
+void board_disp(const board_t * board) {\r
+\r
+ int file, rank, sq;\r
+ int piece, c;\r
+ char fen[256];\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ if (!board_to_fen(board,fen,256)) ASSERT(false);\r
+ my_log("POLYGLOT %s\n",fen);\r
+ my_log("POLYGLOT\n");\r
+\r
+ for (rank = 7; rank >= 0; rank--) {\r
+\r
+ my_log("POLYGLOT ");\r
+\r
+ for (file = 0; file < 8; file++) {\r
+\r
+ sq = square_make(file,rank);\r
+ piece = board->square[sq];\r
+\r
+ c = (piece != Empty) ? piece_to_char(piece) : '-';\r
+ my_log("%c ",c);\r
+ }\r
+\r
+ my_log("\n");\r
+ }\r
+\r
+ my_log("POLYGLOT\n");\r
+\r
+ my_log("POLYGLOT %s to play\n",(colour_is_black(board->turn))?"black":"white");\r
+ my_log("POLYGLOT\n");\r
+}\r
+\r
+// end of board.cpp\r
+\r
--- /dev/null
+\r
+// board.h\r
+\r
+#ifndef BOARD_H\r
+#define BOARD_H\r
+\r
+// includes\r
+\r
+#include "colour.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int Empty = 0;\r
+\r
+const int SideH = 0;\r
+const int SideA = 1;\r
+const int SideNb = 2;\r
+\r
+// types\r
+\r
+struct board_t {\r
+\r
+ uint8 square[SquareNb];\r
+ sint8 pos[SquareNb];\r
+\r
+ uint8 list[ColourNb][32];\r
+ sint8 list_size[ColourNb];\r
+\r
+ sint8 number[12];\r
+\r
+ sint8 turn;\r
+ uint8 castle[ColourNb][SideNb];\r
+ uint8 ep_square;\r
+\r
+ sint16 ply_nb;\r
+ sint16 move_nb;\r
+\r
+ uint64 key;\r
+};\r
+\r
+// functions\r
+\r
+extern bool board_is_ok (const board_t * board);\r
+\r
+extern void board_clear (board_t * board);\r
+extern void board_start (board_t * board);\r
+\r
+extern void board_copy (board_t * dst, const board_t * src);\r
+extern bool board_equal (const board_t * board_1, const board_t * board_2);\r
+\r
+extern void board_init_list (board_t * board);\r
+\r
+extern int board_flags (const board_t * board);\r
+\r
+extern bool board_can_play (const board_t * board);\r
+extern int board_mobility (const board_t * board);\r
+\r
+extern bool board_is_check (const board_t * board);\r
+extern bool board_is_mate (const board_t * board);\r
+extern bool board_is_stalemate (const board_t * board);\r
+\r
+extern int king_pos (const board_t * board, int colour);\r
+\r
+extern void board_disp (const board_t * board);\r
+\r
+#endif // !defined BOARD_H\r
+\r
+// end of board.h\r
+\r
--- /dev/null
+\r
+// book.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "board.h"\r
+#include "book.h"\r
+#include "move.h"\r
+#include "move_legal.h"\r
+#include "san.h"\r
+#include "util.h"\r
+#include "option.h"\r
+\r
+// types\r
+\r
+struct entry_t {\r
+ uint64 key;\r
+ uint16 move;\r
+ uint16 count;\r
+ uint16 n;\r
+ uint16 sum;\r
+};\r
+\r
+// variables\r
+\r
+static FILE * BookFile;\r
+static int BookSize;\r
+\r
+// prototypes\r
+\r
+static int find_pos (uint64 key);\r
+\r
+static void read_entry (entry_t * entry, int n);\r
+static void write_entry (const entry_t * entry, int n);\r
+\r
+static uint64 read_integer (FILE * file, int size);\r
+static void write_integer (FILE * file, int size, uint64 n);\r
+\r
+// functions\r
+\r
+// book_clear()\r
+\r
+void book_clear() {\r
+\r
+ BookFile = NULL;\r
+ BookSize = 0;\r
+}\r
+\r
+bool book_is_open(){\r
+ return BookFile!=NULL;\r
+}\r
+\r
+// book_open()\r
+\r
+void book_open(const char file_name[]) {\r
+\r
+ ASSERT(file_name!=NULL);\r
+ if(option_get_bool("BookLearn")){\r
+ BookFile = fopen(file_name,"rb+");\r
+ }else{\r
+ BookFile = fopen(file_name,"rb");\r
+ }\r
+ \r
+// if (BookFile == NULL) my_fatal("book_open(): can't open file \"%s\": %s\n",file_name,strerror(errno));\r
+ if (BookFile == NULL) return; \r
+\r
+ if (fseek(BookFile,0,SEEK_END) == -1) {\r
+ my_fatal("book_open(): fseek(): %s\n",strerror(errno));\r
+ }\r
+\r
+ BookSize = ftell(BookFile) / 16;\r
+// if (BookSize == 0) my_fatal("book_open(): empty file\n");\r
+ if (BookSize == 0) {\r
+ book_close();\r
+ book_clear(); \r
+ };\r
+}\r
+\r
+// book_close()\r
+\r
+void book_close() {\r
+\r
+ if(BookFile==NULL) return;\r
+\r
+ if (fclose(BookFile) == EOF) {\r
+ my_fatal("book_close(): fclose(): %s\n",strerror(errno));\r
+ }\r
+}\r
+\r
+// is_in_book()\r
+\r
+bool is_in_book(const board_t * board) {\r
+\r
+ int pos;\r
+ entry_t entry[1];\r
+\r
+ if(BookFile==NULL) return false;\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ for (pos = find_pos(board->key); pos < BookSize; pos++) {\r
+ read_entry(entry,pos);\r
+ if (entry->key == board->key) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// book_move()\r
+\r
+int book_move(const board_t * board, bool random) {\r
+\r
+ int best_move;\r
+ int best_score;\r
+ int pos;\r
+ entry_t entry[1];\r
+ int move;\r
+ int score;\r
+\r
+ if(BookFile==NULL) return MoveNone;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(random==true||random==false);\r
+\r
+\r
+ best_move = MoveNone;\r
+ best_score = 0;\r
+ for (pos = find_pos(board->key); pos < BookSize; pos++) {\r
+\r
+ read_entry(entry,pos);\r
+ if (entry->key != board->key) break;\r
+\r
+ move = entry->move;\r
+ score = entry->count;\r
+\r
+ if (move != MoveNone && move_is_legal(move,board)) {\r
+\r
+ // pick this move?\r
+\r
+ ASSERT(score>0);\r
+\r
+ if (random) {\r
+ best_score += score;\r
+ if (my_random_int(best_score) < score) best_move = move;\r
+ } else {\r
+ if (score > best_score) {\r
+ best_move = move;\r
+ best_score = score;\r
+ }\r
+ }\r
+\r
+ } else {\r
+\r
+ ASSERT(false);\r
+ }\r
+ }\r
+\r
+ return best_move;\r
+}\r
+\r
+// book_disp()\r
+\r
+void book_disp(const board_t * board) {\r
+\r
+ int first_pos;\r
+ int sum;\r
+ int pos;\r
+ entry_t entry[1];\r
+ int move;\r
+ int score;\r
+ char move_string[256];\r
+\r
+ ASSERT(board!=NULL);\r
+\r
+ if(BookFile==NULL) return; \r
+\r
+ first_pos = find_pos(board->key);\r
+\r
+ // sum\r
+\r
+ sum = 0;\r
+\r
+ for (pos = first_pos; pos < BookSize; pos++) {\r
+\r
+ read_entry(entry,pos);\r
+ if (entry->key != board->key) break;\r
+\r
+ sum += entry->count;\r
+ }\r
+\r
+ // disp\r
+\r
+ for (pos = first_pos; pos < BookSize; pos++) {\r
+\r
+ read_entry(entry,pos);\r
+ if (entry->key != board->key) break;\r
+\r
+ move = entry->move;\r
+ score = entry->count;\r
+\r
+ if (score > 0 && move != MoveNone && move_is_legal(move,board)) {\r
+ move_to_san(move,board,move_string,256);\r
+ printf(" %s (%.0f%%)\n",move_string,(double(score)/double(sum))*100.0);\r
+ }\r
+ }\r
+\r
+ printf("\n");\r
+}\r
+\r
+// book_learn_move()\r
+\r
+void book_learn_move(const board_t * board, int move, int result) {\r
+\r
+ int pos;\r
+ entry_t entry[1];\r
+\r
+ if(BookFile==NULL) return;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(result>=-1&&result<=+1);\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ for (pos = find_pos(board->key); pos < BookSize; pos++) {\r
+\r
+ read_entry(entry,pos);\r
+ if (entry->key != board->key) break;\r
+\r
+ if (entry->move == move) {\r
+\r
+ entry->n++;\r
+ entry->sum += result+1;\r
+\r
+ write_entry(entry,pos);\r
+\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+// book_flush()\r
+\r
+void book_flush() {\r
+\r
+ if(BookFile==NULL) return;\r
+\r
+ if (fflush(BookFile) == EOF) {\r
+ my_fatal("book_flush(): fflush(): %s\n",strerror(errno));\r
+ }\r
+}\r
+\r
+// find_pos()\r
+\r
+static int find_pos(uint64 key) {\r
+\r
+ int left, right, mid;\r
+ entry_t entry[1];\r
+\r
+ // binary search (finds the leftmost entry)\r
+\r
+ left = 0;\r
+ right = BookSize-1;\r
+\r
+ ASSERT(left<=right);\r
+\r
+ while (left < right) {\r
+\r
+ mid = (left + right) / 2;\r
+ ASSERT(mid>=left&&mid<right);\r
+\r
+ read_entry(entry,mid);\r
+\r
+ if (key <= entry->key) {\r
+ right = mid;\r
+ } else {\r
+ left = mid+1;\r
+ }\r
+ }\r
+\r
+ ASSERT(left==right);\r
+\r
+ read_entry(entry,left);\r
+\r
+ return (entry->key == key) ? left : BookSize;\r
+}\r
+\r
+// read_entry()\r
+\r
+static void read_entry(entry_t * entry, int n) {\r
+\r
+ ASSERT(entry!=NULL);\r
+ ASSERT(n>=0&&n<BookSize);\r
+\r
+ if (fseek(BookFile,n*16,SEEK_SET) == -1) {\r
+ my_fatal("read_entry(): fseek(): %s\n",strerror(errno));\r
+ }\r
+\r
+ entry->key = read_integer(BookFile,8);\r
+ entry->move = read_integer(BookFile,2);\r
+ entry->count = read_integer(BookFile,2);\r
+ entry->n = read_integer(BookFile,2);\r
+ entry->sum = read_integer(BookFile,2);\r
+}\r
+\r
+// write_entry()\r
+\r
+static void write_entry(const entry_t * entry, int n) {\r
+\r
+ ASSERT(entry!=NULL);\r
+ ASSERT(n>=0&&n<BookSize);\r
+\r
+ if (fseek(BookFile,n*16,SEEK_SET) == -1) {\r
+ my_fatal("write_entry(): fseek(): %s\n",strerror(errno));\r
+ }\r
+\r
+ write_integer(BookFile,8,entry->key);\r
+ write_integer(BookFile,2,entry->move);\r
+ write_integer(BookFile,2,entry->count);\r
+ write_integer(BookFile,2,entry->n);\r
+ write_integer(BookFile,2,entry->sum);\r
+}\r
+\r
+// read_integer()\r
+\r
+static uint64 read_integer(FILE * file, int size) {\r
+\r
+ uint64 n;\r
+ int i;\r
+ int b;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(size>0&&size<=8);\r
+\r
+ n = 0;\r
+\r
+ for (i = 0; i < size; i++) {\r
+\r
+ b = fgetc(file);\r
+\r
+ if (b == EOF) {\r
+ if (feof(file)) {\r
+ my_fatal("read_integer(): fgetc(): EOF reached\n");\r
+ } else { // error\r
+ my_fatal("read_integer(): fgetc(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+\r
+ ASSERT(b>=0&&b<256);\r
+ n = (n << 8) | b;\r
+ }\r
+\r
+ return n;\r
+}\r
+\r
+// write_integer()\r
+\r
+static void write_integer(FILE * file, int size, uint64 n) {\r
+\r
+ int i;\r
+ int b;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(size>0&&size<=8);\r
+ ASSERT(size==8||n>>(size*8)==0);\r
+\r
+ for (i = size-1; i >= 0; i--) {\r
+\r
+ b = (n >> (i*8)) & 0xFF;\r
+ ASSERT(b>=0&&b<256);\r
+\r
+ if (fputc(b,file) == EOF) {\r
+ my_fatal("write_integer(): fputc(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+}\r
+\r
+// end of book.cpp\r
+\r
--- /dev/null
+\r
+// book.h\r
+\r
+#ifndef BOOK_H\r
+#define BOOK_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void book_clear ();\r
+\r
+extern void book_open (const char file_name[]);\r
+extern bool book_is_open ();\r
+extern void book_close ();\r
+\r
+extern bool is_in_book (const board_t * board);\r
+extern int book_move (const board_t * board, bool random);\r
+extern void book_disp (const board_t * board);\r
+\r
+extern void book_learn_move (const board_t * board, int move, int result);\r
+extern void book_flush ();\r
+\r
+#endif // !defined BOOK_H\r
+\r
+// end of book.h\r
+\r
--- /dev/null
+<html>
+<head>
+<title>Polyglot book format</title>
+</head>
+<body>
+<h1>Polyglot book format</h1>
+The following description of the Polyglot book format is obtained
+by inspecting the freely available source code of Polyglot.
+<h2>A note on copyright</h2> I believe that the algorithm described
+below may be freely implemented by all GUIs, adapters and engines,
+including closed source ones. Polyglot itself is GPL but the GPL only
+covers actual code and not algorithms.
+<p>
+The array of 781 random numbers is of course taken from the Polyglot
+source code but I am pretty sure that a table of random numbers
+cannot be covered by copyright.
+<p>
+Look below for some sample code which is released
+in the public domain.
+<p>
+At the end of this document we discuss an extension of the Polyglot
+opening book format for Chess960. This extension is implemented in
+upcoming versions of xboard/winboard.
+<h2>Outline</h2>
+A Polyglot book is a series of "entries" of 16 bytes
+<p>
+<pre>
+key uint64
+move uint16
+weight uint16
+learn uint32
+</pre>
+<p>
+All integers are stored highest byte first (regardless of size)
+<p>
+The entries are ordered according to key. Lowest key first.
+<p>
+<h2>key</h2>
+"key" is a 64 bit hash of a board position. Its computation
+is explained below.
+<p>
+The starting point is given by the following declaration
+
+<pre>
+
+#ifdef _MSC_VER
+# define U64(u) (u##ui64)
+#else
+# define U64(u) (u##ULL)
+#endif
+
+const 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),
+};
+</pre>
+The array Random64 is in fact a concatenation of four subarrays
+<pre>
+RandomPiece (offset: 0, length: 768)
+RandomCastle (offset: 768, length: 4)
+RandomEnPassant (offset: 772, length: 8)
+RandomTurn (offset: 780, length: 1)
+</pre>
+"key" is a so-called "Zobrist hash function". In other words it is
+the <b>exclusive or</b> of entries taken from each of the
+subarrays described above.
+
+Thus we have
+<pre>
+key=piece^castle^enpassant^turn;
+</pre>
+
+<h3>piece</h3>
+"piece" is the exclusive or of entries from
+RandomPiece, one for each piece on the board. The offset of the entry
+in RandomPiece corresponding to a piece is computed as follows.
+<pre>
+offset_piece=64*kind_of_piece+8*row+file;
+</pre>
+"row" and "file" are counted from 0 to 7. With this convention one has
+<pre>
+square file row
+======================
+a1 0 0
+h1 7 0
+a8 0 7
+h8 7 7
+</pre>
+
+"kind_of_piece" is encoded as follows
+<pre>
+black pawn 0
+white pawn 1
+black knight 2
+white knight 3
+black bishop 4
+white bishop 5
+black rook 6
+white rook 7
+black queen 8
+white queen 9
+black king 10
+white king 11
+</pre>
+
+<h3>castle</h3>
+"castle" is the exclusive or of entries from
+RandomCastle. The offsets are computed as follows.
+<pre>
+white can castle short 0
+white can castle long 1
+black can castle short 2
+black can castle long 3
+</pre>
+If none of these flags apply then castle=0.
+<p>
+Note that these flags represent "potential future castling" as in the
+FEN standard even if such castling is currently not possible due to blocking
+pieces or enemy attacks.
+<p>
+In other words these flags are all true in the starting position and are
+only updated after the appropriate king, rook or castling moves.
+
+
+
+<h3>enpassent</h3> If the opponent has performed a double pawn push
+and there is now a pawn next to it belonging to the player to move then
+"enpassant" is the entry from RandomEnPassant whose offset is the file
+of the pushed pawn (counted from 0(=a) to 7(=h)). If this does not
+apply then enpassant=0.
+<p>
+Note that this is <b>different from the FEN standard</b>. In the FEN standard
+the presence of an "en passant target square" after a double pawn push
+is unconditional.
+<p> Also note that it is irrelevant if the potential en passant
+capturing move is legal or not (examples where it would not be legal are
+when the capturing pawn is pinned or when the double pawn push was a
+discovered check).
+
+
+<h3>turn</h3>
+If white is to move then "turn" is the sole entry of RandomTurn.
+If not then "turn" is zero.
+
+<h3>Test data</h3>
+Here are some test keys. They were computed using Toga II
+and checked using the algorithm described above.
+
+<pre>
+starting position
+FEN=rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
+key=463b96181691fc9c
+
+position after e2e4
+FEN=rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
+key=823c9b50fd114196
+
+position after e2e4 d75
+FEN=rnbqkbnr/ppp1pppp/8/3p4/4P3/8/PPPP1PPP/RNBQKBNR w KQkq d6 0 2
+key=0756b94461c50fb0
+
+position after e2e4 d7d5 e4e5
+FEN=rnbqkbnr/ppp1pppp/8/3pP3/8/8/PPPP1PPP/RNBQKBNR b KQkq - 0 2
+key=662fafb965db29d4
+
+position after e2e4 d7d5 e4e5 f7f5
+FEN=rnbqkbnr/ppp1p1pp/8/3pPp2/8/8/PPPP1PPP/RNBQKBNR w KQkq f6 0 3
+key=22a48b5a8e47ff78
+
+position after e2e4 d7d5 e4e5 f7f5 e1e2
+FEN=rnbqkbnr/ppp1p1pp/8/3pPp2/8/8/PPPPKPPP/RNBQ1BNR b kq - 0 3
+key=652a607ca3f242c1
+
+position after e2e4 d7d5 e4e5 f7f5 e1e2 e8f7
+FEN=rnbq1bnr/ppp1pkpp/8/3pPp2/8/8/PPPPKPPP/RNBQ1BNR w - - 0 4
+key=00fdd303c946bdd9
+
+position after a2a4 b7b5 h2h4 b5b4 c2c4
+FEN=rnbqkbnr/p1pppppp/8/8/PpP4P/8/1P1PPPP1/RNBQKBNR b KQkq c3 0 3
+key=3c8123ea7b067637
+
+position after a2a4 b7b5 h2h4 b5b4 c2c4 b4c3 a1a3
+FEN=rnbqkbnr/p1pppppp/8/8/P6P/R1p5/1P1PPPP1/1NBQKBNR b Kkq - 0 4
+key=5c3f9b829b279560
+</pre>
+
+
+<h2>move</h2>
+"move" is a bit field with the following meaning (bit 0 is the least
+significant bit)
+<pre>
+bits meaning
+===================================
+0,1,2 to file
+3,4,5 to row
+6,7,8 from file
+9,10,11 from row
+12,13,14 promotion piece
+</pre>
+"promotion piece" is encoded as follows
+<pre>
+none 0
+knight 1
+bishop 2
+rook 3
+queen 4
+</pre>
+If the move is "0" (a1a1) then it should simply be ignored. It seems to me that
+in that case one might as well delete the entry from the book.
+
+<h3>Castling moves</h3> Castling moves are represented somewhat
+unconventially as follows (this convention is related to Chess960, see
+below).
+<pre>
+white short e1h1
+white long e1a1
+black short e8h8
+black long e8a8
+</pre>
+It is technically possible that these moves are legal non-castling
+moves. So before deciding that these are really castling moves the
+implementation may for example verify that there is really a king
+present on e1/e8.
+<h2>weight</h2>
+In the Polyglot source code this field is called "count" but it is in fact
+a measure for the quality of the move. <b>It should be at least one.</b>
+<p>
+The Polyglot book generator sets it to 2*(wins)+(draws), globally
+scaled to fit into 16 bits. A move with a weight of zero is deleted
+from the book. This is just a convention and book authors
+are free to set this field according to their taste (as long as it is at least one).
+<p>
+If random play is enabled in Polyglot then the probability that
+a move is selected is its weight divided by the sum of the weights
+of all the moves in the given position.
+<h3>A note on zero weights</h3>
+Polyglot assumes that weights are at least one since a zero
+weight means the move should not be played, and hence you might as
+well delete the entry from the book (which the Polyglot book generator does).
+
+Nonetheless, if you really insist, an entry with zero weight can be
+approximated by giving it very low probability. This is what Scid does.
+
+<h2>learn</h2> "learn" is set to zero by the Polyglot book generator.
+If you set "BookLearn=true" in polyglot.ini then this field
+is used to record learning information. However I do not know of any
+program that uses this information. Also this means the Polyglot should
+have write access to the opening book which on Unix systems will probably
+not be the case if the book has been installed centrally.
+<p>
+<h2>Sample code</h2>
+The following sample code is released in the public domain.
+<ul>
+<li>
+<a href=pg_key.c>pg_key.c</a>: This little utility computes the PG key
+of a FEN. Note that it does ZERO error checking on the legality
+of the FEN and hence will segfault if something is wrong.
+</li>
+<li>
+<a href=pg_show.c>pg_show.c</a>: This utility looks up a PG key in a PG book
+and prints out the moves and their (relative) weights.
+</li>
+</ul>
+<h2>Utilities</h2>
+Here are a few utilities: <a href=pg_utils-0.2.tar.gz>pg_utils-0.2.tar.gz</a>. They are released under the FreeBSD license.
+<H2>Extension to Chess960</H2>
+We assume that the reader is familar
+with the rules of Chess960 (also called Fisher Random Chess or
+FRC). See e.g.
+<a href=http://en.wikipedia.org/wiki/Fischer_Random_Chess>http://en.wikipedia.org/wiki/Fischer_Random_Chess</a>.
+<p>
+The Zobrist hash function used in Polyglot does not keep track of
+which rook has castling rights if there are multiple rooks present on
+the same side of the king. However it is rather unlikely that this
+situation would occur in the opening. So the ambiguity can be resolved
+in a satisfactory way by making the following convention.
+<p>
+<b> Positions in which a rook has castling rights which is not an outer
+rook (closest to a or h file) should not be included in the book. </b>
+<p>
+Nonetheless this is an unsatisfactory situation. Therefore the
+upcoming versions of xboard/winboard extend the Polyglot hash function
+in such a way that it takes into account the full castling rights in
+Chess960, therefore
+<b>removing the need of the above disambiguating convention</b>. This is done in a backward compatible way. I.e. ordinary
+chess positions or Chess960 positions in which there is no castling
+ambiguity will keep their old hash key.
+<p>
+The above declaration of RandomCastle is replaced by
+<pre>
+const uint64 RandomCastle[16]={
+< to be filled in >
+}
+</pre>
+In this case "castle" will be the exclusive or of entries taken from
+RandomCastle, one for each rook that has castling rights (so at most
+four offsets).
+
+The offset for a rook that has castling rights is computed as follows.
+<ul>
+<li> If the rook is an outer rook (i.e. closest to the a or h file) then
+the offset is
+<pre>
+0 if the rook is white and on the king side
+1 if the rook is white and on the queen side
+2 if the rook is black and on the king side
+3 if the rook is black and on the queen side
+</pre>
+(this is like in ordinary chess)
+</li>
+<li> If the rook is not an outer rook then the offset is
+<pre>
+3+file if the rook is white
+9+file if the rook is black
+</pre>
+where "file" denotes the file the rook is on, encoded in the usual way, i.e.
+b=1,c=2,d=3,e=4,f=5,g=6.
+</li>
+</ul>
+<h3>Encoding of moves</h3> A castling move is encoded as a usual move
+(see above) in which the "from square" is the position of the king and
+the "to square" is the position of the rook. This is to maintain
+compatibility with various Fruit derivatives.
+</body>
+
+
+
+
--- /dev/null
+\r
+// book_make.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cmath>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "board.h"\r
+#include "book_make.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "pgn.h"\r
+#include "san.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const int COUNT_MAX = 16384;\r
+\r
+static const int NIL = -1;\r
+\r
+// types\r
+\r
+struct entry_t {\r
+ uint64 key;\r
+ uint16 move;\r
+ uint16 n;\r
+ uint16 sum;\r
+ uint16 colour;\r
+};\r
+\r
+struct book_t {\r
+ int size;\r
+ int alloc;\r
+ uint32 mask;\r
+ entry_t * entry;\r
+ sint32 * hash;\r
+};\r
+\r
+// variables\r
+\r
+static int MaxPly;\r
+static int MinGame;\r
+static double MinScore;\r
+static bool RemoveWhite, RemoveBlack;\r
+static bool Uniform;\r
+\r
+static book_t Book[1];\r
+\r
+// prototypes\r
+\r
+static void book_clear ();\r
+static void book_insert (const char file_name[]);\r
+static void book_filter ();\r
+static void book_sort ();\r
+static void book_save (const char file_name[]);\r
+\r
+static int find_entry (const board_t * board, int move);\r
+static void resize ();\r
+static void halve_stats (uint64 key);\r
+\r
+static bool keep_entry (int pos);\r
+\r
+static int entry_score (const entry_t * entry);\r
+\r
+static int key_compare (const void * p1, const void * p2);\r
+\r
+static void write_integer (FILE * file, int size, uint64 n);\r
+\r
+// functions\r
+\r
+// book_make()\r
+\r
+void book_make(int argc, char * argv[]) {\r
+\r
+ int i;\r
+ const char * pgn_file;\r
+ const char * bin_file;\r
+\r
+ pgn_file = NULL;\r
+ my_string_set(&pgn_file,"book.pgn");\r
+\r
+ bin_file = NULL;\r
+ my_string_set(&bin_file,"book.bin");\r
+\r
+ MaxPly = 1024;\r
+ MinGame = 3;\r
+ MinScore = 0.0;\r
+ RemoveWhite = false;\r
+ RemoveBlack = false;\r
+ Uniform = false;\r
+\r
+ for (i = 1; i < argc; i++) {\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(argv[i],"make-book")) {\r
+\r
+ // skip\r
+\r
+ } else if (my_string_equal(argv[i],"-pgn")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_make(): missing argument\n");\r
+\r
+ my_string_set(&pgn_file,argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-bin")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_make(): missing argument\n");\r
+\r
+ my_string_set(&bin_file,argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-max-ply")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_make(): missing argument\n");\r
+\r
+ MaxPly = atoi(argv[i]);\r
+ ASSERT(MaxPly>=0);\r
+\r
+ } else if (my_string_equal(argv[i],"-min-game")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_make(): missing argument\n");\r
+\r
+ MinGame = atoi(argv[i]);\r
+ ASSERT(MinGame>0);\r
+\r
+ } else if (my_string_equal(argv[i],"-min-score")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_make(): missing argument\n");\r
+\r
+ MinScore = atof(argv[i]) / 100.0;\r
+ ASSERT(MinScore>=0.0&&MinScore<=1.0);\r
+\r
+ } else if (my_string_equal(argv[i],"-only-white")) {\r
+\r
+ RemoveWhite = false;\r
+ RemoveBlack = true;\r
+\r
+ } else if (my_string_equal(argv[i],"-only-black")) {\r
+\r
+ RemoveWhite = true;\r
+ RemoveBlack = false;\r
+\r
+ } else if (my_string_equal(argv[i],"-uniform")) {\r
+\r
+ Uniform = true;\r
+\r
+ } else {\r
+\r
+ my_fatal("book_make(): unknown option \"%s\"\n",argv[i]);\r
+ }\r
+ }\r
+\r
+ book_clear();\r
+\r
+ printf("inserting games ...\n");\r
+ book_insert(pgn_file);\r
+\r
+ printf("filtering entries ...\n");\r
+ book_filter();\r
+\r
+ printf("sorting entries ...\n");\r
+ book_sort();\r
+\r
+ printf("saving entries ...\n");\r
+ book_save(bin_file);\r
+\r
+ printf("all done!\n");\r
+}\r
+\r
+// book_clear()\r
+\r
+static void book_clear() {\r
+\r
+ int index;\r
+\r
+ Book->alloc = 1;\r
+ Book->mask = (Book->alloc * 2) - 1;\r
+\r
+ Book->entry = (entry_t *) my_malloc(Book->alloc*sizeof(entry_t));\r
+ Book->size = 0;\r
+\r
+ Book->hash = (sint32 *) my_malloc((Book->alloc*2)*sizeof(sint32));\r
+ for (index = 0; index < Book->alloc*2; index++) {\r
+ Book->hash[index] = NIL;\r
+ }\r
+}\r
+\r
+// book_insert()\r
+\r
+static void book_insert(const char file_name[]) {\r
+\r
+ pgn_t pgn[1];\r
+ board_t board[1];\r
+ int ply;\r
+ int result;\r
+ char string[256];\r
+ int move;\r
+ int pos;\r
+\r
+ ASSERT(file_name!=NULL);\r
+\r
+ // init\r
+\r
+ pgn->game_nb=1;\r
+ // scan loop\r
+\r
+ pgn_open(pgn,file_name);\r
+\r
+ while (pgn_next_game(pgn)) {\r
+\r
+ board_start(board);\r
+ ply = 0;\r
+ result = 0;\r
+\r
+ if (false) {\r
+ } else if (my_string_equal(pgn->result,"1-0")) {\r
+ result = +1;\r
+ } else if (my_string_equal(pgn->result,"0-1")) {\r
+ result = -1;\r
+ }\r
+\r
+ while (pgn_next_move(pgn,string,256)) {\r
+\r
+ if (ply < MaxPly) {\r
+\r
+ move = move_from_san(string,board);\r
+\r
+ if (move == MoveNone || !move_is_legal(move,board)) {\r
+ my_fatal("book_insert(): illegal move \"%s\" at line %d, column %d,game %d\n",string,pgn->move_line,pgn->move_column,pgn->game_nb);\r
+ }\r
+\r
+ pos = find_entry(board,move);\r
+\r
+ Book->entry[pos].n++;\r
+ Book->entry[pos].sum += result+1;\r
+\r
+ if (Book->entry[pos].n >= COUNT_MAX) {\r
+ halve_stats(board->key);\r
+ }\r
+\r
+ move_do(board,move);\r
+ ply++;\r
+ result = -result;\r
+ }\r
+ }\r
+ pgn->game_nb++;\r
+ if (pgn->game_nb % 10000 == 0) printf("%d games ...\n",pgn->game_nb);\r
+ }\r
+\r
+ pgn_close(pgn);\r
+\r
+ printf("%d game%s.\n",pgn->game_nb,(pgn->game_nb>2)?"s":"");\r
+ printf("%d entries.\n",Book->size);\r
+\r
+ return;\r
+}\r
+\r
+// book_filter()\r
+\r
+static void book_filter() {\r
+\r
+ int src, dst;\r
+\r
+ // entry loop\r
+\r
+ dst = 0;\r
+\r
+ for (src = 0; src < Book->size; src++) {\r
+ if (keep_entry(src)) Book->entry[dst++] = Book->entry[src];\r
+ }\r
+\r
+ ASSERT(dst>=0&&dst<=Book->size);\r
+ Book->size = dst;\r
+\r
+ printf("%d entries.\n",Book->size);\r
+}\r
+\r
+// book_sort()\r
+\r
+static void book_sort() {\r
+\r
+ // sort keys for binary search\r
+\r
+ qsort(Book->entry,Book->size,sizeof(entry_t),&key_compare);\r
+}\r
+\r
+// book_save()\r
+\r
+static void book_save(const char file_name[]) {\r
+\r
+ FILE * file;\r
+ int pos;\r
+\r
+ ASSERT(file_name!=NULL);\r
+\r
+ file = fopen(file_name,"wb");\r
+ if (file == NULL) my_fatal("book_save(): can't open file \"%s\" for writing: %s\n",file_name,strerror(errno));\r
+\r
+ // entry loop\r
+\r
+ for (pos = 0; pos < Book->size; pos++) {\r
+\r
+ ASSERT(keep_entry(pos));\r
+\r
+ write_integer(file,8,Book->entry[pos].key);\r
+ write_integer(file,2,Book->entry[pos].move);\r
+ write_integer(file,2,entry_score(&Book->entry[pos]));\r
+ write_integer(file,2,0);\r
+ write_integer(file,2,0);\r
+ }\r
+\r
+ fclose(file);\r
+}\r
+\r
+// find_entry()\r
+\r
+static int find_entry(const board_t * board, int move) {\r
+\r
+ uint64 key;\r
+ int index;\r
+ int pos;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(move_is_ok(move));\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ // init\r
+\r
+ key = board->key;\r
+\r
+ // search\r
+\r
+ for (index = key & Book->mask; (pos=Book->hash[index]) != NIL; index = (index+1) & Book->mask) {\r
+\r
+ ASSERT(pos>=0&&pos<Book->size);\r
+\r
+ if (Book->entry[pos].key == key && Book->entry[pos].move == move) {\r
+ return pos; // found\r
+ }\r
+ }\r
+\r
+ // not found\r
+\r
+ ASSERT(Book->size<=Book->alloc);\r
+\r
+ if (Book->size == Book->alloc) {\r
+\r
+ // allocate more memory\r
+\r
+ resize();\r
+\r
+ for (index = key & Book->mask; Book->hash[index] != NIL; index = (index+1) & Book->mask)\r
+ ;\r
+ }\r
+\r
+ // create a new entry\r
+\r
+ ASSERT(Book->size<Book->alloc);\r
+ pos = Book->size++;\r
+\r
+ Book->entry[pos].key = key;\r
+ Book->entry[pos].move = move;\r
+ Book->entry[pos].n = 0;\r
+ Book->entry[pos].sum = 0;\r
+ Book->entry[pos].colour = board->turn;\r
+\r
+ // insert into the hash table\r
+\r
+ ASSERT(index>=0&&index<Book->alloc*2);\r
+ ASSERT(Book->hash[index]==NIL);\r
+ Book->hash[index] = pos;\r
+\r
+ ASSERT(pos>=0&&pos<Book->size);\r
+\r
+ return pos;\r
+}\r
+\r
+// resize()\r
+\r
+static void resize() {\r
+\r
+ int size;\r
+ int pos;\r
+ int index;\r
+\r
+ ASSERT(Book->size==Book->alloc);\r
+\r
+ Book->alloc *= 2;\r
+ Book->mask = (Book->alloc * 2) - 1;\r
+\r
+ size = 0;\r
+ size += Book->alloc * sizeof(entry_t);\r
+ size += (Book->alloc*2) * sizeof(sint32);\r
+ if (size >= 1048576) printf("allocating %gMB ...\n",double(size)/1048576.0);\r
+ // resize arrays\r
+\r
+ Book->entry = (entry_t *) my_realloc(Book->entry,Book->alloc*sizeof(entry_t));\r
+ Book->hash = (sint32 *) my_realloc(Book->hash,(Book->alloc*2)*sizeof(sint32));\r
+\r
+ // rebuild hash table\r
+\r
+ for (index = 0; index < Book->alloc*2; index++) {\r
+ Book->hash[index] = NIL;\r
+ }\r
+\r
+ for (pos = 0; pos < Book->size; pos++) {\r
+\r
+ for (index = Book->entry[pos].key & Book->mask; Book->hash[index] != NIL; index = (index+1) & Book->mask)\r
+ ;\r
+\r
+ ASSERT(index>=0&&index<Book->alloc*2);\r
+ Book->hash[index] = pos;\r
+ }\r
+}\r
+\r
+// halve_stats()\r
+\r
+static void halve_stats(uint64 key) {\r
+\r
+ int index;\r
+ int pos;\r
+\r
+ // search\r
+\r
+ for (index = key & Book->mask; (pos=Book->hash[index]) != NIL; index = (index+1) & Book->mask) {\r
+\r
+ ASSERT(pos>=0&&pos<Book->size);\r
+\r
+ if (Book->entry[pos].key == key) {\r
+ Book->entry[pos].n = (Book->entry[pos].n + 1) / 2;\r
+ Book->entry[pos].sum = (Book->entry[pos].sum + 1) / 2;\r
+ }\r
+ }\r
+}\r
+\r
+// keep_entry()\r
+\r
+static bool keep_entry(int pos) {\r
+\r
+ const entry_t * entry;\r
+ int colour;\r
+ double score;\r
+\r
+ ASSERT(pos>=0&&pos<Book->size);\r
+\r
+ entry = &Book->entry[pos];\r
+\r
+ // if (entry->n == 0) return false;\r
+ if (entry->n < MinGame) return false;\r
+\r
+ if (entry->sum == 0) return false;\r
+\r
+ score = (double(entry->sum) / double(entry->n)) / 2.0;\r
+ ASSERT(score>=0.0&&score<=1.0);\r
+\r
+ if (score < MinScore) return false;\r
+\r
+ colour = entry->colour;\r
+\r
+ if ((RemoveWhite && colour_is_white(colour))\r
+ || (RemoveBlack && colour_is_black(colour))) {\r
+ return false;\r
+ }\r
+\r
+ if (entry_score(entry) == 0) return false; // REMOVE ME?\r
+\r
+ return true;\r
+}\r
+\r
+// entry_score()\r
+\r
+static int entry_score(const entry_t * entry) {\r
+\r
+ int score;\r
+\r
+ ASSERT(entry!=NULL);\r
+\r
+ // score = entry->n; // popularity\r
+ score = entry->sum; // "expectancy"\r
+\r
+ if (Uniform) score = 1;\r
+\r
+ ASSERT(score>=0);\r
+\r
+ return score;\r
+}\r
+\r
+// key_compare()\r
+\r
+static int key_compare(const void * p1, const void * p2) {\r
+\r
+ const entry_t * entry_1, * entry_2;\r
+\r
+ ASSERT(p1!=NULL);\r
+ ASSERT(p2!=NULL);\r
+\r
+ entry_1 = (const entry_t *) p1;\r
+ entry_2 = (const entry_t *) p2;\r
+\r
+ if (entry_1->key > entry_2->key) {\r
+ return +1;\r
+ } else if (entry_1->key < entry_2->key) {\r
+ return -1;\r
+ } else {\r
+ return entry_score(entry_2) - entry_score(entry_1); // highest score first\r
+ }\r
+}\r
+\r
+// write_integer()\r
+\r
+static void write_integer(FILE * file, int size, uint64 n) {\r
+\r
+ int i;\r
+ int b;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(size>0&&size<=8);\r
+ ASSERT(size==8||n>>(size*8)==0);\r
+\r
+ for (i = size-1; i >= 0; i--) {\r
+ b = (n >> (i*8)) & 0xFF;\r
+ ASSERT(b>=0&&b<256);\r
+ fputc(b,file);\r
+ }\r
+}\r
+\r
+// end of book_make.cpp\r
+\r
--- /dev/null
+\r
+// book_make.h\r
+\r
+#ifndef BOOK_MAKE_H\r
+#define BOOK_MAKE_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void book_make (int argc, char * argv[]);\r
+\r
+#endif // !defined BOOK_MAKE_H\r
+\r
+// end of book_make.h\r
+\r
--- /dev/null
+\r
+// book_merge.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "book_merge.h"\r
+#include "util.h"\r
+\r
+// types\r
+\r
+struct book_t {\r
+ FILE * file;\r
+ int size;\r
+};\r
+\r
+struct entry_t {\r
+ uint64 key;\r
+ uint16 move;\r
+ uint16 count;\r
+ uint16 n;\r
+ uint16 sum;\r
+};\r
+\r
+// variables\r
+\r
+static book_t In1[1];\r
+static book_t In2[1];\r
+static book_t Out[1];\r
+\r
+// prototypes\r
+\r
+static void book_clear (book_t * book);\r
+\r
+static void book_open (book_t * book, const char file_name[], const char mode[]);\r
+static void book_close (book_t * book);\r
+\r
+static bool read_entry (book_t * book, entry_t * entry, int n);\r
+static void write_entry (book_t * book, const entry_t * entry);\r
+\r
+static uint64 read_integer (FILE * file, int size);\r
+static void write_integer (FILE * file, int size, uint64 n);\r
+\r
+// functions\r
+\r
+// book_merge()\r
+\r
+void book_merge(int argc, char * argv[]) {\r
+\r
+ int i;\r
+ const char * in_file_1;\r
+ const char * in_file_2;\r
+ const char * out_file;\r
+ int i1, i2;\r
+ bool b1, b2;\r
+ entry_t e1[1], e2[1];\r
+ int skip;\r
+\r
+ in_file_1 = NULL;\r
+ my_string_clear(&in_file_1);\r
+\r
+ in_file_2 = NULL;\r
+ my_string_clear(&in_file_2);\r
+\r
+ out_file = NULL;\r
+ my_string_set(&out_file,"out.bin");\r
+\r
+ for (i = 1; i < argc; i++) {\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(argv[i],"merge-book")) {\r
+\r
+ // skip\r
+\r
+ } else if (my_string_equal(argv[i],"-in1")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_merge(): missing argument\n");\r
+\r
+ my_string_set(&in_file_1,argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-in2")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_merge(): missing argument\n");\r
+\r
+ my_string_set(&in_file_2,argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-out")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("book_merge(): missing argument\n");\r
+\r
+ my_string_set(&out_file,argv[i]);\r
+\r
+ } else {\r
+\r
+ my_fatal("book_merge(): unknown option \"%s\"\n",argv[i]);\r
+ }\r
+ }\r
+\r
+ book_clear(In1);\r
+ book_clear(In2);\r
+ book_clear(Out);\r
+\r
+ book_open(In1,in_file_1,"rb");\r
+ book_open(In2,in_file_2,"rb");\r
+ book_open(Out,out_file,"wb");\r
+\r
+ skip = 0;\r
+\r
+ i1 = 0;\r
+ i2 = 0;\r
+\r
+ while (true) {\r
+\r
+ b1 = read_entry(In1,e1,i1);\r
+ b2 = read_entry(In2,e2,i2);\r
+\r
+ if (false) {\r
+\r
+ } else if (!b1 && !b2) {\r
+\r
+ break;\r
+\r
+ } else if (b1 && !b2) {\r
+\r
+ write_entry(Out,e1);\r
+ i1++;\r
+\r
+ } else if (b2 && !b1) {\r
+\r
+ write_entry(Out,e2);\r
+ i2++;\r
+\r
+ } else {\r
+\r
+ ASSERT(b1);\r
+ ASSERT(b2);\r
+\r
+ if (false) {\r
+ } else if (e1->key < e2->key) {\r
+ write_entry(Out,e1);\r
+ i1++;\r
+ } else if (e1->key > e2->key) {\r
+ write_entry(Out,e2);\r
+ i2++;\r
+ } else {\r
+ ASSERT(e1->key==e2->key);\r
+ skip++;\r
+ i2++;\r
+ }\r
+ }\r
+ }\r
+\r
+ book_close(In1);\r
+ book_close(In2);\r
+ book_close(Out);\r
+\r
+ if (skip != 0) {\r
+ printf("skipped %d entr%s.\n",skip,(skip>1)?"ies":"y");\r
+ }\r
+\r
+ printf("done!\n");\r
+}\r
+\r
+// book_clear()\r
+\r
+static void book_clear(book_t * book) {\r
+\r
+ ASSERT(book!=NULL);\r
+\r
+ book->file = NULL;\r
+ book->size = 0;\r
+}\r
+\r
+// book_open()\r
+\r
+static void book_open(book_t * book, const char file_name[], const char mode[]) {\r
+\r
+ ASSERT(book!=NULL);\r
+ ASSERT(file_name!=NULL);\r
+ ASSERT(mode!=NULL);\r
+\r
+ book->file = fopen(file_name,mode);\r
+ if (book->file == NULL) my_fatal("book_open(): can't open file \"%s\": %s\n",file_name,strerror(errno));\r
+\r
+ if (fseek(book->file,0,SEEK_END) == -1) {\r
+ my_fatal("book_open(): fseek(): %s\n",strerror(errno));\r
+ }\r
+\r
+ book->size = ftell(book->file) / 16;\r
+}\r
+\r
+// book_close()\r
+\r
+static void book_close(book_t * book) {\r
+\r
+ ASSERT(book!=NULL);\r
+\r
+ if (fclose(book->file) == EOF) {\r
+ my_fatal("book_close(): fclose(): %s\n",strerror(errno));\r
+ }\r
+}\r
+\r
+// read_entry()\r
+\r
+static bool read_entry(book_t * book, entry_t * entry, int n) {\r
+\r
+ ASSERT(book!=NULL);\r
+ ASSERT(entry!=NULL);\r
+\r
+ if (n < 0 || n >= book->size) return false;\r
+\r
+ ASSERT(n>=0&&n<book->size);\r
+\r
+ if (fseek(book->file,n*16,SEEK_SET) == -1) {\r
+ my_fatal("read_entry(): fseek(): %s\n",strerror(errno));\r
+ }\r
+\r
+ entry->key = read_integer(book->file,8);\r
+ entry->move = read_integer(book->file,2);\r
+ entry->count = read_integer(book->file,2);\r
+ entry->n = read_integer(book->file,2);\r
+ entry->sum = read_integer(book->file,2);\r
+\r
+ return true;\r
+}\r
+\r
+// write_entry()\r
+\r
+static void write_entry(book_t * book, const entry_t * entry) {\r
+\r
+ ASSERT(book!=NULL);\r
+ ASSERT(entry!=NULL);\r
+\r
+ write_integer(book->file,8,entry->key);\r
+ write_integer(book->file,2,entry->move);\r
+ write_integer(book->file,2,entry->count);\r
+ write_integer(book->file,2,entry->n);\r
+ write_integer(book->file,2,entry->sum);\r
+}\r
+\r
+// read_integer()\r
+\r
+static uint64 read_integer(FILE * file, int size) {\r
+\r
+ uint64 n;\r
+ int i;\r
+ int b;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(size>0&&size<=8);\r
+\r
+ n = 0;\r
+\r
+ for (i = 0; i < size; i++) {\r
+\r
+ b = fgetc(file);\r
+\r
+ if (b == EOF) {\r
+ if (feof(file)) {\r
+ my_fatal("read_integer(): fgetc(): EOF reached\n");\r
+ } else { // error\r
+ my_fatal("read_integer(): fgetc(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+\r
+ ASSERT(b>=0&&b<256);\r
+ n = (n << 8) | b;\r
+ }\r
+\r
+ return n;\r
+}\r
+\r
+// write_integer()\r
+\r
+static void write_integer(FILE * file, int size, uint64 n) {\r
+\r
+ int i;\r
+ int b;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(size>0&&size<=8);\r
+ ASSERT(size==8||n>>(size*8)==0);\r
+\r
+ for (i = size-1; i >= 0; i--) {\r
+\r
+ b = (n >> (i*8)) & 0xFF;\r
+ ASSERT(b>=0&&b<256);\r
+\r
+ if (fputc(b,file) == EOF) {\r
+ my_fatal("write_integer(): fputc(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+}\r
+\r
+// end of book_merge.cpp\r
+\r
--- /dev/null
+\r
+// book_merge.h\r
+\r
+#ifndef BOOK_MERGE_H\r
+#define BOOK_MERGE_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void book_merge (int argc, char * argv[]);\r
+\r
+#endif // !defined BOOK_MERGE_H\r
+\r
+// end of book_merge.h\r
+\r
--- /dev/null
+\r
+// colour.cpp\r
+\r
+// includes\r
+\r
+#include "colour.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+// colour_is_ok()\r
+\r
+bool colour_is_ok(int colour) {\r
+\r
+ return colour == Black || colour == White;\r
+}\r
+\r
+// colour_is_white()\r
+\r
+bool colour_is_white(int colour) {\r
+\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return colour == White;\r
+}\r
+\r
+// colour_is_black()\r
+\r
+bool colour_is_black(int colour) {\r
+\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return colour == Black;\r
+}\r
+\r
+// colour_equal()\r
+\r
+bool colour_equal(int colour_1, int colour_2) {\r
+\r
+ ASSERT(colour_is_ok(colour_2));\r
+\r
+ return (colour_1 & colour_2) != 0;\r
+}\r
+\r
+// colour_opp()\r
+\r
+int colour_opp(int colour) {\r
+\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return colour ^ (BlackFlag^WhiteFlag);\r
+}\r
+\r
+// end of colour.cpp\r
+\r
--- /dev/null
+\r
+// colour.h\r
+\r
+#ifndef COLOUR_H\r
+#define COLOUR_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int BlackFlag = 1 << 0;\r
+const int WhiteFlag = 1 << 1;\r
+\r
+const int ColourNone = 0;\r
+const int Black = BlackFlag;\r
+const int White = WhiteFlag;\r
+const int ColourNb = 3;\r
+\r
+// functions\r
+\r
+extern bool colour_is_ok (int colour);\r
+\r
+extern bool colour_is_white (int colour);\r
+extern bool colour_is_black (int colour);\r
+extern bool colour_equal (int colour_1, int colour_2);\r
+\r
+extern int colour_opp (int colour);\r
+\r
+#endif // !defined COLOUR_H\r
+\r
+// end of colour.h\r
+\r
--- /dev/null
+#! /bin/sh
+# Attempt to guess a canonical system name.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2007-07-22'
+
+# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub. If it succeeds, it prints the system name on stdout, and
+# exits with 0. Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help" >&2
+ exit 1 ;;
+ * )
+ break ;;
+ esac
+done
+
+if test $# != 0; then
+ echo "$me: too many arguments$help" >&2
+ exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# Portable tmp directory creation inspired by the Autoconf team.
+
+set_cc_for_build='
+trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
+trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
+: ${TMPDIR=/tmp} ;
+ { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
+ { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
+ { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
+ { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
+dummy=$tmp/dummy ;
+tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,) echo "int x;" > $dummy.c ;
+ for c in cc gcc c89 c99 ; do
+ if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
+ CC_FOR_BUILD="$c"; break ;
+ fi ;
+ done ;
+ if test x"$CC_FOR_BUILD" = x ; then
+ CC_FOR_BUILD=no_compiler_found ;
+ fi
+ ;;
+ ,,*) CC_FOR_BUILD=$CC ;;
+ ,*,*) CC_FOR_BUILD=$HOST_CC ;;
+esac ; set_cc_for_build= ;'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi@noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+ PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+ *:NetBSD:*:*)
+ # NetBSD (nbsd) targets should (where applicable) match one or
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
+ # switched to ELF, *-*-netbsd* would select the old
+ # object file format. This provides both forward
+ # compatibility and a consistent mechanism for selecting the
+ # object file format.
+ #
+ # Note: NetBSD doesn't particularly care about the vendor
+ # portion of the name. We always set it to "unknown".
+ sysctl="sysctl -n hw.machine_arch"
+ UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+ /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+ case "${UNAME_MACHINE_ARCH}" in
+ armeb) machine=armeb-unknown ;;
+ arm*) machine=arm-unknown ;;
+ sh3el) machine=shl-unknown ;;
+ sh3eb) machine=sh-unknown ;;
+ sh5el) machine=sh5le-unknown ;;
+ *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+ esac
+ # The Operating System including object format, if it has switched
+ # to ELF recently, or will in the future.
+ case "${UNAME_MACHINE_ARCH}" in
+ arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+ eval $set_cc_for_build
+ if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+ | grep __ELF__ >/dev/null
+ then
+ # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+ # Return netbsd for either. FIX?
+ os=netbsd
+ else
+ os=netbsdelf
+ fi
+ ;;
+ *)
+ os=netbsd
+ ;;
+ esac
+ # The OS release
+ # Debian GNU/NetBSD machines have a different userland, and
+ # thus, need a distinct triplet. However, they do not need
+ # kernel version information, so it can be replaced with a
+ # suitable tag, in the style of linux-gnu.
+ case "${UNAME_VERSION}" in
+ Debian*)
+ release='-gnu'
+ ;;
+ *)
+ release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+ ;;
+ esac
+ # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+ # contains redundant information, the shorter form:
+ # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+ echo "${machine}-${os}${release}"
+ exit ;;
+ *:OpenBSD:*:*)
+ UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
+ echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
+ exit ;;
+ *:ekkoBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
+ exit ;;
+ *:SolidBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
+ exit ;;
+ macppc:MirBSD:*:*)
+ echo powerpc-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ *:MirBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
+ exit ;;
+ alpha:OSF1:*:*)
+ case $UNAME_RELEASE in
+ *4.0)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+ ;;
+ *5.*)
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ ;;
+ esac
+ # According to Compaq, /usr/sbin/psrinfo has been available on
+ # OSF/1 and Tru64 systems produced since 1995. I hope that
+ # covers most systems running today. This code pipes the CPU
+ # types through head -n 1, so we only detect the type of CPU 0.
+ ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
+ case "$ALPHA_CPU_TYPE" in
+ "EV4 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "EV4.5 (21064)")
+ UNAME_MACHINE="alpha" ;;
+ "LCA4 (21066/21068)")
+ UNAME_MACHINE="alpha" ;;
+ "EV5 (21164)")
+ UNAME_MACHINE="alphaev5" ;;
+ "EV5.6 (21164A)")
+ UNAME_MACHINE="alphaev56" ;;
+ "EV5.6 (21164PC)")
+ UNAME_MACHINE="alphapca56" ;;
+ "EV5.7 (21164PC)")
+ UNAME_MACHINE="alphapca57" ;;
+ "EV6 (21264)")
+ UNAME_MACHINE="alphaev6" ;;
+ "EV6.7 (21264A)")
+ UNAME_MACHINE="alphaev67" ;;
+ "EV6.8CB (21264C)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8AL (21264B)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.8CX (21264D)")
+ UNAME_MACHINE="alphaev68" ;;
+ "EV6.9A (21264/EV69A)")
+ UNAME_MACHINE="alphaev69" ;;
+ "EV7 (21364)")
+ UNAME_MACHINE="alphaev7" ;;
+ "EV7.9 (21364A)")
+ UNAME_MACHINE="alphaev79" ;;
+ esac
+ # A Pn.n version is a patched version.
+ # A Vn.n version is a released version.
+ # A Tn.n version is a released field test version.
+ # A Xn.n version is an unreleased experimental baselevel.
+ # 1.2 uses "1.2" for uname -r.
+ echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ exit ;;
+ Alpha\ *:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # Should we change UNAME_MACHINE based on the output of uname instead
+ # of the specific Alpha model?
+ echo alpha-pc-interix
+ exit ;;
+ 21064:Windows_NT:50:3)
+ echo alpha-dec-winnt3.5
+ exit ;;
+ Amiga*:UNIX_System_V:4.0:*)
+ echo m68k-unknown-sysv4
+ exit ;;
+ *:[Aa]miga[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-amigaos
+ exit ;;
+ *:[Mm]orph[Oo][Ss]:*:*)
+ echo ${UNAME_MACHINE}-unknown-morphos
+ exit ;;
+ *:OS/390:*:*)
+ echo i370-ibm-openedition
+ exit ;;
+ *:z/VM:*:*)
+ echo s390-ibm-zvmoe
+ exit ;;
+ *:OS400:*:*)
+ echo powerpc-ibm-os400
+ exit ;;
+ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+ echo arm-acorn-riscix${UNAME_RELEASE}
+ exit ;;
+ arm:riscos:*:*|arm:RISCOS:*:*)
+ echo arm-unknown-riscos
+ exit ;;
+ SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+ echo hppa1.1-hitachi-hiuxmpp
+ exit ;;
+ Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+ # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+ if test "`(/bin/universe) 2>/dev/null`" = att ; then
+ echo pyramid-pyramid-sysv3
+ else
+ echo pyramid-pyramid-bsd
+ fi
+ exit ;;
+ NILE*:*:*:dcosx)
+ echo pyramid-pyramid-svr4
+ exit ;;
+ DRS?6000:unix:4.0:6*)
+ echo sparc-icl-nx6
+ exit ;;
+ DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
+ case `/usr/bin/uname -p` in
+ sparc) echo sparc-icl-nx7; exit ;;
+ esac ;;
+ sun4H:SunOS:5.*:*)
+ echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+ echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:6*:*)
+ # According to config.sub, this is the proper way to canonicalize
+ # SunOS6. Hard to guess exactly what SunOS6 will be like, but
+ # it's likely to be more like Solaris than SunOS4.
+ echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ sun4*:SunOS:*:*)
+ case "`/usr/bin/arch -k`" in
+ Series*|S4*)
+ UNAME_RELEASE=`uname -v`
+ ;;
+ esac
+ # Japanese Language versions have a version number like `4.1.3-JL'.
+ echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+ exit ;;
+ sun3*:SunOS:*:*)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ exit ;;
+ sun*:*:4.2BSD:*)
+ UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+ test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+ case "`/bin/arch`" in
+ sun3)
+ echo m68k-sun-sunos${UNAME_RELEASE}
+ ;;
+ sun4)
+ echo sparc-sun-sunos${UNAME_RELEASE}
+ ;;
+ esac
+ exit ;;
+ aushp:SunOS:*:*)
+ echo sparc-auspex-sunos${UNAME_RELEASE}
+ exit ;;
+ # The situation for MiNT is a little confusing. The machine name
+ # can be virtually everything (everything which is not
+ # "atarist" or "atariste" at least should have a processor
+ # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
+ # to the lowercase version "mint" (or "freemint"). Finally
+ # the system name "TOS" denotes a system which is actually not
+ # MiNT. But MiNT is downward compatible to TOS, so this should
+ # be no problem.
+ atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+ echo m68k-atari-mint${UNAME_RELEASE}
+ exit ;;
+ milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
+ hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
+ *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
+ m68k:machten:*:*)
+ echo m68k-apple-machten${UNAME_RELEASE}
+ exit ;;
+ powerpc:machten:*:*)
+ echo powerpc-apple-machten${UNAME_RELEASE}
+ exit ;;
+ RISC*:Mach:*:*)
+ echo mips-dec-mach_bsd4.3
+ exit ;;
+ RISC*:ULTRIX:*:*)
+ echo mips-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ VAX*:ULTRIX*:*:*)
+ echo vax-dec-ultrix${UNAME_RELEASE}
+ exit ;;
+ 2020:CLIX:*:* | 2430:CLIX:*:*)
+ echo clipper-intergraph-clix${UNAME_RELEASE}
+ exit ;;
+ mips:*:*:UMIPS | mips:*:*:RISCos)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h> /* for printf() prototype */
+ int main (int argc, char *argv[]) {
+#else
+ int main (argc, argv) int argc; char *argv[]; {
+#endif
+ #if defined (host_mips) && defined (MIPSEB)
+ #if defined (SYSTYPE_SYSV)
+ printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_SVR4)
+ printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+ #endif
+ #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+ printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+ #endif
+ #endif
+ exit (-1);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c &&
+ dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
+ SYSTEM_NAME=`$dummy $dummyarg` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo mips-mips-riscos${UNAME_RELEASE}
+ exit ;;
+ Motorola:PowerMAX_OS:*:*)
+ echo powerpc-motorola-powermax
+ exit ;;
+ Motorola:*:4.3:PL8-*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
+ echo powerpc-harris-powermax
+ exit ;;
+ Night_Hawk:Power_UNIX:*:*)
+ echo powerpc-harris-powerunix
+ exit ;;
+ m88k:CX/UX:7*:*)
+ echo m88k-harris-cxux7
+ exit ;;
+ m88k:*:4*:R4*)
+ echo m88k-motorola-sysv4
+ exit ;;
+ m88k:*:3*:R3*)
+ echo m88k-motorola-sysv3
+ exit ;;
+ AViiON:dgux:*:*)
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
+ if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+ then
+ if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+ [ ${TARGET_BINARY_INTERFACE}x = x ]
+ then
+ echo m88k-dg-dgux${UNAME_RELEASE}
+ else
+ echo m88k-dg-dguxbcs${UNAME_RELEASE}
+ fi
+ else
+ echo i586-dg-dgux${UNAME_RELEASE}
+ fi
+ exit ;;
+ M88*:DolphinOS:*:*) # DolphinOS (SVR3)
+ echo m88k-dolphin-sysv3
+ exit ;;
+ M88*:*:R3*:*)
+ # Delta 88k system running SVR3
+ echo m88k-motorola-sysv3
+ exit ;;
+ XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+ echo m88k-tektronix-sysv3
+ exit ;;
+ Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+ echo m68k-tektronix-bsd
+ exit ;;
+ *:IRIX*:*:*)
+ echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+ exit ;;
+ ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+ echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
+ exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
+ i*86:AIX:*:*)
+ echo i386-ibm-aix
+ exit ;;
+ ia64:AIX:*:*)
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:2:3)
+ if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <sys/systemcfg.h>
+
+ main()
+ {
+ if (!__power_pc())
+ exit(1);
+ puts("powerpc-ibm-aix3.2.5");
+ exit(0);
+ }
+EOF
+ if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
+ then
+ echo "$SYSTEM_NAME"
+ else
+ echo rs6000-ibm-aix3.2.5
+ fi
+ elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+ echo rs6000-ibm-aix3.2.4
+ else
+ echo rs6000-ibm-aix3.2
+ fi
+ exit ;;
+ *:AIX:*:[45])
+ IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+ if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+ IBM_ARCH=rs6000
+ else
+ IBM_ARCH=powerpc
+ fi
+ if [ -x /usr/bin/oslevel ] ; then
+ IBM_REV=`/usr/bin/oslevel`
+ else
+ IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+ fi
+ echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+ exit ;;
+ *:AIX:*:*)
+ echo rs6000-ibm-aix
+ exit ;;
+ ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+ echo romp-ibm-bsd4.4
+ exit ;;
+ ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
+ echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
+ exit ;; # report: romp-ibm BSD 4.3
+ *:BOSX:*:*)
+ echo rs6000-bull-bosx
+ exit ;;
+ DPX/2?00:B.O.S.:*:*)
+ echo m68k-bull-sysv3
+ exit ;;
+ 9000/[34]??:4.3bsd:1.*:*)
+ echo m68k-hp-bsd
+ exit ;;
+ hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+ echo m68k-hp-bsd4.4
+ exit ;;
+ 9000/[34678]??:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ case "${UNAME_MACHINE}" in
+ 9000/31? ) HP_ARCH=m68000 ;;
+ 9000/[34]?? ) HP_ARCH=m68k ;;
+ 9000/[678][0-9][0-9])
+ if [ -x /usr/bin/getconf ]; then
+ sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
+ '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
+ esac ;;
+ esac
+ fi
+ if [ "${HP_ARCH}" = "" ]; then
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
+
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
+
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
+EOF
+ (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
+ test -z "$HP_ARCH" && HP_ARCH=hppa
+ fi ;;
+ esac
+ if [ ${HP_ARCH} = "hppa2.0w" ]
+ then
+ eval $set_cc_for_build
+
+ # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
+ # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
+ # generating 64-bit code. GNU and HP use different nomenclature:
+ #
+ # $ CC_FOR_BUILD=cc ./config.guess
+ # => hppa2.0w-hp-hpux11.23
+ # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
+ # => hppa64-hp-hpux11.23
+
+ if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
+ grep __LP64__ >/dev/null
+ then
+ HP_ARCH="hppa2.0w"
+ else
+ HP_ARCH="hppa64"
+ fi
+ fi
+ echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+ exit ;;
+ ia64:HP-UX:*:*)
+ HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+ echo ia64-hp-hpux${HPUX_REV}
+ exit ;;
+ 3050*:HI-UX:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <unistd.h>
+ int
+ main ()
+ {
+ long cpu = sysconf (_SC_CPU_VERSION);
+ /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+ true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
+ results, however. */
+ if (CPU_IS_PA_RISC (cpu))
+ {
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+ case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+ default: puts ("hppa-hitachi-hiuxwe2"); break;
+ }
+ }
+ else if (CPU_IS_HP_MC68K (cpu))
+ puts ("m68k-hitachi-hiuxwe2");
+ else puts ("unknown-hitachi-hiuxwe2");
+ exit (0);
+ }
+EOF
+ $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+ echo unknown-hitachi-hiuxwe2
+ exit ;;
+ 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+ echo hppa1.1-hp-bsd
+ exit ;;
+ 9000/8??:4.3bsd:*:*)
+ echo hppa1.0-hp-bsd
+ exit ;;
+ *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+ echo hppa1.0-hp-mpeix
+ exit ;;
+ hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+ echo hppa1.1-hp-osf
+ exit ;;
+ hp8??:OSF1:*:*)
+ echo hppa1.0-hp-osf
+ exit ;;
+ i*86:OSF1:*:*)
+ if [ -x /usr/sbin/sysversion ] ; then
+ echo ${UNAME_MACHINE}-unknown-osf1mk
+ else
+ echo ${UNAME_MACHINE}-unknown-osf1
+ fi
+ exit ;;
+ parisc*:Lites*:*:*)
+ echo hppa1.1-hp-lites
+ exit ;;
+ C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+ echo c1-convex-bsd
+ exit ;;
+ C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+ echo c34-convex-bsd
+ exit ;;
+ C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+ echo c38-convex-bsd
+ exit ;;
+ C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+ echo c4-convex-bsd
+ exit ;;
+ CRAY*Y-MP:*:*:*)
+ echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*[A-Z]90:*:*:*)
+ echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+ -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*TS:*:*:*)
+ echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*T3E:*:*:*)
+ echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ CRAY*SV1:*:*:*)
+ echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ *:UNICOS/mp:*:*)
+ echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+ exit ;;
+ F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+ FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ 5000:UNIX_System_V:4.*:*)
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
+ i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+ echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+ exit ;;
+ sparc*:BSD/OS:*:*)
+ echo sparc-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:BSD/OS:*:*)
+ echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+ exit ;;
+ *:FreeBSD:*:*)
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ amd64)
+ echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ *)
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ esac
+ exit ;;
+ i*:CYGWIN*:*)
+ echo ${UNAME_MACHINE}-pc-cygwin
+ exit ;;
+ *:MINGW*:*)
+ echo ${UNAME_MACHINE}-pc-mingw32
+ exit ;;
+ i*:windows32*:*)
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
+ exit ;;
+ i*:PW*:*)
+ echo ${UNAME_MACHINE}-pc-pw32
+ exit ;;
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
+ x86)
+ echo i586-pc-interix${UNAME_RELEASE}
+ exit ;;
+ EM64T | authenticamd)
+ echo x86_64-unknown-interix${UNAME_RELEASE}
+ exit ;;
+ esac ;;
+ [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
+ echo i${UNAME_MACHINE}-pc-mks
+ exit ;;
+ i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+ # How do we know it's Interix rather than the generic POSIX subsystem?
+ # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+ # UNAME_MACHINE based on the output of uname instead of i386?
+ echo i586-pc-interix
+ exit ;;
+ i*:UWIN*:*)
+ echo ${UNAME_MACHINE}-pc-uwin
+ exit ;;
+ amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
+ echo x86_64-unknown-cygwin
+ exit ;;
+ p*:CYGWIN*:*)
+ echo powerpcle-unknown-cygwin
+ exit ;;
+ prep*:SunOS:5.*:*)
+ echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
+ *:GNU:*:*)
+ # the GNU system
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ exit ;;
+ *:GNU/*:*:*)
+ # other systems with GNU libc and userland
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
+ exit ;;
+ i*86:Minix:*:*)
+ echo ${UNAME_MACHINE}-pc-minix
+ exit ;;
+ arm*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ avr32*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ cris:Linux:*:*)
+ echo cris-axis-linux-gnu
+ exit ;;
+ crisv32:Linux:*:*)
+ echo crisv32-axis-linux-gnu
+ exit ;;
+ frv:Linux:*:*)
+ echo frv-unknown-linux-gnu
+ exit ;;
+ ia64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m32r*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ m68*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ mips:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips
+ #undef mipsel
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mipsel
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ or32:Linux:*:*)
+ echo or32-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
+ exit ;;
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
+ parisc:Linux:*:* | hppa:Linux:*:*)
+ # Look for CPU level
+ case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
+ esac
+ exit ;;
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
+ exit ;;
+ s390:Linux:*:* | s390x:Linux:*:*)
+ echo ${UNAME_MACHINE}-ibm-linux
+ exit ;;
+ sh64*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sh*:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ sparc:Linux:*:* | sparc64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ vax:Linux:*:*)
+ echo ${UNAME_MACHINE}-dec-linux-gnu
+ exit ;;
+ x86_64:Linux:*:*)
+ echo x86_64-unknown-linux-gnu
+ exit ;;
+ xtensa:Linux:*:*)
+ echo xtensa-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ coff-i386)
+ echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
+ i*86:DYNIX/ptx:4*:*)
+ # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+ # earlier versions are messed up and put the nodename in both
+ # sysname and nodename.
+ echo i386-sequent-sysv4
+ exit ;;
+ i*86:UNIX_SV:4.2MP:2.*)
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
+ # I just have to hope. -- rms.
+ # Use sysv4.2uw... so that sysv4* matches it.
+ echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+ exit ;;
+ i*86:OS/2:*:*)
+ # If we were able to find `uname', then EMX Unix compatibility
+ # is probably installed.
+ echo ${UNAME_MACHINE}-pc-os2-emx
+ exit ;;
+ i*86:XTS-300:*:STOP)
+ echo ${UNAME_MACHINE}-unknown-stop
+ exit ;;
+ i*86:atheos:*:*)
+ echo ${UNAME_MACHINE}-unknown-atheos
+ exit ;;
+ i*86:syllable:*:*)
+ echo ${UNAME_MACHINE}-pc-syllable
+ exit ;;
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ echo i386-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ i*86:*DOS:*:*)
+ echo ${UNAME_MACHINE}-pc-msdosdjgpp
+ exit ;;
+ i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+ UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+ if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+ echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+ else
+ echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+ fi
+ exit ;;
+ i*86:*:5:[678]*)
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ case `/bin/uname -X | grep "^Machine"` in
+ *486*) UNAME_MACHINE=i486 ;;
+ *Pentium) UNAME_MACHINE=i586 ;;
+ *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+ esac
+ echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+ exit ;;
+ i*86:*:3.2:*)
+ if test -f /usr/options/cb.name; then
+ UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+ echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+ elif /bin/uname -X 2>/dev/null >/dev/null ; then
+ UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+ (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+ (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+ && UNAME_MACHINE=i586
+ (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+ && UNAME_MACHINE=i686
+ (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+ && UNAME_MACHINE=i686
+ echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+ else
+ echo ${UNAME_MACHINE}-pc-sysv32
+ fi
+ exit ;;
+ pc:*:*:*)
+ # Left here for compatibility:
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
+ Intel:Mach:3*:*)
+ echo i386-pc-mach3
+ exit ;;
+ paragon:*:*:*)
+ echo i860-intel-osf1
+ exit ;;
+ i860:*:4.*:*) # i860-SVR4
+ if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+ echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+ else # Add other i860-SVR4 vendors below as they are discovered.
+ echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
+ fi
+ exit ;;
+ mini*:CTIX:SYS*5:*)
+ # "miniframe"
+ echo m68010-convergent-sysv
+ exit ;;
+ mc68k:UNIX:SYSTEM5:3.51m)
+ echo m68k-convergent-sysv
+ exit ;;
+ M680?0:D-NIX:5.3:*)
+ echo m68k-diab-dnix
+ exit ;;
+ M68*:*:R3V[5678]*:*)
+ test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
+ 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
+ OS_REL=''
+ test -r /etc/.relid \
+ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
+ m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+ echo m68k-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ mc68030:UNIX_System_V:4.*:*)
+ echo m68k-atari-sysv4
+ exit ;;
+ TSUNAMI:LynxOS:2.*:*)
+ echo sparc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ rs6000:LynxOS:2.*:*)
+ echo rs6000-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ echo powerpc-unknown-lynxos${UNAME_RELEASE}
+ exit ;;
+ SM[BE]S:UNIX_SV:*:*)
+ echo mips-dde-sysv${UNAME_RELEASE}
+ exit ;;
+ RM*:ReliantUNIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ RM*:SINIX-*:*:*)
+ echo mips-sni-sysv4
+ exit ;;
+ *:SINIX-*:*:*)
+ if uname -p 2>/dev/null >/dev/null ; then
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ echo ${UNAME_MACHINE}-sni-sysv4
+ else
+ echo ns32k-sni-sysv
+ fi
+ exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
+ *:UNIX_System_V:4*:FTX*)
+ # From Gerald Hewes <hewes@openmarket.com>.
+ # How about differentiating between stratus architectures? -djm
+ echo hppa1.1-stratus-sysv4
+ exit ;;
+ *:*:*:FTX*)
+ # From seanf@swdc.stratus.com.
+ echo i860-stratus-sysv4
+ exit ;;
+ i*86:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo ${UNAME_MACHINE}-stratus-vos
+ exit ;;
+ *:VOS:*:*)
+ # From Paul.Green@stratus.com.
+ echo hppa1.1-stratus-vos
+ exit ;;
+ mc68*:A/UX:*:*)
+ echo m68k-apple-aux${UNAME_RELEASE}
+ exit ;;
+ news*:NEWS-OS:6*:*)
+ echo mips-sony-newsos6
+ exit ;;
+ R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+ if [ -d /usr/nec ]; then
+ echo mips-nec-sysv${UNAME_RELEASE}
+ else
+ echo mips-unknown-sysv${UNAME_RELEASE}
+ fi
+ exit ;;
+ BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
+ echo powerpc-be-beos
+ exit ;;
+ BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
+ echo powerpc-apple-beos
+ exit ;;
+ BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
+ echo i586-pc-beos
+ exit ;;
+ SX-4:SUPER-UX:*:*)
+ echo sx4-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-5:SUPER-UX:*:*)
+ echo sx5-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-6:SUPER-UX:*:*)
+ echo sx6-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-7:SUPER-UX:*:*)
+ echo sx7-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8:SUPER-UX:*:*)
+ echo sx8-nec-superux${UNAME_RELEASE}
+ exit ;;
+ SX-8R:SUPER-UX:*:*)
+ echo sx8r-nec-superux${UNAME_RELEASE}
+ exit ;;
+ Power*:Rhapsody:*:*)
+ echo powerpc-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Rhapsody:*:*)
+ echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+ exit ;;
+ *:Darwin:*:*)
+ UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
+ echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
+ exit ;;
+ *:procnto*:*:* | *:QNX:[0123456789]*:*)
+ UNAME_PROCESSOR=`uname -p`
+ if test "$UNAME_PROCESSOR" = "x86"; then
+ UNAME_PROCESSOR=i386
+ UNAME_MACHINE=pc
+ fi
+ echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+ exit ;;
+ *:QNX:*:4*)
+ echo i386-pc-qnx
+ exit ;;
+ NSE-?:NONSTOP_KERNEL:*:*)
+ echo nse-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ NSR-?:NONSTOP_KERNEL:*:*)
+ echo nsr-tandem-nsk${UNAME_RELEASE}
+ exit ;;
+ *:NonStop-UX:*:*)
+ echo mips-compaq-nonstopux
+ exit ;;
+ BS2000:POSIX*:*:*)
+ echo bs2000-siemens-sysv
+ exit ;;
+ DS/*:UNIX_System_V:*:*)
+ echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+ exit ;;
+ *:Plan9:*:*)
+ # "uname -m" is not consistent, so use $cputype instead. 386
+ # is converted to i386 for consistency with other x86
+ # operating systems.
+ if test "$cputype" = "386"; then
+ UNAME_MACHINE=i386
+ else
+ UNAME_MACHINE="$cputype"
+ fi
+ echo ${UNAME_MACHINE}-unknown-plan9
+ exit ;;
+ *:TOPS-10:*:*)
+ echo pdp10-unknown-tops10
+ exit ;;
+ *:TENEX:*:*)
+ echo pdp10-unknown-tenex
+ exit ;;
+ KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+ echo pdp10-dec-tops20
+ exit ;;
+ XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+ echo pdp10-xkl-tops20
+ exit ;;
+ *:TOPS-20:*:*)
+ echo pdp10-unknown-tops20
+ exit ;;
+ *:ITS:*:*)
+ echo pdp10-unknown-its
+ exit ;;
+ SEI:*:*:SEIUX)
+ echo mips-sei-seiux${UNAME_RELEASE}
+ exit ;;
+ *:DragonFly:*:*)
+ echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
+ exit ;;
+ *:*VMS:*:*)
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ case "${UNAME_MACHINE}" in
+ A*) echo alpha-dec-vms ; exit ;;
+ I*) echo ia64-dec-vms ; exit ;;
+ V*) echo vax-dec-vms ; exit ;;
+ esac ;;
+ *:XENIX:*:SysV)
+ echo i386-pc-xenix
+ exit ;;
+ i*86:skyos:*:*)
+ echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
+ exit ;;
+ i*86:rdos:*:*)
+ echo ${UNAME_MACHINE}-pc-rdos
+ exit ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+ /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
+ I don't know.... */
+ printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+ printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+ "4"
+#else
+ ""
+#endif
+ ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+ printf ("arm-acorn-riscix\n"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+ printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+ int version;
+ version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+ if (version < 4)
+ printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+ else
+ printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+ exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+ printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+ printf ("ns32k-encore-mach\n"); exit (0);
+#else
+ printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+ printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+ printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+ printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+ struct utsname un;
+
+ uname(&un);
+
+ if (strncmp(un.version, "V2", 2) == 0) {
+ printf ("i386-sequent-ptx2\n"); exit (0);
+ }
+ if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+ printf ("i386-sequent-ptx1\n"); exit (0);
+ }
+ printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+# include <sys/param.h>
+# if defined (BSD)
+# if BSD == 43
+ printf ("vax-dec-bsd4.3\n"); exit (0);
+# else
+# if BSD == 199006
+ printf ("vax-dec-bsd4.3reno\n"); exit (0);
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# endif
+# else
+ printf ("vax-dec-bsd\n"); exit (0);
+# endif
+# else
+ printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+ printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+ exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+ { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+ case `getsysinfo -f cpu_type` in
+ c1*)
+ echo c1-convex-bsd
+ exit ;;
+ c2*)
+ if getsysinfo -f scalar_acc
+ then echo c32-convex-bsd
+ else echo c2-convex-bsd
+ fi
+ exit ;;
+ c34*)
+ echo c34-convex-bsd
+ exit ;;
+ c38*)
+ echo c38-convex-bsd
+ exit ;;
+ c4*)
+ echo c4-convex-bsd
+ exit ;;
+ esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+and
+ http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches@gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo = `(hostinfo) 2>/dev/null`
+/bin/universe = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+/* config.h. Generated from config.h.in by configure. */
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if you have the `dup2' function. */
+#define HAVE_DUP2 1
+
+/* Define to 1 if you have the `floor' function. */
+#define HAVE_FLOOR 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `m' library (-lm). */
+#define HAVE_LIBM 1
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#define HAVE_MALLOC 1
+
+/* Define to 1 if you have the `memchr' function. */
+#define HAVE_MEMCHR 1
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#define HAVE_REALLOC 1
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strstr' function. */
+#define HAVE_STRSTR 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the <vfork.h> header file. */
+/* #undef HAVE_VFORK_H */
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if `fork' works. */
+#define HAVE_WORKING_FORK 1
+
+/* Define to 1 if `vfork' works. */
+#define HAVE_WORKING_VFORK 1
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Name of package */
+#define PACKAGE "polyglot"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "michel.vandenbergh@uhasselt.be"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "polyglot"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "polyglot 1.4w10UCIb15"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "polyglot"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.4w10UCIb15"
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#define PROTOTYPES 1
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to the type of arg 1 for `select'. */
+#define SELECT_TYPE_ARG1 int
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#define SELECT_TYPE_ARG234 (fd_set *)
+
+/* Define to the type of arg 5 for `select'. */
+#define SELECT_TYPE_ARG5 (struct timeval *)
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+ second argument and the buffer pointer as the third, as on System V before
+ release 3. */
+/* #undef SETVBUF_REVERSED */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define VERSION "1.4w10UCIb15"
+
+/* Define like PROTOTYPES; this can be used by system headers. */
+#define __PROTOTYPES 1
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+/* #undef malloc */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef pid_t */
+
+/* Define to rpl_realloc if the replacement function should be used. */
+/* #undef realloc */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define as `fork' if `vfork' does not work. */
+/* #undef vfork */
--- /dev/null
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the `floor' function. */
+#undef HAVE_FLOOR
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the `memchr' function. */
+#undef HAVE_MEMCHR
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* 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 `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* 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 to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* 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/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* 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 to 1 if the C compiler supports function prototypes. */
+#undef PROTOTYPES
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to the type of arg 1 for `select'. */
+#undef SELECT_TYPE_ARG1
+
+/* Define to the type of args 2, 3 and 4 for `select'. */
+#undef SELECT_TYPE_ARG234
+
+/* Define to the type of arg 5 for `select'. */
+#undef SELECT_TYPE_ARG5
+
+/* Define to 1 if the `setvbuf' function takes the buffering type as its
+ second argument and the buffer pointer as the third, as on System V before
+ release 3. */
+#undef SETVBUF_REVERSED
+
+/* 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 like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
--- /dev/null
+#! /bin/sh
+# Configuration validation subroutine script.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
+# Inc.
+
+timestamp='2007-06-28'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine. It does not imply ALL GNU software can.
+#
+# This file 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., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support. The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+ $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+ -h, --help print this help, then exit
+ -t, --time-stamp print date of last modification, then exit
+ -v, --version print version number, then exit
+
+Report bugs and patches to <config-patches@gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+ case $1 in
+ --time-stamp | --time* | -t )
+ echo "$timestamp" ; exit ;;
+ --version | -v )
+ echo "$version" ; exit ;;
+ --help | --h* | -h )
+ echo "$usage"; exit ;;
+ -- ) # Stop option processing
+ shift; break ;;
+ - ) # Use stdin as input.
+ break ;;
+ -* )
+ echo "$me: invalid option $1$help"
+ exit 1 ;;
+
+ *local*)
+ # First pass through any local machine types.
+ echo $1
+ exit ;;
+
+ * )
+ break ;;
+ esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+ exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+ exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ storm-chaos* | os2-emx* | rtmk-nova*)
+ os=-$maybe_os
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+ ;;
+ *)
+ basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+ if [ $basic_machine != $1 ]
+ then os=`echo $1 | sed 's/.*-/-/'`
+ else os=; fi
+ ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work. We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+ -sun*os*)
+ # Prevent following clause from handling this invalid input.
+ ;;
+ -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+ -apple | -axis | -knuth | -cray)
+ os=
+ basic_machine=$1
+ ;;
+ -sim | -cisco | -oki | -wec | -winbond)
+ os=
+ basic_machine=$1
+ ;;
+ -scout)
+ ;;
+ -wrs)
+ os=-vxworks
+ basic_machine=$1
+ ;;
+ -chorusos*)
+ os=-chorusos
+ basic_machine=$1
+ ;;
+ -chorusrdb)
+ os=-chorusrdb
+ basic_machine=$1
+ ;;
+ -hiux*)
+ os=-hiuxwe2
+ ;;
+ -sco6)
+ os=-sco5v6
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5)
+ os=-sco3.2v5
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco4)
+ os=-sco3.2v4
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2.[4-9]*)
+ os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco3.2v[4-9]*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco5v6*)
+ # Don't forget version if it is 3.2v4 or newer.
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -sco*)
+ os=-sco3.2v2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -udk*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -isc)
+ os=-isc2.2
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -clix*)
+ basic_machine=clipper-intergraph
+ ;;
+ -isc*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+ ;;
+ -lynx*)
+ os=-lynxos
+ ;;
+ -ptx*)
+ basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+ ;;
+ -windowsnt*)
+ os=`echo $os | sed -e 's/windowsnt/winnt/'`
+ ;;
+ -psos*)
+ os=-psos
+ ;;
+ -mint | -mint[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+ # Recognize the basic CPU types without company name.
+ # Some are omitted here because they have special meanings below.
+ 1750a | 580 \
+ | a29k \
+ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+ | am33_2.0 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
+ | bfin \
+ | c4x | clipper \
+ | d10v | d30v | dlx | dsp16xx \
+ | fido | fr30 | frv \
+ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+ | i370 | i860 | i960 | ia64 \
+ | ip2k | iq2000 \
+ | m32c | m32r | m32rle | m68000 | m68k | m88k \
+ | maxq | mb | microblaze | mcore | mep \
+ | mips | mipsbe | mipseb | mipsel | mipsle \
+ | mips16 \
+ | mips64 | mips64el \
+ | mips64vr | mips64vrel \
+ | mips64orion | mips64orionel \
+ | mips64vr4100 | mips64vr4100el \
+ | mips64vr4300 | mips64vr4300el \
+ | mips64vr5000 | mips64vr5000el \
+ | mips64vr5900 | mips64vr5900el \
+ | mipsisa32 | mipsisa32el \
+ | mipsisa32r2 | mipsisa32r2el \
+ | mipsisa64 | mipsisa64el \
+ | mipsisa64r2 | mipsisa64r2el \
+ | mipsisa64sb1 | mipsisa64sb1el \
+ | mipsisa64sr71k | mipsisa64sr71kel \
+ | mipstx39 | mipstx39el \
+ | mn10200 | mn10300 \
+ | mt \
+ | msp430 \
+ | nios | nios2 \
+ | ns16k | ns32k \
+ | or32 \
+ | pdp10 | pdp11 | pj | pjl \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+ | pyramid \
+ | score \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh64 | sh64le \
+ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
+ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
+ | we32k \
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
+ basic_machine=$basic_machine-unknown
+ ;;
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
+ m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+ ;;
+ ms1)
+ basic_machine=mt-unknown
+ ;;
+
+ # We use `pc' rather than `unknown'
+ # because (1) that's what they normally are, and
+ # (2) the word "unknown" tends to confuse beginning users.
+ i*86 | x86_64)
+ basic_machine=$basic_machine-pc
+ ;;
+ # Object if more than one company name word.
+ *-*-*)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+ # Recognize the basic CPU types with company name.
+ 580-* \
+ | a29k-* \
+ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
+ | avr-* | avr32-* \
+ | bfin-* | bs2000-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
+ | d10v-* | d30v-* | dlx-* \
+ | elxsi-* \
+ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
+ | h8300-* | h8500-* \
+ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+ | i*86-* | i860-* | i960-* | ia64-* \
+ | ip2k-* | iq2000-* \
+ | m32c-* | m32r-* | m32rle-* \
+ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* \
+ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+ | mips16-* \
+ | mips64-* | mips64el-* \
+ | mips64vr-* | mips64vrel-* \
+ | mips64orion-* | mips64orionel-* \
+ | mips64vr4100-* | mips64vr4100el-* \
+ | mips64vr4300-* | mips64vr4300el-* \
+ | mips64vr5000-* | mips64vr5000el-* \
+ | mips64vr5900-* | mips64vr5900el-* \
+ | mipsisa32-* | mipsisa32el-* \
+ | mipsisa32r2-* | mipsisa32r2el-* \
+ | mipsisa64-* | mipsisa64el-* \
+ | mipsisa64r2-* | mipsisa64r2el-* \
+ | mipsisa64sb1-* | mipsisa64sb1el-* \
+ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
+ | mipstx39-* | mipstx39el-* \
+ | mmix-* \
+ | mt-* \
+ | msp430-* \
+ | nios-* | nios2-* \
+ | none-* | np1-* | ns16k-* | ns32k-* \
+ | orion-* \
+ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+ | pyramid-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
+ | sparclite-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tron-* \
+ | v850-* | v850e-* | vax-* \
+ | we32k-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
+ | xstormy16-* | xtensa-* \
+ | ymp-* \
+ | z8k-*)
+ ;;
+ # Recognize the various machine names and aliases which stand
+ # for a CPU type and a company and sometimes even an OS.
+ 386bsd)
+ basic_machine=i386-unknown
+ os=-bsd
+ ;;
+ 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+ basic_machine=m68000-att
+ ;;
+ 3b*)
+ basic_machine=we32k-att
+ ;;
+ a29khif)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ abacus)
+ basic_machine=abacus-unknown
+ ;;
+ adobe68k)
+ basic_machine=m68010-adobe
+ os=-scout
+ ;;
+ alliant | fx80)
+ basic_machine=fx80-alliant
+ ;;
+ altos | altos3068)
+ basic_machine=m68k-altos
+ ;;
+ am29k)
+ basic_machine=a29k-none
+ os=-bsd
+ ;;
+ amd64)
+ basic_machine=x86_64-pc
+ ;;
+ amd64-*)
+ basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ amdahl)
+ basic_machine=580-amdahl
+ os=-sysv
+ ;;
+ amiga | amiga-*)
+ basic_machine=m68k-unknown
+ ;;
+ amigaos | amigados)
+ basic_machine=m68k-unknown
+ os=-amigaos
+ ;;
+ amigaunix | amix)
+ basic_machine=m68k-unknown
+ os=-sysv4
+ ;;
+ apollo68)
+ basic_machine=m68k-apollo
+ os=-sysv
+ ;;
+ apollo68bsd)
+ basic_machine=m68k-apollo
+ os=-bsd
+ ;;
+ aux)
+ basic_machine=m68k-apple
+ os=-aux
+ ;;
+ balance)
+ basic_machine=ns32k-sequent
+ os=-dynix
+ ;;
+ c90)
+ basic_machine=c90-cray
+ os=-unicos
+ ;;
+ convex-c1)
+ basic_machine=c1-convex
+ os=-bsd
+ ;;
+ convex-c2)
+ basic_machine=c2-convex
+ os=-bsd
+ ;;
+ convex-c32)
+ basic_machine=c32-convex
+ os=-bsd
+ ;;
+ convex-c34)
+ basic_machine=c34-convex
+ os=-bsd
+ ;;
+ convex-c38)
+ basic_machine=c38-convex
+ os=-bsd
+ ;;
+ cray | j90)
+ basic_machine=j90-cray
+ os=-unicos
+ ;;
+ craynv)
+ basic_machine=craynv-cray
+ os=-unicosmp
+ ;;
+ cr16)
+ basic_machine=cr16-unknown
+ os=-elf
+ ;;
+ crds | unos)
+ basic_machine=m68k-crds
+ ;;
+ crisv32 | crisv32-* | etraxfs*)
+ basic_machine=crisv32-axis
+ ;;
+ cris | cris-* | etrax*)
+ basic_machine=cris-axis
+ ;;
+ crx)
+ basic_machine=crx-unknown
+ os=-elf
+ ;;
+ da30 | da30-*)
+ basic_machine=m68k-da30
+ ;;
+ decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+ basic_machine=mips-dec
+ ;;
+ decsystem10* | dec10*)
+ basic_machine=pdp10-dec
+ os=-tops10
+ ;;
+ decsystem20* | dec20*)
+ basic_machine=pdp10-dec
+ os=-tops20
+ ;;
+ delta | 3300 | motorola-3300 | motorola-delta \
+ | 3300-motorola | delta-motorola)
+ basic_machine=m68k-motorola
+ ;;
+ delta88)
+ basic_machine=m88k-motorola
+ os=-sysv3
+ ;;
+ djgpp)
+ basic_machine=i586-pc
+ os=-msdosdjgpp
+ ;;
+ dpx20 | dpx20-*)
+ basic_machine=rs6000-bull
+ os=-bosx
+ ;;
+ dpx2* | dpx2*-bull)
+ basic_machine=m68k-bull
+ os=-sysv3
+ ;;
+ ebmon29k)
+ basic_machine=a29k-amd
+ os=-ebmon
+ ;;
+ elxsi)
+ basic_machine=elxsi-elxsi
+ os=-bsd
+ ;;
+ encore | umax | mmax)
+ basic_machine=ns32k-encore
+ ;;
+ es1800 | OSE68k | ose68k | ose | OSE)
+ basic_machine=m68k-ericsson
+ os=-ose
+ ;;
+ fx2800)
+ basic_machine=i860-alliant
+ ;;
+ genix)
+ basic_machine=ns32k-ns
+ ;;
+ gmicro)
+ basic_machine=tron-gmicro
+ os=-sysv
+ ;;
+ go32)
+ basic_machine=i386-pc
+ os=-go32
+ ;;
+ h3050r* | hiux*)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ h8300hms)
+ basic_machine=h8300-hitachi
+ os=-hms
+ ;;
+ h8300xray)
+ basic_machine=h8300-hitachi
+ os=-xray
+ ;;
+ h8500hms)
+ basic_machine=h8500-hitachi
+ os=-hms
+ ;;
+ harris)
+ basic_machine=m88k-harris
+ os=-sysv3
+ ;;
+ hp300-*)
+ basic_machine=m68k-hp
+ ;;
+ hp300bsd)
+ basic_machine=m68k-hp
+ os=-bsd
+ ;;
+ hp300hpux)
+ basic_machine=m68k-hp
+ os=-hpux
+ ;;
+ hp3k9[0-9][0-9] | hp9[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k2[0-9][0-9] | hp9k31[0-9])
+ basic_machine=m68000-hp
+ ;;
+ hp9k3[2-9][0-9])
+ basic_machine=m68k-hp
+ ;;
+ hp9k6[0-9][0-9] | hp6[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hp9k7[0-79][0-9] | hp7[0-79][0-9])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k78[0-9] | hp78[0-9])
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+ # FIXME: really hppa2.0-hp
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][13679] | hp8[0-9][13679])
+ basic_machine=hppa1.1-hp
+ ;;
+ hp9k8[0-9][0-9] | hp8[0-9][0-9])
+ basic_machine=hppa1.0-hp
+ ;;
+ hppa-next)
+ os=-nextstep3
+ ;;
+ hppaosf)
+ basic_machine=hppa1.1-hp
+ os=-osf
+ ;;
+ hppro)
+ basic_machine=hppa1.1-hp
+ os=-proelf
+ ;;
+ i370-ibm* | ibm*)
+ basic_machine=i370-ibm
+ ;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
+ i*86v32)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv32
+ ;;
+ i*86v4*)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv4
+ ;;
+ i*86v)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-sysv
+ ;;
+ i*86sol2)
+ basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+ os=-solaris2
+ ;;
+ i386mach)
+ basic_machine=i386-mach
+ os=-mach
+ ;;
+ i386-vsta | vsta)
+ basic_machine=i386-unknown
+ os=-vsta
+ ;;
+ iris | iris4d)
+ basic_machine=mips-sgi
+ case $os in
+ -irix*)
+ ;;
+ *)
+ os=-irix4
+ ;;
+ esac
+ ;;
+ isi68 | isi)
+ basic_machine=m68k-isi
+ os=-sysv
+ ;;
+ m88k-omron*)
+ basic_machine=m88k-omron
+ ;;
+ magnum | m3230)
+ basic_machine=mips-mips
+ os=-sysv
+ ;;
+ merlin)
+ basic_machine=ns32k-utek
+ os=-sysv
+ ;;
+ mingw32)
+ basic_machine=i386-pc
+ os=-mingw32
+ ;;
+ mingw32ce)
+ basic_machine=arm-unknown
+ os=-mingw32ce
+ ;;
+ miniframe)
+ basic_machine=m68000-convergent
+ ;;
+ *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+ basic_machine=m68k-atari
+ os=-mint
+ ;;
+ mips3*-*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+ ;;
+ mips3*)
+ basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+ ;;
+ monitor)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ morphos)
+ basic_machine=powerpc-unknown
+ os=-morphos
+ ;;
+ msdos)
+ basic_machine=i386-pc
+ os=-msdos
+ ;;
+ ms1-*)
+ basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
+ ;;
+ mvs)
+ basic_machine=i370-ibm
+ os=-mvs
+ ;;
+ ncr3000)
+ basic_machine=i486-ncr
+ os=-sysv4
+ ;;
+ netbsd386)
+ basic_machine=i386-unknown
+ os=-netbsd
+ ;;
+ netwinder)
+ basic_machine=armv4l-rebel
+ os=-linux
+ ;;
+ news | news700 | news800 | news900)
+ basic_machine=m68k-sony
+ os=-newsos
+ ;;
+ news1000)
+ basic_machine=m68030-sony
+ os=-newsos
+ ;;
+ news-3600 | risc-news)
+ basic_machine=mips-sony
+ os=-newsos
+ ;;
+ necv70)
+ basic_machine=v70-nec
+ os=-sysv
+ ;;
+ next | m*-next )
+ basic_machine=m68k-next
+ case $os in
+ -nextstep* )
+ ;;
+ -ns2*)
+ os=-nextstep2
+ ;;
+ *)
+ os=-nextstep3
+ ;;
+ esac
+ ;;
+ nh3000)
+ basic_machine=m68k-harris
+ os=-cxux
+ ;;
+ nh[45]000)
+ basic_machine=m88k-harris
+ os=-cxux
+ ;;
+ nindy960)
+ basic_machine=i960-intel
+ os=-nindy
+ ;;
+ mon960)
+ basic_machine=i960-intel
+ os=-mon960
+ ;;
+ nonstopux)
+ basic_machine=mips-compaq
+ os=-nonstopux
+ ;;
+ np1)
+ basic_machine=np1-gould
+ ;;
+ nsr-tandem)
+ basic_machine=nsr-tandem
+ ;;
+ op50n-* | op60c-*)
+ basic_machine=hppa1.1-oki
+ os=-proelf
+ ;;
+ openrisc | openrisc-*)
+ basic_machine=or32-unknown
+ ;;
+ os400)
+ basic_machine=powerpc-ibm
+ os=-os400
+ ;;
+ OSE68000 | ose68000)
+ basic_machine=m68000-ericsson
+ os=-ose
+ ;;
+ os68k)
+ basic_machine=m68k-none
+ os=-os68k
+ ;;
+ pa-hitachi)
+ basic_machine=hppa1.1-hitachi
+ os=-hiuxwe2
+ ;;
+ paragon)
+ basic_machine=i860-intel
+ os=-osf
+ ;;
+ pbd)
+ basic_machine=sparc-tti
+ ;;
+ pbb)
+ basic_machine=m68k-tti
+ ;;
+ pc532 | pc532-*)
+ basic_machine=ns32k-pc532
+ ;;
+ pc98)
+ basic_machine=i386-pc
+ ;;
+ pc98-*)
+ basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium | p5 | k5 | k6 | nexgen | viac3)
+ basic_machine=i586-pc
+ ;;
+ pentiumpro | p6 | 6x86 | athlon | athlon_*)
+ basic_machine=i686-pc
+ ;;
+ pentiumii | pentium2 | pentiumiii | pentium3)
+ basic_machine=i686-pc
+ ;;
+ pentium4)
+ basic_machine=i786-pc
+ ;;
+ pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+ basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumpro-* | p6-* | 6x86-* | athlon-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
+ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pentium4-*)
+ basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ pn)
+ basic_machine=pn-gould
+ ;;
+ power) basic_machine=power-ibm
+ ;;
+ ppc) basic_machine=powerpc-unknown
+ ;;
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppcle | powerpclittle | ppc-le | powerpc-little)
+ basic_machine=powerpcle-unknown
+ ;;
+ ppcle-* | powerpclittle-*)
+ basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64) basic_machine=powerpc64-unknown
+ ;;
+ ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+ basic_machine=powerpc64le-unknown
+ ;;
+ ppc64le-* | powerpc64little-*)
+ basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ;;
+ ps2)
+ basic_machine=i386-ibm
+ ;;
+ pw32)
+ basic_machine=i586-unknown
+ os=-pw32
+ ;;
+ rdos)
+ basic_machine=i386-pc
+ os=-rdos
+ ;;
+ rom68k)
+ basic_machine=m68k-rom68k
+ os=-coff
+ ;;
+ rm[46]00)
+ basic_machine=mips-siemens
+ ;;
+ rtpc | rtpc-*)
+ basic_machine=romp-ibm
+ ;;
+ s390 | s390-*)
+ basic_machine=s390-ibm
+ ;;
+ s390x | s390x-*)
+ basic_machine=s390x-ibm
+ ;;
+ sa29200)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ sb1)
+ basic_machine=mipsisa64sb1-unknown
+ ;;
+ sb1el)
+ basic_machine=mipsisa64sb1el-unknown
+ ;;
+ sde)
+ basic_machine=mipsisa32-sde
+ os=-elf
+ ;;
+ sei)
+ basic_machine=mips-sei
+ os=-seiux
+ ;;
+ sequent)
+ basic_machine=i386-sequent
+ ;;
+ sh)
+ basic_machine=sh-hitachi
+ os=-hms
+ ;;
+ sh5el)
+ basic_machine=sh5le-unknown
+ ;;
+ sh64)
+ basic_machine=sh64-unknown
+ ;;
+ sparclite-wrs | simso-wrs)
+ basic_machine=sparclite-wrs
+ os=-vxworks
+ ;;
+ sps7)
+ basic_machine=m68k-bull
+ os=-sysv2
+ ;;
+ spur)
+ basic_machine=spur-unknown
+ ;;
+ st2000)
+ basic_machine=m68k-tandem
+ ;;
+ stratus)
+ basic_machine=i860-stratus
+ os=-sysv4
+ ;;
+ sun2)
+ basic_machine=m68000-sun
+ ;;
+ sun2os3)
+ basic_machine=m68000-sun
+ os=-sunos3
+ ;;
+ sun2os4)
+ basic_machine=m68000-sun
+ os=-sunos4
+ ;;
+ sun3os3)
+ basic_machine=m68k-sun
+ os=-sunos3
+ ;;
+ sun3os4)
+ basic_machine=m68k-sun
+ os=-sunos4
+ ;;
+ sun4os3)
+ basic_machine=sparc-sun
+ os=-sunos3
+ ;;
+ sun4os4)
+ basic_machine=sparc-sun
+ os=-sunos4
+ ;;
+ sun4sol2)
+ basic_machine=sparc-sun
+ os=-solaris2
+ ;;
+ sun3 | sun3-*)
+ basic_machine=m68k-sun
+ ;;
+ sun4)
+ basic_machine=sparc-sun
+ ;;
+ sun386 | sun386i | roadrunner)
+ basic_machine=i386-sun
+ ;;
+ sv1)
+ basic_machine=sv1-cray
+ os=-unicos
+ ;;
+ symmetry)
+ basic_machine=i386-sequent
+ os=-dynix
+ ;;
+ t3e)
+ basic_machine=alphaev5-cray
+ os=-unicos
+ ;;
+ t90)
+ basic_machine=t90-cray
+ os=-unicos
+ ;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
+ tx39)
+ basic_machine=mipstx39-unknown
+ ;;
+ tx39el)
+ basic_machine=mipstx39el-unknown
+ ;;
+ toad1)
+ basic_machine=pdp10-xkl
+ os=-tops20
+ ;;
+ tower | tower-32)
+ basic_machine=m68k-ncr
+ ;;
+ tpf)
+ basic_machine=s390x-ibm
+ os=-tpf
+ ;;
+ udi29k)
+ basic_machine=a29k-amd
+ os=-udi
+ ;;
+ ultra3)
+ basic_machine=a29k-nyu
+ os=-sym1
+ ;;
+ v810 | necv810)
+ basic_machine=v810-nec
+ os=-none
+ ;;
+ vaxv)
+ basic_machine=vax-dec
+ os=-sysv
+ ;;
+ vms)
+ basic_machine=vax-dec
+ os=-vms
+ ;;
+ vpp*|vx|vx-*)
+ basic_machine=f301-fujitsu
+ ;;
+ vxworks960)
+ basic_machine=i960-wrs
+ os=-vxworks
+ ;;
+ vxworks68)
+ basic_machine=m68k-wrs
+ os=-vxworks
+ ;;
+ vxworks29k)
+ basic_machine=a29k-wrs
+ os=-vxworks
+ ;;
+ w65*)
+ basic_machine=w65-wdc
+ os=-none
+ ;;
+ w89k-*)
+ basic_machine=hppa1.1-winbond
+ os=-proelf
+ ;;
+ xbox)
+ basic_machine=i686-pc
+ os=-mingw32
+ ;;
+ xps | xps100)
+ basic_machine=xps100-honeywell
+ ;;
+ ymp)
+ basic_machine=ymp-cray
+ os=-unicos
+ ;;
+ z8k-*-coff)
+ basic_machine=z8k-unknown
+ os=-sim
+ ;;
+ none)
+ basic_machine=none-none
+ os=-none
+ ;;
+
+# Here we handle the default manufacturer of certain CPU types. It is in
+# some cases the only manufacturer, in others, it is the most popular.
+ w89k)
+ basic_machine=hppa1.1-winbond
+ ;;
+ op50n)
+ basic_machine=hppa1.1-oki
+ ;;
+ op60c)
+ basic_machine=hppa1.1-oki
+ ;;
+ romp)
+ basic_machine=romp-ibm
+ ;;
+ mmix)
+ basic_machine=mmix-knuth
+ ;;
+ rs6000)
+ basic_machine=rs6000-ibm
+ ;;
+ vax)
+ basic_machine=vax-dec
+ ;;
+ pdp10)
+ # there are many clones, so DEC is not a safe bet
+ basic_machine=pdp10-unknown
+ ;;
+ pdp11)
+ basic_machine=pdp11-dec
+ ;;
+ we32k)
+ basic_machine=we32k-att
+ ;;
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ basic_machine=sh-unknown
+ ;;
+ sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
+ basic_machine=sparc-sun
+ ;;
+ cydra)
+ basic_machine=cydra-cydrome
+ ;;
+ orion)
+ basic_machine=orion-highlevel
+ ;;
+ orion105)
+ basic_machine=clipper-highlevel
+ ;;
+ mac | mpw | mac-mpw)
+ basic_machine=m68k-apple
+ ;;
+ pmac | pmac-mpw)
+ basic_machine=powerpc-apple
+ ;;
+ *-unknown)
+ # Make sure to match an already-canonicalized machine name.
+ ;;
+ *)
+ echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+ *-digital*)
+ basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+ ;;
+ *-commodore*)
+ basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+ ;;
+ *)
+ ;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+ # First match some system type aliases
+ # that might get confused with valid system types.
+ # -solaris* is a basic system type, with this one exception.
+ -solaris1 | -solaris1.*)
+ os=`echo $os | sed -e 's|solaris1|sunos4|'`
+ ;;
+ -solaris)
+ os=-solaris2
+ ;;
+ -svr4*)
+ os=-sysv4
+ ;;
+ -unixware*)
+ os=-sysv4.2uw
+ ;;
+ -gnu/linux*)
+ os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+ ;;
+ # First accept the basic system types.
+ # The portable systems comes first.
+ # Each alternative MUST END IN A *, to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+ | -aos* \
+ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
+ | -openbsd* | -solidbsd* \
+ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
+ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+ | -chorusos* | -chorusrdb* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
+ | -uxpv* | -beos* | -mpeix* | -udk* \
+ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
+ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
+ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ # Remember, each alternative MUST END IN *, to match a version number.
+ ;;
+ -qnx*)
+ case $basic_machine in
+ x86-* | i*86-*)
+ ;;
+ *)
+ os=-nto$os
+ ;;
+ esac
+ ;;
+ -nto-qnx*)
+ ;;
+ -nto*)
+ os=`echo $os | sed -e 's|nto|nto-qnx|'`
+ ;;
+ -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
+ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+ ;;
+ -mac*)
+ os=`echo $os | sed -e 's|mac|macos|'`
+ ;;
+ -linux-dietlibc)
+ os=-linux-dietlibc
+ ;;
+ -linux*)
+ os=`echo $os | sed -e 's|linux|linux-gnu|'`
+ ;;
+ -sunos5*)
+ os=`echo $os | sed -e 's|sunos5|solaris2|'`
+ ;;
+ -sunos6*)
+ os=`echo $os | sed -e 's|sunos6|solaris3|'`
+ ;;
+ -opened*)
+ os=-openedition
+ ;;
+ -os400*)
+ os=-os400
+ ;;
+ -wince*)
+ os=-wince
+ ;;
+ -osfrose*)
+ os=-osfrose
+ ;;
+ -osf*)
+ os=-osf
+ ;;
+ -utek*)
+ os=-bsd
+ ;;
+ -dynix*)
+ os=-bsd
+ ;;
+ -acis*)
+ os=-aos
+ ;;
+ -atheos*)
+ os=-atheos
+ ;;
+ -syllable*)
+ os=-syllable
+ ;;
+ -386bsd)
+ os=-bsd
+ ;;
+ -ctix* | -uts*)
+ os=-sysv
+ ;;
+ -nova*)
+ os=-rtmk-nova
+ ;;
+ -ns2 )
+ os=-nextstep2
+ ;;
+ -nsk*)
+ os=-nsk
+ ;;
+ # Preserve the version number of sinix5.
+ -sinix5.*)
+ os=`echo $os | sed -e 's|sinix|sysv|'`
+ ;;
+ -sinix*)
+ os=-sysv4
+ ;;
+ -tpf*)
+ os=-tpf
+ ;;
+ -triton*)
+ os=-sysv3
+ ;;
+ -oss*)
+ os=-sysv3
+ ;;
+ -svr4)
+ os=-sysv4
+ ;;
+ -svr3)
+ os=-sysv3
+ ;;
+ -sysvr4)
+ os=-sysv4
+ ;;
+ # This must come after -sysvr4.
+ -sysv*)
+ ;;
+ -ose*)
+ os=-ose
+ ;;
+ -es1800*)
+ os=-ose
+ ;;
+ -xenix)
+ os=-xenix
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ os=-mint
+ ;;
+ -aros*)
+ os=-aros
+ ;;
+ -kaos*)
+ os=-kaos
+ ;;
+ -zvmoe)
+ os=-zvmoe
+ ;;
+ -none)
+ ;;
+ *)
+ # Get rid of the `-' at the beginning of $os.
+ os=`echo $os | sed 's/[^-]*-//'`
+ echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+ exit 1
+ ;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system. Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+ score-*)
+ os=-elf
+ ;;
+ spu-*)
+ os=-elf
+ ;;
+ *-acorn)
+ os=-riscix1.2
+ ;;
+ arm*-rebel)
+ os=-linux
+ ;;
+ arm*-semi)
+ os=-aout
+ ;;
+ c4x-* | tic4x-*)
+ os=-coff
+ ;;
+ # This must come before the *-dec entry.
+ pdp10-*)
+ os=-tops20
+ ;;
+ pdp11-*)
+ os=-none
+ ;;
+ *-dec | vax-*)
+ os=-ultrix4.2
+ ;;
+ m68*-apollo)
+ os=-domain
+ ;;
+ i386-sun)
+ os=-sunos4.0.2
+ ;;
+ m68000-sun)
+ os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
+ ;;
+ m68*-cisco)
+ os=-aout
+ ;;
+ mep-*)
+ os=-elf
+ ;;
+ mips*-cisco)
+ os=-elf
+ ;;
+ mips*-*)
+ os=-elf
+ ;;
+ or32-*)
+ os=-coff
+ ;;
+ *-tti) # must be before sparc entry or we get the wrong os.
+ os=-sysv3
+ ;;
+ sparc-* | *-sun)
+ os=-sunos4.1.1
+ ;;
+ *-be)
+ os=-beos
+ ;;
+ *-haiku)
+ os=-haiku
+ ;;
+ *-ibm)
+ os=-aix
+ ;;
+ *-knuth)
+ os=-mmixware
+ ;;
+ *-wec)
+ os=-proelf
+ ;;
+ *-winbond)
+ os=-proelf
+ ;;
+ *-oki)
+ os=-proelf
+ ;;
+ *-hp)
+ os=-hpux
+ ;;
+ *-hitachi)
+ os=-hiux
+ ;;
+ i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+ os=-sysv
+ ;;
+ *-cbm)
+ os=-amigaos
+ ;;
+ *-dg)
+ os=-dgux
+ ;;
+ *-dolphin)
+ os=-sysv3
+ ;;
+ m68k-ccur)
+ os=-rtu
+ ;;
+ m88k-omron*)
+ os=-luna
+ ;;
+ *-next )
+ os=-nextstep
+ ;;
+ *-sequent)
+ os=-ptx
+ ;;
+ *-crds)
+ os=-unos
+ ;;
+ *-ns)
+ os=-genix
+ ;;
+ i370-*)
+ os=-mvs
+ ;;
+ *-next)
+ os=-nextstep3
+ ;;
+ *-gould)
+ os=-sysv
+ ;;
+ *-highlevel)
+ os=-bsd
+ ;;
+ *-encore)
+ os=-bsd
+ ;;
+ *-sgi)
+ os=-irix
+ ;;
+ *-siemens)
+ os=-sysv4
+ ;;
+ *-masscomp)
+ os=-rtu
+ ;;
+ f30[01]-fujitsu | f700-fujitsu)
+ os=-uxpv
+ ;;
+ *-rom68k)
+ os=-coff
+ ;;
+ *-*bug)
+ os=-coff
+ ;;
+ *-apple)
+ os=-macos
+ ;;
+ *-atari*)
+ os=-mint
+ ;;
+ *)
+ os=-none
+ ;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer. We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+ *-unknown)
+ case $os in
+ -riscix*)
+ vendor=acorn
+ ;;
+ -sunos*)
+ vendor=sun
+ ;;
+ -aix*)
+ vendor=ibm
+ ;;
+ -beos*)
+ vendor=be
+ ;;
+ -hpux*)
+ vendor=hp
+ ;;
+ -mpeix*)
+ vendor=hp
+ ;;
+ -hiux*)
+ vendor=hitachi
+ ;;
+ -unos*)
+ vendor=crds
+ ;;
+ -dgux*)
+ vendor=dg
+ ;;
+ -luna*)
+ vendor=omron
+ ;;
+ -genix*)
+ vendor=ns
+ ;;
+ -mvs* | -opened*)
+ vendor=ibm
+ ;;
+ -os400*)
+ vendor=ibm
+ ;;
+ -ptx*)
+ vendor=sequent
+ ;;
+ -tpf*)
+ vendor=ibm
+ ;;
+ -vxsim* | -vxworks* | -windiss*)
+ vendor=wrs
+ ;;
+ -aux*)
+ vendor=apple
+ ;;
+ -hms*)
+ vendor=hitachi
+ ;;
+ -mpw* | -macos*)
+ vendor=apple
+ ;;
+ -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+ vendor=atari
+ ;;
+ -vos*)
+ vendor=stratus
+ ;;
+ esac
+ basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+ ;;
+esac
+
+echo $basic_machine$os
+exit
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
--- /dev/null
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.61 for polyglot 1.4w10UCIb15.
+#
+# Report bugs to <michel.vandenbergh@uhasselt.be>.
+#
+# 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 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
+
+# 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
+
+
+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
+}
+
+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
+ 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=.
+ case $as_dir in
+ /*)
+ 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
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ 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 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 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`
+
+#
+# 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}
+
+# Identity of this package.
+PACKAGE_NAME='polyglot'
+PACKAGE_TARNAME='polyglot'
+PACKAGE_VERSION='1.4w10UCIb15'
+PACKAGE_STRING='polyglot 1.4w10UCIb15'
+PACKAGE_BUGREPORT='michel.vandenbergh@uhasselt.be'
+
+ac_unique_file="adapter.cpp"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#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
+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
+CXX
+CXXFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CXX
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CXXDEPMODE
+am__fastdepCXX_TRUE
+am__fastdepCXX_FALSE
+CC
+CFLAGS
+ac_ct_CC
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+GREP
+EGREP
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CXX
+CXXFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CCC
+CC
+CFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# 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'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+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
+ ac_prev=
+ continue
+ fi
+
+ 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_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -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 &&
+ { 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 ;;
+
+ -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 &&
+ { 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=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -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 ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --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)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --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 ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -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 &&
+ { 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=\$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 &&
+ { 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 ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+# 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=\$$ac_var
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) 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'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+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 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 ||
+echo X"$0" |
+ 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
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+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
+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; }; }
+ 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.
+#
+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 polyglot 1.4w10UCIb15 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+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]
+ --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]
+ --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/polyglot]
+ --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
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of polyglot 1.4w10UCIb15:";;
+ 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
+
+Some influential environment variables:
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib 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>
+ CC C compiler command
+ CFLAGS C compiler flags
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <michel.vandenbergh@uhasselt.be>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" || continue
+ 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
+
+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
+
+ 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 || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+polyglot configure 1.4w10UCIb15
+generated by GNU Autoconf 2.61
+
+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
+fi
+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 polyglot $as_me 1.4w10UCIb15, which was
+generated by GNU Autoconf 2.61. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 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`
+/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`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -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
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 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.
+ 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
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# 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: 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.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_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 $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"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ 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
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ 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
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ 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.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 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 -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+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
+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;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$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";;
+ esac
+ fi
+else
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+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
+ 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
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ 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: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { 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: current value: $ac_new_val" >&2;}
+ 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=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+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
+
+
+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
+
+{ 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
+
+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
+
+# 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
+
+
+# Define the identity of the package.
+ PACKAGE='polyglot'
+ VERSION='1.4w10UCIb15'
+
+
+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 "$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
+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_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
+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; }
+fi
+
+
+fi
+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_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
+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_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_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; }
+fi
+
+ 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
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+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_config_headers="$ac_config_headers config.h"
+
+
+# Checks for programs.
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ 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_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # 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_CXX="$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
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+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_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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_CXX="$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_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ 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
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# 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="$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); }
+{ (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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+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 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[^ ]*//'`
+#
+# 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
+ # 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 | *.map | *.inf | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ 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;;
+ 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
+
+{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# 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; }
+# 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'
+ { (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
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C++ compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ 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 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 { (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
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+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 | *.map | *.inf | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ 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; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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.o conftest.obj
+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 conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+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; }
+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; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ 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_cxx_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_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-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_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ 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_cxx_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_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-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_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+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_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ 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
+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="$CXX" 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_CXX_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_CXX_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_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_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
+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="$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); }
+{ (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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ 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_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); } && {
+ 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); } && {
+ 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
+
+
+fi
+
+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 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
+
+
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+
+
+{ echo "$as_me:$LINENO: checking for sin in -lm" >&5
+echo $ECHO_N "checking for sin in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_sin+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $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 sin ();
+int
+main ()
+{
+return sin ();
+ ;
+ 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_m_sin=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_m_sin=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_m_sin" >&5
+echo "${ECHO_T}$ac_cv_lib_m_sin" >&6; }
+if test $ac_cv_lib_m_sin = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+
+# Checks for header files.
+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; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # 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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_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
+ :
+else
+ echo "$as_me: failed program was:" >&5
+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 nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.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
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ 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
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # 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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_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
+ :
+else
+ echo "$as_me: failed program was:" >&5
+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 nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.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
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+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 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
+ 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_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
+ 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
+
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+
+ 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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.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_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* 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'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+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; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.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 { 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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_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
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+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
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in stdlib.h string.h sys/time.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+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
+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; }
+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 <$ac_header>
+_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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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: $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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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;}
+ { 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;}
+ ( cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to michel.vandenbergh@uhasselt.be ##
+## --------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ 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"
+fi
+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
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ echo "$as_me:$LINENO: checking for stdbool.h that conforms to C99" >&5
+echo $ECHO_N "checking for stdbool.h that conforms to C99... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+#include <stdbool.h>
+#ifndef bool
+ "error: bool is not defined"
+#endif
+#ifndef false
+ "error: false is not defined"
+#endif
+#if false
+ "error: false is not 0"
+#endif
+#ifndef true
+ "error: true is not defined"
+#endif
+#if true != 1
+ "error: true is not 1"
+#endif
+#ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+#endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ bool e = &s;
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+# if defined __xlc__ || defined __GNUC__
+ /* Catch a bug in IBM AIX xlc compiler version 6.0.0.0
+ reported by James Lemley on 2005-10-05; see
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-10/msg00086.html
+ This test is not quite right, since xlc is allowed to
+ reject this program, as the initializer for xlcbug is
+ not one of the forms that C requires support for.
+ However, doing the test right would require a runtime
+ test, and that would make cross-compilation harder.
+ Let us hope that IBM fixes the xlc bug, and also adds
+ support for this kind of constant expression. In the
+ meantime, this test will reject xlc, which is OK, since
+ our stdbool.h substitute should suffice. We also test
+ this with GCC, where it should work, to detect more
+ quickly whether someone messes up the test in the
+ future. */
+ char digs[] = "0123456789";
+ int xlcbug = 1 / (&(digs + 5)[-2 + (bool) 1] == &digs[4] ? 1 : -1);
+# endif
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ 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_header_stdbool_h=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdbool_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdbool_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdbool_h" >&6; }
+{ echo "$as_me:$LINENO: checking for _Bool" >&5
+echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; }
+if test "${ac_cv_type__Bool+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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
+typedef _Bool ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ 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_type__Bool=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type__Bool=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5
+echo "${ECHO_T}$ac_cv_type__Bool" >&6; }
+if test $ac_cv_type__Bool = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDBOOL_H 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ 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_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_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_c_inline=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking for pid_t" >&5
+echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_pid_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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
+typedef pid_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ 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_type_pid_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_pid_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5
+echo "${ECHO_T}$ac_cv_type_pid_t" >&6; }
+if test $ac_cv_type_pid_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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
+typedef size_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ 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_type_size_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_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; }
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ 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_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
+fi
+
+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; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+
+for ac_header in vfork.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+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
+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; }
+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 <$ac_header>
+_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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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: $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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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;}
+ { 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;}
+ ( cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to michel.vandenbergh@uhasselt.be ##
+## --------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ 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"
+fi
+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
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+for ac_func in fork vfork
+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 { 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
+/* 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
+
+#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
+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
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+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
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { echo "$as_me:$LINENO: checking for working fork" >&5
+echo $ECHO_N "checking for working fork... $ECHO_C" >&6; }
+if test "${ac_cv_func_fork_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_fork_works=cross
+else
+ 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
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ ac_cv_func_fork_works=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_fork_works" >&5
+echo "${ECHO_T}$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { echo "$as_me:$LINENO: checking for working vfork" >&5
+echo $ECHO_N "checking for working vfork... $ECHO_C" >&6; }
+if test "${ac_cv_func_vfork_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_vfork_works=cross
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ ac_cv_func_vfork_works=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_vfork_works" >&5
+echo "${ECHO_T}$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { echo "$as_me:$LINENO: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_VFORK 1
+_ACEOF
+
+else
+
+cat >>confdefs.h <<\_ACEOF
+#define vfork fork
+_ACEOF
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_WORKING_FORK 1
+_ACEOF
+
+fi
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+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
+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; }
+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 <$ac_header>
+_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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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: $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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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;}
+ { 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;}
+ ( cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to michel.vandenbergh@uhasselt.be ##
+## --------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ 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"
+fi
+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
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking for GNU libc compatible malloc" >&5
+echo $ECHO_N "checking for GNU libc compatible malloc... $ECHO_C" >&6; }
+if test "${ac_cv_func_malloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_malloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_MALLOC 0
+_ACEOF
+
+ case " $LIBOBJS " in
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define malloc rpl_malloc
+_ACEOF
+
+fi
+
+
+
+
+for ac_header in stdlib.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+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
+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; }
+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 <$ac_header>
+_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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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: $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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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;}
+ { 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;}
+ ( cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to michel.vandenbergh@uhasselt.be ##
+## --------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ 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"
+fi
+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
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking for GNU libc compatible realloc" >&5
+echo $ECHO_N "checking for GNU libc compatible realloc... $ECHO_C" >&6; }
+if test "${ac_cv_func_realloc_0_nonnull+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_realloc_0_nonnull=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+return ! realloc (0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ ac_cv_func_realloc_0_nonnull=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_realloc_0_nonnull" >&5
+echo "${ECHO_T}$ac_cv_func_realloc_0_nonnull" >&6; }
+if test $ac_cv_func_realloc_0_nonnull = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 1
+_ACEOF
+
+else
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_REALLOC 0
+_ACEOF
+
+ case " $LIBOBJS " in
+ *" realloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<\_ACEOF
+#define realloc rpl_realloc
+_ACEOF
+
+fi
+
+
+
+
+
+for ac_header in sys/select.h sys/socket.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+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
+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; }
+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 <$ac_header>
+_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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header 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 <$ac_header>
+_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: $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 compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=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: 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;}
+ { 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;}
+ ( cat <<\_ASBOX
+## --------------------------------------------- ##
+## Report this to michel.vandenbergh@uhasselt.be ##
+## --------------------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ 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"
+fi
+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
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ echo "$as_me:$LINENO: checking types of arguments for select" >&5
+echo $ECHO_N "checking types of arguments for select... $ECHO_C" >&6; }
+if test "${ac_cv_func_select_args+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ for ac_arg234 in 'fd_set *' 'int *' 'void *'; do
+ for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do
+ for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do
+ 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
+#ifdef HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+
+int
+main ()
+{
+extern int select ($ac_arg1,
+ $ac_arg234, $ac_arg234, $ac_arg234,
+ $ac_arg5);
+ ;
+ 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_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+ done
+done
+# Provide a safe default value.
+: ${ac_cv_func_select_args='int,int *,struct timeval *'}
+
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_select_args" >&5
+echo "${ECHO_T}$ac_cv_func_select_args" >&6; }
+ac_save_IFS=$IFS; IFS=','
+set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'`
+IFS=$ac_save_IFS
+shift
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG1 $1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG234 ($2)
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define SELECT_TYPE_ARG5 ($3)
+_ACEOF
+
+rm -f conftest*
+
+{ echo "$as_me:$LINENO: checking for function prototypes" >&5
+echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; }
+if test "$ac_cv_prog_cc_c89" != no; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define PROTOTYPES 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __PROTOTYPES 1
+_ACEOF
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5
+echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6; }
+if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_func_setvbuf_reversed=no
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
+# ifdef PROTOTYPES
+ int (setvbuf) (FILE *, int, char *, size_t);
+# endif
+int
+main ()
+{
+char buf; return setvbuf (stdout, _IOLBF, &buf, 1);
+ ;
+ 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
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
+# ifdef PROTOTYPES
+ int (setvbuf) (FILE *, int, char *, size_t);
+# endif
+int
+main ()
+{
+char buf; return setvbuf (stdout, &buf, _IOLBF, 1);
+ ;
+ 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
+ # It compiles and links either way, so it must not be declared
+ # with a prototype and most likely this is a K&R C compiler.
+ # Try running it.
+ if test "$cross_compiling" = yes; then
+ : # Assume setvbuf is not reversed when cross-compiling.
+else
+ 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
+int
+main ()
+{
+/* This call has the arguments reversed.
+ A reversed system may check and see that the address of buf
+ is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */
+ char buf;
+ if (setvbuf (stdout, _IOLBF, &buf, 1) != 0)
+ return 1;
+ putchar ('\r');
+ return 0; /* Non-reversed systems SEGV here. */
+ ;
+ return 0;
+}
+_ACEOF
+rm -f 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>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (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
+ ac_cv_func_setvbuf_reversed=yes
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+ ac_cv_func_setvbuf_reversed=yes
+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 conftest.$ac_ext
+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 conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5
+echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6; }
+if test $ac_cv_func_setvbuf_reversed = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define SETVBUF_REVERSED 1
+_ACEOF
+
+fi
+
+{ 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
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <signal.h>
+
+int
+main ()
+{
+return *(signal (0, 0)) (0) == 1;
+ ;
+ 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_type_signal=int
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_signal=void
+fi
+
+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; }
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+for ac_func in vprintf
+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 { 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
+/* 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
+
+#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
+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
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+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
+_ACEOF
+
+{ echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6; }
+if test "${ac_cv_func__doprnt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt (); 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
+
+#undef _doprnt
+
+/* 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 _doprnt ();
+/* 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__doprnt || defined __stub____doprnt
+choke me
+#endif
+
+int
+main ()
+{
+return _doprnt ();
+ ;
+ 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_func__doprnt=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func__doprnt=no
+fi
+
+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__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6; }
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in dup2 floor gettimeofday memchr memmove select strchr strdup strerror strstr
+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 { 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
+/* 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
+
+#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
+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
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ 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
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+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
+_ACEOF
+
+fi
+done
+
+
+
+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__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCXX\" 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
+
+# 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 polyglot $as_me 1.4w10UCIb15, 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="\\
+polyglot config.status 1.4w10UCIb15
+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=:
+ ;;
+ *)
+ 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
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "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
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$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
+CXXDEPMODE!$CXXDEPMODE$ac_delim
+am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
+am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+CCDEPMODE!$CCDEPMODE$ac_delim
+am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
+am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
+CPP!$CPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$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` = 86; 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
+
+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
+
+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
+
--- /dev/null
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ(2.61)
+AC_INIT([polyglot], [1.4w10UCIb15], [michel.vandenbergh@uhasselt.be])
+AM_INIT_AUTOMAKE
+AC_CONFIG_SRCDIR([adapter.cpp])
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_CC
+
+# Checks for libraries.
+# FIXME: Replace `main' with a function in `-lm':
+AC_CHECK_LIB([m], [sin])
+
+# Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS([stdlib.h string.h sys/time.h unistd.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_HEADER_STDBOOL
+AC_C_CONST
+AC_C_INLINE
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_HEADER_TIME
+
+# Checks for library functions.
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_REALLOC
+AC_FUNC_SELECT_ARGTYPES
+AC_FUNC_SETVBUF_REVERSED
+AC_TYPE_SIGNAL
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS([dup2 floor gettimeofday memchr memmove select strchr strdup strerror strstr])
+
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
--- /dev/null
+The Debian Package polyglot
+----------------------------
+
+Comments regarding the Package
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 01 Jan 2009 21:32:12 +0100
--- /dev/null
+polyglot (1.4w10UCIb15) unstable; urgency=low
+
+ * bugfix : due to refactoring time stamps in Windows would be written twice. This has been fixed.
+
+ * More refactoring; the number of #ifdef _WIN32's has again been drastically reduced.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Sat, 10 Jan 2009 20:00:00 +0100
+
+polyglot (1.4w10UCIb14) unstable; urgency=low
+
+ * option to alter priority now also works on windows (Eric Mullins)
+
+ * refactoring so that posix and win32 part share more code
+
+ * a number of potential busy loop scenarios have been eliminated in the Windows code (Windows uses polling)
+
+ * the return value of CreateProcess is now checked
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Fri, 09 Jan 2009 20:00:00 +0100
+
+polyglot (1.4w10UCIb13) unstable; urgency=low
+
+ * Perft mode exposed.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 06 Jan 2009 20:00:00 +0100
+
+polyglot (1.4w10UCIb12) unstable; urgency=low
+
+ * Replaced %lld everywhere by S64_FORMAT.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 06 Jan 2009 18:00:00 +0100
+
+polyglot (1.4w10UCIb11) unstable; urgency=low
+
+ * Crash bug fix (wrong parentheses in instruction that checked for help
+option)
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 05 Jan 2009 18:00:00 +0100
+
+polyglot (1.4w10UCIb10) unstable; urgency=low
+
+ * Trivial bug fixes
+
+ * It is now possible to do "make rpm" to make an rpm binary package.
+
+ * Documentation added for epd-test functionality (man page).
+
+ * Cosmetic cleanups of output of epd-test.
+
+ * "polyglot --help" output added.
+
+ * Added polyglot book format specification to distribution.
+
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 02 Jan 2009 18:00:00 +0100
+
+polyglot (1.4w10UCIb9) unstable; urgency=low
+
+ * Trivial cosmetic fixes
+
+ * Some engines do not support the Hash option. So we don't send memory=1 in that case.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 02 Jan 2009 15:15:15 +0100
+
+polyglot (1.4w10UCIb8) unstable; urgency=low
+
+ * Support for egtpath command in xboard protocol
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Fri, 02 Jan 2009 11:10:23 +0100
+
+polyglot (1.4w10UCIb7) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Michel Van den Bergh <michel.vandenbergh@uhasselt.be> Thu, 01 Jan 2009 21:32:12 +0100
--- /dev/null
+Source: polyglot
+Section: games
+Priority: extra
+Maintainer: Michel Van den Bergh <michel.vandenbergh@uhasselt.be>
+Build-Depends: debhelper (>= 5), autotools-dev
+Standards-Version: 3.7.2
+
+Package: polyglot
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: A Winboard protocol to UCI protocol adapter
+ PolyGlot is a "UCI adapter". It connects a GUI interface (such as
+ XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
--- /dev/null
+This package was debianized by Michel Van den Bergh <michel.vandenbergh@uhasselt.be> on
+Thu, 01 Jan 2009 21:32:12 +0100.
+
+It was downloaded from <http://alpha.uhasselt.be/Research/Algebra/Toga/polyglot-release>
+
+Upstream Authors:
+
+ Fabien Letouzey<fabien_letouzey(at)hotmail.com>
+ Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
+ Fonzy Bleumers<match(at)geenvis.net>
+ Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
+
+Copyright:
+
+ Copyright (C) 2006 Fabien Letouzey
+ Copyright (C) 2006 Huang Chen
+ Copyright (C) 2009 Fonzy Bleumers
+ Copyright (C) 2009 Michel Van den Bergh
+
+License:
+
+ This package 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 package 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 package; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2009, Michel Van den Bergh <michel.vandenbergh@uhasselt.be> and
+is licensed under the GPL, see above.
+
--- /dev/null
+NEWS
+README
+README1.3
+README1.4
+README1.4w
+README1.4w10UCI
--- /dev/null
+polyglot_1.4w10UCIb15_i386.deb games extra
--- /dev/null
+shlibs:Depends=libgcc1 , libstdc++6 (>= 4.1.1-21), libc6 (>= 2.4)
--- /dev/null
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+
+
+config.status: configure
+ dh_testdir
+ # Add here commands to configure the package.
+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
+ cp -f /usr/share/misc/config.sub config.sub
+endif
+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
+ cp -f /usr/share/misc/config.guess config.guess
+endif
+ ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --bindir=\$${prefix}/games CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
+
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+
+ # Add here commands to compile the package.
+ $(MAKE)
+ #docbook-to-man debian/polyglot.sgml > polyglot.1
+
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ rm -f build-stamp
+
+ # Add here commands to clean up after the build process.
+ [ ! -f Makefile ] || $(MAKE) distclean
+ rm -f config.sub config.guess
+
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ # Add here commands to install the package into debian/polyglot.
+ $(MAKE) DESTDIR=$(CURDIR)/debian/polyglot install
+
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_installexamples
+# dh_install
+# dh_installmenu
+# dh_installdebconf
+# dh_installlogrotate
+# dh_installemacsen
+# dh_installpam
+# dh_installmime
+# dh_python
+# dh_installinit
+# dh_installcron
+# dh_installinfo
+ dh_installman
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+# dh_perl
+# dh_makeshlibs
+ dh_installdeb
+ dh_shlibdeps
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- /dev/null
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2007-03-29.01
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake@gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> $depfile
+ echo >> $depfile
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> $depfile
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no
+ for arg in "$@"; do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix="`echo $object | sed 's/^.*\././'`"
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test $1 != '--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o,
+ # because we must use -o when running libtool.
+ "$@" || exit $?
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+#ifndef _WIN32\r
+\r
+// engine.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdarg>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include <sys/types.h>\r
+#include <unistd.h>\r
+\r
+#include "engine.h"\r
+#include "io.h"\r
+#include "option.h"\r
+#include "util.h"\r
+\r
+\r
+// constants\r
+\r
+static const int StringSize = 4096;\r
+\r
+// variables\r
+\r
+engine_t Engine[1];\r
+\r
+// prototypes\r
+\r
+static void my_close (int fd);\r
+static void my_dup2 (int old_fd, int new_fd);\r
+\r
+// functions\r
+\r
+// engine_is_ok()\r
+\r
+bool engine_is_ok(const engine_t * engine) {\r
+\r
+ if (engine == NULL) return false;\r
+\r
+ if (!io_is_ok(engine->io)) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// engine_open()\r
+\r
+void engine_open(engine_t * engine) {\r
+\r
+ const char * dir, * command;\r
+ char string[StringSize];\r
+ int argc;\r
+ char * ptr;\r
+ char * argv[256];\r
+ int from_engine[2], to_engine[2];\r
+ pid_t pid;\r
+\r
+ ASSERT(engine!=NULL);\r
+\r
+ // init\r
+\r
+ dir = option_get_string("EngineDir");\r
+ my_log("POLYGLOT Dir \"%s\"\n",dir);\r
+\r
+ command = option_get_string("EngineCommand");\r
+ my_log("POLYGLOT Command \"%s\"\n",command);\r
+\r
+ // parse the command line and create the argument list\r
+\r
+ if (strlen(command) >= StringSize) my_fatal("engine_open(): buffer overflow\n");\r
+ strcpy(string,command);\r
+\r
+ argc = 0;\r
+\r
+ for (ptr = strtok(string," "); ptr != NULL; ptr = strtok(NULL," ")) {\r
+ argv[argc++] = ptr;\r
+ }\r
+\r
+ argv[argc] = NULL;\r
+\r
+ // create the pipes\r
+\r
+ if (pipe(from_engine) == -1) {\r
+ my_fatal("engine_open(): pipe(): %s\n",strerror(errno));\r
+ }\r
+\r
+ if (pipe(to_engine) == -1) {\r
+ my_fatal("engine_open(): pipe(): %s\n",strerror(errno));\r
+ }\r
+\r
+ // create the child process\r
+\r
+ pid = fork();\r
+\r
+ if (pid == -1) {\r
+\r
+ my_fatal("engine_open(): fork(): %s\n",strerror(errno));\r
+\r
+ } else if (pid == 0) {\r
+\r
+ // child = engine\r
+\r
+ // close unused pipe descriptors to avoid deadlocks\r
+\r
+ my_close(from_engine[0]);\r
+ my_close(to_engine[1]);\r
+\r
+ // attach the pipe to standard input\r
+\r
+ my_dup2(to_engine[0],STDIN_FILENO);\r
+ my_close(to_engine[0]);\r
+\r
+ // attach the pipe to standard output\r
+\r
+ my_dup2(from_engine[1],STDOUT_FILENO);\r
+ my_close(from_engine[1]);\r
+\r
+ // attach standard error to standard output\r
+\r
+ my_dup2(STDOUT_FILENO,STDERR_FILENO);\r
+\r
+ // set a low priority\r
+\r
+ if (option_get_bool("UseNice"))\r
+ {\r
+ my_log("POLYGLOT Adjust Engine Piority");\r
+ nice(+option_get_int("NiceValue"));\r
+ }\r
+\r
+ // change the current directory\r
+\r
+ if (dir[0] != '\0' && chdir(dir) == -1) {\r
+ my_fatal("engine_open(): chdir(): %s\n",strerror(errno));\r
+ }\r
+\r
+ // launch the new executable file\r
+\r
+ execvp(argv[0],&argv[0]);\r
+\r
+ // execvp() only returns when an error has occured\r
+\r
+ my_fatal("engine_open(): execvp(): %s\n",strerror(errno));\r
+\r
+ } else { // pid > 0\r
+\r
+ ASSERT(pid>0);\r
+\r
+ // parent = PolyGlot\r
+\r
+ // close unused pipe descriptors to avoid deadlocks\r
+\r
+ my_close(from_engine[1]);\r
+ my_close(to_engine[0]);\r
+\r
+ // fill in the engine struct\r
+\r
+ engine->io->in_fd = from_engine[0];\r
+ engine->io->out_fd = to_engine[1];\r
+ engine->io->name = "Engine";\r
+\r
+ io_init(engine->io);\r
+ }\r
+}\r
+\r
+// engine_close()\r
+\r
+void engine_close(engine_t * engine) {\r
+\r
+ ASSERT(engine_is_ok(engine));\r
+\r
+ io_close(engine->io);\r
+}\r
+\r
+// engine_get()\r
+\r
+void engine_get(engine_t * engine, char string[], int size) {\r
+\r
+ ASSERT(engine_is_ok(engine));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=256);\r
+\r
+ while (!io_line_ready(engine->io)) {\r
+ io_get_update(engine->io);\r
+ }\r
+\r
+ if (!io_get_line(engine->io,string,size)) { // EOF\r
+ my_log("POLYGLOT *** EOF from Engine ***\n");\r
+ exit(EXIT_SUCCESS);\r
+ }\r
+}\r
+\r
+// engine_send()\r
+\r
+void engine_send(engine_t * engine, const char format[], ...) {\r
+\r
+ va_list arg_list;\r
+ char string[StringSize];\r
+\r
+ ASSERT(engine_is_ok(engine));\r
+ ASSERT(format!=NULL);\r
+\r
+ // format\r
+\r
+ va_start(arg_list,format);\r
+ vsprintf(string,format,arg_list);\r
+ va_end(arg_list);\r
+\r
+ // send\r
+\r
+ io_send(engine->io,"%s",string);\r
+}\r
+\r
+// engine_send_queue()\r
+\r
+void engine_send_queue(engine_t * engine, const char format[], ...) {\r
+\r
+ va_list arg_list;\r
+ char string[StringSize];\r
+\r
+ ASSERT(engine_is_ok(engine));\r
+ ASSERT(format!=NULL);\r
+\r
+ // format\r
+\r
+ va_start(arg_list,format);\r
+ vsprintf(string,format,arg_list);\r
+ va_end(arg_list);\r
+\r
+ // send\r
+\r
+ io_send_queue(engine->io,"%s",string);\r
+}\r
+\r
+// my_close()\r
+\r
+static void my_close(int fd) {\r
+\r
+ ASSERT(fd>=0);\r
+\r
+ if (close(fd) == -1) my_fatal("my_close(): close(): %s\n",strerror(errno));\r
+}\r
+\r
+// my_dup2()\r
+\r
+static void my_dup2(int old_fd, int new_fd) {\r
+\r
+ ASSERT(old_fd>=0);\r
+ ASSERT(new_fd>=0);\r
+\r
+ if (dup2(old_fd,new_fd) == -1) my_fatal("my_dup2(): dup2(): %s\n",strerror(errno));\r
+}\r
+\r
+// end of posix part\r
+#else\r
+\r
+// WIN32 part\r
+\r
+// includes\r
+\r
+#include <stdlib.h>\r
+#include <string.h>\r
+#include <windows.h>\r
+#include <direct.h>\r
+\r
+\r
+\r
+#include "engine.h"\r
+#include "option.h"\r
+#include "pipe.h"\r
+#include "posix.h"\r
+\r
+// constants\r
+\r
+static const int StringSize = 4096;\r
+\r
+// variables\r
+\r
+static int nQueuePtr = 0;\r
+static char szQueueString[StringSize];\r
+engine_t Engine[1];\r
+\r
+// functions\r
+\r
+DWORD GetWin32Priority(int nice)\r
+{\r
+/*\r
+REALTIME_PRIORITY_CLASS 0x00000100\r
+HIGH_PRIORITY_CLASS 0x00000080\r
+ABOVE_NORMAL_PRIORITY_CLASS 0x00008000\r
+NORMAL_PRIORITY_CLASS 0x00000020\r
+BELOW_NORMAL_PRIORITY_CLASS 0x00004000\r
+IDLE_PRIORITY_CLASS 0x00000040\r
+*/\r
+ if (nice < -15) return 0x00000080;\r
+ if (nice < 0) return 0x00008000;\r
+ if (nice == 0) return 0x00000020;\r
+ if (nice < 15) return 0x00004000;\r
+ return 0x00000040;\r
+}\r
+\r
+\r
+\r
+void set_affinity(engine_t *engine, int affin){\r
+ if(affin==-1) return;\r
+ SetProcessAffinityMask((engine->pipeEngine).hProcess,affin);\r
+}\r
+\r
+\r
+\r
+void engine_send_queue(engine_t * engine,const char *szFormat, ...) {\r
+ nQueuePtr += vsprintf(szQueueString + nQueuePtr, szFormat, (va_list) (&szFormat + 1));\r
+}\r
+\r
+void engine_send(engine_t * engine, const char *szFormat, ...) {\r
+ vsprintf(szQueueString + nQueuePtr, szFormat, (va_list) (&szFormat + 1));\r
+ (engine->pipeEngine).LineOutput(szQueueString);\r
+ my_log("Adapter->Engine: %s\n",szQueueString);\r
+ nQueuePtr = 0;\r
+}\r
+\r
+void engine_close(engine_t * engine){\r
+ (engine->pipeEngine).Close();\r
+}\r
+\r
+\r
+void engine_open(engine_t * engine){\r
+ int affinity;\r
+ char *my_dir;\r
+ if( (my_dir = _getcwd( NULL, 0 )) == NULL )\r
+ my_fatal("Can't build path: %s\n",strerror(errno));\r
+ SetCurrentDirectory(option_get_string("EngineDir"));\r
+ (engine->pipeEngine).Open(option_get_string("EngineCommand"));\r
+ //play with affinity (bad idea) \r
+ affinity=option_get_int("Affinity");\r
+ if(affinity!=-1) set_affinity(engine,affinity); //AAA\r
+ //lets go back\r
+ SetCurrentDirectory(my_dir);\r
+ // set a low priority\r
+ if (option_get_bool("UseNice")){\r
+ my_log("POLYGLOT Adjust Engine Piority\n");\r
+ SetPriorityClass((engine->pipeEngine).hProcess,\r
+ GetWin32Priority(option_get_int("NiceValue")));\r
+ }\r
+ \r
+}\r
+\r
+bool engine_get_non_blocking(engine_t * engine, char *szLineStr, int size){\r
+ if ((engine->pipeEngine).LineInput(szLineStr)) {\r
+ my_log("Engine->Adapter: %s\n",szLineStr);\r
+ return true;\r
+ } else {\r
+ szLineStr[0]='\0';\r
+ return false;\r
+ }\r
+}\r
+\r
+void engine_get(engine_t * engine, char *szLineStr, int size){\r
+ bool data_available;\r
+ while(true){\r
+ data_available=engine_get_non_blocking(engine,szLineStr,size);\r
+ if(!data_available){\r
+ Idle();\r
+ }else{\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+\r
+#endif\r
--- /dev/null
+// engine.h\r
+\r
+#ifndef ENGINE_H\r
+#define ENGINE_H\r
+\r
+// includes\r
+\r
+#include "io.h"\r
+#include "util.h"\r
+#include "pipe.h"\r
+\r
+// types\r
+\r
+struct engine_t {\r
+#ifndef _WIN32\r
+ io_t io[1];\r
+#else\r
+ PipeStruct pipeEngine;\r
+#endif\r
+};\r
+\r
+\r
+\r
+// variables\r
+\r
+extern engine_t Engine[1];\r
+\r
+// functions\r
+\r
+extern bool engine_is_ok (const engine_t * engine);\r
+extern void engine_open (engine_t * engine);\r
+extern void engine_close (engine_t * engine);\r
+extern void engine_send (engine_t * engine, const char format[], ...);\r
+extern void engine_send_queue (engine_t * engine, const char format[], ...);\r
+extern bool engine_get_non_blocking(engine_t * engine, char string[], int size);\r
+extern void engine_get (engine_t * engine, char string[], int size);\r
+\r
+\r
+#endif // !defined ENGINE_H\r
--- /dev/null
+\r
+// epd.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "board.h"\r
+#include "engine.h"\r
+#include "epd.h"\r
+#include "fen.h"\r
+#include "line.h"\r
+#include "main.h"\r
+#include "move.h"\r
+#include "move_legal.h"\r
+#include "option.h"\r
+#include "parse.h"\r
+#include "san.h"\r
+#include "uci.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseDebug = false;\r
+static const bool UseTrace = false;\r
+\r
+static const int StringSize = 4096;\r
+\r
+// variables\r
+\r
+static int MinDepth;\r
+static int MaxDepth;\r
+\r
+static double MaxTime;\r
+static double MinTime;\r
+\r
+static int DepthDelta;\r
+\r
+static int FirstMove;\r
+static int FirstDepth;\r
+static int FirstSelDepth;\r
+static int FirstScore;\r
+static double FirstTime;\r
+static uint64 FirstNodeNb;\r
+static move_t FirstPV[LineSize];\r
+\r
+static int LastMove;\r
+static int LastDepth;\r
+static int LastSelDepth;\r
+static int LastScore;\r
+static double LastTime;\r
+static uint64 LastNodeNb;\r
+static move_t LastPV[LineSize];\r
+\r
+// prototypes\r
+\r
+static void epd_test_file (const char file_name[]);\r
+\r
+static bool is_solution (int move, const board_t * board, const char bm[], const char am[]);\r
+static bool string_contain (const char string[], const char substring[]);\r
+\r
+static bool engine_step ();\r
+\r
+// functions\r
+\r
+// epd_test()\r
+\r
+void epd_test(int argc, char * argv[]) {\r
+\r
+ int i;\r
+ const char * epd_file;\r
+\r
+ epd_file = NULL;\r
+ my_string_set(&epd_file,"wac.epd");\r
+\r
+ MinDepth = 8;\r
+ MaxDepth = 63;\r
+\r
+ MinTime = 1.0;\r
+ MaxTime = 5.0;\r
+\r
+ DepthDelta = 3;\r
+\r
+ for (i = 1; i < argc; i++) {\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(argv[i],"epd-test")) {\r
+\r
+ // skip\r
+\r
+ } else if (my_string_equal(argv[i],"-epd")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ my_string_set(&epd_file,argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-min-depth")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ MinDepth = atoi(argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-max-depth")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ MaxDepth = atoi(argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-min-time")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ MinTime = atof(argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-max-time")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ MaxTime = atof(argv[i]);\r
+\r
+ } else if (my_string_equal(argv[i],"-depth-delta")) {\r
+\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("epd_test(): missing argument\n");\r
+\r
+ DepthDelta = atoi(argv[i]);\r
+\r
+ } else {\r
+\r
+ my_fatal("epd_test(): unknown option \"%s\"\n",argv[i]);\r
+ }\r
+ }\r
+\r
+ if(MinTime>MaxTime){\r
+ MaxTime=MinTime;\r
+ }\r
+ \r
+ epd_test_file(epd_file);\r
+}\r
+\r
+// epd_test_file()\r
+\r
+static void epd_test_file(const char file_name[]) {\r
+\r
+ FILE * file;\r
+ int hit, tot;\r
+ char epd[StringSize];\r
+ char am[StringSize], bm[StringSize], id[StringSize];\r
+ board_t board[1];\r
+ char string[StringSize];\r
+ int move;\r
+ char pv_string[StringSize];\r
+ bool correct;\r
+ double depth_tot, time_tot, node_tot;\r
+ int line=0;\r
+\r
+ ASSERT(file_name!=NULL);\r
+\r
+ // init\r
+\r
+ file = fopen(file_name,"r");\r
+ if (file == NULL) my_fatal("epd_test_file(): can't open file \"%s\": %s\n",file_name,strerror(errno));\r
+\r
+ hit = 0;\r
+ tot = 0;\r
+\r
+ depth_tot = 0.0;\r
+ time_tot = 0.0;\r
+ node_tot = 0.0;\r
+\r
+ printf("\nEngineName=%s\n",option_get_string("EngineName"));\r
+\r
+ printf("\n[Search parameters: MaxDepth=%d MaxTime=%.1f DepthDelta=%d MinDepth=%d MinTime=%.1f]\n\n",MaxDepth,MaxTime,DepthDelta,MinDepth,MinTime);\r
+\r
+ // loop\r
+\r
+ while (my_file_read_line(file,epd,StringSize)) {\r
+ line++;\r
+ if(my_string_whitespace(epd)) continue;\r
+ if (UseTrace) printf("%s\n",epd);\r
+\r
+ if (!epd_get_op(epd,"am",am,StringSize)) strcpy(am,"");\r
+ if (!epd_get_op(epd,"bm",bm,StringSize)) strcpy(bm,"");\r
+ if (!epd_get_op(epd,"id",id,StringSize)) strcpy(id,"");\r
+\r
+ if (my_string_empty(am) && my_string_empty(bm)) {\r
+ my_fatal("epd_test(): no am or bm field at line %d\n",line);\r
+ }\r
+\r
+ // init\r
+\r
+ uci_send_ucinewgame(Uci);\r
+ uci_send_isready_sync(Uci);\r
+\r
+ ASSERT(!Uci->searching);\r
+\r
+ // position\r
+ if (!board_from_fen(board,epd)) ASSERT(false);\r
+ if (!board_to_fen(board,string,StringSize)) ASSERT(false);\r
+\r
+ engine_send(Engine,"position fen %s",string);\r
+\r
+ // search\r
+\r
+ // which ones of the next two alternatives is best?\r
+ engine_send(Engine,"go movetime %.0f depth %d",MaxTime*1000.0,MaxDepth);\r
+ //engine_send(Engine,"go infinite");\r
+\r
+ // engine data\r
+\r
+ board_copy(Uci->board,board);\r
+\r
+ uci_clear(Uci);\r
+ Uci->searching = true;\r
+ Uci->pending_nb++;\r
+\r
+ FirstMove = MoveNone;\r
+ FirstDepth = 0;\r
+ FirstSelDepth = 0;\r
+ FirstScore = 0;\r
+ FirstTime = 0.0;\r
+ FirstNodeNb = 0;\r
+ line_clear(FirstPV);\r
+\r
+ LastMove = MoveNone;\r
+ LastDepth = 0;\r
+ LastSelDepth = 0;\r
+ LastScore = 0;\r
+ LastTime = 0.0;\r
+ LastNodeNb = 0;\r
+ line_clear(LastPV);\r
+\r
+ // parse engine output\r
+\r
+ while (engine_step()) {\r
+ bool stop=false;\r
+ // stop search?\r
+\r
+ if (Uci->depth > MaxDepth){\r
+ my_log("POLYGLOT Maximum depth %d reached\n",MaxDepth);\r
+ stop=true;\r
+ }else if(Uci->time >= MaxTime){\r
+ my_log("POLYGLOT Maximum search time %.2fs reached\n",MaxTime);\r
+ stop=true;\r
+ }else if(Uci->depth - FirstDepth >= DepthDelta){\r
+ my_log("POLYGLOT DepthDelta (=%d) reached\n",DepthDelta);\r
+ if(Uci->depth > MinDepth){\r
+ my_log("POLYGLOT Minimum depth %d reached\n",MinDepth);\r
+ if(Uci->time >= MinTime){\r
+ my_log("POLYGLOT Minimum search time %.2fs reached\n",MinTime);\r
+ if(is_solution(FirstMove,board,bm,am)){\r
+ my_log("POLYGLOT Solution is correct\n");\r
+ stop=true;\r
+ }else{\r
+ my_log("POLYGLOT Solution is not correct\n");\r
+ }\r
+ }\r
+ }\r
+ }\r
+ if(stop){\r
+ my_log("POLYGLOT Stopping engine\n");\r
+ engine_send(Engine,"stop");\r
+ break;\r
+ }\r
+ }\r
+ \r
+ move = FirstMove;\r
+ correct = is_solution(move,board,bm,am);\r
+\r
+ if (correct) hit++;\r
+ tot++;\r
+\r
+ if (correct) {\r
+ depth_tot += double(FirstDepth);\r
+ time_tot += FirstTime;\r
+ node_tot += double(FirstNodeNb);\r
+ }\r
+\r
+ printf("%2d: %-15s %s %4d",tot,id,correct?"OK":"--",hit);\r
+\r
+ if (!line_to_san(LastPV,Uci->board,pv_string,StringSize)) ASSERT(false);\r
+ printf(" [at: depth=%2d time=%6.2f nodes="S64_FORMAT"] score=%+6.2f pv=%s\n",FirstDepth,FirstTime,FirstNodeNb,double(LastScore)/100.0,pv_string);\r
+ }\r
+\r
+ printf("\nscore=%d/%d",hit,tot);\r
+\r
+ if (hit != 0) {\r
+\r
+ depth_tot /= double(hit);\r
+ time_tot /= double(hit);\r
+ node_tot /= double(hit);\r
+\r
+ printf(" [averages on correct positions: depth=%.1f time=%.2f nodes=%.0f]",depth_tot,time_tot,node_tot);\r
+ }\r
+\r
+ printf("\n");\r
+\r
+ fclose(file);\r
+ quit();\r
+}\r
+\r
+// is_solution()\r
+\r
+static bool is_solution(int move, const board_t * board, const char bm[], const char am[]) {\r
+\r
+ char move_string[256];\r
+ bool correct;\r
+\r
+ ASSERT(move!=MoveNone);\r
+ ASSERT(bm!=NULL);\r
+ ASSERT(am!=NULL);\r
+\r
+ if (!move_is_legal(move,board)) {\r
+ board_disp(board);\r
+ move_disp(move,board);\r
+ printf("\n\n");\r
+ }\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ if (!move_to_san(move,board,move_string,256)) ASSERT(false);\r
+\r
+ correct = false;\r
+ if (!my_string_empty(bm)) {\r
+ correct = string_contain(bm,move_string);\r
+ } else if (!my_string_empty(am)) {\r
+ correct = !string_contain(am,move_string);\r
+ } else {\r
+ ASSERT(false);\r
+ }\r
+\r
+ return correct;\r
+}\r
+\r
+// epd_get_op()\r
+\r
+bool epd_get_op(const char record[], const char opcode[], char string[], int size) {\r
+\r
+ char op[256];\r
+ int len;\r
+ const char *p_start, *p_end;\r
+\r
+ ASSERT(record!=NULL);\r
+ ASSERT(opcode!=NULL);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>0);\r
+\r
+ // find the opcode\r
+\r
+ sprintf(op," %s ",opcode); \r
+\r
+ p_start = strstr(record,op);\r
+ if (p_start == NULL){\r
+ sprintf(op,";%s ",opcode); \r
+ p_start = strstr(record,op);\r
+ if (p_start == NULL){\r
+ return false;\r
+ }\r
+ }\r
+\r
+ // skip the opcode\r
+\r
+ p_start += strlen(op);\r
+\r
+ // find the end\r
+ p_end = strchr(p_start,';');\r
+ if (p_end == NULL) return false;\r
+\r
+ // calculate the length\r
+\r
+ len = p_end - p_start;\r
+ if (size < len+1) my_fatal("epd_get_op(): size < len+1\n");\r
+\r
+ strncpy(string,p_start,len);\r
+ string[len] = '\0';\r
+\r
+ return true;\r
+}\r
+\r
+// string_contain()\r
+\r
+static bool string_contain(const char string[], const char substring[]) {\r
+\r
+ char new_string[StringSize], *p;\r
+\r
+ strcpy(new_string,string); // HACK\r
+\r
+ for (p = strtok(new_string," "); p != NULL; p = strtok(NULL," ")) {\r
+ if (my_string_equal(p,substring)) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// engine_step()\r
+\r
+static bool engine_step() {\r
+\r
+ char string[StringSize];\r
+ int event;\r
+\r
+ engine_get(Engine,string,StringSize);\r
+ event = uci_parse(Uci,string);\r
+\r
+ if ((event & EVENT_MOVE) != 0) {\r
+\r
+ return false;\r
+ }\r
+\r
+ if ((event & EVENT_PV) != 0) {\r
+\r
+ LastMove = Uci->best_pv[0];\r
+ LastDepth = Uci->best_depth;\r
+ LastSelDepth = Uci->best_sel_depth;\r
+ LastScore = Uci->best_score;\r
+ LastTime = Uci->time;\r
+ LastNodeNb = Uci->node_nb;\r
+ line_copy(LastPV,Uci->best_pv);\r
+\r
+ if (LastMove != FirstMove) {\r
+ FirstMove = LastMove;\r
+ FirstDepth = LastDepth;\r
+ FirstSelDepth = LastSelDepth;\r
+ FirstScore = LastScore;\r
+ FirstTime = LastTime;\r
+ FirstNodeNb = LastNodeNb;\r
+ line_copy(FirstPV,LastPV);\r
+ }\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// end of epd.cpp\r
+\r
--- /dev/null
+\r
+// epd.h\r
+\r
+#ifndef EPD_H\r
+#define EPD_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void epd_test (int argc, char * argv[]);\r
+\r
+extern bool epd_get_op (const char record[], const char opcode[], char string[], int size);\r
+\r
+#endif // !defined EPD_H\r
+\r
+// end of epd.h\r
+\r
--- /dev/null
+\r
+// fen.cpp\r
+\r
+// includes\r
+\r
+#include <cctype>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "fen.h"\r
+#include "option.h"\r
+#include "piece.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+// const char * StartFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w HAha - 0 1";\r
+const char * StartFen = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";\r
+\r
+// variables\r
+\r
+static const bool Strict = false;\r
+\r
+// macros\r
+\r
+#define skip_white_space() \\r
+ c=string[pos];\\r
+ if (c != ' ' && c!='\t') my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos); \\r
+ while(c==' ' || c=='\t') c=string[++pos];\r
+\r
+\r
+// functions\r
+\r
+// board_from_fen()\r
+\r
+bool board_from_fen(board_t * board, const char string[]) {\r
+\r
+ int pos;\r
+ int file, rank, sq;\r
+ int c;\r
+ int i, len;\r
+ int piece;\r
+ int king_pos[ColourNb];\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(string!=NULL);\r
+\r
+ board_clear(board);\r
+\r
+ king_pos[White] = SquareNone;\r
+ king_pos[Black] = SquareNone;\r
+\r
+ pos = 0;\r
+ c = string[pos];\r
+\r
+ // piece placement\r
+\r
+ for (rank = 7; rank >= 0; rank--) {\r
+\r
+ for (file = 0; file < 8;) {\r
+\r
+ sq = square_make(file,rank);\r
+\r
+ if (c >= '1' && c <= '8') { // empty square(s)\r
+\r
+ len = c - '0';\r
+ if (file + len > 8) my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+\r
+ for (i = 0; i < len; i++) {\r
+ board->square[sq++] = Empty;\r
+ file++;\r
+ }\r
+\r
+ } else { // piece\r
+\r
+ piece = piece_from_char(c);\r
+ if (piece == PieceNone256) my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+\r
+ if (piece_is_king(piece)) king_pos[piece_colour(piece)] = sq;\r
+\r
+ board->square[sq++] = piece;\r
+ file++;\r
+ }\r
+\r
+ c = string[++pos];\r
+ }\r
+\r
+ if (rank > 0) {\r
+ if (c != '/') my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ c = string[++pos];\r
+ }\r
+ }\r
+\r
+ // active colour\r
+\r
+ skip_white_space();\r
+\r
+ switch (c) {\r
+ case 'w':\r
+ board->turn = White;\r
+ break;\r
+ case 'b':\r
+ board->turn = Black;\r
+ break;\r
+ default:\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ break;\r
+ }\r
+\r
+ c = string[++pos];\r
+\r
+ // castling\r
+\r
+ skip_white_space();\r
+\r
+ board->castle[White][SideH] = SquareNone;\r
+ board->castle[White][SideA] = SquareNone;\r
+ board->castle[Black][SideH] = SquareNone;\r
+ board->castle[Black][SideA] = SquareNone;\r
+\r
+ if (c == '-') { // no castling rights\r
+\r
+ c = string[++pos];\r
+\r
+ } else {\r
+\r
+ // TODO: filter out illegal rights\r
+\r
+ do {\r
+\r
+ if (false) {\r
+\r
+ } else if (c == 'K') {\r
+\r
+ for (sq = H1; sq > king_pos[White]; sq--) {\r
+ if (board->square[sq] == WhiteRook256) {\r
+ board->castle[White][SideH] = sq;\r
+ break;\r
+ }\r
+ }\r
+\r
+ } else if (c == 'Q') {\r
+\r
+ for (sq = A1; sq < king_pos[White]; sq++) {\r
+ if (board->square[sq] == WhiteRook256) {\r
+ board->castle[White][SideA] = sq;\r
+ break;\r
+ }\r
+ }\r
+\r
+ } else if (c == 'k') {\r
+\r
+ for (sq = H8; sq > king_pos[Black]; sq--) {\r
+ if (board->square[sq] == BlackRook256) {\r
+ board->castle[Black][SideH] = sq;\r
+ break;\r
+ }\r
+ }\r
+\r
+ } else if (c == 'q') {\r
+\r
+ for (sq = A8; sq < king_pos[Black]; sq++) {\r
+ if (board->square[sq] == BlackRook256) {\r
+ board->castle[Black][SideA] = sq;\r
+ break;\r
+ }\r
+ }\r
+\r
+ } else if (c >= 'A' && c <= 'H') {\r
+\r
+ // white castling right\r
+\r
+ sq = square_make(file_from_char(tolower(c)),Rank1);\r
+\r
+ if (sq > king_pos[White]) { // h side\r
+ board->castle[White][SideH] = sq;\r
+ } else { // a side\r
+ board->castle[White][SideA] = sq;\r
+ }\r
+\r
+ } else if (c >= 'a' && c <= 'h') {\r
+\r
+ // black castling right\r
+\r
+ sq = square_make(file_from_char(tolower(c)),Rank8);\r
+\r
+ if (sq > king_pos[Black]) { // h side\r
+ board->castle[Black][SideH] = sq;\r
+ } else { // a side\r
+ board->castle[Black][SideA] = sq;\r
+ }\r
+\r
+ } else {\r
+\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ }\r
+\r
+ c = string[++pos];\r
+\r
+ } while (c != ' ');\r
+ }\r
+\r
+ // en-passant\r
+\r
+ skip_white_space();\r
+\r
+ if (c == '-') { // no en-passant\r
+\r
+ sq = SquareNone;\r
+ c = string[++pos];\r
+\r
+ } else {\r
+\r
+ if (c < 'a' || c > 'h') my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ file = file_from_char(c);\r
+ c = string[++pos];\r
+\r
+ if (c < '1' || c > '8') my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ rank = rank_from_char(c);\r
+ c = string[++pos];\r
+\r
+ sq = square_make(file,rank);\r
+ }\r
+\r
+ board->ep_square = sq;\r
+\r
+ // halfmove clock\r
+\r
+ board->ply_nb = 0;\r
+ board->move_nb = 0; // HACK, in case of broken syntax\r
+\r
+ if (c != ' ') {\r
+ if (!Strict) goto update;\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ }\r
+ c = string[++pos];\r
+\r
+ if (!isdigit(c)) {\r
+ if (!Strict) goto update;\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ }\r
+\r
+ board->ply_nb = atoi(&string[pos]);\r
+ do c = string[++pos]; while (isdigit(c));\r
+\r
+ // fullmove number\r
+\r
+ board->move_nb = 0;\r
+\r
+ if (c != ' ') {\r
+ if (!Strict) goto update;\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ }\r
+ c = string[++pos];\r
+\r
+ if (!isdigit(c)) {\r
+ if (!Strict) goto update;\r
+ my_fatal("board_from_fen(): bad FEN (pos=%d)\n",pos);\r
+ }\r
+\r
+ board->move_nb = atoi(&string[pos]) - 1;\r
+ do c = string[++pos]; while (isdigit(c));\r
+\r
+ // board update\r
+\r
+update:\r
+ board_init_list(board);\r
+\r
+ return true;\r
+}\r
+\r
+// board_to_fen()\r
+\r
+bool board_to_fen(const board_t * board, char string[], int size) {\r
+\r
+ int pos;\r
+ int file, rank;\r
+ int sq, piece;\r
+ int c;\r
+ int len;\r
+ int old_pos;\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=92);\r
+\r
+ // init\r
+\r
+ if (size < 92) return false;\r
+\r
+ pos = 0;\r
+\r
+ // piece placement\r
+\r
+ for (rank = 7; rank >= 0; rank--) {\r
+\r
+ for (file = 0; file < 8;) {\r
+\r
+ sq = square_make(file,rank);\r
+ piece = board->square[sq];\r
+ ASSERT(piece==Empty||piece_is_ok(piece));\r
+\r
+ if (piece == Empty) {\r
+\r
+ len = 0;\r
+ for (; file < 8 && board->square[square_make(file,rank)] == Empty; file++) {\r
+ len++;\r
+ }\r
+\r
+ ASSERT(len>=1&&len<=8);\r
+ c = '0' + len;\r
+\r
+ } else {\r
+\r
+ c = piece_to_char(piece);\r
+ file++;\r
+ }\r
+\r
+ string[pos++] = c;\r
+ }\r
+\r
+ string[pos++] = '/';\r
+ }\r
+\r
+ string[pos-1] = ' '; // HACK: remove the last '/'\r
+\r
+ // active colour\r
+\r
+ string[pos++] = (colour_is_white(board->turn)) ? 'w' : 'b';\r
+ string[pos++] = ' ';\r
+\r
+ // castling\r
+\r
+ old_pos = pos;\r
+\r
+ if (option_get_bool("Chess960")) {\r
+\r
+ // FEN-960\r
+\r
+ if (board->castle[White][SideH] != SquareNone) {\r
+ string[pos++] = toupper(file_to_char(square_file(board->castle[White][SideH])));\r
+ }\r
+\r
+ if (board->castle[White][SideA] != SquareNone) {\r
+ string[pos++] = toupper(file_to_char(square_file(board->castle[White][SideA])));\r
+ }\r
+\r
+ if (board->castle[Black][SideH] != SquareNone) {\r
+ string[pos++] = tolower(file_to_char(square_file(board->castle[Black][SideH])));\r
+ }\r
+\r
+ if (board->castle[Black][SideA] != SquareNone) {\r
+ string[pos++] = tolower(file_to_char(square_file(board->castle[Black][SideA])));\r
+ }\r
+\r
+ } else {\r
+\r
+ // FEN\r
+\r
+ if (board->castle[White][SideH] != SquareNone) string[pos++] = 'K';\r
+ if (board->castle[White][SideA] != SquareNone) string[pos++] = 'Q';\r
+ if (board->castle[Black][SideH] != SquareNone) string[pos++] = 'k';\r
+ if (board->castle[Black][SideA] != SquareNone) string[pos++] = 'q';\r
+ }\r
+\r
+ if (pos == old_pos) string[pos++] = '-';\r
+\r
+ string[pos++] = ' ';\r
+\r
+ // en-passant\r
+\r
+ if (board->ep_square == SquareNone) {\r
+ string[pos++] = '-';\r
+ } else {\r
+ if (!square_to_string(board->ep_square,&string[pos],3)) return false;\r
+ pos += 2;\r
+ }\r
+\r
+ string[pos++] = ' ';\r
+\r
+ // halfmove clock and fullmove number\r
+\r
+ sprintf(&string[pos],"%d %d",board->ply_nb,board->move_nb+1);\r
+\r
+ return true;\r
+}\r
+\r
+// end of fen.cpp\r
+\r
--- /dev/null
+\r
+// fen.h\r
+\r
+#ifndef FEN_H\r
+#define FEN_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+extern const char * StartFen;\r
+\r
+// functions\r
+\r
+extern bool board_from_fen (board_t * board, const char string[]);\r
+extern bool board_to_fen (const board_t * board, char string[], int size);\r
+\r
+#endif // !defined FEN_H\r
+\r
+// end of fen.h\r
+\r
--- /dev/null
+\r
+// game.cpp\r
+\r
+// includes\r
+\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "fen.h"\r
+#include "game.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseSlowDebug = false;\r
+\r
+// variables\r
+\r
+game_t Game[1];\r
+\r
+// prototypes\r
+\r
+static void game_update (game_t * game);\r
+static int game_comp_status (const game_t * game);\r
+\r
+// functions\r
+\r
+// game_is_ok()\r
+\r
+bool game_is_ok(const game_t * game) {\r
+\r
+ board_t board[1];\r
+ int pos, move;\r
+\r
+ if (game == NULL) return false;\r
+\r
+ if (game->size < 0 || game->size > GameSize) return false;\r
+ if (game->pos < 0 || game->pos > game->size) return false;\r
+\r
+ // optional heavy DEBUG mode\r
+\r
+ if (!UseSlowDebug) return true;\r
+\r
+ if (!board_is_ok(game->start_board)) return false;\r
+\r
+ board_copy(board,game->start_board);\r
+\r
+ for (pos = 0; pos <= game->size; pos++) {\r
+\r
+ if (pos == game->pos) {\r
+ if (!board_equal(game->board,board)) return false;\r
+ }\r
+\r
+ if (pos >= game->size) break;\r
+\r
+ if (game->key[pos] != board->key) return false;\r
+\r
+ move = game->move[pos];\r
+ //if (!move_is_legal(move,board)); //huh??\r
+ if (!move_is_legal(move,board)) return false; \r
+\r
+ move_do(board,move);\r
+ }\r
+\r
+ if (game->status != game_comp_status(game)) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// game_clear()\r
+\r
+void game_clear(game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ game_init(game,StartFen);\r
+}\r
+\r
+// game_init()\r
+\r
+bool game_init(game_t * game, const char fen[]) {\r
+\r
+ ASSERT(game!=NULL);\r
+ ASSERT(fen!=NULL);\r
+\r
+ if (!board_from_fen(game->start_board,fen)) return false;\r
+\r
+ game->size = 0;\r
+\r
+ board_copy(game->board,game->start_board);\r
+ game->pos = 0;\r
+\r
+ game_update(game);\r
+\r
+ return true;\r
+}\r
+\r
+// game_status()\r
+\r
+int game_status(const game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ return game->status;\r
+}\r
+\r
+// game_size()\r
+\r
+int game_size(const game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ return game->size;\r
+}\r
+\r
+// game_pos()\r
+\r
+int game_pos(const game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ return game->pos;\r
+}\r
+\r
+// game_move()\r
+\r
+int game_move(const game_t * game, int pos) {\r
+\r
+ ASSERT(game!=NULL);\r
+ ASSERT(pos>=0&&pos<game->pos);\r
+\r
+ return game->move[pos];\r
+}\r
+\r
+// game_get_board()\r
+\r
+void game_get_board(const game_t * game, board_t * board, int pos) {\r
+\r
+ int start;\r
+ int i;\r
+\r
+ ASSERT(game!=NULL);\r
+ ASSERT(board!=NULL);\r
+ ASSERT(pos==-1||(pos>=0&&pos<=game->size)); // HACK\r
+\r
+ if (pos < 0) pos = game->pos;\r
+\r
+ if (pos >= game->pos) { // forward from current position\r
+ start = game->pos;\r
+ board_copy(board,game->board);\r
+ } else { // backward => replay the whole game\r
+ start = 0;\r
+ board_copy(board,game->start_board);\r
+ }\r
+\r
+ for (i = start; i < pos; i++) move_do(board,game->move[i]);\r
+}\r
+\r
+// game_turn()\r
+\r
+int game_turn(const game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ return game->board->turn;\r
+}\r
+\r
+// game_move_nb()\r
+\r
+int game_move_nb(const game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ return game->board->move_nb;\r
+}\r
+\r
+// game_add_move()\r
+\r
+void game_add_move(game_t * game, int move) {\r
+\r
+ ASSERT(game!=NULL);\r
+ ASSERT(move_is_ok(move));\r
+\r
+ ASSERT(move_is_legal(move,game->board));\r
+\r
+ if (game->pos >= GameSize) my_fatal("game_add_move(): game overflow\n");\r
+\r
+ game->move[game->pos] = move;\r
+ game->key[game->pos] = game->board->key;\r
+\r
+ move_do(game->board,move);\r
+ game->pos++;\r
+\r
+ game->size = game->pos; // truncate game, HACK: before calling game_is_ok() in game_update()\r
+\r
+ game_update(game);\r
+}\r
+\r
+// game_rem_move()\r
+\r
+void game_rem_move(game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ game_goto(game,game->pos-1);\r
+\r
+ game->size = game->pos; // truncate game\r
+}\r
+\r
+// game_goto()\r
+\r
+void game_goto(game_t * game, int pos) {\r
+\r
+ int i;\r
+\r
+ ASSERT(game!=NULL);\r
+ ASSERT(pos>=0&&pos<=game->size);\r
+\r
+ if (pos < game->pos) { // going backward => replay the whole game\r
+ board_copy(game->board,game->start_board);\r
+ game->pos = 0;\r
+ }\r
+\r
+ for (i = game->pos; i < pos; i++) move_do(game->board,game->move[i]);\r
+ ASSERT(i==pos);\r
+\r
+ game->pos = pos;\r
+\r
+ game_update(game);\r
+}\r
+\r
+// game_disp()\r
+\r
+void game_disp(const game_t * game) {\r
+\r
+ board_t board[1];\r
+ int i, move;\r
+\r
+ ASSERT(game_is_ok(game));\r
+\r
+ board_copy(board,game->start_board);\r
+\r
+ board_disp(board);\r
+\r
+ for (i = 0; i < game->pos; i++) {\r
+\r
+ move = game->move[i];\r
+ move_disp(move,board);\r
+\r
+ move_do(board,move);\r
+ }\r
+\r
+ my_log("POLYGLOT\n");\r
+\r
+ board_disp(board);\r
+}\r
+\r
+// game_update()\r
+\r
+static void game_update(game_t * game) {\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ game->status = game_comp_status(game);\r
+\r
+ ASSERT(game_is_ok(game));\r
+}\r
+\r
+// game_comp_status()\r
+\r
+static int game_comp_status(const game_t * game) {\r
+\r
+ int i, n;\r
+ int wb, bb;\r
+ const board_t * board;\r
+ uint64 key;\r
+ int start;\r
+\r
+ ASSERT(game!=NULL);\r
+\r
+ // init\r
+\r
+ board = game->board;\r
+\r
+ // mate and stalemate\r
+\r
+ if (!board_can_play(board)) {\r
+ if (false) {\r
+ } else if (is_in_check(board,Black)) { // HACK\r
+ return WHITE_MATES;\r
+ } else if (is_in_check(board,White)) { // HACK\r
+ return BLACK_MATES;\r
+ } else {\r
+ return STALEMATE;\r
+ }\r
+ }\r
+\r
+ // insufficient material\r
+\r
+ if (board->number[WhitePawn12] == 0\r
+ && board->number[BlackPawn12] == 0\r
+ && board->number[WhiteQueen12] == 0\r
+ && board->number[BlackQueen12] == 0\r
+ && board->number[WhiteRook12] == 0\r
+ && board->number[BlackRook12] == 0) {\r
+\r
+ if (board->number[WhiteBishop12]\r
+ + board->number[BlackBishop12]\r
+ + board->number[WhiteKnight12]\r
+ + board->number[BlackKnight12] <= 1) { // KK, KBK and KNK\r
+\r
+ return DRAW_MATERIAL;\r
+\r
+ } else if (board->number[WhiteBishop12] == 1\r
+ && board->number[BlackBishop12] == 1\r
+ && board->number[WhiteKnight12] == 0\r
+ && board->number[BlackKnight12] == 0) {\r
+\r
+ wb = board->list[White][1]; // HACK\r
+ bb = board->list[Black][1]; // HACK\r
+\r
+ if (square_colour(wb) == square_colour(bb)) { // KBKB\r
+ return DRAW_MATERIAL;\r
+ }\r
+ }\r
+ }\r
+\r
+ // 50-move rule\r
+\r
+ if (board->ply_nb >= 100) return DRAW_FIFTY;\r
+\r
+ // position repetition\r
+\r
+ key = board->key;\r
+ n = 0;\r
+\r
+ start = game->pos - board->ply_nb;\r
+ if (start < 0) start = 0;\r
+\r
+ for (i = game->pos-4; i >= start; i -= 2) {\r
+ if (game->key[i] == key) {\r
+ if (++n == 2) return DRAW_REPETITION;\r
+ }\r
+ }\r
+\r
+ return PLAYING;\r
+}\r
+\r
+// end of game.cpp\r
+\r
--- /dev/null
+\r
+// game.h\r
+\r
+#ifndef GAME_H\r
+#define GAME_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "move.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int GameSize = 4096;\r
+\r
+enum status_t {\r
+ PLAYING,\r
+ WHITE_MATES,\r
+ BLACK_MATES,\r
+ STALEMATE,\r
+ DRAW_MATERIAL,\r
+ DRAW_FIFTY,\r
+ DRAW_REPETITION\r
+};\r
+\r
+// types\r
+\r
+struct game_t {\r
+ board_t start_board[1];\r
+ board_t board[1];\r
+ sint16 size;\r
+ sint16 pos;\r
+ sint8 status;\r
+ move_t move[GameSize];\r
+ uint64 key[GameSize];\r
+};\r
+\r
+// variables\r
+\r
+extern game_t Game[1];\r
+\r
+// functions\r
+\r
+extern bool game_is_ok (const game_t * game);\r
+\r
+extern void game_clear (game_t * game);\r
+extern bool game_init (game_t * game, const char fen[]);\r
+\r
+extern int game_status (const game_t * game);\r
+\r
+extern int game_size (const game_t * game);\r
+extern int game_pos (const game_t * game);\r
+extern int game_move (const game_t * game, int pos);\r
+\r
+extern void game_get_board (const game_t * game, board_t * board, int pos = -1);\r
+extern int game_turn (const game_t * game);\r
+extern int game_move_nb (const game_t * game);\r
+\r
+extern void game_add_move (game_t * game, int move);\r
+extern void game_rem_move (game_t * game);\r
+\r
+extern void game_goto (game_t * game, int pos);\r
+\r
+extern void game_disp (const game_t * game);\r
+\r
+#endif // !defined GAME_H\r
+\r
+// end of game.h\r
+\r
--- /dev/null
+// gui.cpp
+
+// includes
+
+#include <cstdarg>
+
+#include "gui.h"
+#include "main.h"
+
+// constants
+
+static const int StringSize = 4096;
+
+// variables
+
+gui_t GUI[1];
+
+// functions
+
+
+// gui_init()
+
+void gui_init(gui_t *gui){
+ #ifdef _WIN32
+ (gui->pipeStdin).Open();
+#else
+ // xboard
+
+ gui->io->in_fd = STDIN_FILENO;
+ gui->io->out_fd = STDOUT_FILENO;
+ gui->io->name = "GUI";
+
+ io_init(gui->io);
+#endif
+}
+
+
+// gui_get_non_blocking()
+
+// this is only non_blocking on windows!
+
+bool gui_get_non_blocking(gui_t * gui, char string[], int size) {
+
+ ASSERT(xboard!=NULL);
+ ASSERT(string!=NULL);
+ ASSERT(size>=256);
+#ifndef _WIN32
+ if (!io_get_line(gui->io,string,size)) { // EOF
+ my_log("POLYGLOT *** EOF from GUI ***\n");
+ quit();
+ }
+ return true;
+#else
+ if ((gui->pipeStdin).LineInput(string)) {
+ my_log("GUI->Adapter: %s\n", string);
+ return true;
+ } else {
+ string[0]='\0';
+ return false;
+ }
+
+#endif
+}
+
+// gui_get()
+
+void gui_get(gui_t * gui, char string[], int size) {
+ bool data_available;
+ while(true){
+ data_available=gui_get_non_blocking(gui, string, size);
+ if(!data_available){
+ Idle();
+ }else{
+ break;
+ }
+ }
+}
+
+
+// gui_send()
+
+void gui_send(gui_t * gui, const char format[], ...) {
+
+ va_list arg_list;
+ char string[StringSize];
+
+ ASSERT(xboard!=NULL);
+ ASSERT(format!=NULL);
+
+ // format
+
+ va_start(arg_list,format);
+ vsprintf(string,format,arg_list);
+ va_end(arg_list);
+
+ // send
+
+#ifndef _WIN32
+ io_send(gui->io,"%s",string);
+#else
+ printf("%s\n",string);
+ fflush(stdout);
+ my_log("Adapter->GUI: %s\n",string);
+#endif
+}
+
--- /dev/null
+// gui.h
+
+#ifndef GUI_H
+#define GUI_H
+
+// includes
+
+#include "pipe.h"
+#include "io.h"
+
+struct gui_t {
+#ifndef _WIN32
+ io_t io[1];
+#else
+ PipeStruct pipeStdin;
+#endif
+};
+
+// variables
+
+extern gui_t GUI[1];
+
+// functions
+
+extern void gui_init(gui_t * gui);
+extern void gui_send(gui_t * gui, const char format[], ...);
+extern void gui_get (gui_t * gui, char string[], int size);
+extern bool gui_get_non_blocking (gui_t * gui, char string[], int size);
+
+
+#endif
--- /dev/null
+\r
+// hash.cpp\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "hash.h"\r
+#include "piece.h"\r
+#include "random.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// variables\r
+\r
+static uint64 Castle64[16];\r
+\r
+// prototypes\r
+\r
+static uint64 hash_castle_key_debug (int flags);\r
+\r
+// functions\r
+\r
+// hash_init()\r
+\r
+void hash_init() {\r
+\r
+ int i;\r
+\r
+ for (i = 0; i < 16; i++) Castle64[i] = hash_castle_key_debug(i);\r
+}\r
+\r
+// hash_key()\r
+\r
+uint64 hash_key(const board_t * board) {\r
+\r
+ uint64 key;\r
+ int colour;\r
+ const uint8 * ptr;\r
+ int sq, piece;\r
+\r
+ ASSERT(board_is_ok(board));\r
+\r
+ // init\r
+\r
+ key = 0;\r
+\r
+ // pieces\r
+\r
+ for (colour = 1; colour <= 2; colour++) { // HACK\r
+ for (ptr = board->list[colour]; (sq=*ptr) != SquareNone; ptr++) {\r
+ piece = board->square[sq];\r
+ key ^= hash_piece_key(piece,sq);\r
+ }\r
+ }\r
+\r
+ // castle flags\r
+\r
+ key ^= hash_castle_key(board_flags(board));\r
+\r
+ // en-passant square\r
+\r
+ sq = board->ep_square;\r
+ if (sq != SquareNone) key ^= hash_ep_key(sq);\r
+\r
+ // turn\r
+\r
+ key ^= hash_turn_key(board->turn);\r
+\r
+ return key;\r
+}\r
+\r
+// hash_piece_key()\r
+\r
+uint64 hash_piece_key(int piece, int square) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+ ASSERT(square_is_ok(square));\r
+\r
+ return random_64(RandomPiece+piece_to_12(piece)*64+square_to_64(square));\r
+}\r
+\r
+// hash_castle_key()\r
+\r
+uint64 hash_castle_key(int flags) {\r
+\r
+ ASSERT((flags&~0xF)==0);\r
+\r
+ return Castle64[flags];\r
+}\r
+\r
+// hash_castle_key_debug()\r
+\r
+static uint64 hash_castle_key_debug(int flags) {\r
+\r
+ uint64 key;\r
+ int i;\r
+\r
+ ASSERT((flags&~0xF)==0);\r
+\r
+ key = 0;\r
+\r
+ for (i = 0; i < 4; i++) {\r
+ if ((flags & (1<<i)) != 0) key ^= random_64(RandomCastle+i);\r
+ }\r
+\r
+ return key;\r
+}\r
+\r
+// hash_ep_key()\r
+\r
+uint64 hash_ep_key(int square) {\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ return random_64(RandomEnPassant+square_file(square));\r
+}\r
+\r
+// hash_turn_key()\r
+\r
+uint64 hash_turn_key(int colour) {\r
+\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return (colour_is_white(colour)) ? random_64(RandomTurn) : 0;\r
+}\r
+\r
+// end of hash.cpp\r
+\r
--- /dev/null
+\r
+// hash.h\r
+\r
+#ifndef HASH_H\r
+#define HASH_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int RandomPiece = 0; // 12 * 64\r
+const int RandomCastle = 768; // 4\r
+const int RandomEnPassant = 772; // 8\r
+const int RandomTurn = 780; // 1\r
+\r
+// functions\r
+\r
+extern void hash_init ();\r
+\r
+extern uint64 hash_key (const board_t * board);\r
+\r
+extern uint64 hash_piece_key (int piece, int square);\r
+extern uint64 hash_castle_key (int flags);\r
+extern uint64 hash_ep_key (int square);\r
+extern uint64 hash_turn_key (int colour);\r
+\r
+extern uint64 hash_random_64 (int index);\r
+\r
+#endif // !defined HASH_H\r
+\r
+// end of hash.h\r
+\r
--- /dev/null
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2006-12-25.00
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+#ifndef _WIN32\r
+\r
+// io.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdarg>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include <sys/types.h>\r
+#include <unistd.h>\r
+\r
+#include "io.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseDebug = false;\r
+static const bool UseCR = false;\r
+\r
+static const int StringSize = 4096;\r
+\r
+static const char LF = '\n';\r
+static const char CR = '\r';\r
+\r
+// prototypes\r
+\r
+static int my_read (int fd, char string[], int size);\r
+static void my_write (int fd, const char string[], int size);\r
+\r
+// functions\r
+\r
+// io_is_ok()\r
+\r
+bool io_is_ok(const io_t * io) {\r
+\r
+ if (io == NULL) return false;\r
+\r
+ if (io->name == NULL) return false;\r
+\r
+ if (io->in_eof != true && io->in_eof != false) return false;\r
+\r
+ if (io->in_size < 0 || io->in_size > BufferSize) return false;\r
+ if (io->out_size < 0 || io->out_size > BufferSize) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// io_init()\r
+\r
+void io_init(io_t * io) {\r
+\r
+ ASSERT(io!=NULL);\r
+\r
+ io->in_eof = false;\r
+\r
+ io->in_size = 0;\r
+ io->out_size = 0;\r
+\r
+ ASSERT(io_is_ok(io));\r
+}\r
+\r
+// io_close()\r
+\r
+void io_close(io_t * io) {\r
+\r
+ ASSERT(io_is_ok(io));\r
+\r
+ ASSERT(io->out_fd>=0);\r
+\r
+ my_log("> %s EOF\n",io->name);\r
+\r
+ if (close(io->out_fd) == -1) {\r
+ my_fatal("io_close(): close(): %s\n",strerror(errno));\r
+ }\r
+\r
+ io->out_fd = -1;\r
+}\r
+\r
+// io_get_update()\r
+\r
+void io_get_update(io_t * io) {\r
+\r
+ int pos, size;\r
+ int n;\r
+\r
+ ASSERT(io_is_ok(io));\r
+\r
+ ASSERT(io->in_fd>=0);\r
+ ASSERT(!io->in_eof);\r
+\r
+ // init\r
+\r
+ pos = io->in_size;\r
+\r
+ size = BufferSize - pos;\r
+ if (size <= 0) my_fatal("io_get_update(): buffer overflow\n");\r
+\r
+ // read as many data as possible\r
+\r
+ n = my_read(io->in_fd,&io->in_buffer[pos],size);\r
+ if (UseDebug) my_log("POLYGLOT read %d byte%s from %s\n",n,(n>1)?"s":"",io->name);\r
+\r
+ if (n > 0) { // at least one character was read\r
+\r
+ // update buffer size\r
+\r
+ ASSERT(n>=1&&n<=size);\r
+\r
+ io->in_size += n;\r
+ ASSERT(io->in_size>=0&&io->in_size<=BufferSize);\r
+\r
+ } else { // EOF\r
+\r
+ ASSERT(n==0);\r
+\r
+ io->in_eof = true;\r
+ }\r
+}\r
+\r
+// io_line_ready()\r
+\r
+bool io_line_ready(const io_t * io) {\r
+\r
+ ASSERT(io_is_ok(io));\r
+\r
+ if (io->in_eof) return true;\r
+\r
+ if (memchr(io->in_buffer,LF,io->in_size) != NULL) return true; // buffer contains LF\r
+\r
+ return false;\r
+}\r
+\r
+// io_get_line()\r
+\r
+bool io_get_line(io_t * io, char string[], int size) {\r
+\r
+ int src, dst;\r
+ int c;\r
+\r
+ ASSERT(io_is_ok(io));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=256);\r
+\r
+ src = 0;\r
+ dst = 0;\r
+\r
+ while (true) {\r
+\r
+ // test for end of buffer\r
+\r
+ if (src >= io->in_size) {\r
+ if (io->in_eof) {\r
+ my_log("%s->Adapter: EOF\n",io->name);\r
+ return false;\r
+ } else {\r
+ my_fatal("io_get_line(): no EOL in buffer\n");\r
+ }\r
+ }\r
+\r
+ // test for end of string\r
+\r
+ if (dst >= size) my_fatal("io_get_line(): buffer overflow\n");\r
+\r
+ // copy the next character\r
+\r
+ c = io->in_buffer[src++];\r
+\r
+ if (c == LF) { // LF => line complete\r
+ string[dst] = '\0';\r
+ break;\r
+ } else if (c != CR) { // skip CRs\r
+ string[dst++] = c;\r
+ }\r
+ }\r
+\r
+ // shift the buffer\r
+\r
+ ASSERT(src>0);\r
+\r
+ io->in_size -= src;\r
+ ASSERT(io->in_size>=0);\r
+\r
+ if (io->in_size > 0) memmove(&io->in_buffer[0],&io->in_buffer[src],io->in_size);\r
+\r
+ // return\r
+\r
+ my_log("%s->Adapter: %s\n",io->name,string);\r
+\r
+ return true;\r
+}\r
+\r
+// io_send()\r
+\r
+void io_send(io_t * io, const char format[], ...) {\r
+\r
+ va_list arg_list;\r
+ char string[StringSize];\r
+ int len;\r
+\r
+ ASSERT(io_is_ok(io));\r
+ ASSERT(format!=NULL);\r
+\r
+ ASSERT(io->out_fd>=0);\r
+\r
+ // format\r
+\r
+ va_start(arg_list,format);\r
+ vsprintf(string,format,arg_list);\r
+ va_end(arg_list);\r
+\r
+ // append string to buffer\r
+\r
+ len = strlen(string);\r
+ if (io->out_size + len > BufferSize-2) my_fatal("io_send(): buffer overflow\n");\r
+\r
+ memcpy(&io->out_buffer[io->out_size],string,len);\r
+ io->out_size += len;\r
+\r
+ ASSERT(io->out_size>=0&&io->out_size<=BufferSize-2);\r
+\r
+ // log\r
+\r
+ io->out_buffer[io->out_size] = '\0';\r
+ my_log("Adapter->%s: %s\n",io->name,io->out_buffer);\r
+// my_log("> %f %s %s\n",now_real(),io->name,io->out_buffer);\r
+ // append EOL to buffer\r
+\r
+ if (UseCR) io->out_buffer[io->out_size++] = CR;\r
+ io->out_buffer[io->out_size++] = LF;\r
+\r
+ ASSERT(io->out_size>=0&&io->out_size<=BufferSize);\r
+\r
+ // flush buffer\r
+\r
+ if (UseDebug) my_log("POLYGLOT writing %d byte%s to %s\n",io->out_size,(io->out_size>1)?"s":"",io->name);\r
+ my_write(io->out_fd,io->out_buffer,io->out_size);\r
+\r
+ io->out_size = 0;\r
+}\r
+\r
+// io_send_queue()\r
+\r
+void io_send_queue(io_t * io, const char format[], ...) {\r
+\r
+ va_list arg_list;\r
+ char string[StringSize];\r
+ int len;\r
+\r
+ ASSERT(io_is_ok(io));\r
+ ASSERT(format!=NULL);\r
+\r
+ ASSERT(io->out_fd>=0);\r
+\r
+ // format\r
+\r
+ va_start(arg_list,format);\r
+ vsprintf(string,format,arg_list);\r
+ va_end(arg_list);\r
+\r
+ // append string to buffer\r
+\r
+ len = strlen(string);\r
+ if (io->out_size + len > BufferSize-2) my_fatal("io_send_queue(): buffer overflow\n");\r
+\r
+ memcpy(&io->out_buffer[io->out_size],string,len);\r
+ io->out_size += len;\r
+\r
+ ASSERT(io->out_size>=0&&io->out_size<=BufferSize-2);\r
+}\r
+\r
+// my_read()\r
+\r
+static int my_read(int fd, char string[], int size) {\r
+\r
+ int n;\r
+\r
+ ASSERT(fd>=0);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>0);\r
+\r
+ do {\r
+ n = read(fd,string,size);\r
+ } while (n == -1 && errno == EINTR);\r
+\r
+ if (n == -1) my_fatal("my_read(): read(): %s\n",strerror(errno));\r
+\r
+ ASSERT(n>=0);\r
+\r
+ return n;\r
+}\r
+\r
+// my_write()\r
+\r
+static void my_write(int fd, const char string[], int size) {\r
+\r
+ int n;\r
+\r
+ ASSERT(fd>=0);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>0);\r
+\r
+ do {\r
+\r
+ n = write(fd,string,size);\r
+\r
+ // if (n == -1 && errno != EINTR && errno != EPIPE) my_fatal("my_write(): write(): %s\n",strerror(errno));\r
+\r
+ if (n == -1) {\r
+ if (false) {\r
+ } else if (errno == EINTR) {\r
+ n = 0; // nothing has been written\r
+ } else if (errno == EPIPE) {\r
+ n = size; // pretend everything has been written\r
+ } else {\r
+ my_fatal("my_write(): write(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+\r
+ ASSERT(n>=0);\r
+\r
+ string += n;\r
+ size -= n;\r
+\r
+ } while (size > 0);\r
+\r
+ ASSERT(size==0);\r
+}\r
+\r
+// end of io.cpp\r
+\r
+#endif\r
--- /dev/null
+\r
+// io.h\r
+\r
+#ifndef IO_H\r
+#define IO_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int BufferSize = 16384;\r
+\r
+// types\r
+\r
+struct io_t {\r
+\r
+ int in_fd;\r
+ int out_fd;\r
+\r
+ const char * name;\r
+\r
+ bool in_eof;\r
+\r
+ sint32 in_size;\r
+ sint32 out_size;\r
+\r
+ char in_buffer[BufferSize];\r
+ char out_buffer[BufferSize];\r
+};\r
+\r
+// functions\r
+\r
+extern bool io_is_ok (const io_t * io);\r
+\r
+extern void io_init (io_t * io);\r
+extern void io_close (io_t * io);\r
+\r
+extern void io_get_update (io_t * io);\r
+\r
+extern bool io_line_ready (const io_t * io);\r
+extern bool io_get_line (io_t * io, char string[], int size);\r
+\r
+extern void io_send (io_t * io, const char format[], ...);\r
+extern void io_send_queue (io_t * io, const char format[], ...);\r
+\r
+#endif // !defined IO_H\r
+\r
+// end of io.h\r
+\r
--- /dev/null
+\r
+// line.cpp\r
+\r
+// includes\r
+\r
+#include <cstring>\r
+\r
+#include "board.h"\r
+#include "line.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "san.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool Strict = false; // false\r
+static const bool UseDebug = false; // false\r
+\r
+static const int StringSize = 1024;\r
+\r
+// functions\r
+\r
+// line_is_ok()\r
+\r
+bool line_is_ok(const move_t line[]) {\r
+\r
+ int move;\r
+\r
+ if (line == NULL) return false;\r
+\r
+ while ((move = *line++) != MoveNone) {\r
+ if (!move_is_ok(move)) return false;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// line_clear()\r
+\r
+void line_clear(move_t line[]) {\r
+\r
+ ASSERT(line!=NULL);\r
+\r
+ *line = MoveNone;\r
+}\r
+\r
+// line_copy()\r
+\r
+void line_copy(move_t dst[], const move_t src[]) {\r
+\r
+ ASSERT(dst!=NULL);\r
+ ASSERT(src!=NULL);\r
+\r
+ ASSERT(dst!=src);\r
+\r
+ while ((*dst++ = *src++) != MoveNone)\r
+ ;\r
+}\r
+\r
+// line_from_can()\r
+\r
+bool line_from_can (move_t line[], const board_t * board, const char string[], int size) {\r
+\r
+ int pos;\r
+ char new_string[StringSize], *p;\r
+ int move;\r
+ board_t new_board[1];\r
+\r
+ ASSERT(line!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=LineSize);\r
+\r
+ // init\r
+\r
+ pos = 0;\r
+ board_copy(new_board,board);\r
+\r
+ // loop\r
+\r
+ strcpy(new_string,string); // HACK\r
+\r
+ for (p = strtok(new_string," "); p != NULL; p = strtok(NULL," ")) {\r
+\r
+ move = move_from_can(p,new_board);\r
+\r
+ ASSERT(move!=MoveNone);\r
+ ASSERT(move_is_legal(move,new_board));\r
+\r
+ if (move == MoveNone || !move_is_legal(move,new_board)) break; // HACK: ignore illegal moves\r
+\r
+ if (pos >= size) return false;\r
+ line[pos++] = move;\r
+\r
+ move_do(new_board,move);\r
+ }\r
+\r
+ if (pos >= size) return false;\r
+ line[pos] = MoveNone;\r
+\r
+ return true;\r
+}\r
+\r
+// line_to_can()\r
+\r
+bool line_to_can(const move_t line[], const board_t * board, char string[], int size) {\r
+\r
+ board_t new_board[1];\r
+ int pos;\r
+ int move;\r
+\r
+ ASSERT(line_is_ok(line));\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=StringSize);\r
+\r
+ // init\r
+\r
+ if (size < StringSize) return false;\r
+\r
+ board_copy(new_board,board);\r
+ pos = 0;\r
+\r
+ // loop\r
+\r
+ while ((move = *line++) != MoveNone) {\r
+\r
+ if (pos != 0) {\r
+ if (pos >= size) return false;\r
+ string[pos++] = ' ';\r
+ }\r
+\r
+ if (!move_to_can(move,new_board,&string[pos],size-pos)) return false;\r
+ pos += strlen(&string[pos]);\r
+\r
+ move_do(new_board,move);\r
+ }\r
+\r
+ if (pos >= size) return false;\r
+ string[pos] = '\0';\r
+\r
+ return true;\r
+}\r
+\r
+// line_to_san()\r
+\r
+bool line_to_san(const move_t line[], const board_t * board, char string[], int size) {\r
+\r
+ board_t new_board[1];\r
+ int pos;\r
+ int move;\r
+ char move_string[256];\r
+\r
+ ASSERT(line_is_ok(line));\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=StringSize);\r
+\r
+ // init\r
+\r
+ if (size < StringSize) return false;\r
+\r
+ board_copy(new_board,board);\r
+ pos = 0;\r
+\r
+ // loop\r
+\r
+ while ((move = *line++) != MoveNone) {\r
+\r
+ if (pos != 0) {\r
+ if (pos >= size) return false;\r
+ string[pos++] = ' ';\r
+ }\r
+\r
+ if (!move_is_legal(move,new_board)\r
+ || !move_to_san(move,new_board,&string[pos],size-pos)) {\r
+\r
+ if (Strict || UseDebug) {\r
+\r
+ move_to_can(move,new_board,move_string,256);\r
+ my_log("POLYGLOT ILLEGAL MOVE IN LINE %s\n",move_string);\r
+\r
+ board_disp(new_board);\r
+ }\r
+\r
+ if (Strict) my_fatal("line_to_san(): illegal move\n");\r
+\r
+ break;\r
+ }\r
+\r
+ pos += strlen(&string[pos]);\r
+\r
+ move_do(new_board,move);\r
+ }\r
+\r
+ if (pos >= size) return false;\r
+ string[pos] = '\0';\r
+\r
+ return true;\r
+}\r
+\r
+// end of line.cpp\r
+\r
--- /dev/null
+\r
+// line.h\r
+\r
+#ifndef LINE_H\r
+#define LINE_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "move.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int LineSize = 256;\r
+\r
+// functions\r
+\r
+extern bool line_is_ok (const move_t line[]);\r
+\r
+extern void line_clear (move_t line[]);\r
+extern void line_copy (move_t dst[], const move_t src[]);\r
+\r
+extern bool line_from_can (move_t line[], const board_t * board, const char string[], int size);\r
+\r
+extern bool line_to_can (const move_t line[], const board_t * board, char string[], int size);\r
+extern bool line_to_san (const move_t line[], const board_t * board, char string[], int size);\r
+\r
+#endif // !defined LINE_H\r
+\r
+// end of line.h\r
+\r
--- /dev/null
+\r
+// list.cpp\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+// list_is_ok()\r
+\r
+bool list_is_ok(const list_t * list) {\r
+\r
+ if (list == NULL) return false;\r
+\r
+ if (list->size >= ListSize) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// list_clear()\r
+\r
+void list_clear(list_t * list) {\r
+\r
+ ASSERT(list!=NULL);\r
+\r
+ list->size = 0;\r
+}\r
+\r
+// list_add()\r
+\r
+void list_add(list_t * list, int move, int value) {\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(value>=-32767&&value<=+32767);\r
+\r
+ ASSERT(list->size<ListSize-1);\r
+\r
+ list->move[list->size] = move;\r
+ list->value[list->size] = value;\r
+ list->size++;\r
+}\r
+\r
+// list_remove()\r
+\r
+void list_remove(list_t * list, int index) {\r
+\r
+ int i;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(index>=0&&index<list->size);\r
+\r
+ for (i = index; i < list->size-1; i++) {\r
+ list->move[i] = list->move[i+1];\r
+ list->value[i] = list->value[i+1];\r
+ }\r
+\r
+ list->size--;\r
+}\r
+\r
+// list_is_empty()\r
+\r
+bool list_is_empty(const list_t * list) {\r
+\r
+ ASSERT(list_is_ok(list));\r
+\r
+ return list->size == 0;\r
+}\r
+\r
+// list_size()\r
+\r
+int list_size(const list_t * list) {\r
+\r
+ ASSERT(list_is_ok(list));\r
+\r
+ return list->size;\r
+}\r
+\r
+// list_move()\r
+\r
+int list_move(const list_t * list, int index) {\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(index>=0&&index<list->size);\r
+\r
+ return list->move[index];\r
+}\r
+\r
+// list_value()\r
+\r
+int list_value(const list_t * list, int index) {\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(index>=0&&index<list->size);\r
+\r
+ return list->value[index];\r
+}\r
+\r
+// list_copy()\r
+\r
+void list_copy(list_t * dst, const list_t * src) {\r
+\r
+ int i;\r
+\r
+ ASSERT(dst!=NULL);\r
+ ASSERT(list_is_ok(src));\r
+\r
+ dst->size = src->size;\r
+\r
+ for (i = 0; i < src->size; i++) {\r
+ dst->move[i] = src->move[i];\r
+ dst->value[i] = src->value[i];\r
+ }\r
+}\r
+\r
+// list_move_to_front()\r
+\r
+void list_move_to_front(list_t * list, int index) {\r
+\r
+ int i;\r
+ int move, value;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(index>=0&&index<list->size);\r
+\r
+ if (index != 0) {\r
+\r
+ move = list->move[index];\r
+ value = list->value[index];\r
+\r
+ for (i = index; i > 0; i--) {\r
+ list->move[i] = list->move[i-1];\r
+ list->value[i] = list->value[i-1];\r
+ }\r
+\r
+ list->move[0] = move;\r
+ list->value[0] = value;\r
+ }\r
+}\r
+\r
+// list_note()\r
+\r
+void list_note(list_t * list) {\r
+\r
+ int i, move;\r
+\r
+ ASSERT(list_is_ok(list));\r
+\r
+ for (i = 0; i < list->size; i++) {\r
+ move = list->move[i];\r
+ ASSERT(move_is_ok(move));\r
+ list->value[i] = -move_order(move);\r
+ }\r
+}\r
+\r
+// list_sort()\r
+\r
+void list_sort(list_t * list) {\r
+\r
+ int i, j;\r
+ int best_index, best_move, best_value;\r
+\r
+ ASSERT(list_is_ok(list));\r
+\r
+ for (i = 0; i < list->size-1; i++) {\r
+\r
+ best_index = i;\r
+ best_value = list->value[i];\r
+\r
+ for (j = i+1; j < list->size; j++) {\r
+ if (list->value[j] > best_value) {\r
+ best_index = j;\r
+ best_value = list->value[j];\r
+ }\r
+ }\r
+\r
+ if (best_index != i) {\r
+\r
+ best_move = list->move[best_index];\r
+ ASSERT(best_value==list->value[best_index]);\r
+\r
+ for (j = best_index; j > i; j--) {\r
+ list->move[j] = list->move[j-1];\r
+ list->value[j] = list->value[j-1];\r
+ }\r
+\r
+ list->move[i] = best_move;\r
+ list->value[i] = best_value;\r
+ }\r
+ }\r
+\r
+ if (DEBUG) {\r
+ for (i = 0; i < list->size-1; i++) {\r
+ ASSERT(list->value[i]>=list->value[i+1]);\r
+ }\r
+ }\r
+}\r
+\r
+// list_contain()\r
+\r
+bool list_contain(const list_t * list, int move) {\r
+\r
+ int i;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(move_is_ok(move));\r
+\r
+ for (i = 0; i < list->size; i++) {\r
+ if (list->move[i] == move) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// list_equal()\r
+\r
+bool list_equal(list_t * list_1, list_t * list_2) {\r
+\r
+ list_t copy_1[1], copy_2[1];\r
+ int i;\r
+\r
+ ASSERT(list_is_ok(list_1));\r
+ ASSERT(list_is_ok(list_2));\r
+\r
+ if (list_1->size != list_2->size) return false;\r
+\r
+ list_copy(copy_1,list_1);\r
+ list_note(copy_1);\r
+ list_sort(copy_1);\r
+\r
+ list_copy(copy_2,list_2);\r
+ list_note(copy_2);\r
+ list_sort(copy_2);\r
+\r
+ for (i = 0; i < copy_1->size; i++) {\r
+ if (copy_1->move[i] != copy_2->move[i]) return false;\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// list_disp()\r
+\r
+void list_disp(const list_t * list, const board_t * board) {\r
+\r
+ int i, move, value;\r
+ char string[256];\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ for (i = 0; i < list->size; i++) {\r
+\r
+ move = list->move[i];\r
+ value = list->value[i];\r
+\r
+ if (!move_to_can(move,board,string,256)) ASSERT(false);\r
+ my_log("POLYGLOT %-5s %04X %+4d\n",string,move,value);\r
+ }\r
+\r
+ my_log("POLYGLOT\n");\r
+}\r
+\r
+// end of list.cpp\r
+\r
--- /dev/null
+\r
+// list.h\r
+\r
+#ifndef LIST_H\r
+#define LIST_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "move.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int ListSize = 256;\r
+\r
+// types\r
+\r
+struct list_t {\r
+ sint16 size;\r
+ move_t move[ListSize];\r
+ sint16 value[ListSize];\r
+};\r
+\r
+// functions\r
+\r
+extern bool list_is_ok (const list_t * list);\r
+\r
+extern void list_clear (list_t * list);\r
+extern void list_add (list_t * list, int move, int value = 0);\r
+extern void list_remove (list_t * list, int index);\r
+\r
+extern bool list_is_empty (const list_t * list);\r
+extern int list_size (const list_t * list);\r
+\r
+extern int list_move (const list_t * list, int index);\r
+extern int list_value (const list_t * list, int index);\r
+\r
+extern void list_copy (list_t * dst, const list_t * src);\r
+\r
+extern void list_note (list_t * list);\r
+extern void list_sort (list_t * list);\r
+\r
+extern bool list_contain (const list_t * list, int move);\r
+extern bool list_equal (list_t * list_1, list_t * list_2);\r
+\r
+extern void list_disp (const list_t * list, const board_t * board);\r
+\r
+#endif // !defined LIST_H\r
+\r
+// end of list.h\r
+\r
--- /dev/null
+\r
+// main.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <csignal>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#ifdef _WIN32\r
+ #include <windows.h>\r
+#else\r
+ #include <unistd.h>\r
+#endif\r
+\r
+#include "adapter.h"\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "book.h"\r
+#include "book_make.h"\r
+#include "book_merge.h"\r
+#include "engine.h"\r
+#include "epd.h"\r
+#include "fen.h"\r
+#include "gui.h"\r
+#include "hash.h"\r
+#include "list.h"\r
+#include "main.h"\r
+#include "move.h"\r
+#include "move_gen.h"\r
+#include "option.h"\r
+#include "piece.h"\r
+#include "search.h"\r
+#include "square.h"\r
+#include "uci.h"\r
+#include "util.h"\r
+// constants\r
+\r
+\r
+static const char * const Version = "1.4W10UCIb15";\r
+static const char * const HelpMessage = "\\r
+SYNTAX\n\\r
+polyglot [configfile]\n\\r
+polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]\n\\r
+polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]\n\\r
+polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta delta]\n\\r
+polyglot perft [-fen fen] [-max-depth depth]\\r
+";\r
+\r
+\r
+\r
+static const int SearchDepth = 63;\r
+static const double SearchTime = 3600.0;\r
+static const int StringSize = 4096;\r
+// variables\r
+static bool Init;\r
+// prototypes\r
+\r
+static void parse_option ();\r
+static void init_book ();\r
+static bool parse_line (char line[], char * * name_ptr, char * * value_ptr);\r
+static void stop_search ();\r
+static void sig_quit(int);\r
+\r
+// functions\r
+\r
+// main()\r
+\r
+int main(int argc, char * argv[]) {\r
+\r
+// board_t board[1];\r
+\r
+ if(argc>=2 && ((my_string_case_equal(argv[1],"help")) || (my_string_case_equal(argv[1],"-help")) || (my_string_case_equal(argv[1],"--help")) || (my_string_case_equal(argv[1],"-h")) || my_string_case_equal(argv[1],"/?"))){\r
+ printf("%s\n",HelpMessage);\r
+ return EXIT_SUCCESS;\r
+ }\r
+ // init\r
+\r
+ Init = false;\r
+\r
+ signal(SIGINT,sig_quit);\r
+\r
+#ifdef _WIN32\r
+ signal(SIGTERM,SIG_IGN);\r
+#ifdef SIGPIPE\r
+ signal(SIGPIPE,SIG_IGN);\r
+#endif\r
+#endif\r
+\r
+ util_init();\r
+ printf("PolyGlot %s by Fabien Letouzey\n",Version);\r
+\r
+ option_init();\r
+\r
+ square_init();\r
+ piece_init();\r
+ attack_init();\r
+\r
+ hash_init();\r
+\r
+ my_random_init();\r
+\r
+ // build book\r
+\r
+ if (argc >= 2 && my_string_equal(argv[1],"make-book")) {\r
+ book_make(argc,argv);\r
+ return EXIT_SUCCESS;\r
+ }\r
+\r
+ if (argc >= 2 && my_string_equal(argv[1],"merge-book")) {\r
+ book_merge(argc,argv);\r
+ return EXIT_SUCCESS;\r
+ }\r
+\r
+ if (argc >= 2 && my_string_equal(argv[1],"perft")) {\r
+ do_perft(argc,argv);\r
+ return EXIT_SUCCESS;\r
+ }\r
+\r
+ // read options\r
+\r
+ if (argc == 2) option_set("OptionFile",argv[1]); // HACK for compatibility\r
+\r
+ parse_option(); // HACK: also launches the engine\r
+\r
+ // EPD test\r
+\r
+ if (argc >= 2 && my_string_equal(argv[1],"epd-test")){\r
+ epd_test(argc,argv);\r
+ return EXIT_SUCCESS;\r
+ }else if(argc >= 3 && my_string_equal(argv[2],"epd-test")){\r
+ epd_test(argc-1,argv+1);\r
+ return EXIT_SUCCESS;\r
+ }\r
+ \r
+ init_book();\r
+ // adapter\r
+ \r
+ gui_init(GUI);\r
+ adapter_loop();\r
+ return EXIT_SUCCESS; // we never get here....\r
+}\r
+\r
+// init_book()\r
+\r
+static void init_book(){\r
+ book_clear();\r
+ if (option_get_bool("Book")){\r
+ my_log("POLYGLOT *** SETTING BOOK ***\n");\r
+ my_log("POLYGLOT BOOK \"%s\"\n",option_get_string("BookFile"));\r
+ uci_set_option(Uci,\r
+ PolyglotBookFile, // name\r
+ option_get_string("BookFile"), // value\r
+ "string", // type\r
+ "<empty>", // max\r
+ "<empty>", // min\r
+ "<empty>" // var\r
+ );\r
+ book_open(option_get_string("BookFile"));\r
+ if(!book_is_open()){\r
+ my_log("POLYGLOT Unable to open book \"%s\"\n",\r
+ option_get_string("BookFile"));\r
+ }\r
+ } else {\r
+ uci_set_option(Uci,\r
+ PolyglotBookFile, // name\r
+ "<empty>", // value\r
+ "string", // type\r
+ "<empty>", // max\r
+ "<empty>", // min\r
+ "<empty>" // var\r
+ );\r
+ \r
+ }\r
+}\r
+\r
+// parse_option()\r
+\r
+static void parse_option() {\r
+\r
+ const char * file_name;\r
+ FILE * file;\r
+ char line[256];\r
+ char * name, * value;\r
+ file_name = option_get_string("OptionFile");\r
+\r
+ file = fopen(file_name,"r");\r
+ if (file == NULL) {\r
+ my_fatal("Can't open file \"%s\": %s\n",file_name,strerror(errno));\r
+ }\r
+\r
+ // PolyGlot options (assumed first)\r
+\r
+ while (true) {\r
+\r
+ if (!my_file_read_line(file,line,256)) {\r
+ my_fatal("parse_option(): missing [Engine] section\n");\r
+ }\r
+\r
+ if(line[0]=='#') continue;\r
+\r
+ if (my_string_case_equal(line,"[engine]")) break;\r
+\r
+ if (parse_line(line,&name,&value)) option_set(name,value);\r
+ }\r
+\r
+ if (option_get_bool("Log")) {\r
+ my_log_open(option_get_string("LogFile"));\r
+ }\r
+\r
+ my_log("POLYGLOT *** START ***\n");\r
+ my_log("POLYGLOT INI file \"%s\"\n",file_name);\r
+ engine_open(Engine);\r
+ if (option_get_bool("UCI")) {\r
+ my_log("POLYGLOT *** Switching to UCI mode ***\n");\r
+ }\r
+\r
+ \r
+ Init = true;\r
+ uci_open(Uci,Engine);\r
+ while (my_file_read_line(file,line,256)) {\r
+ \r
+ if (line[0] == '[') my_fatal("parse_option(): unknown section %s\n",line);\r
+ \r
+ if (parse_line(line,&name,&value)) {\r
+ uci_send_option(Uci,name,"%s",value);\r
+ //to get a decent display in winboard_x we need to now if an engine really is doing multipv analysis\r
+ // "multipv 1" in the pv is meaningless,f.i. toga sends that all the time\r
+ //therefore check if MultiPV is set to a decent value in the polyglot ini file\r
+ if(my_string_case_equal(name,"MultiPV") && atoi(value)>1) Uci->multipv_mode=true;\r
+ }\r
+ }\r
+ if (my_string_equal(option_get_string("EngineName"),"<empty>")) {\r
+ option_set("EngineName",Uci->name);\r
+ }\r
+ fclose(file);\r
+}\r
+\r
+// parse_line()\r
+\r
+static bool parse_line(char line[], char * * name_ptr, char * * value_ptr) {\r
+\r
+ char * ptr;\r
+ char * name, * value;\r
+\r
+ ASSERT(line!=NULL);\r
+ ASSERT(name_ptr!=NULL);\r
+ ASSERT(value_ptr!=NULL);\r
+\r
+ // remove comments\r
+\r
+ ptr = strchr(line,';');\r
+ if (ptr != NULL) *ptr = '\0';\r
+\r
+ ptr = strchr(line,'#');\r
+ if (ptr != NULL) *ptr = '\0';\r
+\r
+ // split at '='\r
+\r
+ ptr = strchr(line,'=');\r
+ if (ptr == NULL) return false;\r
+\r
+ name = line;\r
+ value = ptr+1;\r
+\r
+ // cleanup name\r
+\r
+ while (*name == ' ') name++; // remove leading spaces\r
+\r
+ while (ptr > name && ptr[-1] == ' ') ptr--; // remove trailing spaces\r
+ *ptr = '\0';\r
+\r
+ if (*name == '\0') return false;\r
+\r
+ // cleanup value\r
+\r
+ ptr = &value[strlen(value)]; // pointer to string terminator\r
+\r
+ while (*value == ' ') value++; // remove leading spaces\r
+\r
+ while (ptr > value && ptr[-1] == ' ') ptr--; // remove trailing spaces\r
+ *ptr = '\0';\r
+\r
+ if (*value == '\0') return false;\r
+\r
+ // end\r
+\r
+ *name_ptr = name;\r
+ *value_ptr = value;\r
+\r
+ return true;\r
+}\r
+\r
+static void sig_quit(int dummy){\r
+ my_log("POLYGLOT *** SIGINT Received ***\n");\r
+ quit();\r
+}\r
+\r
+\r
+// quit()\r
+\r
+void quit() {\r
+\r
+ char string[StringSize];\r
+\r
+ my_log("POLYGLOT *** QUIT ***\n");\r
+\r
+ if (Init) {\r
+\r
+ stop_search();\r
+ engine_send(Engine,"quit");\r
+\r
+ // wait for the engine to quit\r
+ while (true) {\r
+ engine_get(Engine,string,StringSize); // HACK: calls exit() on receiving EOF\r
+ }\r
+ }\r
+}\r
+\r
+// stop_search()\r
+\r
+static void stop_search() {\r
+\r
+ if (Init && Uci->searching) {\r
+\r
+ ASSERT(Uci->searching);\r
+ ASSERT(Uci->pending_nb>=1);\r
+\r
+ my_log("POLYGLOT STOP SEARCH\n");\r
+\r
+/*\r
+ engine_send(Engine,"stop");\r
+ Uci->searching = false;\r
+*/\r
+\r
+ if (option_get_bool("SyncStop")) {\r
+ uci_send_stop_sync(Uci);\r
+ } else {\r
+ uci_send_stop(Uci);\r
+ }\r
+ }\r
+}\r
+\r
+// end of main.cpp\r
+\r
--- /dev/null
+\r
+// main.h\r
+\r
+#ifndef MAIN_H\r
+#define MAIN_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void quit ();\r
+\r
+#endif // !defined MAIN_H\r
+\r
+// end of main.h\r
+\r
--- /dev/null
+# what's this??
+# This is not a makefile....
+
+# Anyway here is the command for compiling polyglot under Mingw/Cygwin
+
+g++ -O2 -mno-cygwin -D_WIN32 *.cpp -opolyglot
--- /dev/null
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2006-05-10.23
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Send bug reports to <bug-automake@gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program).
+case $1 in
+ lex|yacc)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $1 in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison|yacc)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex|flex)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit 1
+ fi
+ ;;
+
+ makeinfo)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-end: "$"
+# End:
--- /dev/null
+\r
+// move.cpp\r
+\r
+// includes\r
+\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "attack.h"\r
+#include "colour.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "option.h"\r
+#include "piece.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+static const uint8 PromotePiece[5] = { PieceNone64, Knight64, Bishop64, Rook64, Queen64 };\r
+\r
+// functions\r
+\r
+// move_is_ok()\r
+\r
+bool move_is_ok(int move) {\r
+\r
+ if (move < 0 || move >= 65536) return false;\r
+\r
+ if (move == MoveNone) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// move_make()\r
+\r
+int move_make(int from, int to) {\r
+\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+\r
+ return (square_to_64(from) << 6) | square_to_64(to);\r
+}\r
+\r
+// move_make_flags()\r
+\r
+int move_make_flags(int from, int to, int flags) {\r
+\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+ ASSERT((flags&~0xF000)==0);\r
+\r
+ ASSERT(to!=from);\r
+\r
+ return (square_to_64(from) << 6) | square_to_64(to) | flags;\r
+}\r
+\r
+// move_from()\r
+\r
+int move_from(int move) {\r
+\r
+ int from_64;\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ from_64 = (move >> 6) & 077;\r
+\r
+ return square_from_64(from_64);\r
+}\r
+\r
+// move_to()\r
+\r
+int move_to(int move) {\r
+\r
+ int to_64;\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ to_64 = move & 077;\r
+\r
+ return square_from_64(to_64);\r
+}\r
+\r
+// move_promote_hack()\r
+\r
+int move_promote_hack(int move) {\r
+\r
+ int code;\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ ASSERT(move_is_promote(move));\r
+\r
+ code = move >> 12;\r
+ ASSERT(code>=1&&code<=4);\r
+\r
+ return PromotePiece[code];\r
+}\r
+\r
+// move_is_capture()\r
+\r
+bool move_is_capture(int move, const board_t * board) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (move_is_en_passant(move,board)) return true;\r
+ if (board->square[move_to(move)] != Empty) return true;\r
+\r
+ return false;\r
+}\r
+\r
+// move_is_promote()\r
+\r
+bool move_is_promote(int move) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ return (move & MoveFlags) != 0;\r
+}\r
+\r
+// move_is_en_passant()\r
+\r
+bool move_is_en_passant(int move, const board_t * board) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ return piece_is_pawn(move_piece(move,board))\r
+ && move_to(move) == board->ep_square;\r
+}\r
+\r
+// move_is_castle()\r
+\r
+bool move_is_castle(int move, const board_t * board) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ return colour_equal(board->square[move_to(move)],board->turn);\r
+}\r
+\r
+// move_piece()\r
+\r
+int move_piece(int move, const board_t * board) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ return board->square[move_from(move)];\r
+}\r
+\r
+// move_capture()\r
+\r
+int move_capture(int move, const board_t * board) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (move_is_en_passant(move,board)) {\r
+ return piece_pawn_opp(move_piece(move,board));\r
+ }\r
+\r
+ return board->square[move_to(move)];\r
+}\r
+\r
+// move_promote()\r
+\r
+int move_promote(int move, const board_t * board) {\r
+\r
+ int code;\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (move_is_promote(move)) {\r
+ code = move >> 12;\r
+ ASSERT(code>=1&&code<=4);\r
+ return PromotePiece[code] | board->turn;\r
+ }\r
+\r
+ return Empty;\r
+}\r
+\r
+// move_is_check()\r
+\r
+bool move_is_check(int move, const board_t * board) {\r
+\r
+ board_t new_board[1];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ board_copy(new_board,board);\r
+ move_do(new_board,move);\r
+ ASSERT(!is_in_check(new_board,colour_opp(new_board->turn)));\r
+\r
+ return board_is_check(new_board);\r
+}\r
+\r
+// move_is_mate()\r
+\r
+bool move_is_mate(int move, const board_t * board) {\r
+\r
+ board_t new_board[1];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ board_copy(new_board,board);\r
+ move_do(new_board,move);\r
+ ASSERT(!is_in_check(new_board,colour_opp(new_board->turn)));\r
+\r
+ return board_is_mate(new_board);\r
+}\r
+\r
+// move_to_can()\r
+\r
+bool move_to_can(int move, const board_t * board, char string[], int size) {\r
+\r
+ int from, to;\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=6);\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ if (size < 6) return false;\r
+\r
+ // init\r
+\r
+ from = move_from(move);\r
+ to = move_to(move);\r
+\r
+ // king-slide castling\r
+\r
+ if (move_is_castle(move,board) && !option_get_bool("Chess960")) {\r
+ if (false) {\r
+ } else if (from == E1 && to == H1) {\r
+ to = G1;\r
+ } else if (from == E1 && to == A1) {\r
+ to = C1;\r
+ } else if (from == E8 && to == H8) {\r
+ to = G8;\r
+ } else if (from == E8 && to == A8) {\r
+ to = C8;\r
+ }\r
+ }\r
+\r
+ // normal moves\r
+\r
+ if (!square_to_string(from,&string[0],3)) ASSERT(false);\r
+ if (!square_to_string(to,&string[2],3)) ASSERT(false);\r
+ ASSERT(strlen(string)==4);\r
+\r
+ // promotes\r
+\r
+ if (move_is_promote(move)) {\r
+ string[4] = piece_to_char(move_promote_hack(move)|Black); // HACK: black => lower-case\r
+ string[5] = '\0';\r
+ }\r
+\r
+ // debug\r
+\r
+ ASSERT(move_from_can(string,board)==move);\r
+\r
+ return true;\r
+}\r
+\r
+// move_from_can()\r
+\r
+int move_from_can(const char string[], const board_t * board) {\r
+\r
+ char tmp_string[256];\r
+ int from, to;\r
+ int side;\r
+ int move;\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ // from\r
+\r
+ tmp_string[0] = string[0];\r
+ tmp_string[1] = string[1];\r
+ tmp_string[2] = '\0';\r
+\r
+ from = square_from_string(tmp_string);\r
+ if (from == SquareNone) return MoveNone;\r
+\r
+ // to\r
+\r
+ tmp_string[0] = string[2];\r
+ tmp_string[1] = string[3];\r
+ tmp_string[2] = '\0';\r
+\r
+ to = square_from_string(tmp_string);\r
+ if (to == SquareNone) return MoveNone;\r
+\r
+ // convert "king slide" castling to KxR\r
+\r
+ if (piece_is_king(board->square[from])\r
+ && square_rank(to) == square_rank(from)\r
+ && abs(to-from) > 1) {\r
+ side = (to > from) ? SideH : SideA;\r
+ to = board->castle[board->turn][side];\r
+ if (to == SquareNone) return MoveNone;\r
+ }\r
+\r
+ // move\r
+\r
+ move = move_make(from,to);\r
+\r
+ // promote\r
+\r
+ switch (string[4]) {\r
+ case '\0': // not a promotion\r
+ if (piece_is_pawn(board->square[from])\r
+ && square_side_rank(to,board->turn) == Rank8\r
+ && option_get_bool("PromoteWorkAround")) {\r
+ move |= MovePromoteQueen;\r
+ }\r
+ break;\r
+ case 'N':\r
+ case 'n':\r
+ move |= MovePromoteKnight;\r
+ break;\r
+ case 'B':\r
+ case 'b':\r
+ move |= MovePromoteBishop;\r
+ break;\r
+ case 'R':\r
+ case 'r':\r
+ move |= MovePromoteRook;\r
+ break;\r
+ case 'Q':\r
+ case 'q':\r
+ move |= MovePromoteQueen;\r
+ break;\r
+ default:\r
+ return MoveNone;\r
+ break;\r
+ }\r
+\r
+ // debug\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ return move;\r
+}\r
+\r
+// move_order()\r
+\r
+int move_order(int move) {\r
+\r
+ ASSERT(move_is_ok(move));\r
+\r
+ return ((move & 07777) << 3) | (move >> 12); // from, to, promote\r
+}\r
+\r
+// move_disp()\r
+\r
+void move_disp(int move, const board_t * board) {\r
+\r
+ char string[256];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ if (!move_to_can(move,board,string,256)) ASSERT(false);\r
+ my_log("POLYGLOT %s\n",string);\r
+}\r
+\r
+// end of move.cpp\r
+\r
--- /dev/null
+\r
+// move.h\r
+\r
+#ifndef MOVE_H\r
+#define MOVE_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int MoveNone = 0; // HACK: a1a1 cannot be a legal move\r
+\r
+const int MovePromoteKnight = 1 << 12;\r
+const int MovePromoteBishop = 2 << 12;\r
+const int MovePromoteRook = 3 << 12;\r
+const int MovePromoteQueen = 4 << 12;\r
+const int MoveFlags = 7 << 12;\r
+\r
+// types\r
+\r
+typedef uint16 move_t;\r
+\r
+// functions\r
+\r
+extern bool move_is_ok (int move);\r
+\r
+extern int move_make (int from, int to);\r
+extern int move_make_flags (int from, int to, int flags);\r
+\r
+extern int move_from (int move);\r
+extern int move_to (int move);\r
+extern int move_promote_hack (int move);\r
+\r
+extern bool move_is_capture (int move, const board_t * board);\r
+extern bool move_is_promote (int move);\r
+extern bool move_is_en_passant (int move, const board_t * board);\r
+extern bool move_is_castle (int move, const board_t * board);\r
+\r
+extern int move_piece (int move, const board_t * board);\r
+extern int move_capture (int move, const board_t * board);\r
+extern int move_promote (int move, const board_t * board);\r
+\r
+extern bool move_is_check (int move, const board_t * board);\r
+extern bool move_is_mate (int move, const board_t * board);\r
+\r
+extern int move_order (int move);\r
+\r
+extern bool move_to_can (int move, const board_t * board, char string[], int size);\r
+extern int move_from_can (const char string[], const board_t * board);\r
+\r
+extern void move_disp (int move, const board_t * board);\r
+\r
+#endif // !defined MOVE_H\r
+\r
+// end of move.h\r
+\r
--- /dev/null
+\r
+// move_do.cpp\r
+\r
+// includes\r
+\r
+#include <cstdlib>\r
+\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "hash.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "random.h"\r
+#include "util.h"\r
+\r
+// prototypes\r
+\r
+static void square_clear (board_t * board, int square, int piece);\r
+static void square_set (board_t * board, int square, int piece, int pos);\r
+static void square_move (board_t * board, int from, int to, int piece);\r
+\r
+// functions\r
+\r
+// move_do()\r
+\r
+void move_do(board_t * board, int move) {\r
+\r
+ int me, opp;\r
+ int from, to;\r
+ int piece, pos, capture;\r
+ int old_flags, new_flags;\r
+ int sq, ep_square;\r
+ int pawn;\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(move_is_ok(move));\r
+\r
+ ASSERT(move_is_pseudo(move,board));\r
+\r
+ // init\r
+\r
+ me = board->turn;\r
+ opp = colour_opp(me);\r
+\r
+ from = move_from(move);\r
+ to = move_to(move);\r
+\r
+ piece = board->square[from];\r
+ ASSERT(colour_equal(piece,me));\r
+\r
+ pos = board->pos[from];\r
+ ASSERT(pos>=0);\r
+\r
+ // update turn\r
+\r
+ board->turn = opp;\r
+ board->key ^= random_64(RandomTurn);\r
+\r
+ // update castling rights\r
+\r
+ old_flags = board_flags(board);\r
+\r
+ if (piece_is_king(piece)) {\r
+ board->castle[me][SideH] = SquareNone;\r
+ board->castle[me][SideA] = SquareNone;\r
+ }\r
+\r
+ if (board->castle[me][SideH] == from) board->castle[me][SideH] = SquareNone;\r
+ if (board->castle[me][SideA] == from) board->castle[me][SideA] = SquareNone;\r
+\r
+ if (board->castle[opp][SideH] == to) board->castle[opp][SideH] = SquareNone;\r
+ if (board->castle[opp][SideA] == to) board->castle[opp][SideA] = SquareNone;\r
+\r
+ new_flags = board_flags(board);\r
+\r
+ board->key ^= hash_castle_key(new_flags^old_flags); // HACK\r
+\r
+ // update en-passant square\r
+\r
+ ep_square = sq = board->ep_square;\r
+ if (sq != SquareNone) {\r
+ board->key ^= random_64(RandomEnPassant+square_file(sq));\r
+ board->ep_square = SquareNone;\r
+ }\r
+\r
+ if (piece_is_pawn(piece) && abs(to-from) == 32) {\r
+ pawn = piece_make_pawn(opp);\r
+ if (board->square[to-1] == pawn || board->square[to+1] == pawn) {\r
+ board->ep_square = sq = (from + to) / 2;\r
+ board->key ^= random_64(RandomEnPassant+square_file(sq));\r
+ }\r
+ }\r
+\r
+ // update ply number (captures are handled later)\r
+\r
+ board->ply_nb++;\r
+ if (piece_is_pawn(piece)) board->ply_nb = 0; // conversion\r
+\r
+ // update move number\r
+\r
+ if (me == Black) board->move_nb++;\r
+\r
+ // castle\r
+\r
+ if (colour_equal(board->square[to],me)) {\r
+\r
+ int rank;\r
+ int king_from, king_to;\r
+ int rook_from, rook_to;\r
+ int rook;\r
+\r
+ rank = colour_is_white(me) ? Rank1 : Rank8;\r
+\r
+ king_from = from;\r
+ rook_from = to;\r
+\r
+ if (to > from) { // h side\r
+ king_to = square_make(FileG,rank);\r
+ rook_to = square_make(FileF,rank);\r
+ } else { // a side\r
+ king_to = square_make(FileC,rank);\r
+ rook_to = square_make(FileD,rank);\r
+ }\r
+\r
+ // remove the rook\r
+\r
+ pos = board->pos[rook_from];\r
+ ASSERT(pos>=0);\r
+\r
+ rook = Rook64 | me; // HACK\r
+\r
+ square_clear(board,rook_from,rook);\r
+\r
+ // move the king\r
+\r
+ square_move(board,king_from,king_to,piece);\r
+\r
+ // put the rook back\r
+\r
+ square_set(board,rook_to,rook,pos);\r
+\r
+ ASSERT(board->key==hash_key(board));\r
+\r
+ return;\r
+ }\r
+\r
+ // remove the captured piece\r
+\r
+ if (piece_is_pawn(piece) && to == ep_square) {\r
+\r
+ // en-passant capture\r
+\r
+ sq = square_ep_dual(to);\r
+ capture = board->square[sq];\r
+ ASSERT(capture==piece_make_pawn(opp));\r
+\r
+ square_clear(board,sq,capture);\r
+\r
+ board->ply_nb = 0; // conversion\r
+\r
+ } else {\r
+\r
+ capture = board->square[to];\r
+\r
+ if (capture != Empty) {\r
+\r
+ // normal capture\r
+\r
+ ASSERT(colour_equal(capture,opp));\r
+ ASSERT(!piece_is_king(capture));\r
+\r
+ square_clear(board,to,capture);\r
+\r
+ board->ply_nb = 0; // conversion\r
+ }\r
+ }\r
+\r
+ // move the piece\r
+\r
+ if (move_is_promote(move)) {\r
+\r
+ // promote\r
+\r
+ square_clear(board,from,piece);\r
+ piece = move_promote_hack(move) | me; // HACK\r
+ square_set(board,to,piece,pos);\r
+\r
+ } else {\r
+\r
+ // normal move\r
+\r
+ square_move(board,from,to,piece);\r
+ }\r
+\r
+ ASSERT(board->key==hash_key(board));\r
+}\r
+\r
+// square_clear()\r
+\r
+static void square_clear(board_t * board, int square, int piece) {\r
+\r
+ int pos, piece_12, colour;\r
+ int sq, size;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(square_is_ok(square));\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ // init\r
+\r
+ pos = board->pos[square];\r
+ ASSERT(pos>=0);\r
+\r
+ colour = piece_colour(piece);\r
+ piece_12 = piece_to_12(piece);\r
+\r
+ // square\r
+\r
+ ASSERT(board->square[square]==piece);\r
+ board->square[square] = Empty;\r
+\r
+ ASSERT(board->pos[square]==pos);\r
+ board->pos[square] = -1; // not needed\r
+\r
+ // piece list\r
+\r
+ ASSERT(board->list_size[colour]>=2);\r
+ size = --board->list_size[colour];\r
+ ASSERT(pos<=size);\r
+\r
+ if (pos != size) {\r
+\r
+ sq = board->list[colour][size];\r
+ ASSERT(square_is_ok(sq));\r
+ ASSERT(sq!=square);\r
+\r
+ ASSERT(board->pos[sq]==size);\r
+ board->pos[sq] = pos;\r
+\r
+ ASSERT(board->list[colour][pos]==square);\r
+ board->list[colour][pos] = sq;\r
+ }\r
+\r
+ board->list[colour][size] = SquareNone;\r
+\r
+ // material\r
+\r
+ ASSERT(board->number[piece_12]>=1);\r
+ board->number[piece_12]--;\r
+\r
+ // hash key\r
+\r
+ board->key ^= random_64(RandomPiece+piece_12*64+square_to_64(square));\r
+}\r
+\r
+// square_set()\r
+\r
+static void square_set(board_t * board, int square, int piece, int pos) {\r
+\r
+ int piece_12, colour;\r
+ int sq, size;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(square_is_ok(square));\r
+ ASSERT(piece_is_ok(piece));\r
+ ASSERT(pos>=0);\r
+\r
+ // init\r
+\r
+ colour = piece_colour(piece);\r
+ piece_12 = piece_to_12(piece);\r
+\r
+ // square\r
+\r
+ ASSERT(board->square[square]==Empty);\r
+ board->square[square] = piece;\r
+\r
+ ASSERT(board->pos[square]==-1);\r
+ board->pos[square] = pos;\r
+\r
+ // piece list\r
+\r
+ size = board->list_size[colour]++;\r
+ ASSERT(board->list[colour][size]==SquareNone);\r
+ ASSERT(pos<=size);\r
+\r
+ if (pos != size) {\r
+\r
+ sq = board->list[colour][pos];\r
+ ASSERT(square_is_ok(sq));\r
+ ASSERT(sq!=square);\r
+\r
+ ASSERT(board->pos[sq]==pos);\r
+ board->pos[sq] = size;\r
+\r
+ ASSERT(board->list[colour][size]==SquareNone);\r
+ board->list[colour][size] = sq;\r
+ }\r
+\r
+ board->list[colour][pos] = square;\r
+\r
+ // material\r
+\r
+ ASSERT(board->number[piece_12]<=8);\r
+ board->number[piece_12]++;\r
+\r
+ // hash key\r
+\r
+ board->key ^= random_64(RandomPiece+piece_12*64+square_to_64(square));\r
+}\r
+\r
+// square_move()\r
+\r
+static void square_move(board_t * board, int from, int to, int piece) {\r
+\r
+ int colour, pos;\r
+ int piece_index;\r
+\r
+ ASSERT(board!=NULL);\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ // init\r
+\r
+ colour = piece_colour(piece);\r
+\r
+ pos = board->pos[from];\r
+ ASSERT(pos>=0);\r
+\r
+ // from\r
+\r
+ ASSERT(board->square[from]==piece);\r
+ board->square[from] = Empty;\r
+\r
+ ASSERT(board->pos[from]==pos);\r
+ board->pos[from] = -1; // not needed\r
+\r
+ // to\r
+\r
+ ASSERT(board->square[to]==Empty);\r
+ board->square[to] = piece;\r
+\r
+ ASSERT(board->pos[to]==-1);\r
+ board->pos[to] = pos;\r
+\r
+ // piece list\r
+\r
+ ASSERT(board->list[colour][pos]==from);\r
+ board->list[colour][pos] = to;\r
+\r
+ // hash key\r
+\r
+ piece_index = RandomPiece + piece_to_12(piece) * 64;\r
+\r
+ board->key ^= random_64(piece_index+square_to_64(from))\r
+ ^ random_64(piece_index+square_to_64(to));\r
+}\r
+\r
+// end of move_do.cpp\r
+\r
--- /dev/null
+\r
+// move_do.h\r
+\r
+#ifndef MOVE_DO_H\r
+#define MOVE_DO_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void move_do (board_t * board, int move);\r
+\r
+#endif // !defined MOVE_DO_H\r
+\r
+// end of move_do.h\r
+\r
--- /dev/null
+\r
+// move_gen.cpp\r
+\r
+// includes\r
+\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "util.h"\r
+\r
+// prototypes\r
+\r
+static void add_all_moves (list_t * list, const board_t * board);\r
+static void add_castle_moves (list_t * list, const board_t * board);\r
+\r
+static void add_pawn_move (list_t * list, int from, int to);\r
+\r
+// functions\r
+\r
+// gen_legal_moves()\r
+\r
+void gen_legal_moves(list_t * list, const board_t * board) {\r
+\r
+ ASSERT(list!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_moves(list,board);\r
+ filter_legal(list,board);\r
+}\r
+\r
+// gen_moves()\r
+\r
+void gen_moves(list_t * list, const board_t * board) {\r
+\r
+ ASSERT(list!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ list_clear(list);\r
+\r
+ add_all_moves(list,board);\r
+ if (!is_in_check(board,board->turn)) add_castle_moves(list,board);\r
+}\r
+\r
+// add_all_moves()\r
+\r
+static void add_all_moves(list_t * list, const board_t * board) {\r
+\r
+ int me, opp;\r
+ const uint8 * ptr;\r
+ const sint8 * ptr_inc;\r
+ int from, to;\r
+ int inc;\r
+ int piece, capture;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ me = board->turn;\r
+ opp = colour_opp(me);\r
+\r
+ for (ptr = board->list[me]; (from=*ptr) != SquareNone; ptr++) {\r
+\r
+ piece = board->square[from];\r
+ ASSERT(colour_equal(piece,me));\r
+\r
+ switch (piece_type(piece)) {\r
+\r
+ case WhitePawn64:\r
+\r
+ to = from + 15;\r
+ if (to == board->ep_square || colour_equal(board->square[to],opp)) {\r
+ add_pawn_move(list,from,to);\r
+ }\r
+\r
+ to = from + 17;\r
+ if (to == board->ep_square || colour_equal(board->square[to],opp)) {\r
+ add_pawn_move(list,from,to);\r
+ }\r
+\r
+ to = from + 16;\r
+ if (board->square[to] == Empty) {\r
+ add_pawn_move(list,from,to);\r
+ if (square_rank(from) == Rank2) {\r
+ to = from + 32;\r
+ if (board->square[to] == Empty) {\r
+ ASSERT(!square_is_promote(to));\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case BlackPawn64:\r
+\r
+ to = from - 17;\r
+ if (to == board->ep_square || colour_equal(board->square[to],opp)) {\r
+ add_pawn_move(list,from,to);\r
+ }\r
+\r
+ to = from - 15;\r
+ if (to == board->ep_square || colour_equal(board->square[to],opp)) {\r
+ add_pawn_move(list,from,to);\r
+ }\r
+\r
+ to = from - 16;\r
+ if (board->square[to] == Empty) {\r
+ add_pawn_move(list,from,to);\r
+ if (square_rank(from) == Rank7) {\r
+ to = from - 32;\r
+ if (board->square[to] == Empty) {\r
+ ASSERT(!square_is_promote(to));\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case Knight64:\r
+\r
+ for (ptr_inc = KnightInc; (inc=*ptr_inc) != IncNone; ptr_inc++) {\r
+ to = from + inc;\r
+ capture = board->square[to];\r
+ if (capture == Empty || colour_equal(capture,opp)) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case Bishop64:\r
+\r
+ for (ptr_inc = BishopInc; (inc=*ptr_inc) != IncNone; ptr_inc++) {\r
+ for (to = from+inc; (capture=board->square[to]) == Empty; to += inc) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ if (colour_equal(capture,opp)) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case Rook64:\r
+\r
+ for (ptr_inc = RookInc; (inc=*ptr_inc) != IncNone; ptr_inc++) {\r
+ for (to = from+inc; (capture=board->square[to]) == Empty; to += inc) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ if (colour_equal(capture,opp)) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case Queen64:\r
+\r
+ for (ptr_inc = QueenInc; (inc=*ptr_inc) != IncNone; ptr_inc++) {\r
+ for (to = from+inc; (capture=board->square[to]) == Empty; to += inc) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ if (colour_equal(capture,opp)) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ case King64:\r
+\r
+ for (ptr_inc = KingInc; (inc=*ptr_inc) != IncNone; ptr_inc++) {\r
+ to = from + inc;\r
+ capture = board->square[to];\r
+ if (capture == Empty || colour_equal(capture,opp)) {\r
+ list_add(list,move_make(from,to));\r
+ }\r
+ }\r
+\r
+ break;\r
+\r
+ default:\r
+\r
+ ASSERT(false);\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+// add_castle_moves()\r
+\r
+static void add_castle_moves(list_t * list, const board_t * board) {\r
+\r
+ int me, opp;\r
+ int rank;\r
+ int king_from, king_to;\r
+ int rook_from, rook_to;\r
+ bool legal;\r
+ int inc;\r
+ int sq;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ ASSERT(!is_in_check(board,board->turn));\r
+\r
+ me = board->turn;\r
+ opp = colour_opp(me);\r
+\r
+ rank = colour_is_white(me) ? Rank1 : Rank8;\r
+\r
+ // h-side castling\r
+\r
+ if (board->castle[me][SideH] != SquareNone) {\r
+\r
+ king_from = king_pos(board,me);\r
+ king_to = square_make(FileG,rank);\r
+ rook_from = board->castle[me][SideH];\r
+ rook_to = square_make(FileF,rank);\r
+\r
+ ASSERT(square_rank(king_from)==rank);\r
+ ASSERT(square_rank(rook_from)==rank);\r
+ ASSERT(board->square[king_from]==(King64|me)); // HACK\r
+ ASSERT(board->square[rook_from]==(Rook64|me)); // HACK\r
+ ASSERT(rook_from>king_from);\r
+\r
+ legal = true;\r
+\r
+ if (king_to != king_from) {\r
+\r
+ inc = (king_to > king_from) ? +1 : -1;\r
+\r
+ for (sq = king_from+inc; true; sq += inc) {\r
+\r
+ if (sq != rook_from && board->square[sq] != Empty) legal = false;\r
+ if (is_attacked(board,sq,opp)) legal = false;\r
+\r
+ if (sq == king_to) break;\r
+ }\r
+ }\r
+\r
+ if (rook_to != rook_from) {\r
+\r
+ inc = (rook_to > rook_from) ? +1 : -1;\r
+\r
+ for (sq = rook_from+inc; true; sq += inc) {\r
+ if (sq != king_from && board->square[sq] != Empty) legal = false;\r
+ if (sq == rook_to) break;\r
+ }\r
+ }\r
+\r
+ if (legal) list_add(list,move_make(king_from,rook_from));\r
+ }\r
+\r
+ // a-side castling\r
+\r
+ if (board->castle[me][SideA] != SquareNone) {\r
+\r
+ king_from = king_pos(board,me);\r
+ king_to = square_make(FileC,rank);\r
+ rook_from = board->castle[me][SideA];\r
+ rook_to = square_make(FileD,rank);\r
+\r
+ ASSERT(square_rank(king_from)==rank);\r
+ ASSERT(square_rank(rook_from)==rank);\r
+ ASSERT(board->square[king_from]==(King64|me)); // HACK\r
+ ASSERT(board->square[rook_from]==(Rook64|me)); // HACK\r
+ ASSERT(rook_from<king_from);\r
+\r
+ legal = true;\r
+\r
+ if (king_to != king_from) {\r
+\r
+ inc = (king_to > king_from) ? +1 : -1;\r
+\r
+ for (sq = king_from+inc; true; sq += inc) {\r
+\r
+ if (sq != rook_from && board->square[sq] != Empty) legal = false;\r
+ if (is_attacked(board,sq,opp)) legal = false;\r
+\r
+ if (sq == king_to) break;\r
+ }\r
+ }\r
+\r
+ if (rook_to != rook_from) {\r
+\r
+ inc = (rook_to > rook_from) ? +1 : -1;\r
+\r
+ for (sq = rook_from+inc; true; sq += inc) {\r
+ if (sq != king_from && board->square[sq] != Empty) legal = false;\r
+ if (sq == rook_to) break;\r
+ }\r
+ }\r
+\r
+ if (legal) list_add(list,move_make(king_from,rook_from));\r
+ }\r
+}\r
+\r
+// add_pawn_move()\r
+\r
+static void add_pawn_move(list_t * list, int from, int to) {\r
+\r
+ int move;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(square_is_ok(from));\r
+ ASSERT(square_is_ok(to));\r
+\r
+ move = move_make(from,to);\r
+\r
+ if (square_is_promote(to)) {\r
+ list_add(list,move|MovePromoteKnight);\r
+ list_add(list,move|MovePromoteBishop);\r
+ list_add(list,move|MovePromoteRook);\r
+ list_add(list,move|MovePromoteQueen);\r
+ } else {\r
+ list_add(list,move);\r
+ }\r
+}\r
+\r
+// end of move_gen.cpp\r
+\r
--- /dev/null
+\r
+// move_gen.h\r
+\r
+#ifndef MOVE_GEN_H\r
+#define MOVE_GEN_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "list.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void gen_legal_moves (list_t * list, const board_t * board);\r
+extern void gen_moves (list_t * list, const board_t * board);\r
+\r
+#endif // !defined MOVE_GEN_H\r
+\r
+// end of move_gen.h\r
+\r
--- /dev/null
+\r
+// move_legal.cpp\r
+\r
+// includes\r
+\r
+#include "attack.h"\r
+#include "colour.h"\r
+#include "fen.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// prototypes\r
+\r
+static bool move_is_legal_debug (int move, const board_t * board);\r
+\r
+// functions\r
+\r
+// move_is_pseudo()\r
+\r
+bool move_is_pseudo(int move, const board_t * board) {\r
+\r
+ list_t list[1];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_moves(list,board);\r
+\r
+ return list_contain(list,move);\r
+}\r
+\r
+// pseudo_is_legal()\r
+\r
+bool pseudo_is_legal(int move, const board_t * board) {\r
+\r
+ board_t new_board[1];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ ASSERT(move_is_pseudo(move,board));\r
+\r
+ board_copy(new_board,board);\r
+ move_do(new_board,move);\r
+\r
+ return !is_in_check(new_board,colour_opp(new_board->turn));\r
+}\r
+\r
+// move_is_legal()\r
+\r
+bool move_is_legal(int move, const board_t * board) {\r
+\r
+ bool legal;\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ legal = move_is_pseudo(move,board) && pseudo_is_legal(move,board);\r
+ ASSERT(legal==move_is_legal_debug(move,board));\r
+\r
+ return legal;\r
+}\r
+\r
+// filter_legal()\r
+\r
+void filter_legal(list_t * list, const board_t * board) {\r
+\r
+ int pos;\r
+ int i, move, value;\r
+\r
+ ASSERT(list_is_ok(list));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ pos = 0;\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+\r
+ ASSERT(pos>=0&&pos<=i);\r
+\r
+ move = list_move(list,i);\r
+ value = list_value(list,i);\r
+\r
+ if (pseudo_is_legal(move,board)) {\r
+ list->move[pos] = move;\r
+ list->value[pos] = value;\r
+ pos++;\r
+ }\r
+ }\r
+\r
+ ASSERT(pos>=0&&pos<=list_size(list));\r
+ list->size = pos;\r
+}\r
+\r
+// move_is_legal_debug()\r
+\r
+static bool move_is_legal_debug(int move, const board_t * board) {\r
+\r
+ list_t list[1];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_legal_moves(list,board);\r
+\r
+ return list_contain(list,move);\r
+}\r
+\r
+// end of move_legal.cpp\r
+\r
--- /dev/null
+\r
+// move_legal.h\r
+\r
+#ifndef MOVE_LEGAL_H\r
+#define MOVE_LEGAL_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "list.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern bool move_is_pseudo (int move, const board_t * board);\r
+extern bool pseudo_is_legal (int move, const board_t * board);\r
+extern bool move_is_legal (int move, const board_t * board);\r
+\r
+extern void filter_legal (list_t * list, const board_t * board);\r
+\r
+#endif // !defined MOVE_LEGAL_H\r
+\r
+// end of move_legal.h\r
+\r
--- /dev/null
+\r
+// option.cpp\r
+\r
+// includes\r
+\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "option.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseDebug = false;\r
+\r
+// types\r
+\r
+struct option_t {\r
+ const char * var;\r
+ const char * val;\r
+};\r
+\r
+// variables\r
+\r
+static option_t Option[] = {\r
+\r
+ { "OptionFile", NULL, }, // string\r
+\r
+ // options\r
+\r
+ { "EngineName", NULL, }, // string\r
+ { "EngineDir", NULL, }, // string\r
+ { "EngineCommand", NULL, }, // string\r
+\r
+ { "Log", NULL, }, // true/false\r
+ { "LogFile", NULL, }, // string\r
+\r
+ { "UCI", NULL, }, // true/false\r
+\r
+ { "UseNice", NULL, }, // true/false\r
+\r
+ { "NiceValue", NULL, }, // true/false\r
+\r
+ { "Chess960", NULL, }, // true/false\r
+\r
+ { "Resign", NULL, }, // true/false\r
+ { "ResignMoves", NULL, }, // move number\r
+ { "ResignScore", NULL, }, // centipawns\r
+\r
+ { "MateScore", NULL, }, // centipawns\r
+\r
+ { "Book", NULL, }, // true/false\r
+ { "BookFile", NULL, }, // string\r
+\r
+ { "BookRandom", NULL, }, // true/false\r
+ { "BookLearn", NULL, }, // true/false\r
+\r
+ { "KibitzMove", NULL, }, // true/false\r
+ { "KibitzPV", NULL, }, // true/false\r
+\r
+ { "KibitzCommand", NULL, }, // string\r
+ { "KibitzDelay", NULL, }, // seconds\r
+\r
+ { "ShowPonder", NULL, }, // true/false\r
+\r
+ // work-arounds\r
+\r
+ { "UCIVersion", NULL, }, // 1-\r
+ { "CanPonder", NULL, }, // true/false\r
+ { "SyncStop", NULL, }, // true/false\r
+ { "Affinity", NULL, }, // -1 else 0-32 //won't do much on *nix systems\r
+ { "RepeatPV", NULL, },\r
+ { "PromoteWorkAround", NULL, }, // true/false\r
+\r
+ // { "", NULL, },\r
+\r
+ { NULL, NULL, },\r
+};\r
+\r
+// prototypes\r
+\r
+static option_t * option_find (const char var[]);\r
+\r
+// functions\r
+\r
+// option_init()\r
+\r
+void option_init() {\r
+\r
+ option_set("OptionFile","polyglot.ini");\r
+\r
+ // options\r
+\r
+ option_set("EngineName","<empty>");\r
+ option_set("EngineDir",".");\r
+ option_set("EngineCommand","<empty>");\r
+\r
+ option_set("Log","false");\r
+ option_set("LogFile","polyglot.log");\r
+\r
+ option_set("UCI","false");\r
+\r
+ option_set("UseNice","false");\r
+ option_set("NiceValue","5");\r
+ \r
+ option_set("Chess960","false");\r
+\r
+ option_set("Resign","false");\r
+ option_set("ResignMoves","3");\r
+ option_set("ResignScore","600");\r
+\r
+ option_set("MateScore","10000");\r
+\r
+ option_set("Book","false");\r
+ option_set("BookFile","book.bin");\r
+\r
+ option_set("BookRandom","true");\r
+ option_set("BookLearn","false");\r
+\r
+ option_set("KibitzMove","false");\r
+ option_set("KibitzPV","false");\r
+\r
+ option_set("KibitzCommand","tellall");\r
+ option_set("KibitzDelay","5");\r
+\r
+ option_set("ShowPonder","true");\r
+\r
+ // work-arounds\r
+\r
+ option_set("UCIVersion","2");\r
+ option_set("CanPonder","false");\r
+ option_set("SyncStop","false");\r
+ option_set("Affinity","-1");\r
+ option_set("PromoteWorkAround","false");\r
+ option_set("RepeatPV","true");\r
+ // option_set("","");\r
+}\r
+\r
+// option_set()\r
+\r
+bool option_set(const char var[], const char val[]) {\r
+\r
+ option_t * opt;\r
+\r
+ ASSERT(var!=NULL);\r
+ ASSERT(val!=NULL);\r
+\r
+ opt = option_find(var);\r
+ if (opt == NULL) return false;\r
+\r
+ my_string_set(&opt->val,val);\r
+\r
+ if (UseDebug) my_log("POLYGLOT OPTION SET \"%s\" -> \"%s\"\n",opt->var,opt->val);\r
+\r
+ return true;\r
+}\r
+\r
+// option_get()\r
+\r
+const char * option_get(const char var[]) {\r
+\r
+ option_t * opt;\r
+\r
+ ASSERT(var!=NULL);\r
+\r
+ opt = option_find(var);\r
+ if (opt == NULL) my_fatal("option_get(): unknown option \"%s\"\n",var);\r
+\r
+ if (UseDebug) my_log("POLYGLOT OPTION GET \"%s\" -> \"%s\"\n",opt->var,opt->val);\r
+\r
+ return opt->val;\r
+}\r
+\r
+// option_get_bool()\r
+\r
+bool option_get_bool(const char var[]) {\r
+\r
+ const char * val;\r
+\r
+ val = option_get(var);\r
+\r
+ if (false) {\r
+ } else if (my_string_case_equal(val,"true") || my_string_case_equal(val,"yes") || my_string_equal(val,"1")) {\r
+ return true;\r
+ } else if (my_string_case_equal(val,"false") || my_string_case_equal(val,"no") || my_string_equal(val,"0")) {\r
+ return false;\r
+ }\r
+\r
+ ASSERT(false);\r
+\r
+ return false;\r
+}\r
+\r
+// option_get_double()\r
+\r
+double option_get_double(const char var[]) {\r
+\r
+ const char * val;\r
+\r
+ val = option_get(var);\r
+\r
+ return atof(val);\r
+}\r
+\r
+// option_get_int()\r
+\r
+int option_get_int(const char var[]) {\r
+\r
+ const char * val;\r
+\r
+ val = option_get(var);\r
+\r
+ return atoi(val);\r
+}\r
+\r
+// option_get_string()\r
+\r
+const char * option_get_string(const char var[]) {\r
+\r
+ const char * val;\r
+\r
+ val = option_get(var);\r
+\r
+ return val;\r
+}\r
+\r
+// option_find()\r
+\r
+static option_t * option_find(const char var[]) {\r
+\r
+ option_t * opt;\r
+\r
+ ASSERT(var!=NULL);\r
+\r
+ for (opt = &Option[0]; opt->var != NULL; opt++) {\r
+ if (my_string_case_equal(opt->var,var)) return opt;\r
+ }\r
+\r
+ return NULL;\r
+}\r
+\r
+// end of option.cpp\r
+\r
--- /dev/null
+\r
+// option.h\r
+\r
+#ifndef OPTION_H\r
+#define OPTION_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern void option_init ();\r
+\r
+extern bool option_set (const char var[], const char val[]);\r
+extern const char * option_get (const char var[]);\r
+\r
+extern bool option_get_bool (const char var[]);\r
+extern double option_get_double (const char var[]);\r
+extern int option_get_int (const char var[]);\r
+extern const char * option_get_string (const char var[]);\r
+\r
+#endif // !defined OPTION_H\r
+\r
+// end of option.h\r
+\r
--- /dev/null
+\r
+// parse.cpp\r
+\r
+// includes\r
+\r
+#include <cstring>\r
+\r
+#include "parse.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const int StringSize = 256;\r
+\r
+// variables\r
+\r
+char * Star[STAR_NUMBER];\r
+\r
+// prototypes\r
+\r
+static bool match_rec (char string[], const char pattern[], char * star[]);\r
+\r
+// functions\r
+\r
+// match()\r
+\r
+bool match(char string[], const char pattern[]) {\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(pattern!=NULL);\r
+\r
+ ASSERT(strstr(pattern,"**")==NULL);\r
+\r
+ return match_rec(string,pattern,Star);\r
+}\r
+\r
+// match_rec()\r
+\r
+static bool match_rec(char string[], const char pattern[], char * star[]) {\r
+\r
+ int c;\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(pattern!=NULL);\r
+ ASSERT(star!=NULL);\r
+\r
+ // iterative matches\r
+\r
+ while ((c=*pattern++) != '*') {\r
+ if (false) {\r
+ } else if (c == '\0') { // end of pattern\r
+ while (*string == ' ') string++; // skip trailing spaces\r
+ return *string == '\0';\r
+ } else if (c == ' ') { // spaces\r
+ if (*string++ != ' ') return false; // mismatch\r
+ while (*string == ' ') string++; // skip trailing spaces\r
+ } else { // normal character\r
+ if (*string++ != c) return false; // mismatch\r
+ }\r
+ }\r
+\r
+ // recursive wildcard match\r
+\r
+ ASSERT(c=='*');\r
+\r
+ while (*string == ' ') string++; // skip leading spaces\r
+ *star++ = string; // remember beginning of star\r
+\r
+ while ((c=*string++) != '\0') { // reject empty-string match\r
+ if (c != ' ' && match_rec(string,pattern,star)) { // shortest match\r
+ ASSERT(string>star[-1]);\r
+ *string = '\0'; // truncate star\r
+ return true;\r
+ }\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// parse_is_ok()\r
+\r
+bool parse_is_ok(const parse_t * parse) {\r
+\r
+ if (parse == NULL) return false;\r
+ if (parse->string == NULL) return false;\r
+ if (parse->pos < 0 || parse->pos > strlen(parse->string)) return false;\r
+ if (parse->keyword_nb < 0 || parse->keyword_nb >= KEYWORD_NUMBER) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// parse_open()\r
+\r
+void parse_open(parse_t * parse, const char string[]) {\r
+\r
+ ASSERT(parse!=NULL);\r
+ ASSERT(string!=NULL);\r
+\r
+ parse->string = string;\r
+ parse->pos = 0;\r
+ parse->keyword_nb = 0;\r
+}\r
+\r
+// parse_close()\r
+\r
+void parse_close(parse_t * parse) {\r
+\r
+ int i;\r
+\r
+ ASSERT(parse_is_ok(parse));\r
+\r
+ parse->string = NULL;\r
+ parse->pos = 0;\r
+\r
+ for (i = 0; i < parse->keyword_nb; i++) {\r
+ my_string_clear(&parse->keyword[i]);\r
+ }\r
+\r
+ parse->keyword_nb = 0;\r
+}\r
+\r
+// parse_add_keyword()\r
+\r
+void parse_add_keyword(parse_t * parse, const char keyword[]) {\r
+\r
+ const char * * string;\r
+\r
+ ASSERT(parse_is_ok(parse));\r
+ ASSERT(keyword!=NULL);\r
+\r
+ if (parse->keyword_nb < KEYWORD_NUMBER) {\r
+\r
+ string = &parse->keyword[parse->keyword_nb];\r
+ parse->keyword_nb++;\r
+\r
+ *string = NULL;\r
+ my_string_set(string,keyword);\r
+ }\r
+}\r
+\r
+// parse_get_word()\r
+\r
+bool parse_get_word(parse_t * parse, char string[], int size) {\r
+\r
+ int pos;\r
+ int c;\r
+\r
+ ASSERT(parse!=NULL);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=256);\r
+\r
+ // skip blanks\r
+\r
+ for (; parse->string[parse->pos] == ' '; parse->pos++)\r
+ ;\r
+\r
+ ASSERT(parse->string[parse->pos]!=' ');\r
+\r
+ // copy word\r
+\r
+ pos = 0;\r
+\r
+ while (true) {\r
+\r
+ c = parse->string[parse->pos];\r
+ if (c == ' ' || pos >= size-1) c = '\0';\r
+\r
+ string[pos] = c;\r
+ if (c == '\0') break;\r
+\r
+ parse->pos++;\r
+ pos++;\r
+ }\r
+\r
+ ASSERT(strchr(string,' ')==NULL);\r
+\r
+ return pos > 0; // non-empty word?\r
+}\r
+\r
+// parse_get_string()\r
+\r
+bool parse_get_string(parse_t * parse, char string[], int size) {\r
+\r
+ int pos;\r
+ parse_t parse_2[1];\r
+ char word[StringSize];\r
+ int i;\r
+ int c;\r
+\r
+ ASSERT(parse!=NULL);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=256);\r
+\r
+ // skip blanks\r
+\r
+ for (; parse->string[parse->pos] == ' '; parse->pos++)\r
+ ;\r
+\r
+ ASSERT(parse->string[parse->pos]!=' ');\r
+\r
+ // copy string\r
+\r
+ pos = 0;\r
+\r
+ while (true) {\r
+\r
+ parse_open(parse_2,&parse->string[parse->pos]);\r
+\r
+ if (!parse_get_word(parse_2,word,StringSize)) {\r
+ string[pos] = '\0';\r
+ parse_close(parse_2);\r
+ goto finished;\r
+ }\r
+\r
+ for (i = 0; i < parse->keyword_nb; i++) {\r
+ if (my_string_equal(parse->keyword[i],word)) {\r
+ string[pos] = '\0';\r
+ parse_close(parse_2);\r
+ goto finished;\r
+ }\r
+ }\r
+\r
+ parse_close(parse_2);\r
+\r
+ // copy spaces\r
+\r
+ while (true) {\r
+\r
+ c = parse->string[parse->pos];\r
+ if (c != ' ') break;\r
+\r
+ if (pos >= size-1) c = '\0';\r
+\r
+ string[pos] = c;\r
+ if (c == '\0') break;\r
+\r
+ parse->pos++;\r
+ pos++;\r
+ }\r
+\r
+ // copy non spaces\r
+\r
+ while (true) {\r
+\r
+ c = parse->string[parse->pos];\r
+ if (c == ' ' || pos >= size-1) c = '\0';\r
+\r
+ string[pos] = c;\r
+ if (c == '\0') break;\r
+\r
+ parse->pos++;\r
+ pos++;\r
+ }\r
+\r
+ string[pos] = '\0';\r
+ }\r
+\r
+finished: ;\r
+\r
+ return pos > 0; // non-empty string?\r
+}\r
+\r
+// end of parse.cpp\r
+\r
--- /dev/null
+\r
+// parse.h\r
+\r
+#ifndef PARSE_H\r
+#define PARSE_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int STAR_NUMBER = 16;\r
+const int KEYWORD_NUMBER = 256;\r
+\r
+// types\r
+\r
+struct parse_t {\r
+ const char * string;\r
+ int pos;\r
+ int keyword_nb;\r
+ const char * keyword[KEYWORD_NUMBER];\r
+};\r
+\r
+// variables\r
+\r
+extern char * Star[STAR_NUMBER];\r
+\r
+// functions\r
+\r
+extern bool match (char string[], const char pattern[]);\r
+\r
+extern void parse_open (parse_t * parse, const char string[]);\r
+extern void parse_close (parse_t * parse);\r
+\r
+extern void parse_add_keyword (parse_t * parse, const char keyword[]);\r
+\r
+extern bool parse_get_word (parse_t * parse, char string[], int size);\r
+extern bool parse_get_string (parse_t * parse, char string[], int size);\r
+\r
+#endif // !defined PARSE_H\r
+\r
+// end of parse.h\r
+\r
--- /dev/null
+\r
+// pgn.cpp\r
+\r
+// includes\r
+\r
+#include <cctype>\r
+#include <cerrno>\r
+#include <cstdio>\r
+#include <cstring>\r
+\r
+#include "pgn.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool DispMove = false;\r
+static const bool DispToken = false;\r
+static const bool DispChar = false;\r
+\r
+static const int TAB_SIZE = 8;\r
+\r
+static const int CHAR_EOF = 256;\r
+\r
+// types\r
+\r
+enum token_t {\r
+ TOKEN_ERROR = -1,\r
+ TOKEN_EOF = 256,\r
+ TOKEN_SYMBOL = 257,\r
+ TOKEN_STRING = 258,\r
+ TOKEN_INTEGER = 259,\r
+ TOKEN_NAG = 260,\r
+ TOKEN_RESULT = 261\r
+};\r
+\r
+// prototypes\r
+\r
+static void pgn_token_read (pgn_t * pgn);\r
+static void pgn_token_unread (pgn_t * pgn);\r
+\r
+static void pgn_read_token (pgn_t * pgn);\r
+\r
+static bool is_symbol_start (int c);\r
+static bool is_symbol_next (int c);\r
+\r
+static void pgn_skip_blanks (pgn_t * pgn);\r
+\r
+static void pgn_char_read (pgn_t * pgn);\r
+static void pgn_char_unread (pgn_t * pgn);\r
+\r
+// functions\r
+\r
+// pgn_open()\r
+\r
+void pgn_open(pgn_t * pgn, const char file_name[]) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+ ASSERT(file_name!=NULL);\r
+\r
+ pgn->file = fopen(file_name,"r");\r
+ if (pgn->file == NULL) my_fatal("pgn_open(): can't open file \"%s\": %s\n",file_name,strerror(errno));\r
+\r
+ pgn->char_hack = CHAR_EOF; // DEBUG\r
+ pgn->char_line = 1;\r
+ pgn->char_column = 0;\r
+ pgn->char_unread = false;\r
+ pgn->char_first = true;\r
+\r
+ pgn->token_type = TOKEN_ERROR; // DEBUG\r
+ strcpy(pgn->token_string,"?"); // DEBUG\r
+ pgn->token_length = -1; // DEBUG\r
+ pgn->token_line = -1; // DEBUG\r
+ pgn->token_column = -1; // DEBUG\r
+ pgn->token_unread = false;\r
+ pgn->token_first = true;\r
+\r
+ strcpy(pgn->result,"?"); // DEBUG\r
+ strcpy(pgn->fen,"?"); // DEBUG\r
+\r
+ pgn->move_line = -1; // DEBUG\r
+ pgn->move_column = -1; // DEBUG\r
+}\r
+\r
+// pgn_close()\r
+\r
+void pgn_close(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ fclose(pgn->file);\r
+}\r
+\r
+// pgn_next_game()\r
+\r
+bool pgn_next_game(pgn_t * pgn) {\r
+\r
+ char name[PGN_STRING_SIZE];\r
+ char value[PGN_STRING_SIZE];\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ // init\r
+\r
+ strcpy(pgn->result,"*");\r
+ strcpy(pgn->fen,"");\r
+\r
+ // loop\r
+\r
+ while (true) {\r
+\r
+ pgn_token_read(pgn);\r
+\r
+ if (pgn->token_type != '[') break;\r
+\r
+ // tag\r
+\r
+ pgn_token_read(pgn);\r
+ if (pgn->token_type != TOKEN_SYMBOL) {\r
+ my_fatal("pgn_next_game(): malformed tag at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+ strcpy(name,pgn->token_string);\r
+\r
+ pgn_token_read(pgn);\r
+ if (pgn->token_type != TOKEN_STRING) {\r
+ my_fatal("pgn_next_game(): malformed tag at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+ strcpy(value,pgn->token_string);\r
+\r
+ pgn_token_read(pgn);\r
+ if (pgn->token_type != ']') {\r
+ my_fatal("pgn_next_game(): malformed tag at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+\r
+ // special tag?\r
+\r
+ if (false) {\r
+ } else if (my_string_equal(name,"Result")) {\r
+ strcpy(pgn->result,value);\r
+ } else if (my_string_equal(name,"FEN")) {\r
+ strcpy(pgn->fen,value);\r
+ }\r
+ }\r
+\r
+ if (pgn->token_type == TOKEN_EOF) return false;\r
+\r
+ pgn_token_unread(pgn);\r
+\r
+ return true;\r
+}\r
+\r
+// pgn_next_move()\r
+\r
+bool pgn_next_move(pgn_t * pgn, char string[], int size) {\r
+\r
+ int depth;\r
+\r
+ ASSERT(pgn!=NULL);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=PGN_STRING_SIZE);\r
+\r
+ // init\r
+\r
+ pgn->move_line = -1; // DEBUG\r
+ pgn->move_column = -1; // DEBUG\r
+\r
+ // loop\r
+\r
+ depth = 0;\r
+\r
+ while (true) {\r
+\r
+ pgn_token_read(pgn);\r
+\r
+ if (false) {\r
+\r
+ } else if (pgn->token_type == '(') {\r
+\r
+ // open RAV\r
+\r
+ depth++;\r
+\r
+ } else if (pgn->token_type == ')') {\r
+\r
+ // close RAV\r
+\r
+ if (depth == 0) {\r
+ my_fatal("pgn_next_move(): malformed variation at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+\r
+ depth--;\r
+ ASSERT(depth>=0);\r
+\r
+ } else if (pgn->token_type == TOKEN_RESULT) {\r
+\r
+ // game finished\r
+\r
+ if (depth > 0) {\r
+ my_fatal("pgn_next_move(): malformed variation at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+\r
+ return false;\r
+\r
+ } else {\r
+\r
+ // skip optional move number\r
+\r
+ if (pgn->token_type == TOKEN_INTEGER) {\r
+ do pgn_token_read(pgn); while (pgn->token_type == '.');\r
+ }\r
+\r
+ // move must be a symbol\r
+\r
+ if (pgn->token_type != TOKEN_SYMBOL) {\r
+ my_fatal("pgn_next_move(): malformed move at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+\r
+ // store move for later use\r
+\r
+ if (depth == 0) {\r
+\r
+ if (pgn->token_length >= size) {\r
+ my_fatal("pgn_next_move(): move too long at line %d, column %d, game %d\n",pgn->token_line,pgn->token_column,pgn->game_nb);\r
+ }\r
+\r
+ strcpy(string,pgn->token_string);\r
+ pgn->move_line = pgn->token_line;\r
+ pgn->move_column = pgn->token_column;\r
+ }\r
+\r
+ // skip optional NAGs\r
+\r
+ do pgn_token_read(pgn); while (pgn->token_type == TOKEN_NAG);\r
+ pgn_token_unread(pgn);\r
+\r
+ // return move\r
+\r
+ if (depth == 0) {\r
+ if (DispMove) printf("move=\"%s\"\n",string);\r
+ return true;\r
+ }\r
+ }\r
+ }\r
+\r
+ ASSERT(false);\r
+\r
+ return false;\r
+}\r
+\r
+// pgn_token_read()\r
+\r
+static void pgn_token_read(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ // token "stack"\r
+\r
+ if (pgn->token_unread) {\r
+ pgn->token_unread = false;\r
+ return;\r
+ }\r
+\r
+ // consume the current token\r
+\r
+ if (pgn->token_first) {\r
+ pgn->token_first = false;\r
+ } else {\r
+ ASSERT(pgn->token_type!=TOKEN_ERROR);\r
+ ASSERT(pgn->token_type!=TOKEN_EOF);\r
+ }\r
+\r
+ // read a new token\r
+\r
+ pgn_read_token(pgn);\r
+ if (pgn->token_type == TOKEN_ERROR) my_fatal("pgn_token_read(): lexical error at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+\r
+ if (DispToken) printf("< L%d C%d \"%s\" (%03X)\n",pgn->token_line,pgn->token_column,pgn->token_string,pgn->token_type);\r
+}\r
+\r
+// pgn_token_unread()\r
+\r
+static void pgn_token_unread(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ ASSERT(!pgn->token_unread);\r
+ ASSERT(!pgn->token_first);\r
+\r
+ pgn->token_unread = true;\r
+}\r
+\r
+// pgn_read_token()\r
+\r
+static void pgn_read_token(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ // skip white-space characters\r
+\r
+ pgn_skip_blanks(pgn);\r
+\r
+ // init\r
+\r
+ pgn->token_type = TOKEN_ERROR;\r
+ strcpy(pgn->token_string,"");\r
+ pgn->token_length = 0;\r
+ pgn->token_line = pgn->char_line;\r
+ pgn->token_column = pgn->char_column;\r
+\r
+ // determine token type\r
+\r
+ if (false) {\r
+\r
+ } else if (pgn->char_hack == CHAR_EOF) {\r
+\r
+ pgn->token_type = TOKEN_EOF;\r
+\r
+ } else if (strchr(".[]()<>",pgn->char_hack) != NULL) {\r
+\r
+ // single-character token\r
+\r
+ pgn->token_type = pgn->char_hack;\r
+ sprintf(pgn->token_string,"%c",pgn->char_hack);\r
+ pgn->token_length = 1;\r
+\r
+ } else if (pgn->char_hack == '*') {\r
+\r
+ pgn->token_type = TOKEN_RESULT;\r
+ sprintf(pgn->token_string,"%c",pgn->char_hack);\r
+ pgn->token_length = 1;\r
+\r
+ } else if (pgn->char_hack == '!') {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (false) {\r
+\r
+ } else if (pgn->char_hack == '!') { // "!!"\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"3");\r
+ pgn->token_length = 1;\r
+\r
+ } else if (pgn->char_hack == '?') { // "!?"\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"5");\r
+ pgn->token_length = 1;\r
+\r
+ } else { // "!"\r
+\r
+ pgn_char_unread(pgn);\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"1");\r
+ pgn->token_length = 1;\r
+ }\r
+\r
+ } else if (pgn->char_hack == '?') {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (false) {\r
+\r
+ } else if (pgn->char_hack == '?') { // "??"\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"4");\r
+ pgn->token_length = 1;\r
+\r
+ } else if (pgn->char_hack == '!') { // "?!"\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"6");\r
+ pgn->token_length = 1;\r
+\r
+ } else { // "?"\r
+\r
+ pgn_char_unread(pgn);\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ strcpy(pgn->token_string,"2");\r
+ pgn->token_length = 1;\r
+ }\r
+\r
+ } else if (is_symbol_start(pgn->char_hack)) {\r
+\r
+ // symbol, integer, or result\r
+\r
+ pgn->token_type = TOKEN_INTEGER;\r
+ pgn->token_length = 0;\r
+\r
+ do {\r
+\r
+ if (pgn->token_length >= PGN_STRING_SIZE-1) {\r
+ my_fatal("pgn_read_token(): symbol too long at line %d, column %d,game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ if (!isdigit(pgn->char_hack)) pgn->token_type = TOKEN_SYMBOL;\r
+\r
+ pgn->token_string[pgn->token_length++] = pgn->char_hack;\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ } while (is_symbol_next(pgn->char_hack));\r
+\r
+ pgn_char_unread(pgn);\r
+\r
+ ASSERT(pgn->token_length>0&&pgn->token_length<PGN_STRING_SIZE);\r
+ pgn->token_string[pgn->token_length] = '\0';\r
+\r
+ if (my_string_equal(pgn->token_string,"1-0")\r
+ || my_string_equal(pgn->token_string,"0-1")\r
+ || my_string_equal(pgn->token_string,"1/2-1/2")) {\r
+ pgn->token_type = TOKEN_RESULT;\r
+ }\r
+\r
+ } else if (pgn->char_hack == '"') {\r
+\r
+ // string\r
+\r
+ pgn->token_type = TOKEN_STRING;\r
+ pgn->token_length = 0;\r
+\r
+ while (true) {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (pgn->char_hack == CHAR_EOF) {\r
+ my_fatal("pgn_read_token(): EOF in string at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ if (pgn->char_hack == '"') break;\r
+\r
+ if (pgn->char_hack == '\\') {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (pgn->char_hack == CHAR_EOF) {\r
+ my_fatal("pgn_read_token(): EOF in string at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ if (pgn->char_hack != '"' && pgn->char_hack != '\\') {\r
+\r
+ // bad escape, ignore\r
+\r
+ if (pgn->token_length >= PGN_STRING_SIZE-1) {\r
+ my_fatal("pgn_read_token(): string too long at line %d, column %d,game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ pgn->token_string[pgn->token_length++] = '\\';\r
+ }\r
+ }\r
+\r
+ if (pgn->token_length >= PGN_STRING_SIZE-1) {\r
+ my_fatal("pgn_read_token(): string too long at line %d, column %d,game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ pgn->token_string[pgn->token_length++] = pgn->char_hack;\r
+ }\r
+\r
+ ASSERT(pgn->token_length>=0&&pgn->token_length<PGN_STRING_SIZE);\r
+ pgn->token_string[pgn->token_length] = '\0';\r
+\r
+ } else if (pgn->char_hack == '$') {\r
+\r
+ // NAG\r
+\r
+ pgn->token_type = TOKEN_NAG;\r
+ pgn->token_length = 0;\r
+\r
+ while (true) {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (!isdigit(pgn->char_hack)) break;\r
+\r
+ if (pgn->token_length >= 3) {\r
+ my_fatal("pgn_read_token(): NAG too long at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ pgn->token_string[pgn->token_length++] = pgn->char_hack;\r
+ }\r
+\r
+ pgn_char_unread(pgn);\r
+\r
+ if (pgn->token_length == 0) {\r
+ my_fatal("pgn_read_token(): malformed NAG at line %d, column %d,game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ ASSERT(pgn->token_length>0&&pgn->token_length<=3);\r
+ pgn->token_string[pgn->token_length] = '\0';\r
+\r
+ } else {\r
+\r
+ // unknown token\r
+\r
+ my_fatal("lexical error at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+}\r
+\r
+// pgn_skip_blanks()\r
+\r
+static void pgn_skip_blanks(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ while (true) {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (false) {\r
+ }else if(pgn->char_hack==CHAR_EOF){ break;\r
+ } else if (isspace(pgn->char_hack)) {\r
+\r
+ // skip white space\r
+\r
+ } else if (pgn->char_hack == ';') {\r
+\r
+ // skip comment to EOL\r
+\r
+ do {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (pgn->char_hack == CHAR_EOF) {\r
+ my_fatal("pgn_skip_blanks(): EOF in comment at line %d, column %d,game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ } while (pgn->char_hack != '\n');\r
+\r
+ } else if (pgn->char_hack == '%' && pgn->char_column == 0) {\r
+\r
+ // skip comment to EOL\r
+\r
+ do {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (pgn->char_hack == CHAR_EOF) {\r
+ my_fatal("pgn_skip_blanks(): EOF in comment at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ } while (pgn->char_hack != '\n');\r
+\r
+ } else if (pgn->char_hack == '{') {\r
+\r
+ // skip comment to next '}'\r
+\r
+ do {\r
+\r
+ pgn_char_read(pgn);\r
+\r
+ if (pgn->char_hack == CHAR_EOF) {\r
+ my_fatal("pgn_skip_blanks(): EOF in comment at line %d, column %d, game %d\n",pgn->char_line,pgn->char_column,pgn->game_nb);\r
+ }\r
+\r
+ } while (pgn->char_hack != '}');\r
+\r
+ } else { // not a white space\r
+\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+// is_symbol_start()\r
+\r
+static bool is_symbol_start(int c) {\r
+\r
+ return strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",c) != NULL;\r
+}\r
+\r
+// is_symbol_next()\r
+\r
+static bool is_symbol_next(int c) {\r
+\r
+ return strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_+#=:-/",c) != NULL;\r
+}\r
+\r
+// pgn_char_read()\r
+\r
+static void pgn_char_read(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ // char "stack"\r
+\r
+ if (pgn->char_unread) {\r
+ pgn->char_unread = false;\r
+ return;\r
+ }\r
+\r
+ // consume the current character\r
+\r
+ if (pgn->char_first) {\r
+\r
+ pgn->char_first = false;\r
+\r
+ } else {\r
+\r
+ // update counters\r
+\r
+ ASSERT(pgn->char_hack!=CHAR_EOF);\r
+\r
+ if (false) {\r
+ } else if (pgn->char_hack == '\n') {\r
+ pgn->char_line++;\r
+ pgn->char_column = 0;\r
+ } else if (pgn->char_hack == '\t') {\r
+ pgn->char_column += TAB_SIZE - (pgn->char_column % TAB_SIZE);\r
+ } else {\r
+ pgn->char_column++;\r
+ }\r
+ }\r
+\r
+ // read a new character\r
+\r
+ pgn->char_hack = fgetc(pgn->file);\r
+\r
+ if (pgn->char_hack == EOF) {\r
+ if (ferror(pgn->file)) my_fatal("pgn_char_read(): fgetc(): %s\n",strerror(errno));\r
+ pgn->char_hack = CHAR_EOF;\r
+ }\r
+\r
+ if (DispChar) printf("< L%d C%d '%c' (%02X)\n",pgn->char_line,pgn->char_column,pgn->char_hack,pgn->char_hack);\r
+}\r
+\r
+// pgn_char_unread()\r
+\r
+static void pgn_char_unread(pgn_t * pgn) {\r
+\r
+ ASSERT(pgn!=NULL);\r
+\r
+ ASSERT(!pgn->char_unread);\r
+ ASSERT(!pgn->char_first);\r
+\r
+ pgn->char_unread = true;\r
+}\r
+\r
+// end of pgn.cpp\r
+\r
--- /dev/null
+\r
+// pgn.h\r
+\r
+#ifndef PGN_H\r
+#define PGN_H\r
+\r
+// includes\r
+\r
+#include <cstdio>\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int PGN_STRING_SIZE = 256;\r
+\r
+// types\r
+\r
+struct pgn_t {\r
+\r
+ FILE * file;\r
+\r
+ int char_hack;\r
+ int char_line;\r
+ int char_column;\r
+ bool char_unread;\r
+ bool char_first;\r
+\r
+ int token_type;\r
+ char token_string[PGN_STRING_SIZE];\r
+ int token_length;\r
+ int token_line;\r
+ int token_column;\r
+ bool token_unread;\r
+ bool token_first;\r
+\r
+ char result[PGN_STRING_SIZE];\r
+ char fen[PGN_STRING_SIZE];\r
+\r
+ int move_line;\r
+ int move_column;\r
+ int game_nb;\r
+};\r
+\r
+// functions\r
+\r
+extern void pgn_open (pgn_t * pgn, const char file_name[]);\r
+extern void pgn_close (pgn_t * pgn);\r
+\r
+extern bool pgn_next_game (pgn_t * pgn);\r
+extern bool pgn_next_move (pgn_t * pgn, char string[], int size);\r
+\r
+#endif // !defined PGN_H\r
+\r
+// end of pgn.h\r
+\r
--- /dev/null
+\r
+// piece.cpp\r
+\r
+// includes\r
+\r
+#include <cstring>\r
+\r
+#include "colour.h"\r
+#include "piece.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+static const uint8 MakePawn[ColourNb] = { PieceNone256, BlackPawn256, WhitePawn256 }; // -BW\r
+\r
+static const uint8 PieceFrom12[12] = {\r
+ BlackPawn256, WhitePawn256,\r
+ BlackKnight256, WhiteKnight256,\r
+ BlackBishop256, WhiteBishop256,\r
+ BlackRook256, WhiteRook256,\r
+ BlackQueen256, WhiteQueen256,\r
+ BlackKing256, WhiteKing256,\r
+};\r
+\r
+static const char PieceString[12+1] = "pPnNbBrRqQkK";\r
+\r
+// variables\r
+\r
+static sint8 PieceTo12[256];\r
+\r
+// functions\r
+\r
+// piece_init()\r
+\r
+void piece_init() {\r
+\r
+ int piece;\r
+\r
+ for (piece = 0; piece < 256; piece++) PieceTo12[piece] = -1;\r
+\r
+ for (piece = 0; piece < 12; piece++) {\r
+ PieceTo12[PieceFrom12[piece]] = piece;\r
+ }\r
+}\r
+\r
+// piece_is_ok()\r
+\r
+bool piece_is_ok(int piece) {\r
+\r
+ if (piece < 0 || piece >= 256) return false;\r
+\r
+ if (PieceTo12[piece] < 0) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// piece_make_pawn()\r
+\r
+int piece_make_pawn(int colour) {\r
+\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ return MakePawn[colour];\r
+}\r
+\r
+// piece_pawn_opp()\r
+\r
+int piece_pawn_opp(int piece) {\r
+\r
+ ASSERT(piece==BlackPawn256||piece==WhitePawn256);\r
+\r
+ return piece ^ 15;\r
+}\r
+\r
+// piece_colour()\r
+\r
+int piece_colour(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return piece & 3;\r
+}\r
+\r
+// piece_type()\r
+\r
+int piece_type(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return piece & ~3;\r
+}\r
+\r
+// piece_is_pawn()\r
+\r
+bool piece_is_pawn(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & PawnFlags) != 0;\r
+}\r
+\r
+// piece_is_knight()\r
+\r
+bool piece_is_knight(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & KnightFlag) != 0;\r
+}\r
+\r
+// piece_is_bishop()\r
+\r
+bool piece_is_bishop(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & QueenFlags) == BishopFlag;\r
+}\r
+\r
+// piece_is_rook()\r
+\r
+bool piece_is_rook(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & QueenFlags) == RookFlag;\r
+}\r
+\r
+// piece_is_queen()\r
+\r
+bool piece_is_queen(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & QueenFlags) == QueenFlags;\r
+}\r
+\r
+// piece_is_king()\r
+\r
+bool piece_is_king(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & KingFlag) != 0;\r
+}\r
+\r
+// piece_is_slider()\r
+\r
+bool piece_is_slider(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return (piece & QueenFlags) != 0;\r
+}\r
+\r
+// piece_to_12()\r
+\r
+int piece_to_12(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return PieceTo12[piece];\r
+}\r
+\r
+// piece_from_12()\r
+\r
+int piece_from_12(int piece) {\r
+\r
+ ASSERT(piece>=0&&piece<12);\r
+\r
+ return PieceFrom12[piece];\r
+}\r
+\r
+// piece_to_char()\r
+\r
+int piece_to_char(int piece) {\r
+\r
+ ASSERT(piece_is_ok(piece));\r
+\r
+ return PieceString[piece_to_12(piece)];\r
+}\r
+\r
+// piece_from_char()\r
+\r
+int piece_from_char(int c) {\r
+\r
+ const char * ptr;\r
+\r
+ ptr = strchr(PieceString,c);\r
+ if (ptr == NULL) return PieceNone256;\r
+\r
+ return piece_from_12(ptr-PieceString);\r
+}\r
+\r
+// char_is_piece()\r
+\r
+bool char_is_piece(int c) {\r
+\r
+ return strchr("PNBRQK",c) != NULL;\r
+}\r
+\r
+// end of piece.cpp\r
+\r
--- /dev/null
+\r
+// piece.h\r
+\r
+#ifndef PIECE_H\r
+#define PIECE_H\r
+\r
+// includes\r
+\r
+#include "colour.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int BlackPawnFlag = 1 << 2;\r
+const int WhitePawnFlag = 1 << 3;\r
+const int KnightFlag = 1 << 4;\r
+const int BishopFlag = 1 << 5;\r
+const int RookFlag = 1 << 6;\r
+const int KingFlag = 1 << 7;\r
+\r
+const int PawnFlags = BlackPawnFlag | WhitePawnFlag;\r
+const int QueenFlags = BishopFlag | RookFlag;\r
+\r
+const int PieceNone64 = 0;\r
+const int BlackPawn64 = BlackPawnFlag;\r
+const int WhitePawn64 = WhitePawnFlag;\r
+const int Knight64 = KnightFlag;\r
+const int Bishop64 = BishopFlag;\r
+const int Rook64 = RookFlag;\r
+const int Queen64 = QueenFlags;\r
+const int King64 = KingFlag;\r
+\r
+const int PieceNone256 = 0;\r
+const int BlackPawn256 = BlackPawn64 | Black;\r
+const int WhitePawn256 = WhitePawn64 | White;\r
+const int BlackKnight256 = Knight64 | Black;\r
+const int WhiteKnight256 = Knight64 | White;\r
+const int BlackBishop256 = Bishop64 | Black;\r
+const int WhiteBishop256 = Bishop64 | White;\r
+const int BlackRook256 = Rook64 | Black;\r
+const int WhiteRook256 = Rook64 | White;\r
+const int BlackQueen256 = Queen64 | Black;\r
+const int WhiteQueen256 = Queen64 | White;\r
+const int BlackKing256 = King64 | Black;\r
+const int WhiteKing256 = King64 | White;\r
+\r
+const int BlackPawn12 = 0;\r
+const int WhitePawn12 = 1;\r
+const int BlackKnight12 = 2;\r
+const int WhiteKnight12 = 3;\r
+const int BlackBishop12 = 4;\r
+const int WhiteBishop12 = 5;\r
+const int BlackRook12 = 6;\r
+const int WhiteRook12 = 7;\r
+const int BlackQueen12 = 8;\r
+const int WhiteQueen12 = 9;\r
+const int BlackKing12 = 10;\r
+const int WhiteKing12 = 11;\r
+\r
+// functions\r
+\r
+extern void piece_init ();\r
+\r
+extern bool piece_is_ok (int piece);\r
+\r
+extern int piece_make_pawn (int colour);\r
+extern int piece_pawn_opp (int piece);\r
+\r
+extern int piece_colour (int piece);\r
+extern int piece_type (int piece);\r
+\r
+extern bool piece_is_pawn (int piece);\r
+extern bool piece_is_knight (int piece);\r
+extern bool piece_is_bishop (int piece);\r
+extern bool piece_is_rook (int piece);\r
+extern bool piece_is_queen (int piece);\r
+extern bool piece_is_king (int piece);\r
+\r
+extern bool piece_is_slider (int piece);\r
+\r
+extern int piece_to_12 (int piece);\r
+extern int piece_from_12 (int piece);\r
+\r
+extern int piece_to_char (int piece);\r
+extern int piece_from_char (int c);\r
+\r
+extern bool char_is_piece (int c);\r
+\r
+#endif // !defined PIECE_H\r
+\r
+// end of piece.h\r
+\r
--- /dev/null
+#ifdef _WIN32
+#include "pipe.h"
+#include "util.h"
+void PipeStruct::Open(const char *szProcFile) {
+ DWORD dwMode;
+ HANDLE hStdinRead, hStdinWrite, hStdoutRead, hStdoutWrite;
+ SECURITY_ATTRIBUTES sa;
+ STARTUPINFO si;
+ PROCESS_INFORMATION pi;
+
+ if (szProcFile == NULL) {
+ hInput = GetStdHandle(STD_INPUT_HANDLE);
+ hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
+ bConsole = GetConsoleMode(hInput, &dwMode);
+ } else {
+ sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+ sa.bInheritHandle = TRUE;
+ sa.lpSecurityDescriptor = NULL;
+ CreatePipe(&hStdinRead, &hStdinWrite, &sa, 0);
+ CreatePipe(&hStdoutRead, &hStdoutWrite, &sa, 0);
+ si.cb = sizeof(STARTUPINFO);
+ si.lpReserved = si.lpDesktop = si.lpTitle = NULL;
+ si.dwFlags = STARTF_USESTDHANDLES;
+ si.cbReserved2 = 0;
+ si.lpReserved2 = NULL;
+ si.hStdInput = hStdinRead;
+ si.hStdOutput = hStdoutWrite;
+ si.hStdError = hStdoutWrite;
+ if(!CreateProcess(NULL, (LPSTR) szProcFile, NULL, NULL, TRUE, DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP, NULL, NULL, &si, &pi)){
+ my_fatal("PipeStruct::Open(): Could not start \"%s\"\n",szProcFile);
+ }
+ hProcess=pi.hProcess;
+ //CloseHandle(pi.hProcess);//not here,baby,but in pipe.close
+ CloseHandle(pi.hThread);
+ CloseHandle(hStdinRead);
+ CloseHandle(hStdoutWrite);
+ hInput = hStdoutRead;
+ hOutput = hStdinWrite;
+ bConsole = FALSE;
+ }
+ if (bConsole) {
+ SetConsoleMode(hInput, dwMode & ~(ENABLE_MOUSE_INPUT | ENABLE_WINDOW_INPUT));
+ FlushConsoleInputBuffer(hInput);
+ } else {
+ nBytesLeft = 0;
+ }
+ nReadEnd = 0;
+}
+
+void PipeStruct::Close(void) const {
+ CloseHandle(hInput);
+ CloseHandle(hOutput);
+ DWORD lpexit;
+
+ my_log("POLYGLOT Closing child\n");
+ if(GetExitCodeProcess(hProcess,&lpexit)){
+ if(lpexit==STILL_ACTIVE)
+ my_log("POLYGLOT Process still active after \"quit\" ");
+ //must be java,hammer it down!
+ TerminateProcess(hProcess,lpexit);
+ }
+ CloseHandle(hProcess);
+}
+
+void PipeStruct::ReadInput(void) {
+ DWORD dwBytes;
+ if(!ReadFile(hInput, szBuffer + nReadEnd, LINE_INPUT_MAX_CHAR - nReadEnd, &dwBytes, NULL)){
+ // TODO move this comment to a more suitable place
+ my_log("POLYGLOT *** EOF from Engine or GUI ***\n");
+ exit(EXIT_SUCCESS); // if we are here there should be data!
+ }
+ nReadEnd += dwBytes;
+ if (nBytesLeft > 0) {
+ nBytesLeft -= dwBytes;
+ }
+}
+
+bool PipeStruct::CheckInput(void) {
+ DWORD dwEvents, dwBytes;
+ if (bConsole) { // a tty, or an un-redirected handle
+ GetNumberOfConsoleInputEvents(hInput, &dwEvents);
+ if (dwEvents > 1) {
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ } else { // a handle redirected to a pipe or a file
+ if (nBytesLeft > 0) {
+ return TRUE;
+ } else {
+ if (PeekNamedPipe(hInput, NULL, 0, NULL, &dwBytes, NULL)) {
+ nBytesLeft = dwBytes;
+ return nBytesLeft > 0; // a pipe
+ } else {
+ return TRUE; // a file, always TRUE
+ }
+ }
+ }
+}
+
+void PipeStruct::LineOutput(const char *szLineStr) const {
+ DWORD dwBytes;
+ int nStrLen;
+ char szWriteBuffer[LINE_INPUT_MAX_CHAR];
+ nStrLen = strlen(szLineStr);
+ memcpy(szWriteBuffer, szLineStr, nStrLen);
+ szWriteBuffer[nStrLen] = '\r';
+ szWriteBuffer[nStrLen + 1] = '\n';
+ WriteFile(hOutput, szWriteBuffer, nStrLen + 2, &dwBytes, NULL);
+}
+
+
+
+bool PipeStruct::GetBuffer(char *szLineStr) {
+ char *lpFeedEnd;
+ int nFeedEnd;
+ lpFeedEnd = (char *) memchr(szBuffer, '\n', nReadEnd);
+ if (lpFeedEnd == NULL) {
+ return FALSE;
+ } else {
+ nFeedEnd = lpFeedEnd - szBuffer;
+ memcpy(szLineStr, szBuffer, nFeedEnd);
+ if (szLineStr[nFeedEnd - 1] == '\r') {
+ szLineStr[nFeedEnd - 1] = '\0';
+ } else {
+ szLineStr[nFeedEnd] = '\0';
+ }
+ nFeedEnd ++;
+ nReadEnd -= nFeedEnd;
+ memcpy(szBuffer, szBuffer + nFeedEnd, nReadEnd);
+ return TRUE;
+ }
+}
+
+bool PipeStruct::LineInput(char *szLineStr) {
+ if (GetBuffer(szLineStr)) {
+ return TRUE;
+ }
+ if (CheckInput()) {
+ ReadInput();
+ if (GetBuffer(szLineStr)) {
+ return TRUE;
+ } else {
+ if (nReadEnd == LINE_INPUT_MAX_CHAR) {
+ memcpy(szLineStr, szBuffer, LINE_INPUT_MAX_CHAR - 1);
+ szLineStr[LINE_INPUT_MAX_CHAR - 1] = '\0';
+ szBuffer[0] = szBuffer[LINE_INPUT_MAX_CHAR - 1];
+ nReadEnd = 1;
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+ }
+ } else {
+ return FALSE;
+ }
+}
+#endif
--- /dev/null
+#ifndef PIPE_H
+#define PIPE_H
+#ifdef _WIN32
+// includes
+
+#include <windows.h>
+
+
+// constants
+
+const int LINE_INPUT_MAX_CHAR = 4096;
+
+// types
+
+struct PipeStruct {
+ HANDLE hInput, hOutput;
+ HANDLE hProcess;
+ BOOL bConsole;
+ int nBytesLeft;
+ int nReadEnd;
+ char szBuffer[LINE_INPUT_MAX_CHAR];
+
+ void Open(const char *szExecFile = NULL);
+ void Close(void) const;
+ void ReadInput(void);
+ bool CheckInput(void);
+ bool GetBuffer(char *szLineStr);
+ bool LineInput(char *szLineStr);
+ void LineOutput(const char *szLineStr) const;
+}; // pipe
+
+#endif
+#endif
--- /dev/null
+.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
+.\"
+.\" Standard preamble:
+.\" ========================================================================
+.de Sh \" Subsection heading
+.br
+.if t .Sp
+.ne 5
+.PP
+\fB\\$1\fR
+.PP
+..
+.de Sp \" Vertical space (when we can't use .PP)
+.if t .sp .5v
+.if n .sp
+..
+.de Vb \" Begin verbatim text
+.ft CW
+.nf
+.ne \\$1
+..
+.de Ve \" End verbatim text
+.ft R
+.fi
+..
+.\" Set up some character translations and predefined strings. \*(-- will
+.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
+.\" double quote, and \*(R" will give a right double quote. \*(C+ will
+.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
+.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
+.\" nothing in troff, for use with C<>.
+.tr \(*W-
+.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
+.ie n \{\
+. ds -- \(*W-
+. ds PI pi
+. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
+. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
+. ds L" ""
+. ds R" ""
+. ds C` ""
+. ds C' ""
+'br\}
+.el\{\
+. ds -- \|\(em\|
+. ds PI \(*p
+. ds L" ``
+. ds R" ''
+'br\}
+.\"
+.\" If the F register is turned on, we'll generate index entries on stderr for
+.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
+.\" entries marked with X<> in POD. Of course, you'll have to process the
+.\" output yourself in some meaningful fashion.
+.if \nF \{\
+. de IX
+. tm Index:\\$1\t\\n%\t"\\$2"
+..
+. nr % 0
+. rr F
+.\}
+.\"
+.\" For nroff, turn off justification. Always turn off hyphenation; it makes
+.\" way too many mistakes in technical documents.
+.hy 0
+.if n .na
+.\"
+.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
+.\" Fear. Run. Save yourself. No user-serviceable parts.
+. \" fudge factors for nroff and troff
+.if n \{\
+. ds #H 0
+. ds #V .8m
+. ds #F .3m
+. ds #[ \f1
+. ds #] \fP
+.\}
+.if t \{\
+. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
+. ds #V .6m
+. ds #F 0
+. ds #[ \&
+. ds #] \&
+.\}
+. \" simple accents for nroff and troff
+.if n \{\
+. ds ' \&
+. ds ` \&
+. ds ^ \&
+. ds , \&
+. ds ~ ~
+. ds /
+.\}
+.if t \{\
+. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
+. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
+. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
+. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
+. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
+. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
+.\}
+. \" troff and (daisy-wheel) nroff accents
+.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
+.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
+.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
+.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
+.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
+.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
+.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
+.ds ae a\h'-(\w'a'u*4/10)'e
+.ds Ae A\h'-(\w'A'u*4/10)'E
+. \" corrections for vroff
+.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
+.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
+. \" for low resolution devices (crt and lpr)
+.if \n(.H>23 .if \n(.V>19 \
+\{\
+. ds : e
+. ds 8 ss
+. ds o a
+. ds d- d\h'-1'\(ga
+. ds D- D\h'-1'\(hy
+. ds th \o'bp'
+. ds Th \o'LP'
+. ds ae ae
+. ds Ae AE
+.\}
+.rm #[ #] #H #V #F C
+.\" ========================================================================
+.\"
+.IX Title "POLYGLOT 6"
+.TH POLYGLOT 6 "2009-01-10" "" ""
+.SH "NAME"
+PolyGlot \- Winboard protocol to UCI protocol adapter
+ \- book engine for Polyglot books
+ \- a collection of utilities for creating opening books
+ \- a utility for analyzing epd files
+ \- a perft counter
+.SH "SYNOPSIS"
+.IX Header "SYNOPSIS"
+polyglot [configfile]
+.PP
+polyglot make-book [\-pgn inputfile] [\-bin outputfile] [\-max\-ply ply] [\-min\-game games] [\-min\-score score] [\-only\-white] [\-only\-black] [\-uniform]
+.PP
+polyglot merge-book \-in1 inputfile1 \-in2 inputfile2 [\-out outputfile]
+.PP
+polyglot [configfile] epd-test [\-epd inputfile] [\-min\-depth depth] [\-max\-depth depth] [\-max\-time time] [\-depth\-delta delta]
+.PP
+polyglot perft [\-fen fen] [\-max\-depth depth]
+.SH "DESCRIPTION"
+.IX Header "DESCRIPTION"
+.Sh "PolyGlot as adapter and book engine"
+.IX Subsection "PolyGlot as adapter and book engine"
+PolyGlot is a \*(L"\s-1UCI\s0 adapter\*(R". It connects a \s-1GUI\s0 interface (such as
+XBoard, Winboard, Arena or Chessbase) to a \s-1UCI\s0 chess engine.
+.PP
+By specifying an opening book (in PolyGlot book format) chess engines can
+transparently use such books.
+.PP
+PolyGlot understands the two main \s-1GUI\s0 protocols: \s-1UCI\s0 and
+xboard. Normally the protocol will be auto detected but this can be
+overridden in the configuration file.
+.PP
+In xboard mode PolyGlot fully translates between the xboard and \s-1UCI\s0 protocols.
+In addition it tries to solve known problems with other adapters.
+For instance, it detects and reports draws by fifty-move rule,
+repetition, etc ... It also supports Chess960.
+.PP
+When in \s-1UCI\s0 mode PolyGlot mostly passes commands from the \s-1GUI\s0
+to the engine and vice versa, except that it will play book moves on
+behalf of the engine when the occasion arises.
+.Sh "Book making utilities"
+.IX Subsection "Book making utilities"
+PolyGlot supports the \*(L"PolyGlot opening book format\*(R". This is the
+defacto standard non-proprietary opening book format. It is fully documented
+here
+.PP
+http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
+.PP
+Roughly speaking a PolyGlot opening book is a collection of triples
+(position, move, weight). A \*(L"position\*(R" is represented by a 64\-bit
+Zobrist hash key. The weight is proportional to the probability the move should
+be played.
+.PP
+Other opening book formats such as ChessBase's .ctg format and Arena's
+\&.abk format are undocumented and proprietary. They can only be used
+by their own GUIs.
+.PP
+PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
+it can merge two such binary books into a third one.
+.Sh "Epd test mode"
+.IX Subsection "Epd test mode"
+In epd test mode, PolyGlot will search positions in an epd file and
+record the number of times the right best move was found. The
+arguments specify when to stop the search in any given position.
+.Sh "Perft counts"
+.IX Subsection "Perft counts"
+A perft count is the number of legal move sequence in a given position
+up to a given depth. PolyGlot can perform such perft counts. It
+is however much slower than other more dedicated programs.
+.SH "OPTIONS"
+.IX Header "OPTIONS"
+When invoked without options or with a config file as argument PolyGlot
+acts as an adapter. The config file format is documented below. The
+default config file is \*(L"polyglot.ini\*(R".
+.PP
+When invoked as
+.Sh "polyglot make-book"
+.IX Subsection "polyglot make-book"
+PolyGlot supports the following options
+.ie n .IP "\fB\-pgn\fR (default: ""book.pgn"")" 4
+.el .IP "\fB\-pgn\fR (default: ``book.pgn'')" 4
+.IX Item "-pgn (default: book.pgn)"
+Input file in pgn format.
+.ie n .IP "\fB\-bin\fR (default: ""book.bin"")" 4
+.el .IP "\fB\-bin\fR (default: ``book.bin'')" 4
+.IX Item "-bin (default: book.bin)"
+Output file in PolyGlot format.
+.IP "\fB\-max\-ply\fR (default: 1024)" 4
+.IX Item "-max-ply (default: 1024)"
+Specifies the maximum ply-depth of lines included in the book.
+.IP "\fB\-min\-game\fR (default: 3)" 4
+.IX Item "-min-game (default: 3)"
+Specifies the minimum number of games that have to contain this move for it to be included in the book.
+.IP "\fB\-min\-score\fR (default: 0.0)" 4
+.IX Item "-min-score (default: 0.0)"
+Specifies the minimum score (or weight) this move should have received for
+it to be included in the book. The score is 2*(wins)+(draws), globally scaled
+to fit into 16 bits.
+.IP "\fB\-only\-white\fR" 4
+.IX Item "-only-white"
+Include only moves for white in the book.
+.IP "\fB\-only\-black\fR" 4
+.IX Item "-only-black"
+Include only moves for black in the book.
+.IP "\fB\-uniform\fR" 4
+.IX Item "-uniform"
+Set all weights to 1. In other words, all moves will be selected with
+equal probability.
+.PP
+When invoked
+as
+.Sh "polyglot merge-book"
+.IX Subsection "polyglot merge-book"
+PolyGlot supports the following options
+.IP "\fB\-in1\fR" 4
+.IX Item "-in1"
+First input file (in PolyGlot book format).
+.IP "\fB\-in2\fR" 4
+.IX Item "-in2"
+Second input file (in PolyGlot book format).
+.IP "\fB\-out\fR (default: out.bin)" 4
+.IX Item "-out (default: out.bin)"
+Output file (in PolyGlot book format).
+.PP
+Input files are not symmetrical, \*(L"in1\*(R" has priority over \*(L"in2\*(R". In other
+words when a position occurs both in \*(L"in1\*(R" and \*(L"in2\*(R" only the
+moves and weights from \*(L"in1\*(R" will be retained in \*(L"out\*(R".
+.PP
+When invoked as
+.Sh "polyglot epd-test"
+.IX Subsection "polyglot epd-test"
+(possibly with a config file as first argument) PolyGlot supports the following
+options
+.IP "\fB\-max\-depth\fR (default: 63)" 4
+.IX Item "-max-depth (default: 63)"
+Unconditionally stop the search when this depth has
+been reached.
+.IP "\fB\-max\-time\fR (default: 5.0)" 4
+.IX Item "-max-time (default: 5.0)"
+Unconditionally stop the seach after this amount of time.
+.IP "\fB\-depth\-delta\fR (default: 3)" 4
+.IX Item "-depth-delta (default: 3)"
+Stop the search if the best move has been constant for this many depths,
+on condition that the mininal depth and minimal time have been reached.
+.IP "\fB\-min\-depth\fR (default: 8)" 4
+.IX Item "-min-depth (default: 8)"
+Minimal search depth when the search is stopped using \*(L"\-depth\-delta\*(R".
+.IP "\fB\-min\-time\fR (default: 1.0)" 4
+.IX Item "-min-time (default: 1.0)"
+Minimal search time when the search is stopped using \*(L"\-depth\-delta\*(R".
+.PP
+When invoked as
+.Sh "polyglot perft"
+.IX Subsection "polyglot perft"
+PolyGlot supports the following
+options
+.IP "\fB\-fen\fR (default: starting position)" 4
+.IX Item "-fen (default: starting position)"
+Fen at which to start searching.
+.IP "\fB\-max\-depth\fR (default: 1)" 4
+.IX Item "-max-depth (default: 1)"
+Maximum depth to search.
+.SH "CONFIG FILE FORMAT"
+.IX Header "CONFIG FILE FORMAT"
+There should be a different config file for each engine.
+.PP
+The config file is in the traditional \s-1INI\s0 format.
+.PP
+.Vb 6
+\& [PolyGLot]
+\& option = value
+\& ...
+\& [Engine]
+\& option = value
+\& ...
+.Ve
+.PP
+Lines starting with \*(L"#\*(R" are ignored.
+.PP
+\&\s-1NOTE:\s0 There can be spaces in option names or values. Do not use
+quotes. Boolean values are written as \*(L"true\*(R" or \*(L"false\*(R".
+.Sh "[PolyGlot] section"
+.IX Subsection "[PolyGlot] section"
+This section is used by PolyGlot only. The engine is unaware of these
+options. The list of available options is detailed below.
+.IP "\fBEngineName\fR (default: \s-1UCI\s0 name)" 4
+.IX Item "EngineName (default: UCI name)"
+This is the name that will appear in the \s-1GUI\s0. It is
+cosmetic only. You can use different names for tweaked versions of
+the same engine.
+.ie n .IP "\fBEngineDir\fR (default: ""."")" 4
+.el .IP "\fBEngineDir\fR (default: ``.'')" 4
+.IX Item "EngineDir (default: .)"
+Full path of the directory where the engine is installed. You can use
+\&\*(L".\*(R" (without the quotes) if you know that PolyGlot will be launched in
+the engine directory or the engine is in the \*(L"path\*(R" and does not need
+any data file.
+.IP "\fBEngineCommand\fR" 4
+.IX Item "EngineCommand"
+Put here the name of the engine executable file. You can also add
+command-line arguments. Path searching is used and the current
+directory will be \*(L"EngineDir\*(R".
+.IP "\fBLog\fR (default: false)" 4
+.IX Item "Log (default: false)"
+Whether PolyGlot should log all transactions with the interface and
+the engine. This should be necessary only to locate problems.
+.IP "\fBLogFile\fR (default: polyglot.log)" 4
+.IX Item "LogFile (default: polyglot.log)"
+The name of the log file. Note that it is put where PolyGlot was
+launched from, not into the engine directory.
+.Sp
+\&\s-1WARNING:\s0 Log files are not cleared between sessions, and can become
+very large. It is safe to remove them though.
+.IP "\fBResign\fR (default: false)" 4
+.IX Item "Resign (default: false)"
+Set this to \*(L"true\*(R" if you want PolyGlot to resign on behalf of the
+engine.
+.Sp
+\&\s-1NOTE:\s0 Some engines display buggy scores from time to time although the
+best move is correct. Use this option only if you know what you are
+doing (e.g. you always check the final position of games).
+.IP "\fBResignMoves\fR (default: 3)" 4
+.IX Item "ResignMoves (default: 3)"
+Number of consecutive moves with \*(L"resign\*(R" score (see below) before
+PolyGlot resigns for the engine. Positions with only one legal move
+are ignored.
+.IP "\fBResignScore\fR (default: 600)" 4
+.IX Item "ResignScore (default: 600)"
+This is the score in centipawns that will trigger resign \*(L"counting\*(R".
+.IP "\fBShowPonder\fR (default: true)" 4
+.IX Item "ShowPonder (default: true)"
+Show search information during engine pondering. Turning this off
+might be better for interactive use in some interfaces.
+.IP "\fBKibitzMove\fR (default: false)" 4
+.IX Item "KibitzMove (default: false)"
+Whether to kibitz when playing a move.
+.IP "\fBKibitzPV\fR (default: false)" 4
+.IX Item "KibitzPV (default: false)"
+Whether to kibitz when the \s-1PV\s0 is changed (new iteration or new best move).
+.ie n .IP "\fBKibitzCommand\fR (default: ""tellall"")" 4
+.el .IP "\fBKibitzCommand\fR (default: ``tellall'')" 4
+.IX Item "KibitzCommand (default: tellall)"
+xboard command to use for kibitzing, normally \*(L"tellall\*(R" for kibitzing
+or \*(L"tellothers\*(R" for whispering.
+.IP "\fBKibitzDelay\fR (default: 5)" 4
+.IX Item "KibitzDelay (default: 5)"
+How many seconds to wait before starting kibitzing. This has an
+effect only if \*(L"KibitzPV\*(R" is selected, move kibitzes are always sent
+regardless of the delay.
+.IP "\fB\s-1UCI\s0\fR (default: false)" 4
+.IX Item "UCI (default: false)"
+If true PolyGlot will not understand xboard commands.
+.IP "\fBBook\fR (default: false)" 4
+.IX Item "Book (default: false)"
+Indicates whether a PolyGlot book should be used. This has no effect
+on the engine own book (which can be controlled with the \s-1UCI\s0 option
+\&\*(L"OwnBook\*(R" in the [Engine] section). In particular, it is possible to
+use both a PolyGlot book and an engine book. In that case, the engine
+book will be used whenever PolyGlot is out of book. Remember that
+PolyGlot is unaware of whether the engine is itself using a book or
+not.
+.IP "\fBChess960\fR (default: false)" 4
+.IX Item "Chess960 (default: false)"
+Play Chess960 (also called Fischer Random Chess or \s-1FRC\s0),
+.IP "\fBMateScore\fR (default: 10000)" 4
+.IX Item "MateScore (default: 10000)"
+Mate score reported to \s-1GUI\s0 when in xboard mode.
+.IP "\fBBookFile\fR (default: book.bin)" 4
+.IX Item "BookFile (default: book.bin)"
+The name of the (binary) book file. Note that PolyGlot will look for
+it in the directory it was launched from, not in the engine directory.
+Of course, full path can be used in which case the current directory
+does not matter.
+.Sp
+\&\s-1NOTE:\s0 When using PolyGlot with a \s-1UCI\s0 \s-1GUI\s0 this parameter can be set
+via the \s-1UCI\s0 option \*(L"Polyglot BookFile\*(R".
+.IP "\fBBookRandom\fR (default: true)" 4
+.IX Item "BookRandom (default: true)"
+Select moves according to their weights in the book. If false the move
+with the highest weight is selected.
+.IP "\fBBookLearn\fR (default: false)" 4
+.IX Item "BookLearn (default: false)"
+Record learning information in the opening book. Naturally this requires
+the opening book to be writable.
+.IP "\fBUseNice\fR (default: false)" 4
+.IX Item "UseNice (default: false)"
+Run the engine at nice level 5, or \*(L"NiceValue\*(R" if it set. On some
+operating systems it may be necessary to run the engine at lower
+priority for it to be responsive to commands from PolyGlot while
+searching.
+.IP "\fBNiceValue\fR (default: 5)" 4
+.IX Item "NiceValue (default: 5)"
+Nice levels go from \-20 to 20 with 20 being the lowest priority.
+On Unix only root can set negative nice levels. On Windows the standard
+Win32 priority levels are mapped in a sensible way to Unix nice levels.
+.IP "\fBAffinity\fR (default: \-1)" 4
+.IX Item "Affinity (default: -1)"
+This a bit vector in which each bit represents the processors that a
+process is allowed to run on. This option works only on Windows.
+.Sh "Work arounds"
+.IX Subsection "Work arounds"
+Work arounds are identical to options except that they should be used
+only when necessary. Their purpose is to try to hide problems with
+various software (not just engines). The default value is always
+correct for bug-free software.
+.PP
+\&\s-1IMPORTANT:\s0 Any of these work arounds might be removed in future
+versions of PolyGlot. You are strongly recommended to contact the
+author of faulty software and truly fix the problem.
+.PP
+PolyGlot supports the following work arounds:
+.IP "\fBUCIVersion\fR (default: 2)" 4
+.IX Item "UCIVersion (default: 2)"
+The default value of 2 corresponds to \s-1UCI+\s0. Use 1 to select plain
+\&\s-1UCI\s0 for engines that have problems with \s-1UCI+\s0.
+.IP "\fBCanPonder\fR (default: false)" 4
+.IX Item "CanPonder (default: false)"
+PolyGlot now conforms to the documented \s-1UCI\s0 behaviour: the engine will
+be allowed to ponder only if it (the engine) declares the \*(L"Ponder\*(R" \s-1UCI\s0
+option. However some engines which can actually ponder do not declare
+the option. This work around lets PolyGlot know that they can ponder.
+.IP "\fBSyncStop\fR (default: false)" 4
+.IX Item "SyncStop (default: false)"
+When a ponder miss occurs, Polyglot interrupts the engine and
+\&\s-1IMMEDIATELY\s0 launches a new search. While there should be no problem
+with this, some engines seem confused and corrupt their search board.
+\&\*(L"SyncStop\*(R" forces PolyGlot to wait for the (now useless) ponder search
+to finish before launching the new search.
+.IP "\fBPromoteWorkAround\fR (default: false)" 4
+.IX Item "PromoteWorkAround (default: false)"
+Some engines do not specify a promotion piece, e.g. they send \*(L"e7e8\*(R"
+instead of the correct \*(L"e7e8q\*(R". This work around enables the
+incorrect form (and of course promotes into a queen).
+.IP "\fBRepeatPV\fR (default: true)" 4
+.IX Item "RepeatPV (default: true)"
+When true, PolyGlot repeats the last pv string (which also contains
+score,depth and time usage) it got from the engine. Some engines
+however do not send a new pv string just before sending the move and
+the now old pv string might confuse debugtools that parse the winboard
+debug files.
+.Sh "[Engine] section"
+.IX Subsection "[Engine] section"
+This section contains engine \s-1UCI\s0 options. PolyGlot does not
+understand them, but sends the information to the engine at startup
+(converted to \s-1UCI\s0 form). You can add any \s-1UCI\s0 option that makes sense
+to the engine (not just the common options about hash-table size and
+tablebases).
+.PP
+\&\s-1NOTE:\s0 use \s-1INI\s0 syntax, not \s-1UCI\s0. For example \*(L"OwnBook = true\*(R" is
+correct. It will be replaced by PolyGlot with \*(L"setoption name OwnBook
+value true\*(R" at engine startup.
+.PP
+Standard \s-1UCI\s0 options are
+.PP
+.Vb 4
+\& Hash
+\& NalimovPath
+\& NalimovCache
+\& OwnBook
+.Ve
+.PP
+Hidden options like \*(L"Ponder\*(R" or \*(L"UCI_xxx\*(R" are automatic
+and should not be put in an \s-1INI\s0 file.
+.PP
+The other options are engine\-specific. Check their name using a \s-1UCI\s0
+\&\s-1GUI\s0 or launch the engine in a console and type \*(L"uci\*(R".
+.SH "EXAMPLES"
+.IX Header "EXAMPLES"
+Compile \*(L"games.pgn\*(R" into a book \*(L"book.bin\*(R" retaining all lines of at
+most 30 plies.
+.PP
+.Vb 1
+\& polyglot make\-book \-pgn games.pgn \-bin book.bin \-max\-ply 30
+.Ve
+.PP
+Merge books \*(L"in1.bin\*(R" and \*(L"in2.bin\*(R" into a book \*(L"out.bin\*(R".
+.PP
+.Vb 1
+\& polyglot merge\-book \-in1 w1.bin \-in2 w2.bin \-out w.bin
+.Ve
+.PP
+Here is a minimal config file
+.PP
+.Vb 3
+\& [PolyGlot]
+\& EngineCommand = fruit
+\& [Engine]
+.Ve
+.SH "EXIT STATUS"
+.IX Header "EXIT STATUS"
+PolyGlot always returns 0 on exit.
+.SH "AUTHORS"
+.IX Header "AUTHORS"
+Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
+.PP
+Native Windows port: Huang Chen<webmaster@elephantbase.net> (\*(L"Morning Yellow\*(R")
+.PP
+Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
+.PP
+\&\s-1UCI\s0 port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
+.SH "SEE ALSO"
+.IX Header "SEE ALSO"
+\&\fIxboard\fR\|(6)
--- /dev/null
+=head1 NAME
+
+PolyGlot - Winboard protocol to UCI protocol adapter
+ - book engine for Polyglot books
+ - a collection of utilities for creating opening books
+ - a utility for analyzing epd files
+ - a perft counter
+
+=head1 SYNOPSIS
+
+polyglot [configfile]
+
+polyglot make-book [-pgn inputfile] [-bin outputfile] [-max-ply ply] [-min-game games] [-min-score score] [-only-white] [-only-black] [-uniform]
+
+polyglot merge-book -in1 inputfile1 -in2 inputfile2 [-out outputfile]
+
+polyglot [configfile] epd-test [-epd inputfile] [-min-depth depth] [-max-depth depth] [-max-time time] [-depth-delta delta]
+
+polyglot perft [-fen fen] [-max-depth depth]
+
+=head1 DESCRIPTION
+
+=head2 PolyGlot as adapter and book engine
+
+PolyGlot is a "UCI adapter". It connects a GUI interface (such as
+XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
+
+By specifying an opening book (in PolyGlot book format) chess engines can
+transparently use such books.
+
+PolyGlot understands the two main GUI protocols: UCI and
+xboard. Normally the protocol will be auto detected but this can be
+overridden in the configuration file.
+
+In xboard mode PolyGlot fully translates between the xboard and UCI protocols.
+In addition it tries to solve known problems with other adapters.
+For instance, it detects and reports draws by fifty-move rule,
+repetition, etc ... It also supports Chess960.
+
+When in UCI mode PolyGlot mostly passes commands from the GUI
+to the engine and vice versa, except that it will play book moves on
+behalf of the engine when the occasion arises.
+
+=head2 Book making utilities
+
+PolyGlot supports the "PolyGlot opening book format". This is the
+defacto standard non-proprietary opening book format. It is fully documented
+here
+
+http://alpha.uhasselt.be/Research/Algebra/Toga/book_format.html
+
+Roughly speaking a PolyGlot opening book is a collection of triples
+(position, move, weight). A "position" is represented by a 64-bit
+Zobrist hash key. The weight is proportional to the probability the move should
+be played.
+
+Other opening book formats such as ChessBase's .ctg format and Arena's
+.abk format are undocumented and proprietary. They can only be used
+by their own GUIs.
+
+PolyGlot can compile a pgn file into a binary PolyGlot book and furthermore
+it can merge two such binary books into a third one.
+
+=head2 Epd test mode
+
+In epd test mode, PolyGlot will search positions in an epd file and
+record the number of times the right best move was found. The
+arguments specify when to stop the search in any given position.
+
+=head2 Perft counts
+
+A perft count is the number of legal move sequence in a given position
+up to a given depth. PolyGlot can perform such perft counts. It
+is however much slower than other more dedicated programs.
+
+=head1 OPTIONS
+
+When invoked without options or with a config file as argument PolyGlot
+acts as an adapter. The config file format is documented below. The
+default config file is "polyglot.ini".
+
+When invoked as
+
+=head2 polyglot make-book
+
+PolyGlot supports the following options
+
+=over 4
+
+=item B<-pgn> (default: "book.pgn")
+
+Input file in pgn format.
+
+=item B<-bin> (default: "book.bin")
+
+Output file in PolyGlot format.
+
+=item B<-max-ply> (default: 1024)
+
+Specifies the maximum ply-depth of lines included in the book.
+
+=item B<-min-game> (default: 3)
+
+Specifies the minimum number of games that have to contain this move for it to be included in the book.
+
+=item B<-min-score> (default: 0.0)
+
+Specifies the minimum score (or weight) this move should have received for
+it to be included in the book. The score is 2*(wins)+(draws), globally scaled
+to fit into 16 bits.
+
+=item B<-only-white>
+
+Include only moves for white in the book.
+
+=item B<-only-black>
+
+Include only moves for black in the book.
+
+=item B<-uniform>
+
+Set all weights to 1. In other words, all moves will be selected with
+equal probability.
+
+=back
+
+When invoked
+as
+
+=head2 polyglot merge-book
+
+PolyGlot supports the following options
+
+=over 4
+
+=item B<-in1>
+
+First input file (in PolyGlot book format).
+
+=item B<-in2>
+
+Second input file (in PolyGlot book format).
+
+=item B<-out> (default: out.bin)
+
+Output file (in PolyGlot book format).
+
+=back
+
+Input files are not symmetrical, "in1" has priority over "in2". In other
+words when a position occurs both in "in1" and "in2" only the
+moves and weights from "in1" will be retained in "out".
+
+When invoked as
+
+=head2 polyglot epd-test
+
+(possibly with a config file as first argument) PolyGlot supports the following
+options
+
+=over 4
+
+=item B<-max-depth> (default: 63)
+
+Unconditionally stop the search when this depth has
+been reached.
+
+=item B<-max-time> (default: 5.0)
+
+Unconditionally stop the seach after this amount of time.
+
+=item B<-depth-delta> (default: 3)
+
+Stop the search if the best move has been constant for this many depths,
+on condition that the mininal depth and minimal time have been reached.
+
+=item B<-min-depth> (default: 8)
+
+Minimal search depth when the search is stopped using "-depth-delta".
+
+=item B<-min-time> (default: 1.0)
+
+Minimal search time when the search is stopped using "-depth-delta".
+
+
+=back
+
+When invoked as
+
+=head2 polyglot perft
+
+PolyGlot supports the following
+options
+
+=over 4
+
+=item B<-fen> (default: starting position)
+
+Fen at which to start searching.
+
+=item B<-max-depth> (default: 1)
+
+Maximum depth to search.
+
+=back
+
+=head1 CONFIG FILE FORMAT
+
+There should be a different config file for each engine.
+
+The config file is in the traditional INI format.
+
+ [PolyGLot]
+ option = value
+ ...
+ [Engine]
+ option = value
+ ...
+
+Lines starting with "#" are ignored.
+
+NOTE: There can be spaces in option names or values. Do not use
+quotes. Boolean values are written as "true" or "false".
+
+=head2 [PolyGlot] section
+
+This section is used by PolyGlot only. The engine is unaware of these
+options. The list of available options is detailed below.
+
+=over 4
+
+=item B<EngineName> (default: UCI name)
+
+This is the name that will appear in the GUI. It is
+cosmetic only. You can use different names for tweaked versions of
+the same engine.
+
+=item B<EngineDir> (default: ".")
+
+Full path of the directory where the engine is installed. You can use
+"." (without the quotes) if you know that PolyGlot will be launched in
+the engine directory or the engine is in the "path" and does not need
+any data file.
+
+=item B<EngineCommand>
+
+Put here the name of the engine executable file. You can also add
+command-line arguments. Path searching is used and the current
+directory will be "EngineDir".
+
+=item B<Log> (default: false)
+
+Whether PolyGlot should log all transactions with the interface and
+the engine. This should be necessary only to locate problems.
+
+=item B<LogFile> (default: polyglot.log)
+
+The name of the log file. Note that it is put where PolyGlot was
+launched from, not into the engine directory.
+
+WARNING: Log files are not cleared between sessions, and can become
+very large. It is safe to remove them though.
+
+=item B<Resign> (default: false)
+
+Set this to "true" if you want PolyGlot to resign on behalf of the
+engine.
+
+NOTE: Some engines display buggy scores from time to time although the
+best move is correct. Use this option only if you know what you are
+doing (e.g. you always check the final position of games).
+
+=item B<ResignMoves> (default: 3)
+
+Number of consecutive moves with "resign" score (see below) before
+PolyGlot resigns for the engine. Positions with only one legal move
+are ignored.
+
+=item B<ResignScore> (default: 600)
+
+This is the score in centipawns that will trigger resign "counting".
+
+=item B<ShowPonder> (default: true)
+
+Show search information during engine pondering. Turning this off
+might be better for interactive use in some interfaces.
+
+=item B<KibitzMove> (default: false)
+
+Whether to kibitz when playing a move.
+
+=item B<KibitzPV> (default: false)
+
+Whether to kibitz when the PV is changed (new iteration or new best move).
+
+=item B<KibitzCommand> (default: "tellall")
+
+xboard command to use for kibitzing, normally "tellall" for kibitzing
+or "tellothers" for whispering.
+
+
+=item B<KibitzDelay> (default: 5)
+
+How many seconds to wait before starting kibitzing. This has an
+effect only if "KibitzPV" is selected, move kibitzes are always sent
+regardless of the delay.
+
+=item B<UCI> (default: false)
+
+If true PolyGlot will not understand xboard commands.
+
+=item B<Book> (default: false)
+
+Indicates whether a PolyGlot book should be used. This has no effect
+on the engine own book (which can be controlled with the UCI option
+"OwnBook" in the [Engine] section). In particular, it is possible to
+use both a PolyGlot book and an engine book. In that case, the engine
+book will be used whenever PolyGlot is out of book. Remember that
+PolyGlot is unaware of whether the engine is itself using a book or
+not.
+
+=item B<Chess960> (default: false)
+
+Play Chess960 (also called Fischer Random Chess or FRC),
+
+=item B<MateScore> (default: 10000)
+
+Mate score reported to GUI when in xboard mode.
+
+=item B<BookFile> (default: book.bin)
+
+The name of the (binary) book file. Note that PolyGlot will look for
+it in the directory it was launched from, not in the engine directory.
+Of course, full path can be used in which case the current directory
+does not matter.
+
+NOTE: When using PolyGlot with a UCI GUI this parameter can be set
+via the UCI option "Polyglot BookFile".
+
+=item B<BookRandom> (default: true)
+
+Select moves according to their weights in the book. If false the move
+with the highest weight is selected.
+
+=item B<BookLearn> (default: false)
+
+Record learning information in the opening book. Naturally this requires
+the opening book to be writable.
+
+=item B<UseNice> (default: false)
+
+Run the engine at nice level 5, or "NiceValue" if it set. On some
+operating systems it may be necessary to run the engine at lower
+priority for it to be responsive to commands from PolyGlot while
+searching.
+
+=item B<NiceValue> (default: 5)
+
+Nice levels go from -20 to 20 with 20 being the lowest priority.
+On Unix only root can set negative nice levels. On Windows the standard
+Win32 priority levels are mapped in a sensible way to Unix nice levels.
+
+
+=item B<Affinity> (default: -1)
+
+This a bit vector in which each bit represents the processors that a
+process is allowed to run on. This option works only on Windows.
+
+
+=back
+
+=head2 Work arounds
+
+Work arounds are identical to options except that they should be used
+only when necessary. Their purpose is to try to hide problems with
+various software (not just engines). The default value is always
+correct for bug-free software.
+
+IMPORTANT: Any of these work arounds might be removed in future
+versions of PolyGlot. You are strongly recommended to contact the
+author of faulty software and truly fix the problem.
+
+PolyGlot supports the following work arounds:
+
+=over 4
+
+=item B<UCIVersion> (default: 2)
+
+The default value of 2 corresponds to UCI+. Use 1 to select plain
+UCI for engines that have problems with UCI+.
+
+=item B<CanPonder> (default: false)
+
+PolyGlot now conforms to the documented UCI behaviour: the engine will
+be allowed to ponder only if it (the engine) declares the "Ponder" UCI
+option. However some engines which can actually ponder do not declare
+the option. This work around lets PolyGlot know that they can ponder.
+
+=item B<SyncStop> (default: false)
+
+When a ponder miss occurs, Polyglot interrupts the engine and
+IMMEDIATELY launches a new search. While there should be no problem
+with this, some engines seem confused and corrupt their search board.
+"SyncStop" forces PolyGlot to wait for the (now useless) ponder search
+to finish before launching the new search.
+
+=item B<PromoteWorkAround> (default: false)
+
+Some engines do not specify a promotion piece, e.g. they send "e7e8"
+instead of the correct "e7e8q". This work around enables the
+incorrect form (and of course promotes into a queen).
+
+=item B<RepeatPV> (default: true)
+
+When true, PolyGlot repeats the last pv string (which also contains
+score,depth and time usage) it got from the engine. Some engines
+however do not send a new pv string just before sending the move and
+the now old pv string might confuse debugtools that parse the winboard
+debug files.
+
+
+=back
+
+
+=head2 [Engine] section
+
+This section contains engine UCI options. PolyGlot does not
+understand them, but sends the information to the engine at startup
+(converted to UCI form). You can add any UCI option that makes sense
+to the engine (not just the common options about hash-table size and
+tablebases).
+
+NOTE: use INI syntax, not UCI. For example "OwnBook = true" is
+correct. It will be replaced by PolyGlot with "setoption name OwnBook
+value true" at engine startup.
+
+Standard UCI options are
+
+ Hash
+ NalimovPath
+ NalimovCache
+ OwnBook
+
+Hidden options like "Ponder" or "UCI_xxx" are automatic
+and should not be put in an INI file.
+
+The other options are engine-specific. Check their name using a UCI
+GUI or launch the engine in a console and type "uci".
+
+=head1 EXAMPLES
+
+Compile "games.pgn" into a book "book.bin" retaining all lines of at
+most 30 plies.
+
+ polyglot make-book -pgn games.pgn -bin book.bin -max-ply 30
+
+Merge books "in1.bin" and "in2.bin" into a book "out.bin".
+
+ polyglot merge-book -in1 w1.bin -in2 w2.bin -out w.bin
+
+
+Here is a minimal config file
+
+ [PolyGlot]
+ EngineCommand = fruit
+ [Engine]
+
+
+=head1 EXIT STATUS
+
+PolyGlot always returns 0 on exit.
+
+=head1 AUTHORS
+
+Main author: Fabien Letouzey<fabien_letouzey(at)hotmail.com>
+
+Native Windows port: Huang Chen<webmaster@elephantbase.net> ("Morning Yellow")
+
+Various enhancements: Fonzy Bleumers<match(at)geenvis.net>
+
+UCI port: Michel Van den Bergh <michel.vandenbergh(at)uhasselt.be>
+
+=head1 SEE ALSO
+
+xboard(6)
--- /dev/null
+Summary: A Winboard protocol to UCI protocol adapter
+Name: polyglot
+Version: 1.4w10UCIb15
+Release: 1
+License: GPL
+Group: Amusement/Games
+URL: http://alpha.uhasselt.be/Research/Algebra/Toga
+
+Source: http://alpha.uhasselt.be/Research/Algebra/Toga/polyglot-%{version}.tar.gz
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
+
+%description
+PolyGlot is a "UCI adapter". It connects a GUI interface (such as
+ XBoard, Winboard, Arena or Chessbase) to a UCI chess engine.
+
+%prep
+%setup
+
+%build
+%configure
+%{__make}
+
+%install
+%{__rm} -rf %{buildroot}
+%makeinstall
+
+%clean
+%{__rm} -rf %{buildroot}
+
+%files
+%defattr(-, root, root, 0755)
+%doc %{_mandir}/man6/polyglot.6*
+%doc %{_docdir}/polyglot/README*
+%doc %{_docdir}/polyglot/book_format.html
+%{_bindir}/polyglot
+
+%changelog
+* Sat Jan 3 2009 Michel Van den Bergh <michel.vandenbergh@uhasselt.be> - 1.4w10UCIb10-1
+- Initial spec file
+
--- /dev/null
+\r
+// posix.cpp\r
+\r
+// includes\r
+\r
+#include <cerrno>\r
+#include <cstdlib>\r
+#include <cstring>\r
+#include <ctime>\r
+\r
+#ifdef _WIN32\r
+\r
+#include <windows.h>\r
+\r
+#else\r
+\r
+#include <sys/time.h> // Mac OS X needs this one first\r
+#include <sys/resource.h>\r
+#include <sys/types.h>\r
+#include <unistd.h>\r
+\r
+#endif\r
+\r
+#include "posix.h"\r
+#include "util.h"\r
+\r
+#ifndef _WIN32\r
+// prototypes\r
+\r
+static double duration (const struct timeval *t);\r
+\r
+// functions\r
+\r
+\r
+// input_available()\r
+\r
+bool input_available() {\r
+\r
+ int val;\r
+ fd_set set[1];\r
+ struct timeval time_val[1];\r
+\r
+ FD_ZERO(set);\r
+ FD_SET(STDIN_FILENO,set);\r
+\r
+ time_val->tv_sec = 0;\r
+ time_val->tv_usec = 0;\r
+\r
+ val = select(STDIN_FILENO+1,set,NULL,NULL,time_val);\r
+ if (val == -1) my_fatal("input_available(): select(): %s\n",strerror(errno));\r
+\r
+ return val != 0;\r
+}\r
+\r
+\r
+// now_real()\r
+\r
+double now_real() {\r
+\r
+ struct timeval tv[1];\r
+ struct timezone tz[1];\r
+\r
+ tz->tz_minuteswest = 0;\r
+ tz->tz_dsttime = 0; // DST_NONE not declared in linux\r
+\r
+ if (gettimeofday(tv,tz) == -1) {\r
+ my_fatal("now_real(): gettimeofday(): %s\n",strerror(errno));\r
+ }\r
+\r
+ return duration(tv);\r
+}\r
+\r
+// now_cpu()\r
+\r
+double now_cpu() {\r
+\r
+ struct rusage ru[1];\r
+\r
+ if (getrusage(RUSAGE_SELF,ru) == -1) {\r
+ my_fatal("now_cpu(): getrusage(): %s\n",strerror(errno));\r
+ }\r
+\r
+ return duration(&ru->ru_utime);\r
+}\r
+\r
+// duration()\r
+\r
+static double duration(const struct timeval *tv) {\r
+\r
+ return tv->tv_sec + tv->tv_usec * 1E-6;\r
+}\r
+\r
+#else\r
+\r
+double now_real(void) {\r
+ return (double) GetTickCount() / 1000.0;\r
+}\r
+\r
+#endif\r
+\r
+// end of posix.cpp\r
--- /dev/null
+\r
+// posix.h\r
+\r
+#ifndef POSIX_H\r
+#define POSIX_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern bool input_available ();\r
+\r
+extern double now_real ();\r
+\r
+#endif // !defined POSIX_H\r
+\r
+// end of posix.h\r
+\r
--- /dev/null
+\r
+// random.cpp\r
+\r
+// includes\r
+\r
+#include "random.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+const uint64 Random64[RandomNb] = {\r
+ U64(0x9D39247E33776D41), U64(0x2AF7398005AAA5C7), U64(0x44DB015024623547), U64(0x9C15F73E62A76AE2),\r
+ U64(0x75834465489C0C89), U64(0x3290AC3A203001BF), U64(0x0FBBAD1F61042279), U64(0xE83A908FF2FB60CA),\r
+ U64(0x0D7E765D58755C10), U64(0x1A083822CEAFE02D), U64(0x9605D5F0E25EC3B0), U64(0xD021FF5CD13A2ED5),\r
+ U64(0x40BDF15D4A672E32), U64(0x011355146FD56395), U64(0x5DB4832046F3D9E5), U64(0x239F8B2D7FF719CC),\r
+ U64(0x05D1A1AE85B49AA1), U64(0x679F848F6E8FC971), U64(0x7449BBFF801FED0B), U64(0x7D11CDB1C3B7ADF0),\r
+ U64(0x82C7709E781EB7CC), U64(0xF3218F1C9510786C), U64(0x331478F3AF51BBE6), U64(0x4BB38DE5E7219443),\r
+ U64(0xAA649C6EBCFD50FC), U64(0x8DBD98A352AFD40B), U64(0x87D2074B81D79217), U64(0x19F3C751D3E92AE1),\r
+ U64(0xB4AB30F062B19ABF), U64(0x7B0500AC42047AC4), U64(0xC9452CA81A09D85D), U64(0x24AA6C514DA27500),\r
+ U64(0x4C9F34427501B447), U64(0x14A68FD73C910841), U64(0xA71B9B83461CBD93), U64(0x03488B95B0F1850F),\r
+ U64(0x637B2B34FF93C040), U64(0x09D1BC9A3DD90A94), U64(0x3575668334A1DD3B), U64(0x735E2B97A4C45A23),\r
+ U64(0x18727070F1BD400B), U64(0x1FCBACD259BF02E7), U64(0xD310A7C2CE9B6555), U64(0xBF983FE0FE5D8244),\r
+ U64(0x9F74D14F7454A824), U64(0x51EBDC4AB9BA3035), U64(0x5C82C505DB9AB0FA), U64(0xFCF7FE8A3430B241),\r
+ U64(0x3253A729B9BA3DDE), U64(0x8C74C368081B3075), U64(0xB9BC6C87167C33E7), U64(0x7EF48F2B83024E20),\r
+ U64(0x11D505D4C351BD7F), U64(0x6568FCA92C76A243), U64(0x4DE0B0F40F32A7B8), U64(0x96D693460CC37E5D),\r
+ U64(0x42E240CB63689F2F), U64(0x6D2BDCDAE2919661), U64(0x42880B0236E4D951), U64(0x5F0F4A5898171BB6),\r
+ U64(0x39F890F579F92F88), U64(0x93C5B5F47356388B), U64(0x63DC359D8D231B78), U64(0xEC16CA8AEA98AD76),\r
+ U64(0x5355F900C2A82DC7), U64(0x07FB9F855A997142), U64(0x5093417AA8A7ED5E), U64(0x7BCBC38DA25A7F3C),\r
+ U64(0x19FC8A768CF4B6D4), U64(0x637A7780DECFC0D9), U64(0x8249A47AEE0E41F7), U64(0x79AD695501E7D1E8),\r
+ U64(0x14ACBAF4777D5776), U64(0xF145B6BECCDEA195), U64(0xDABF2AC8201752FC), U64(0x24C3C94DF9C8D3F6),\r
+ U64(0xBB6E2924F03912EA), U64(0x0CE26C0B95C980D9), U64(0xA49CD132BFBF7CC4), U64(0xE99D662AF4243939),\r
+ U64(0x27E6AD7891165C3F), U64(0x8535F040B9744FF1), U64(0x54B3F4FA5F40D873), U64(0x72B12C32127FED2B),\r
+ U64(0xEE954D3C7B411F47), U64(0x9A85AC909A24EAA1), U64(0x70AC4CD9F04F21F5), U64(0xF9B89D3E99A075C2),\r
+ U64(0x87B3E2B2B5C907B1), U64(0xA366E5B8C54F48B8), U64(0xAE4A9346CC3F7CF2), U64(0x1920C04D47267BBD),\r
+ U64(0x87BF02C6B49E2AE9), U64(0x092237AC237F3859), U64(0xFF07F64EF8ED14D0), U64(0x8DE8DCA9F03CC54E),\r
+ U64(0x9C1633264DB49C89), U64(0xB3F22C3D0B0B38ED), U64(0x390E5FB44D01144B), U64(0x5BFEA5B4712768E9),\r
+ U64(0x1E1032911FA78984), U64(0x9A74ACB964E78CB3), U64(0x4F80F7A035DAFB04), U64(0x6304D09A0B3738C4),\r
+ U64(0x2171E64683023A08), U64(0x5B9B63EB9CEFF80C), U64(0x506AACF489889342), U64(0x1881AFC9A3A701D6),\r
+ U64(0x6503080440750644), U64(0xDFD395339CDBF4A7), U64(0xEF927DBCF00C20F2), U64(0x7B32F7D1E03680EC),\r
+ U64(0xB9FD7620E7316243), U64(0x05A7E8A57DB91B77), U64(0xB5889C6E15630A75), U64(0x4A750A09CE9573F7),\r
+ U64(0xCF464CEC899A2F8A), U64(0xF538639CE705B824), U64(0x3C79A0FF5580EF7F), U64(0xEDE6C87F8477609D),\r
+ U64(0x799E81F05BC93F31), U64(0x86536B8CF3428A8C), U64(0x97D7374C60087B73), U64(0xA246637CFF328532),\r
+ U64(0x043FCAE60CC0EBA0), U64(0x920E449535DD359E), U64(0x70EB093B15B290CC), U64(0x73A1921916591CBD),\r
+ U64(0x56436C9FE1A1AA8D), U64(0xEFAC4B70633B8F81), U64(0xBB215798D45DF7AF), U64(0x45F20042F24F1768),\r
+ U64(0x930F80F4E8EB7462), U64(0xFF6712FFCFD75EA1), U64(0xAE623FD67468AA70), U64(0xDD2C5BC84BC8D8FC),\r
+ U64(0x7EED120D54CF2DD9), U64(0x22FE545401165F1C), U64(0xC91800E98FB99929), U64(0x808BD68E6AC10365),\r
+ U64(0xDEC468145B7605F6), U64(0x1BEDE3A3AEF53302), U64(0x43539603D6C55602), U64(0xAA969B5C691CCB7A),\r
+ U64(0xA87832D392EFEE56), U64(0x65942C7B3C7E11AE), U64(0xDED2D633CAD004F6), U64(0x21F08570F420E565),\r
+ U64(0xB415938D7DA94E3C), U64(0x91B859E59ECB6350), U64(0x10CFF333E0ED804A), U64(0x28AED140BE0BB7DD),\r
+ U64(0xC5CC1D89724FA456), U64(0x5648F680F11A2741), U64(0x2D255069F0B7DAB3), U64(0x9BC5A38EF729ABD4),\r
+ U64(0xEF2F054308F6A2BC), U64(0xAF2042F5CC5C2858), U64(0x480412BAB7F5BE2A), U64(0xAEF3AF4A563DFE43),\r
+ U64(0x19AFE59AE451497F), U64(0x52593803DFF1E840), U64(0xF4F076E65F2CE6F0), U64(0x11379625747D5AF3),\r
+ U64(0xBCE5D2248682C115), U64(0x9DA4243DE836994F), U64(0x066F70B33FE09017), U64(0x4DC4DE189B671A1C),\r
+ U64(0x51039AB7712457C3), U64(0xC07A3F80C31FB4B4), U64(0xB46EE9C5E64A6E7C), U64(0xB3819A42ABE61C87),\r
+ U64(0x21A007933A522A20), U64(0x2DF16F761598AA4F), U64(0x763C4A1371B368FD), U64(0xF793C46702E086A0),\r
+ U64(0xD7288E012AEB8D31), U64(0xDE336A2A4BC1C44B), U64(0x0BF692B38D079F23), U64(0x2C604A7A177326B3),\r
+ U64(0x4850E73E03EB6064), U64(0xCFC447F1E53C8E1B), U64(0xB05CA3F564268D99), U64(0x9AE182C8BC9474E8),\r
+ U64(0xA4FC4BD4FC5558CA), U64(0xE755178D58FC4E76), U64(0x69B97DB1A4C03DFE), U64(0xF9B5B7C4ACC67C96),\r
+ U64(0xFC6A82D64B8655FB), U64(0x9C684CB6C4D24417), U64(0x8EC97D2917456ED0), U64(0x6703DF9D2924E97E),\r
+ U64(0xC547F57E42A7444E), U64(0x78E37644E7CAD29E), U64(0xFE9A44E9362F05FA), U64(0x08BD35CC38336615),\r
+ U64(0x9315E5EB3A129ACE), U64(0x94061B871E04DF75), U64(0xDF1D9F9D784BA010), U64(0x3BBA57B68871B59D),\r
+ U64(0xD2B7ADEEDED1F73F), U64(0xF7A255D83BC373F8), U64(0xD7F4F2448C0CEB81), U64(0xD95BE88CD210FFA7),\r
+ U64(0x336F52F8FF4728E7), U64(0xA74049DAC312AC71), U64(0xA2F61BB6E437FDB5), U64(0x4F2A5CB07F6A35B3),\r
+ U64(0x87D380BDA5BF7859), U64(0x16B9F7E06C453A21), U64(0x7BA2484C8A0FD54E), U64(0xF3A678CAD9A2E38C),\r
+ U64(0x39B0BF7DDE437BA2), U64(0xFCAF55C1BF8A4424), U64(0x18FCF680573FA594), U64(0x4C0563B89F495AC3),\r
+ U64(0x40E087931A00930D), U64(0x8CFFA9412EB642C1), U64(0x68CA39053261169F), U64(0x7A1EE967D27579E2),\r
+ U64(0x9D1D60E5076F5B6F), U64(0x3810E399B6F65BA2), U64(0x32095B6D4AB5F9B1), U64(0x35CAB62109DD038A),\r
+ U64(0xA90B24499FCFAFB1), U64(0x77A225A07CC2C6BD), U64(0x513E5E634C70E331), U64(0x4361C0CA3F692F12),\r
+ U64(0xD941ACA44B20A45B), U64(0x528F7C8602C5807B), U64(0x52AB92BEB9613989), U64(0x9D1DFA2EFC557F73),\r
+ U64(0x722FF175F572C348), U64(0x1D1260A51107FE97), U64(0x7A249A57EC0C9BA2), U64(0x04208FE9E8F7F2D6),\r
+ U64(0x5A110C6058B920A0), U64(0x0CD9A497658A5698), U64(0x56FD23C8F9715A4C), U64(0x284C847B9D887AAE),\r
+ U64(0x04FEABFBBDB619CB), U64(0x742E1E651C60BA83), U64(0x9A9632E65904AD3C), U64(0x881B82A13B51B9E2),\r
+ U64(0x506E6744CD974924), U64(0xB0183DB56FFC6A79), U64(0x0ED9B915C66ED37E), U64(0x5E11E86D5873D484),\r
+ U64(0xF678647E3519AC6E), U64(0x1B85D488D0F20CC5), U64(0xDAB9FE6525D89021), U64(0x0D151D86ADB73615),\r
+ U64(0xA865A54EDCC0F019), U64(0x93C42566AEF98FFB), U64(0x99E7AFEABE000731), U64(0x48CBFF086DDF285A),\r
+ U64(0x7F9B6AF1EBF78BAF), U64(0x58627E1A149BBA21), U64(0x2CD16E2ABD791E33), U64(0xD363EFF5F0977996),\r
+ U64(0x0CE2A38C344A6EED), U64(0x1A804AADB9CFA741), U64(0x907F30421D78C5DE), U64(0x501F65EDB3034D07),\r
+ U64(0x37624AE5A48FA6E9), U64(0x957BAF61700CFF4E), U64(0x3A6C27934E31188A), U64(0xD49503536ABCA345),\r
+ U64(0x088E049589C432E0), U64(0xF943AEE7FEBF21B8), U64(0x6C3B8E3E336139D3), U64(0x364F6FFA464EE52E),\r
+ U64(0xD60F6DCEDC314222), U64(0x56963B0DCA418FC0), U64(0x16F50EDF91E513AF), U64(0xEF1955914B609F93),\r
+ U64(0x565601C0364E3228), U64(0xECB53939887E8175), U64(0xBAC7A9A18531294B), U64(0xB344C470397BBA52),\r
+ U64(0x65D34954DAF3CEBD), U64(0xB4B81B3FA97511E2), U64(0xB422061193D6F6A7), U64(0x071582401C38434D),\r
+ U64(0x7A13F18BBEDC4FF5), U64(0xBC4097B116C524D2), U64(0x59B97885E2F2EA28), U64(0x99170A5DC3115544),\r
+ U64(0x6F423357E7C6A9F9), U64(0x325928EE6E6F8794), U64(0xD0E4366228B03343), U64(0x565C31F7DE89EA27),\r
+ U64(0x30F5611484119414), U64(0xD873DB391292ED4F), U64(0x7BD94E1D8E17DEBC), U64(0xC7D9F16864A76E94),\r
+ U64(0x947AE053EE56E63C), U64(0xC8C93882F9475F5F), U64(0x3A9BF55BA91F81CA), U64(0xD9A11FBB3D9808E4),\r
+ U64(0x0FD22063EDC29FCA), U64(0xB3F256D8ACA0B0B9), U64(0xB03031A8B4516E84), U64(0x35DD37D5871448AF),\r
+ U64(0xE9F6082B05542E4E), U64(0xEBFAFA33D7254B59), U64(0x9255ABB50D532280), U64(0xB9AB4CE57F2D34F3),\r
+ U64(0x693501D628297551), U64(0xC62C58F97DD949BF), U64(0xCD454F8F19C5126A), U64(0xBBE83F4ECC2BDECB),\r
+ U64(0xDC842B7E2819E230), U64(0xBA89142E007503B8), U64(0xA3BC941D0A5061CB), U64(0xE9F6760E32CD8021),\r
+ U64(0x09C7E552BC76492F), U64(0x852F54934DA55CC9), U64(0x8107FCCF064FCF56), U64(0x098954D51FFF6580),\r
+ U64(0x23B70EDB1955C4BF), U64(0xC330DE426430F69D), U64(0x4715ED43E8A45C0A), U64(0xA8D7E4DAB780A08D),\r
+ U64(0x0572B974F03CE0BB), U64(0xB57D2E985E1419C7), U64(0xE8D9ECBE2CF3D73F), U64(0x2FE4B17170E59750),\r
+ U64(0x11317BA87905E790), U64(0x7FBF21EC8A1F45EC), U64(0x1725CABFCB045B00), U64(0x964E915CD5E2B207),\r
+ U64(0x3E2B8BCBF016D66D), U64(0xBE7444E39328A0AC), U64(0xF85B2B4FBCDE44B7), U64(0x49353FEA39BA63B1),\r
+ U64(0x1DD01AAFCD53486A), U64(0x1FCA8A92FD719F85), U64(0xFC7C95D827357AFA), U64(0x18A6A990C8B35EBD),\r
+ U64(0xCCCB7005C6B9C28D), U64(0x3BDBB92C43B17F26), U64(0xAA70B5B4F89695A2), U64(0xE94C39A54A98307F),\r
+ U64(0xB7A0B174CFF6F36E), U64(0xD4DBA84729AF48AD), U64(0x2E18BC1AD9704A68), U64(0x2DE0966DAF2F8B1C),\r
+ U64(0xB9C11D5B1E43A07E), U64(0x64972D68DEE33360), U64(0x94628D38D0C20584), U64(0xDBC0D2B6AB90A559),\r
+ U64(0xD2733C4335C6A72F), U64(0x7E75D99D94A70F4D), U64(0x6CED1983376FA72B), U64(0x97FCAACBF030BC24),\r
+ U64(0x7B77497B32503B12), U64(0x8547EDDFB81CCB94), U64(0x79999CDFF70902CB), U64(0xCFFE1939438E9B24),\r
+ U64(0x829626E3892D95D7), U64(0x92FAE24291F2B3F1), U64(0x63E22C147B9C3403), U64(0xC678B6D860284A1C),\r
+ U64(0x5873888850659AE7), U64(0x0981DCD296A8736D), U64(0x9F65789A6509A440), U64(0x9FF38FED72E9052F),\r
+ U64(0xE479EE5B9930578C), U64(0xE7F28ECD2D49EECD), U64(0x56C074A581EA17FE), U64(0x5544F7D774B14AEF),\r
+ U64(0x7B3F0195FC6F290F), U64(0x12153635B2C0CF57), U64(0x7F5126DBBA5E0CA7), U64(0x7A76956C3EAFB413),\r
+ U64(0x3D5774A11D31AB39), U64(0x8A1B083821F40CB4), U64(0x7B4A38E32537DF62), U64(0x950113646D1D6E03),\r
+ U64(0x4DA8979A0041E8A9), U64(0x3BC36E078F7515D7), U64(0x5D0A12F27AD310D1), U64(0x7F9D1A2E1EBE1327),\r
+ U64(0xDA3A361B1C5157B1), U64(0xDCDD7D20903D0C25), U64(0x36833336D068F707), U64(0xCE68341F79893389),\r
+ U64(0xAB9090168DD05F34), U64(0x43954B3252DC25E5), U64(0xB438C2B67F98E5E9), U64(0x10DCD78E3851A492),\r
+ U64(0xDBC27AB5447822BF), U64(0x9B3CDB65F82CA382), U64(0xB67B7896167B4C84), U64(0xBFCED1B0048EAC50),\r
+ U64(0xA9119B60369FFEBD), U64(0x1FFF7AC80904BF45), U64(0xAC12FB171817EEE7), U64(0xAF08DA9177DDA93D),\r
+ U64(0x1B0CAB936E65C744), U64(0xB559EB1D04E5E932), U64(0xC37B45B3F8D6F2BA), U64(0xC3A9DC228CAAC9E9),\r
+ U64(0xF3B8B6675A6507FF), U64(0x9FC477DE4ED681DA), U64(0x67378D8ECCEF96CB), U64(0x6DD856D94D259236),\r
+ U64(0xA319CE15B0B4DB31), U64(0x073973751F12DD5E), U64(0x8A8E849EB32781A5), U64(0xE1925C71285279F5),\r
+ U64(0x74C04BF1790C0EFE), U64(0x4DDA48153C94938A), U64(0x9D266D6A1CC0542C), U64(0x7440FB816508C4FE),\r
+ U64(0x13328503DF48229F), U64(0xD6BF7BAEE43CAC40), U64(0x4838D65F6EF6748F), U64(0x1E152328F3318DEA),\r
+ U64(0x8F8419A348F296BF), U64(0x72C8834A5957B511), U64(0xD7A023A73260B45C), U64(0x94EBC8ABCFB56DAE),\r
+ U64(0x9FC10D0F989993E0), U64(0xDE68A2355B93CAE6), U64(0xA44CFE79AE538BBE), U64(0x9D1D84FCCE371425),\r
+ U64(0x51D2B1AB2DDFB636), U64(0x2FD7E4B9E72CD38C), U64(0x65CA5B96B7552210), U64(0xDD69A0D8AB3B546D),\r
+ U64(0x604D51B25FBF70E2), U64(0x73AA8A564FB7AC9E), U64(0x1A8C1E992B941148), U64(0xAAC40A2703D9BEA0),\r
+ U64(0x764DBEAE7FA4F3A6), U64(0x1E99B96E70A9BE8B), U64(0x2C5E9DEB57EF4743), U64(0x3A938FEE32D29981),\r
+ U64(0x26E6DB8FFDF5ADFE), U64(0x469356C504EC9F9D), U64(0xC8763C5B08D1908C), U64(0x3F6C6AF859D80055),\r
+ U64(0x7F7CC39420A3A545), U64(0x9BFB227EBDF4C5CE), U64(0x89039D79D6FC5C5C), U64(0x8FE88B57305E2AB6),\r
+ U64(0xA09E8C8C35AB96DE), U64(0xFA7E393983325753), U64(0xD6B6D0ECC617C699), U64(0xDFEA21EA9E7557E3),\r
+ U64(0xB67C1FA481680AF8), U64(0xCA1E3785A9E724E5), U64(0x1CFC8BED0D681639), U64(0xD18D8549D140CAEA),\r
+ U64(0x4ED0FE7E9DC91335), U64(0xE4DBF0634473F5D2), U64(0x1761F93A44D5AEFE), U64(0x53898E4C3910DA55),\r
+ U64(0x734DE8181F6EC39A), U64(0x2680B122BAA28D97), U64(0x298AF231C85BAFAB), U64(0x7983EED3740847D5),\r
+ U64(0x66C1A2A1A60CD889), U64(0x9E17E49642A3E4C1), U64(0xEDB454E7BADC0805), U64(0x50B704CAB602C329),\r
+ U64(0x4CC317FB9CDDD023), U64(0x66B4835D9EAFEA22), U64(0x219B97E26FFC81BD), U64(0x261E4E4C0A333A9D),\r
+ U64(0x1FE2CCA76517DB90), U64(0xD7504DFA8816EDBB), U64(0xB9571FA04DC089C8), U64(0x1DDC0325259B27DE),\r
+ U64(0xCF3F4688801EB9AA), U64(0xF4F5D05C10CAB243), U64(0x38B6525C21A42B0E), U64(0x36F60E2BA4FA6800),\r
+ U64(0xEB3593803173E0CE), U64(0x9C4CD6257C5A3603), U64(0xAF0C317D32ADAA8A), U64(0x258E5A80C7204C4B),\r
+ U64(0x8B889D624D44885D), U64(0xF4D14597E660F855), U64(0xD4347F66EC8941C3), U64(0xE699ED85B0DFB40D),\r
+ U64(0x2472F6207C2D0484), U64(0xC2A1E7B5B459AEB5), U64(0xAB4F6451CC1D45EC), U64(0x63767572AE3D6174),\r
+ U64(0xA59E0BD101731A28), U64(0x116D0016CB948F09), U64(0x2CF9C8CA052F6E9F), U64(0x0B090A7560A968E3),\r
+ U64(0xABEEDDB2DDE06FF1), U64(0x58EFC10B06A2068D), U64(0xC6E57A78FBD986E0), U64(0x2EAB8CA63CE802D7),\r
+ U64(0x14A195640116F336), U64(0x7C0828DD624EC390), U64(0xD74BBE77E6116AC7), U64(0x804456AF10F5FB53),\r
+ U64(0xEBE9EA2ADF4321C7), U64(0x03219A39EE587A30), U64(0x49787FEF17AF9924), U64(0xA1E9300CD8520548),\r
+ U64(0x5B45E522E4B1B4EF), U64(0xB49C3B3995091A36), U64(0xD4490AD526F14431), U64(0x12A8F216AF9418C2),\r
+ U64(0x001F837CC7350524), U64(0x1877B51E57A764D5), U64(0xA2853B80F17F58EE), U64(0x993E1DE72D36D310),\r
+ U64(0xB3598080CE64A656), U64(0x252F59CF0D9F04BB), U64(0xD23C8E176D113600), U64(0x1BDA0492E7E4586E),\r
+ U64(0x21E0BD5026C619BF), U64(0x3B097ADAF088F94E), U64(0x8D14DEDB30BE846E), U64(0xF95CFFA23AF5F6F4),\r
+ U64(0x3871700761B3F743), U64(0xCA672B91E9E4FA16), U64(0x64C8E531BFF53B55), U64(0x241260ED4AD1E87D),\r
+ U64(0x106C09B972D2E822), U64(0x7FBA195410E5CA30), U64(0x7884D9BC6CB569D8), U64(0x0647DFEDCD894A29),\r
+ U64(0x63573FF03E224774), U64(0x4FC8E9560F91B123), U64(0x1DB956E450275779), U64(0xB8D91274B9E9D4FB),\r
+ U64(0xA2EBEE47E2FBFCE1), U64(0xD9F1F30CCD97FB09), U64(0xEFED53D75FD64E6B), U64(0x2E6D02C36017F67F),\r
+ U64(0xA9AA4D20DB084E9B), U64(0xB64BE8D8B25396C1), U64(0x70CB6AF7C2D5BCF0), U64(0x98F076A4F7A2322E),\r
+ U64(0xBF84470805E69B5F), U64(0x94C3251F06F90CF3), U64(0x3E003E616A6591E9), U64(0xB925A6CD0421AFF3),\r
+ U64(0x61BDD1307C66E300), U64(0xBF8D5108E27E0D48), U64(0x240AB57A8B888B20), U64(0xFC87614BAF287E07),\r
+ U64(0xEF02CDD06FFDB432), U64(0xA1082C0466DF6C0A), U64(0x8215E577001332C8), U64(0xD39BB9C3A48DB6CF),\r
+ U64(0x2738259634305C14), U64(0x61CF4F94C97DF93D), U64(0x1B6BACA2AE4E125B), U64(0x758F450C88572E0B),\r
+ U64(0x959F587D507A8359), U64(0xB063E962E045F54D), U64(0x60E8ED72C0DFF5D1), U64(0x7B64978555326F9F),\r
+ U64(0xFD080D236DA814BA), U64(0x8C90FD9B083F4558), U64(0x106F72FE81E2C590), U64(0x7976033A39F7D952),\r
+ U64(0xA4EC0132764CA04B), U64(0x733EA705FAE4FA77), U64(0xB4D8F77BC3E56167), U64(0x9E21F4F903B33FD9),\r
+ U64(0x9D765E419FB69F6D), U64(0xD30C088BA61EA5EF), U64(0x5D94337FBFAF7F5B), U64(0x1A4E4822EB4D7A59),\r
+ U64(0x6FFE73E81B637FB3), U64(0xDDF957BC36D8B9CA), U64(0x64D0E29EEA8838B3), U64(0x08DD9BDFD96B9F63),\r
+ U64(0x087E79E5A57D1D13), U64(0xE328E230E3E2B3FB), U64(0x1C2559E30F0946BE), U64(0x720BF5F26F4D2EAA),\r
+ U64(0xB0774D261CC609DB), U64(0x443F64EC5A371195), U64(0x4112CF68649A260E), U64(0xD813F2FAB7F5C5CA),\r
+ U64(0x660D3257380841EE), U64(0x59AC2C7873F910A3), U64(0xE846963877671A17), U64(0x93B633ABFA3469F8),\r
+ U64(0xC0C0F5A60EF4CDCF), U64(0xCAF21ECD4377B28C), U64(0x57277707199B8175), U64(0x506C11B9D90E8B1D),\r
+ U64(0xD83CC2687A19255F), U64(0x4A29C6465A314CD1), U64(0xED2DF21216235097), U64(0xB5635C95FF7296E2),\r
+ U64(0x22AF003AB672E811), U64(0x52E762596BF68235), U64(0x9AEBA33AC6ECC6B0), U64(0x944F6DE09134DFB6),\r
+ U64(0x6C47BEC883A7DE39), U64(0x6AD047C430A12104), U64(0xA5B1CFDBA0AB4067), U64(0x7C45D833AFF07862),\r
+ U64(0x5092EF950A16DA0B), U64(0x9338E69C052B8E7B), U64(0x455A4B4CFE30E3F5), U64(0x6B02E63195AD0CF8),\r
+ U64(0x6B17B224BAD6BF27), U64(0xD1E0CCD25BB9C169), U64(0xDE0C89A556B9AE70), U64(0x50065E535A213CF6),\r
+ U64(0x9C1169FA2777B874), U64(0x78EDEFD694AF1EED), U64(0x6DC93D9526A50E68), U64(0xEE97F453F06791ED),\r
+ U64(0x32AB0EDB696703D3), U64(0x3A6853C7E70757A7), U64(0x31865CED6120F37D), U64(0x67FEF95D92607890),\r
+ U64(0x1F2B1D1F15F6DC9C), U64(0xB69E38A8965C6B65), U64(0xAA9119FF184CCCF4), U64(0xF43C732873F24C13),\r
+ U64(0xFB4A3D794A9A80D2), U64(0x3550C2321FD6109C), U64(0x371F77E76BB8417E), U64(0x6BFA9AAE5EC05779),\r
+ U64(0xCD04F3FF001A4778), U64(0xE3273522064480CA), U64(0x9F91508BFFCFC14A), U64(0x049A7F41061A9E60),\r
+ U64(0xFCB6BE43A9F2FE9B), U64(0x08DE8A1C7797DA9B), U64(0x8F9887E6078735A1), U64(0xB5B4071DBFC73A66),\r
+ U64(0x230E343DFBA08D33), U64(0x43ED7F5A0FAE657D), U64(0x3A88A0FBBCB05C63), U64(0x21874B8B4D2DBC4F),\r
+ U64(0x1BDEA12E35F6A8C9), U64(0x53C065C6C8E63528), U64(0xE34A1D250E7A8D6B), U64(0xD6B04D3B7651DD7E),\r
+ U64(0x5E90277E7CB39E2D), U64(0x2C046F22062DC67D), U64(0xB10BB459132D0A26), U64(0x3FA9DDFB67E2F199),\r
+ U64(0x0E09B88E1914F7AF), U64(0x10E8B35AF3EEAB37), U64(0x9EEDECA8E272B933), U64(0xD4C718BC4AE8AE5F),\r
+ U64(0x81536D601170FC20), U64(0x91B534F885818A06), U64(0xEC8177F83F900978), U64(0x190E714FADA5156E),\r
+ U64(0xB592BF39B0364963), U64(0x89C350C893AE7DC1), U64(0xAC042E70F8B383F2), U64(0xB49B52E587A1EE60),\r
+ U64(0xFB152FE3FF26DA89), U64(0x3E666E6F69AE2C15), U64(0x3B544EBE544C19F9), U64(0xE805A1E290CF2456),\r
+ U64(0x24B33C9D7ED25117), U64(0xE74733427B72F0C1), U64(0x0A804D18B7097475), U64(0x57E3306D881EDB4F),\r
+ U64(0x4AE7D6A36EB5DBCB), U64(0x2D8D5432157064C8), U64(0xD1E649DE1E7F268B), U64(0x8A328A1CEDFE552C),\r
+ U64(0x07A3AEC79624C7DA), U64(0x84547DDC3E203C94), U64(0x990A98FD5071D263), U64(0x1A4FF12616EEFC89),\r
+ U64(0xF6F7FD1431714200), U64(0x30C05B1BA332F41C), U64(0x8D2636B81555A786), U64(0x46C9FEB55D120902),\r
+ U64(0xCCEC0A73B49C9921), U64(0x4E9D2827355FC492), U64(0x19EBB029435DCB0F), U64(0x4659D2B743848A2C),\r
+ U64(0x963EF2C96B33BE31), U64(0x74F85198B05A2E7D), U64(0x5A0F544DD2B1FB18), U64(0x03727073C2E134B1),\r
+ U64(0xC7F6AA2DE59AEA61), U64(0x352787BAA0D7C22F), U64(0x9853EAB63B5E0B35), U64(0xABBDCDD7ED5C0860),\r
+ U64(0xCF05DAF5AC8D77B0), U64(0x49CAD48CEBF4A71E), U64(0x7A4C10EC2158C4A6), U64(0xD9E92AA246BF719E),\r
+ U64(0x13AE978D09FE5557), U64(0x730499AF921549FF), U64(0x4E4B705B92903BA4), U64(0xFF577222C14F0A3A),\r
+ U64(0x55B6344CF97AAFAE), U64(0xB862225B055B6960), U64(0xCAC09AFBDDD2CDB4), U64(0xDAF8E9829FE96B5F),\r
+ U64(0xB5FDFC5D3132C498), U64(0x310CB380DB6F7503), U64(0xE87FBB46217A360E), U64(0x2102AE466EBB1148),\r
+ U64(0xF8549E1A3AA5E00D), U64(0x07A69AFDCC42261A), U64(0xC4C118BFE78FEAAE), U64(0xF9F4892ED96BD438),\r
+ U64(0x1AF3DBE25D8F45DA), U64(0xF5B4B0B0D2DEEEB4), U64(0x962ACEEFA82E1C84), U64(0x046E3ECAAF453CE9),\r
+ U64(0xF05D129681949A4C), U64(0x964781CE734B3C84), U64(0x9C2ED44081CE5FBD), U64(0x522E23F3925E319E),\r
+ U64(0x177E00F9FC32F791), U64(0x2BC60A63A6F3B3F2), U64(0x222BBFAE61725606), U64(0x486289DDCC3D6780),\r
+ U64(0x7DC7785B8EFDFC80), U64(0x8AF38731C02BA980), U64(0x1FAB64EA29A2DDF7), U64(0xE4D9429322CD065A),\r
+ U64(0x9DA058C67844F20C), U64(0x24C0E332B70019B0), U64(0x233003B5A6CFE6AD), U64(0xD586BD01C5C217F6),\r
+ U64(0x5E5637885F29BC2B), U64(0x7EBA726D8C94094B), U64(0x0A56A5F0BFE39272), U64(0xD79476A84EE20D06),\r
+ U64(0x9E4C1269BAA4BF37), U64(0x17EFEE45B0DEE640), U64(0x1D95B0A5FCF90BC6), U64(0x93CBE0B699C2585D),\r
+ U64(0x65FA4F227A2B6D79), U64(0xD5F9E858292504D5), U64(0xC2B5A03F71471A6F), U64(0x59300222B4561E00),\r
+ U64(0xCE2F8642CA0712DC), U64(0x7CA9723FBB2E8988), U64(0x2785338347F2BA08), U64(0xC61BB3A141E50E8C),\r
+ U64(0x150F361DAB9DEC26), U64(0x9F6A419D382595F4), U64(0x64A53DC924FE7AC9), U64(0x142DE49FFF7A7C3D),\r
+ U64(0x0C335248857FA9E7), U64(0x0A9C32D5EAE45305), U64(0xE6C42178C4BBB92E), U64(0x71F1CE2490D20B07),\r
+ U64(0xF1BCC3D275AFE51A), U64(0xE728E8C83C334074), U64(0x96FBF83A12884624), U64(0x81A1549FD6573DA5),\r
+ U64(0x5FA7867CAF35E149), U64(0x56986E2EF3ED091B), U64(0x917F1DD5F8886C61), U64(0xD20D8C88C8FFE65F),\r
+ U64(0x31D71DCE64B2C310), U64(0xF165B587DF898190), U64(0xA57E6339DD2CF3A0), U64(0x1EF6E6DBB1961EC9),\r
+ U64(0x70CC73D90BC26E24), U64(0xE21A6B35DF0C3AD7), U64(0x003A93D8B2806962), U64(0x1C99DED33CB890A1),\r
+ U64(0xCF3145DE0ADD4289), U64(0xD0E4427A5514FB72), U64(0x77C621CC9FB3A483), U64(0x67A34DAC4356550B),\r
+ U64(0xF8D626AAAF278509),\r
+};\r
+\r
+// functions\r
+\r
+// random_init()\r
+\r
+void random_init() {\r
+\r
+ if ((Random64[RandomNb-1] >> 32) != 0xF8D626AA) { // upper half of the last element of the array\r
+ my_fatal("random_init(): broken 64-bit types\n");\r
+ }\r
+}\r
+\r
+// random_64()\r
+\r
+uint64 random_64(int n) {\r
+\r
+ ASSERT(n>=0&&n<RandomNb);\r
+\r
+ return Random64[n];\r
+}\r
+\r
+// end of random.cpp\r
+\r
--- /dev/null
+\r
+// random.h\r
+\r
+#ifndef RANDOM_H\r
+#define RANDOM_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int RandomNb = 781;\r
+\r
+// macros\r
+\r
+#define RANDOM_64(n) (Random64[(n)])\r
+\r
+// "constants"\r
+\r
+extern const uint64 Random64[RandomNb];\r
+\r
+// functions\r
+\r
+extern void random_init ();\r
+extern uint64 random_64 (int n);\r
+\r
+#endif // !defined RANDOM_H\r
+\r
+// end of random.h\r
+\r
--- /dev/null
+\r
+// san.cpp\r
+\r
+// includes\r
+\r
+#include <cctype>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "piece.h"\r
+#include "san.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const bool UseSlowDebug = false;\r
+\r
+enum ambiguity_t {\r
+ AMBIGUITY_NONE,\r
+ AMBIGUITY_FILE,\r
+ AMBIGUITY_RANK,\r
+ AMBIGUITY_SQUARE\r
+};\r
+\r
+// functions\r
+\r
+static bool san_to_lan (const char san[], const board_t * board, char string[], int size);\r
+static int move_from_lan (const char string[], const board_t * board);\r
+\r
+static int ambiguity (int move, const board_t * board);\r
+\r
+// move_to_san()\r
+\r
+bool move_to_san(int move, const board_t * board, char string[], int size) {\r
+\r
+ int from, to, piece;\r
+ char tmp_string[256];\r
+\r
+ ASSERT(move_is_ok(move));\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=8);\r
+\r
+ ASSERT(move_is_legal(move,board));\r
+\r
+ if (size < 8) return false;\r
+\r
+ // init\r
+\r
+ from = move_from(move);\r
+ to = move_to(move);\r
+\r
+ string[0] = '\0';\r
+\r
+ // castle\r
+\r
+ if (move_is_castle(move,board)) {\r
+\r
+ if (to > from) {\r
+ strcat(string,"O-O");\r
+ } else {\r
+ strcat(string,"O-O-O");\r
+ }\r
+\r
+ goto check;\r
+ }\r
+\r
+ // from\r
+\r
+ piece = board->square[from];\r
+\r
+ if (piece_is_pawn(piece)) {\r
+\r
+ // pawn\r
+\r
+ if (move_is_capture(move,board)) {\r
+ sprintf(tmp_string,"%c",file_to_char(square_file(from)));\r
+ strcat(string,tmp_string);\r
+ }\r
+\r
+ } else {\r
+\r
+ // piece\r
+\r
+ sprintf(tmp_string,"%c",toupper(piece_to_char(piece)));\r
+ strcat(string,tmp_string);\r
+\r
+ // ambiguity\r
+\r
+ switch (ambiguity(move,board)) {\r
+ case AMBIGUITY_NONE:\r
+ break;\r
+ case AMBIGUITY_FILE:\r
+ sprintf(tmp_string,"%c",file_to_char(square_file(from)));\r
+ strcat(string,tmp_string);\r
+ break;\r
+ case AMBIGUITY_RANK:\r
+ sprintf(tmp_string,"%c",rank_to_char(square_rank(from)));\r
+ strcat(string,tmp_string);\r
+ break;\r
+ case AMBIGUITY_SQUARE:\r
+ if (!square_to_string(from,tmp_string,256)) return false;\r
+ strcat(string,tmp_string);\r
+ break;\r
+ default:\r
+ ASSERT(false);\r
+ break;\r
+ }\r
+ }\r
+\r
+ // capture\r
+\r
+ if (move_is_capture(move,board)) strcat(string,"x");\r
+\r
+ // to\r
+\r
+ if (!square_to_string(to,tmp_string,256)) return false;\r
+ strcat(string,tmp_string);\r
+\r
+ // promote\r
+\r
+ if (move_is_promote(move)) {\r
+ sprintf(tmp_string,"=%c",toupper(piece_to_char(move_promote(move,board))));\r
+ strcat(string,tmp_string);\r
+ }\r
+\r
+ // check\r
+\r
+check:\r
+\r
+ if (move_is_mate(move,board)) {\r
+ strcat(string,"#");\r
+ } else if (move_is_check(move,board)) {\r
+ strcat(string,"+");\r
+ }\r
+\r
+ return true;\r
+}\r
+\r
+// move_from_san()\r
+\r
+int move_from_san(const char string[], const board_t * board) {\r
+\r
+ char s[256];\r
+ int move;\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ san_to_lan(string,board,s,256);\r
+ move = move_from_lan(s,board);\r
+\r
+ ASSERT(!UseSlowDebug||move==move_from_san_debug(string,board));\r
+\r
+ return move;\r
+}\r
+\r
+// move_from_san_debug()\r
+\r
+int move_from_san_debug(const char string[], const board_t * board) {\r
+\r
+ list_t list[1];\r
+ int i, move;\r
+ char move_string[256];\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ gen_legal_moves(list,board);\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+ move = list_move(list,i);\r
+ if (!move_to_san(move,board,move_string,256)) ASSERT(false);\r
+ if (my_string_equal(move_string,string)) return move;\r
+ }\r
+\r
+ return MoveNone;\r
+}\r
+\r
+// san_to_lan()\r
+\r
+static bool san_to_lan(const char san[], const board_t * board, char string[], int size) {\r
+\r
+ int len;\r
+ int left, right;\r
+ int c;\r
+ int king, rook;\r
+ char king_string[3], rook_string[3];\r
+\r
+ ASSERT(san!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=8);\r
+\r
+ // init\r
+\r
+ if (size < 8) return false;\r
+ strcpy(string,"???????");\r
+\r
+ len = strlen(san);\r
+\r
+ left = 0;\r
+ right = len;\r
+\r
+ // skip trailing '+' or '#'\r
+\r
+ if (left < right) {\r
+ c = san[right-1];\r
+ if (c == '+' || c == '#') right--;\r
+ }\r
+\r
+ // castling\r
+\r
+ ASSERT(left==0);\r
+\r
+ if (false) {\r
+\r
+ } else if (right == 3 && strncmp(san,"O-O",3) == 0) {\r
+\r
+ if (board->castle[board->turn][SideH] == SquareNone) return false;\r
+\r
+ king = king_pos(board,board->turn);\r
+ rook = board->castle[board->turn][SideH];\r
+\r
+ square_to_string(king,king_string,3);\r
+ square_to_string(rook,rook_string,3);\r
+\r
+ sprintf(string,"K%s?%s?",king_string,rook_string);\r
+\r
+ } else if (right == 5 && strncmp(san,"O-O-O",5) == 0) {\r
+\r
+ if (board->castle[board->turn][SideA] == SquareNone) return false;\r
+\r
+ king = king_pos(board,board->turn);\r
+ rook = board->castle[board->turn][SideA];\r
+\r
+ square_to_string(king,king_string,3);\r
+ square_to_string(rook,rook_string,3);\r
+\r
+ sprintf(string,"K%s?%s?",king_string,rook_string);\r
+\r
+ } else {\r
+\r
+ // moved piece\r
+\r
+ if (left < right) {\r
+\r
+ c = san[left];\r
+\r
+ if (char_is_piece(c)) {\r
+ string[0] = c;\r
+ left++;\r
+ }\r
+ }\r
+\r
+ // promotion\r
+\r
+ if (left < right) {\r
+\r
+ c = toupper(san[right-1]);\r
+\r
+ if (char_is_piece(c)) {\r
+\r
+ string[6] = c;\r
+ right--;\r
+\r
+ // skip '='\r
+\r
+ if (left < right && san[right-1] == '=') right--;\r
+ }\r
+ }\r
+\r
+ // to-square rank\r
+\r
+ if (left < right) {\r
+\r
+ c = san[right-1];\r
+\r
+ if (char_is_rank(c)) {\r
+ string[5] = c;\r
+ right--;\r
+ }\r
+ }\r
+\r
+ // to-square file\r
+\r
+ if (left < right) {\r
+\r
+ c = san[right-1];\r
+\r
+ if (char_is_file(c)) {\r
+ string[4] = c;\r
+ right--;\r
+ }\r
+ }\r
+\r
+ // captured piece\r
+\r
+ if (left < right) {\r
+\r
+ c = san[right-1];\r
+\r
+ if (char_is_piece(c)) {\r
+ string[3] = c;\r
+ right--;\r
+ }\r
+ }\r
+\r
+ // skip middle '-' or 'x'\r
+\r
+ if (left < right) {\r
+ c = san[right-1];\r
+ if (c == '-' || c == 'x') right--;\r
+ }\r
+\r
+ // from-square file\r
+\r
+ if (left < right) {\r
+\r
+ c = san[left];\r
+\r
+ if (char_is_file(c)) {\r
+ string[1] = c;\r
+ left++;\r
+ }\r
+ }\r
+\r
+ // from-square rank\r
+\r
+ if (left < right) {\r
+\r
+ c = san[left];\r
+\r
+ if (char_is_rank(c)) {\r
+ string[2] = c;\r
+ left++;\r
+ }\r
+ }\r
+\r
+ if (left != right) return false;\r
+ }\r
+\r
+ // end\r
+\r
+ return true;\r
+}\r
+\r
+// move_from_lan()\r
+\r
+static int move_from_lan(const char string[], const board_t * board) {\r
+\r
+ int len;\r
+ int move;\r
+ int promote;\r
+ char s[256];\r
+ int from, to;\r
+ int colour;\r
+ int inc;\r
+ int piece_char;\r
+ int n;\r
+ const uint8 * ptr;\r
+ int piece;\r
+ int side;\r
+\r
+ ASSERT(string!=NULL);\r
+ ASSERT(board_is_ok(board));\r
+\r
+ // init\r
+\r
+ len = strlen(string);\r
+ if (len != 7) return MoveNone;\r
+\r
+ move = MoveNone;\r
+ colour = board->turn;\r
+\r
+ // promote\r
+\r
+ promote = 0;\r
+\r
+ switch (string[6]) {\r
+ case '?': // not a promotion\r
+ break;\r
+ case 'N':\r
+ promote = MovePromoteKnight;\r
+ break;\r
+ case 'B':\r
+ promote = MovePromoteBishop;\r
+ break;\r
+ case 'R':\r
+ promote = MovePromoteRook;\r
+ break;\r
+ case 'Q':\r
+ promote = MovePromoteQueen;\r
+ break;\r
+ default:\r
+ return MoveNone;\r
+ break;\r
+ }\r
+\r
+ // to square\r
+\r
+ s[0] = string[4];\r
+ s[1] = string[5];\r
+ s[2] = '\0';\r
+\r
+ to = square_from_string(s);\r
+ if (to == SquareNone) return MoveNone;\r
+\r
+ // known from square?\r
+\r
+ if (string[1] != '?' && string[2] != '?') {\r
+\r
+ // from square\r
+\r
+ s[0] = string[1];\r
+ s[1] = string[2];\r
+ s[2] = '\0';\r
+\r
+ from = square_from_string(s);\r
+ if (from == SquareNone) return MoveNone;\r
+\r
+ // convert "king slide" castling to KxR\r
+\r
+ if (piece_is_king(board->square[from])\r
+ && square_rank(to) == square_rank(from)\r
+ && abs(to-from) > 1) {\r
+ side = (to > from) ? SideH : SideA;\r
+ to = board->castle[colour][side];\r
+ if (to == SquareNone) return MoveNone;\r
+ }\r
+\r
+ // move\r
+\r
+ move = move_make(from,to) | promote;\r
+\r
+ return move;\r
+ }\r
+\r
+ // pawn non-capture?\r
+\r
+ if (string[0] == '?' && string[1] == '?') {\r
+\r
+ if (board->square[to] != Empty) return MoveNone; // useful?\r
+\r
+ inc = (colour_is_white(colour)) ? +16 : -16;\r
+\r
+ from = to - inc;\r
+ if (board->square[from] == Empty && square_side_rank(to,colour) == Rank4) {\r
+ from -= inc;\r
+ }\r
+\r
+ if (board->square[from] != piece_make_pawn(colour)) { // useful?\r
+ return MoveNone;\r
+ }\r
+\r
+ // move\r
+\r
+ move = move_make(from,to) | promote;\r
+\r
+ return move;\r
+ }\r
+\r
+ // pawn capture?\r
+\r
+ piece_char = string[0];\r
+\r
+ if (piece_char == '?' && string[1] != '?') {\r
+ piece_char = 'P';\r
+ }\r
+\r
+ // attack loop\r
+\r
+ n = 0;\r
+\r
+ for (ptr = board->list[colour]; (from=*ptr) != SquareNone; ptr++) {\r
+\r
+ piece = board->square[from];\r
+\r
+ if (toupper(piece_to_char(piece)) == piece_char) {\r
+ if (piece_attack(board,piece,from,to)) {\r
+ if (true\r
+ && (string[1] == '?' || file_to_char(square_file(from)) == string[1])\r
+ && (string[2] == '?' || rank_to_char(square_rank(from)) == string[2])) {\r
+ if (!is_pinned(board,from,to,colour)) {\r
+ move = move_make(from,to) | promote;\r
+ n++;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (n != 1) move = MoveNone;\r
+\r
+ return move;\r
+}\r
+\r
+// ambiguity()\r
+\r
+static int ambiguity(int move, const board_t * board) {\r
+\r
+ int from, to, piece;\r
+ list_t list[1];\r
+ int i, n, m;\r
+\r
+ // init\r
+\r
+ from = move_from(move);\r
+ to = move_to(move);\r
+ piece = move_piece(move,board);\r
+\r
+ gen_legal_moves(list,board);\r
+\r
+ // no ambiguity?\r
+\r
+ n = 0;\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+ m = list_move(list,i);\r
+ if (move_piece(m,board) == piece && move_to(m) == to) {\r
+ n++;\r
+ }\r
+ }\r
+\r
+ if (n == 1) return AMBIGUITY_NONE;\r
+\r
+ // file ambiguity?\r
+\r
+ n = 0;\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+ m = list_move(list,i);\r
+ if (move_piece(m,board) == piece && move_to(m) == to) {\r
+ if (square_file(move_from(m)) == square_file(from)) n++;\r
+ }\r
+ }\r
+\r
+ if (n == 1) return AMBIGUITY_FILE;\r
+\r
+ // rank ambiguity?\r
+\r
+ n = 0;\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+ m = list_move(list,i);\r
+ if (move_piece(m,board) == piece && move_to(m) == to) {\r
+ if (square_rank(move_from(m)) == square_rank(from)) n++;\r
+ }\r
+ }\r
+\r
+ if (n == 1) return AMBIGUITY_RANK;\r
+\r
+ // square ambiguity\r
+\r
+ return AMBIGUITY_SQUARE;\r
+}\r
+\r
+// end of san.cpp\r
+\r
--- /dev/null
+\r
+// san.h\r
+\r
+#ifndef SAN_H\r
+#define SAN_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// functions\r
+\r
+extern bool move_to_san (int move, const board_t * board, char string[], int size);\r
+extern int move_from_san (const char string[], const board_t * board);\r
+\r
+extern int move_from_san_debug (const char string[], const board_t * board);\r
+\r
+#endif // !defined SAN_H\r
+\r
+// end of san.h\r
+\r
--- /dev/null
+// search.cpp\r
+\r
+// includes\r
+\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "attack.h"\r
+#include "board.h"\r
+#include "colour.h"\r
+#include "engine.h"\r
+#include "fen.h"\r
+#include "line.h"\r
+#include "list.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_gen.h"\r
+#include "move_legal.h"\r
+#include "option.h"\r
+#include "parse.h"\r
+#include "san.h"\r
+#include "search.h"\r
+#include "uci.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+static const int StringSize = 4096;\r
+\r
+// variables\r
+\r
+static int Depth;\r
+\r
+static int BestMove;\r
+static int BestValue;\r
+static move_t BestPV[LineSize];\r
+\r
+static sint64 NodeNb;\r
+static sint64 LeafNb;\r
+static double Time;\r
+\r
+static int Move;\r
+static int MovePos;\r
+static int MoveNb;\r
+\r
+// prototypes\r
+\r
+static bool depth_is_ok (int depth);\r
+static void perft (const board_t * board, int depth);\r
+\r
+// functions\r
+\r
+// depth_is_ok()\r
+\r
+static bool depth_is_ok(int depth) {\r
+\r
+ return depth >= 0 && depth < DepthMax;\r
+}\r
+\r
+// search()\r
+\r
+void search(const board_t * board, int depth_max, double time_max) {\r
+\r
+ char string[256];\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(depth_max>=1&&depth_max<DepthMax);\r
+ ASSERT(time_max>=0.0);\r
+\r
+ // engine\r
+\r
+ Depth = 0;\r
+\r
+ BestMove = MoveNone;\r
+ BestValue = 0;\r
+ line_clear(BestPV);\r
+\r
+ NodeNb = 0;\r
+ LeafNb = 0;\r
+ Time = 0.0;\r
+\r
+ Move = MoveNone;\r
+ MovePos = 0;\r
+ MoveNb = 0;\r
+\r
+ // init\r
+\r
+ uci_send_ucinewgame(Uci);\r
+ uci_send_isready_sync(Uci);\r
+\r
+ // position\r
+\r
+ if (!board_to_fen(board,string,256)) ASSERT(false);\r
+ engine_send(Engine,"position fen %s",string);\r
+\r
+ // search\r
+\r
+ engine_send_queue(Engine,"go");\r
+\r
+ engine_send_queue(Engine," movetime %.0f",time_max*1000.0);\r
+ engine_send_queue(Engine," depth %d",depth_max);\r
+\r
+ engine_send(Engine,""); // newline\r
+\r
+ // wait for feed-back\r
+\r
+ while (true) {\r
+\r
+ engine_get(Engine,string,256);\r
+\r
+ if (false) {\r
+\r
+ } else if (match(string,"bestmove * ponder *")) {\r
+\r
+ BestMove = move_from_can(Star[0],board);\r
+ ASSERT(BestMove!=MoveNone&&move_is_legal(BestMove,board));\r
+\r
+ break;\r
+\r
+ } else if (match(string,"bestmove *")) {\r
+\r
+ BestMove = move_from_can(Star[0],board);\r
+ ASSERT(BestMove!=MoveNone&&move_is_legal(BestMove,board));\r
+\r
+ break;\r
+ }\r
+ }\r
+\r
+ printf("\n");\r
+}\r
+\r
+// do_perft()\r
+\r
+void do_perft(int argc,char * argv[]){\r
+ const char * fen=StartFen;\r
+ int depth=1;\r
+ board_t board[1];\r
+ int i;\r
+ for (i = 1; i < argc; i++) {\r
+ if (false) {\r
+ } else if (my_string_equal(argv[i],"perft")) {\r
+ // skip\r
+ } else if (my_string_equal(argv[i],"-fen")) {\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("do_perft(): missing argument\n");\r
+ fen=strdup(argv[i]);\r
+ } else if (my_string_equal(argv[i],"-max-depth")){\r
+ i++;\r
+ if (argv[i] == NULL) my_fatal("do_perft(): missing argument\n");\r
+ depth=atoi(argv[i]);\r
+ if(depth<1) my_fatal("do_perft(): illegal depth %d\n",depth);\r
+ } else {\r
+ my_fatal("do_perft(): unknown option \"%s\"\n",argv[i]);\r
+ }\r
+ }\r
+ board_from_fen(board,fen);\r
+ search_perft(board,depth);\r
+}\r
+\r
+// search_perft()\r
+\r
+void search_perft(const board_t * board, int depth_max) {\r
+\r
+ int depth;\r
+ my_timer_t timer[1];\r
+ double time, speed;\r
+ char node_string[StringSize];\r
+ char leafnode_string[StringSize];\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(depth_max>=1&&depth_max<DepthMax);\r
+\r
+ // init\r
+\r
+ board_disp(board);\r
+\r
+ // iterative deepening\r
+\r
+ for (depth = 1; depth <= depth_max; depth++) {\r
+\r
+ // init\r
+\r
+ NodeNb = 0;\r
+ LeafNb = 0;\r
+\r
+ my_timer_reset(timer);\r
+\r
+ my_timer_start(timer);\r
+ perft(board,depth);\r
+ my_timer_stop(timer);\r
+\r
+ time = my_timer_elapsed_real(timer);//my_timer_elapsed_cpu(timer);\r
+ speed = (time < 0.01) ? 0.0 : double(NodeNb) / time;\r
+\r
+ snprintf(node_string,StringSize,S64_FORMAT,NodeNb);\r
+ snprintf(leafnode_string,StringSize,S64_FORMAT,LeafNb);\r
+\r
+ printf("depth=%2d nodes=%12s leafnodes=%12s time=%7.2fs nps=%8.0f\n",depth,node_string,leafnode_string,time,speed);\r
+ }\r
+\r
+}\r
+\r
+// perft()\r
+\r
+static void perft(const board_t * board, int depth) {\r
+\r
+ int me;\r
+ list_t list[1];\r
+ int i, move;\r
+ board_t new_board[1];\r
+\r
+ ASSERT(board_is_ok(board));\r
+ ASSERT(depth_is_ok(depth));\r
+\r
+ ASSERT(!is_in_check(board,colour_opp(board->turn)));\r
+\r
+ // init\r
+\r
+ NodeNb++;\r
+\r
+ // leaf\r
+\r
+ if (depth == 0) {\r
+ LeafNb++;\r
+ return;\r
+ }\r
+\r
+ // more init\r
+\r
+ me = board->turn;\r
+\r
+ // move loop\r
+\r
+ gen_moves(list,board);\r
+\r
+ for (i = 0; i < list_size(list); i++) {\r
+\r
+ move = list_move(list,i);\r
+\r
+ board_copy(new_board,board);\r
+ move_do(new_board,move);\r
+\r
+ if (!is_in_check(new_board,me)) perft(new_board,depth-1);\r
+ }\r
+}\r
+\r
+// end of search.cpp\r
+\r
--- /dev/null
+// search.h\r
+\r
+#ifndef SEARCH_H\r
+#define SEARCH_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int DepthMax = 63;\r
+\r
+// functions\r
+\r
+extern void search (const board_t * board, int depth_max, double time_max);\r
+extern void search_perft (const board_t * board, int depth_max);\r
+\r
+extern void do_perft (int argc, char * argv[]);\r
+\r
+#endif // !defined SEARCH_H\r
+\r
+// end of search.h\r
+\r
--- /dev/null
+\r
+// square.cpp\r
+\r
+// includes\r
+\r
+#include "colour.h"\r
+#include "square.h"\r
+#include "util.h"\r
+\r
+// "constants"\r
+\r
+static const uint8 SquareFrom64[64] = {\r
+ A1, B1, C1, D1, E1, F1, G1, H1,\r
+ A2, B2, C2, D2, E2, F2, G2, H2,\r
+ A3, B3, C3, D3, E3, F3, G3, H3,\r
+ A4, B4, C4, D4, E4, F4, G4, H4,\r
+ A5, B5, C5, D5, E5, F5, G5, H5,\r
+ A6, B6, C6, D6, E6, F6, G6, H6,\r
+ A7, B7, C7, D7, E7, F7, G7, H7,\r
+ A8, B8, C8, D8, E8, F8, G8, H8,\r
+};\r
+\r
+// variables\r
+\r
+static sint8 SquareTo64[SquareNb];\r
+\r
+// functions\r
+\r
+// square_init()\r
+\r
+void square_init() {\r
+\r
+ int sq;\r
+\r
+ for (sq = 0; sq < SquareNb; sq++) SquareTo64[sq] = -1;\r
+\r
+ for (sq = 0; sq < 64; sq++) {\r
+ SquareTo64[SquareFrom64[sq]] = sq;\r
+ }\r
+}\r
+\r
+// square_is_ok()\r
+\r
+bool square_is_ok(int square) {\r
+\r
+ if (square < 0 || square >= SquareNb) return false;\r
+\r
+ if (SquareTo64[square] < 0) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// square_make()\r
+\r
+int square_make(int file, int rank) {\r
+\r
+ int sq_64;\r
+\r
+ ASSERT(file>=0&&file<8);\r
+ ASSERT(rank>=0&&rank<8);\r
+\r
+ sq_64 = (rank << 3) | file;\r
+\r
+ return square_from_64(sq_64);\r
+}\r
+\r
+// square_file()\r
+\r
+int square_file(int square) {\r
+\r
+ int file;\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ file = (square - 4) & 7;\r
+ ASSERT(file==(square_to_64(square)&7));\r
+\r
+ return file;\r
+}\r
+\r
+// square_rank()\r
+\r
+int square_rank(int square) {\r
+\r
+ int rank;\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ rank = (square >> 4) - 2;\r
+ ASSERT(rank==square_to_64(square)>>3);\r
+\r
+ return rank;\r
+}\r
+\r
+// square_side_rank()\r
+\r
+int square_side_rank(int square, int colour) {\r
+\r
+ int rank;\r
+\r
+ ASSERT(square_is_ok(square));\r
+ ASSERT(colour_is_ok(colour));\r
+\r
+ rank = square_rank(square);\r
+ if (colour_is_black(colour)) rank = 7-rank;\r
+\r
+ return rank;\r
+}\r
+\r
+// square_from_64()\r
+\r
+int square_from_64(int square) {\r
+\r
+ ASSERT(square>=0&&square<64);\r
+\r
+ return SquareFrom64[square];\r
+}\r
+\r
+// square_to_64()\r
+\r
+int square_to_64(int square) {\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ return SquareTo64[square];\r
+}\r
+\r
+// square_is_promote()\r
+\r
+bool square_is_promote(int square) {\r
+\r
+ int rank;\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ rank = square_rank(square);\r
+\r
+ return rank == Rank1 || rank == Rank8;\r
+}\r
+\r
+// square_ep_dual()\r
+\r
+int square_ep_dual(int square) {\r
+\r
+ ASSERT(square_is_ok(square));\r
+ ASSERT(square_rank(square)>=2&&square_rank(square)<=5);\r
+\r
+ return square ^ 16;\r
+}\r
+\r
+// square_colour()\r
+\r
+int square_colour(int square) {\r
+\r
+ ASSERT(square_is_ok(square));\r
+\r
+ return (square ^ (square >> 4)) & 1;\r
+}\r
+\r
+// file_from_char()\r
+\r
+int file_from_char(int c) {\r
+\r
+ ASSERT(c>='a'&&c<='h');\r
+\r
+ return c - 'a';\r
+}\r
+\r
+// rank_from_char()\r
+\r
+int rank_from_char(int c) {\r
+\r
+ ASSERT(c>='1'&&c<='8');\r
+\r
+ return c - '1';\r
+}\r
+\r
+// file_to_char()\r
+\r
+int file_to_char(int file) {\r
+\r
+ ASSERT(file>=0&&file<8);\r
+\r
+ return 'a' + file;\r
+}\r
+\r
+// rank_to_char()\r
+\r
+int rank_to_char(int rank) {\r
+\r
+ ASSERT(rank>=0&&rank<8);\r
+\r
+ return '1' + rank;\r
+}\r
+\r
+// char_is_file()\r
+\r
+bool char_is_file(int c) {\r
+\r
+ return c >= 'a' && c <= 'h';\r
+}\r
+\r
+// char_is_rank()\r
+\r
+bool char_is_rank(int c) {\r
+\r
+ return c >= '1' && c <= '8';\r
+}\r
+\r
+// square_to_string()\r
+\r
+bool square_to_string(int square, char string[], int size) {\r
+\r
+ ASSERT(square_is_ok(square));\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>=3);\r
+\r
+ if (size < 3) return false;\r
+\r
+ string[0] = 'a' + square_file(square);\r
+ string[1] = '1' + square_rank(square);\r
+ string[2] = '\0';\r
+\r
+ return true;\r
+}\r
+\r
+// square_from_string()\r
+\r
+int square_from_string(const char string[]) {\r
+\r
+ int file, rank;\r
+\r
+ ASSERT(string!=NULL);\r
+\r
+ if (string[0] < 'a' || string[0] > 'h') return SquareNone;\r
+ if (string[1] < '1' || string[1] > '8') return SquareNone;\r
+ if (string[2] != '\0') return SquareNone;\r
+\r
+ file = file_from_char(string[0]);\r
+ rank = rank_from_char(string[1]);\r
+\r
+ return square_make(file,rank);\r
+}\r
+\r
+// end of square.cpp\r
+\r
--- /dev/null
+\r
+// square.h\r
+\r
+#ifndef SQUARE_H\r
+#define SQUARE_H\r
+\r
+// includes\r
+\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int SquareNb = 16 * 12;\r
+\r
+const int FileA = 0;\r
+const int FileB = 1;\r
+const int FileC = 2;\r
+const int FileD = 3;\r
+const int FileE = 4;\r
+const int FileF = 5;\r
+const int FileG = 6;\r
+const int FileH = 7;\r
+\r
+const int Rank1 = 0;\r
+const int Rank2 = 1;\r
+const int Rank3 = 2;\r
+const int Rank4 = 3;\r
+const int Rank5 = 4;\r
+const int Rank6 = 5;\r
+const int Rank7 = 6;\r
+const int Rank8 = 7;\r
+\r
+const int SquareNone = 0;\r
+\r
+const int A1=0x24, B1=0x25, C1=0x26, D1=0x27, E1=0x28, F1=0x29, G1=0x2A, H1=0x2B;\r
+const int A2=0x34, B2=0x35, C2=0x36, D2=0x37, E2=0x38, F2=0x39, G2=0x3A, H2=0x3B;\r
+const int A3=0x44, B3=0x45, C3=0x46, D3=0x47, E3=0x48, F3=0x49, G3=0x4A, H3=0x4B;\r
+const int A4=0x54, B4=0x55, C4=0x56, D4=0x57, E4=0x58, F4=0x59, G4=0x5A, H4=0x5B;\r
+const int A5=0x64, B5=0x65, C5=0x66, D5=0x67, E5=0x68, F5=0x69, G5=0x6A, H5=0x6B;\r
+const int A6=0x74, B6=0x75, C6=0x76, D6=0x77, E6=0x78, F6=0x79, G6=0x7A, H6=0x7B;\r
+const int A7=0x84, B7=0x85, C7=0x86, D7=0x87, E7=0x88, F7=0x89, G7=0x8A, H7=0x8B;\r
+const int A8=0x94, B8=0x95, C8=0x96, D8=0x97, E8=0x98, F8=0x99, G8=0x9A, H8=0x9B;\r
+\r
+const int Dark = 0;\r
+const int Light = 1;\r
+\r
+// functions\r
+\r
+extern void square_init ();\r
+\r
+extern bool square_is_ok (int square);\r
+\r
+extern int square_make (int file, int rank);\r
+\r
+extern int square_file (int square);\r
+extern int square_rank (int square);\r
+extern int square_side_rank (int square, int colour);\r
+\r
+extern int square_from_64 (int square);\r
+extern int square_to_64 (int square);\r
+\r
+extern bool square_is_promote (int square);\r
+extern int square_ep_dual (int square);\r
+\r
+extern int square_colour (int square);\r
+\r
+extern bool char_is_file (int c);\r
+extern bool char_is_rank (int c);\r
+\r
+extern int file_from_char (int c);\r
+extern int rank_from_char (int c);\r
+\r
+extern int file_to_char (int file);\r
+extern int rank_to_char (int rank);\r
+\r
+extern bool square_to_string (int square, char string[], int size);\r
+extern int square_from_string (const char string[]);\r
+\r
+#endif // !defined SQUARE_H\r
+\r
+// end of square.h\r
+\r
--- /dev/null
+\r
+// uci.cpp\r
+\r
+// includes\r
+\r
+#include <cstdarg>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+\r
+#include "board.h"\r
+#include "engine.h"\r
+#include "move.h"\r
+#include "move_do.h"\r
+#include "move_legal.h"\r
+#include "option.h"\r
+#include "parse.h"\r
+#include "line.h"\r
+#include "uci.h"\r
+\r
+// constants\r
+\r
+static const bool UseDebug = false;\r
+\r
+static const int StringSize = 4096;\r
+\r
+// variables\r
+\r
+uci_t Uci[1];\r
+\r
+// Hopefully the following confusion is temporary\r
+// Normally we should check for the engine name but this is a hack anyway\r
+// Some of there where provided by Marc Lacrosse\r
+\r
+const char * thread_options[]={\r
+ "number of threads", // toga\r
+ "number threads", // Deep Learning Toga\r
+ "threads", // glaurung, zappa, cyclone, grapefruit,\r
+ // Deep Shredder, Deep Junior\r
+ "core threads", // HIARCS\r
+ "max cpus", // rybka\r
+ "cpus", // Deep Sjeng, Fruit2.3.5\r
+ "maxthreads", // Naum \r
+ NULL\r
+};\r
+\r
+// prototypes\r
+\r
+static bool uci_is_ok (const uci_t * uci);\r
+\r
+static int parse_bestmove (uci_t * uci, const char string[]);\r
+static void parse_id (uci_t * uci, const char string[]);\r
+static int parse_info (uci_t * uci, const char string[]);\r
+static void parse_option (uci_t * uci, const char string[]);\r
+static void parse_score (uci_t * uci, const char string[]);\r
+\r
+static int mate_score (int dist);\r
+\r
+// functions\r
+\r
+// uci_set_threads()\r
+\r
+void uci_set_threads(uci_t * uci, int n) {\r
+ const char **thread_options_copy = thread_options;\r
+ const char *thread_option;\r
+ ASSERT(n>=1);\r
+ while((thread_option = *(thread_options_copy++))){\r
+ uci_send_option(uci,thread_option,"%d",n); // checks also for existence\r
+ }\r
+}\r
+\r
+// uci_thread_option_exists()\r
+\r
+bool uci_thread_option_exist(uci_t * uci) {\r
+ const char **thread_options_copy = thread_options;\r
+ const char *thread_option;\r
+ while((thread_option = *(thread_options_copy++))){\r
+ if(uci_option_exist(uci,thread_option)) return true;\r
+ }\r
+ return false;\r
+}\r
+\r
+// uci_is_ok()\r
+\r
+static bool uci_is_ok(const uci_t * uci) {\r
+\r
+ if (uci == NULL) return false;\r
+ if (uci->engine == NULL) return false;\r
+ if (uci->option_nb < 0 || uci->option_nb >= OptionNb) return false;\r
+\r
+ return true;\r
+}\r
+\r
+// uci_open()\r
+\r
+void uci_open(uci_t * uci, engine_t * engine) {\r
+\r
+ char string[StringSize];\r
+ int event;\r
+\r
+ ASSERT(uci!=NULL);\r
+ ASSERT(engine!=NULL);\r
+\r
+ // init\r
+\r
+ uci->engine = engine;\r
+\r
+ uci->name = NULL;\r
+ my_string_set(&uci->name,"<empty>");\r
+ uci->author = NULL;\r
+ my_string_set(&uci->author,"<empty>");\r
+ uci->option_nb = 0;\r
+\r
+ uci->ready_nb = 0;\r
+ uci->searching = 0;\r
+ uci->pending_nb = 0;\r
+ uci->multipv_mode = false;\r
+ board_start(uci->board);\r
+ uci_clear(uci);\r
+\r
+ // send "uci" and wait for "uciok"\r
+\r
+ engine_send(uci->engine,"uci");\r
+\r
+ do {\r
+ engine_get(uci->engine,string,StringSize);\r
+ event = uci_parse(uci,string);\r
+ } while ((event & EVENT_UCI) == 0);\r
+}\r
+\r
+// uci_close()\r
+\r
+void uci_close(uci_t * uci) {\r
+\r
+ int i;\r
+ option_t * opt;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ engine_close(uci->engine);\r
+ uci->engine = NULL;\r
+ my_string_clear(&uci->name);\r
+ my_string_clear(&uci->author);\r
+\r
+ for (i = 0; i < uci->option_nb; i++) {\r
+ opt = &uci->option[i];\r
+ my_string_clear(&opt->name);\r
+ my_string_clear(&opt->value);\r
+ }\r
+\r
+ uci->option_nb = 0;\r
+}\r
+\r
+// uci_clear()\r
+\r
+void uci_clear(uci_t * uci) {\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+\r
+ ASSERT(!uci->searching);\r
+\r
+ uci->best_move = MoveNone;\r
+ uci->ponder_move = MoveNone;\r
+\r
+ uci->score = 0;\r
+ uci->depth = 0;\r
+ uci->sel_depth = 0;\r
+ line_clear(uci->pv);\r
+\r
+ uci->best_score = 0;\r
+ uci->best_depth = 0;\r
+ uci->best_sel_depth = 0;\r
+ line_clear(uci->best_pv);\r
+\r
+ uci->node_nb = 0;\r
+ uci->time = 0.0;\r
+ uci->speed = 0.0;\r
+ uci->cpu = 0.0;\r
+ uci->hash = 0.0;\r
+ line_clear(uci->current_line);\r
+\r
+ uci->root_move = MoveNone;\r
+ uci->root_move_pos = 0;\r
+ uci->root_move_nb = board_mobility(uci->board);\r
+}\r
+\r
+// uci_send_isready()\r
+\r
+void uci_send_isready(uci_t * uci) {\r
+\r
+ ASSERT(uci!=NULL);\r
+\r
+ engine_send(uci->engine,"isready");\r
+ uci->ready_nb++;\r
+}\r
+\r
+// uci_send_isready_sync()\r
+\r
+void uci_send_isready_sync(uci_t * uci) {\r
+\r
+ char string[StringSize];\r
+ int event;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+\r
+ // send "isready" and wait for "readyok"\r
+\r
+ uci_send_isready(uci);\r
+\r
+ do {\r
+ engine_get(uci->engine,string,StringSize);\r
+ event = uci_parse(uci,string);\r
+ } while ((event & EVENT_READY) == 0);\r
+}\r
+\r
+// uci_send_stop()\r
+\r
+void uci_send_stop(uci_t * uci) {\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+\r
+ ASSERT(uci->searching);\r
+ ASSERT(uci->pending_nb>=1);\r
+\r
+ engine_send(Engine,"stop");\r
+ uci->searching = false;\r
+}\r
+\r
+// uci_send_stop_sync()\r
+\r
+void uci_send_stop_sync(uci_t * uci) {\r
+\r
+ char string[StringSize];\r
+ int event;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+\r
+ ASSERT(uci->searching);\r
+ ASSERT(uci->pending_nb>=1);\r
+\r
+ // send "stop" and wait for "bestmove"\r
+\r
+ uci_send_stop(uci);\r
+\r
+ do {\r
+ engine_get(uci->engine,string,StringSize);\r
+ event = uci_parse(uci,string);\r
+ } while ((event & EVENT_STOP) == 0);\r
+}\r
+\r
+// uci_send_ucinewgame()\r
+\r
+void uci_send_ucinewgame(uci_t * uci) {\r
+\r
+ ASSERT(uci!=NULL);\r
+\r
+ if (option_get_int("UCIVersion") >= 2) {\r
+ engine_send(uci->engine,"ucinewgame");\r
+ }\r
+}\r
+\r
+// uci_option_exist()\r
+\r
+bool uci_option_exist(uci_t * uci, const char option[]) {\r
+\r
+ int i;\r
+ option_t * opt;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(option!=NULL);\r
+\r
+ // scan options\r
+\r
+ for (i = 0; i < uci->option_nb; i++) {\r
+ opt = &uci->option[i];\r
+ if (my_string_case_equal(opt->name,option)) return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// uci_send_option()\r
+\r
+void uci_send_option(uci_t * uci, const char option[], const char format[], ...) {\r
+\r
+ va_list arg_list;\r
+ char value[StringSize];\r
+ int i;\r
+ option_t * opt;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(option!=NULL);\r
+ ASSERT(format!=NULL);\r
+\r
+ // format\r
+\r
+ va_start(arg_list,format);\r
+ vsprintf(value,format,arg_list);\r
+ va_end(arg_list);\r
+\r
+ if (UseDebug) my_log("POLYGLOT OPTION %s VALUE %s\n",option,value);\r
+\r
+ // scan options\r
+\r
+ for (i = 0; i < uci->option_nb; i++) {\r
+\r
+ opt = &uci->option[i];\r
+\r
+ if (my_string_case_equal(opt->name,option) && !my_string_equal(opt->value,value)) {\r
+ engine_send(uci->engine,"setoption name %s value %s",opt->name,value);\r
+ my_string_set(&opt->value,value);\r
+ break;\r
+ }\r
+ }\r
+}\r
+\r
+// uci_parse()\r
+\r
+int uci_parse(uci_t * uci, const char string[]) {\r
+\r
+ int event;\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char argument[StringSize];\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ event = EVENT_NONE;\r
+\r
+ // parse\r
+\r
+ parse_open(parse,string);\r
+\r
+ if (parse_get_word(parse,command,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" ARGUMENT \"%s\"\n",command,argument);\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(command,"bestmove")) {\r
+\r
+ // search end\r
+\r
+ ASSERT(uci->pending_nb>0);\r
+\r
+ if (uci->searching && uci->pending_nb == 1) {\r
+\r
+ // current search\r
+\r
+ uci->searching = false;\r
+ uci->pending_nb--;\r
+\r
+ event = parse_bestmove(uci,argument); // updates uci->best_move and uci->ponder_move\r
+\r
+ } else {\r
+\r
+ // obsolete search\r
+\r
+ if (uci->pending_nb > 0) {\r
+ uci->pending_nb--;\r
+ if (uci->pending_nb == 0) event = EVENT_STOP;\r
+ }\r
+ }\r
+\r
+ } else if (my_string_equal(command,"id")) {\r
+\r
+ parse_id(uci,argument);\r
+\r
+ } else if (my_string_equal(command,"info")) {\r
+\r
+ // search information\r
+\r
+ if (uci->searching && uci->pending_nb == 1) { // current search\r
+ event = parse_info(uci,argument);\r
+ }\r
+\r
+ } else if (my_string_equal(command,"option")) {\r
+\r
+ parse_option(uci,argument);\r
+\r
+ } else if (my_string_equal(command,"readyok")) {\r
+\r
+ // engine is ready\r
+\r
+ ASSERT(uci->ready_nb>0);\r
+\r
+ if (uci->ready_nb > 0) {\r
+ uci->ready_nb--;\r
+ if (uci->ready_nb == 0) event = EVENT_READY;\r
+ }\r
+\r
+ } else if (my_string_equal(command,"uciok")) {\r
+\r
+ event = EVENT_UCI;\r
+\r
+ } else {\r
+\r
+ if (UseDebug) my_log("POLYGLOT unknown command \"%s\"\n",command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+\r
+ return event;\r
+}\r
+\r
+// parse_bestmove()\r
+\r
+static int parse_bestmove(uci_t * uci, const char string[]) {\r
+\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char option[StringSize];\r
+ char argument[StringSize];\r
+ board_t board[1];\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ strcpy(command,"bestmove");\r
+\r
+ parse_open(parse,string);\r
+ parse_add_keyword(parse,"ponder");\r
+\r
+ // bestmove\r
+\r
+ if (!parse_get_string(parse,argument,StringSize)) {\r
+ my_fatal("parse_bestmove(): missing argument\n");\r
+ }\r
+\r
+ uci->best_move = move_from_can(argument,uci->board);\r
+ if (uci->best_move == MoveNone) my_fatal("parse_bestmove(): not a move \"%s\"\n",argument);\r
+\r
+ ASSERT(uci->best_move!=MoveNone);\r
+ ASSERT(move_is_legal(uci->best_move,uci->board));\r
+\r
+ // loop\r
+\r
+ while (parse_get_word(parse,option,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" OPTION \"%s\" ARGUMENT \"%s\"\n",command,option,argument);\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(option,"ponder")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ board_copy(board,uci->board);\r
+ move_do(board,uci->best_move);\r
+\r
+ uci->ponder_move = move_from_can(argument,board);\r
+ // if (uci->ponder_move == MoveNone) my_fatal("parse_bestmove(): not a move \"%s\"\n",argument);\r
+\r
+ ASSERT(uci->ponder_move!=MoveNone);\r
+ ASSERT(move_is_legal(uci->ponder_move,board));\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+\r
+ return EVENT_MOVE;\r
+}\r
+\r
+// parse_id()\r
+\r
+static void parse_id(uci_t * uci, const char string[]) {\r
+\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char option[StringSize];\r
+ char argument[StringSize];\r
+\r
+ ASSERT(uci!=NULL);\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ strcpy(command,"id");\r
+\r
+ parse_open(parse,string);\r
+ parse_add_keyword(parse,"author");\r
+ parse_add_keyword(parse,"name");\r
+\r
+ // loop\r
+\r
+ while (parse_get_word(parse,option,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" OPTION \"%s\" ARGUMENT \"%s\"\n",command,option,argument);\r
+\r
+ if (false) {\r
+ } else if (my_string_equal(option,"author")) {\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&uci->author,argument);\r
+ } else if (my_string_equal(option,"name")) {\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&uci->name,argument);\r
+ } else {\r
+ my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+\r
+ if (UseDebug) my_log("POLYGLOT engine name \"%s\" author \"%s\"\n",uci->name,uci->author);\r
+}\r
+\r
+// parse_info()\r
+\r
+static int parse_info(uci_t * uci, const char string[]) {\r
+\r
+ int event;\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char option[StringSize];\r
+ char argument[StringSize];\r
+ int n;\r
+ int multipvline=0;\r
+ sint64 ln;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ event = EVENT_NONE;\r
+\r
+ strcpy(command,"info");\r
+\r
+ parse_open(parse,string);\r
+ parse_add_keyword(parse,"cpuload");\r
+ parse_add_keyword(parse,"currline");\r
+ parse_add_keyword(parse,"currmove");\r
+ parse_add_keyword(parse,"currmovenumber");\r
+ parse_add_keyword(parse,"depth");\r
+ parse_add_keyword(parse,"hashfull");\r
+ parse_add_keyword(parse,"multipv");\r
+ parse_add_keyword(parse,"nodes");\r
+ parse_add_keyword(parse,"nps");\r
+ parse_add_keyword(parse,"pv");\r
+ parse_add_keyword(parse,"refutation");\r
+ parse_add_keyword(parse,"score");\r
+ parse_add_keyword(parse,"seldepth");\r
+ parse_add_keyword(parse,"string");\r
+ parse_add_keyword(parse,"tbhits");\r
+ parse_add_keyword(parse,"time");\r
+\r
+ // loop\r
+\r
+ while (parse_get_word(parse,option,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" OPTION \"%s\" ARGUMENT \"%s\"\n",command,option,argument);\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(option,"cpuload")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=0);\r
+\r
+ if (n >= 0) uci->cpu = double(n) / 1000.0;\r
+\r
+ } else if (my_string_equal(option,"currline")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ line_from_can(uci->current_line,uci->board,argument,LineSize);\r
+\r
+ } else if (my_string_equal(option,"currmove")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ uci->root_move = move_from_can(argument,uci->board);\r
+ ASSERT(uci->root_move!=MoveNone);\r
+\r
+ } else if (my_string_equal(option,"currmovenumber")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=1&&n<=uci->root_move_nb);\r
+\r
+ if (n >= 1 && n <= uci->root_move_nb) {\r
+ uci->root_move_pos = n - 1;\r
+ ASSERT(uci->root_move_pos>=0&&uci->root_move_pos<uci->root_move_nb);\r
+ }\r
+\r
+ } else if (my_string_equal(option,"depth")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=1);\r
+\r
+ if (n >= 0) {\r
+ if (n > uci->depth) event |= EVENT_DEPTH;\r
+ uci->depth = n;\r
+ }\r
+\r
+ } else if (my_string_equal(option,"hashfull")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=0);\r
+\r
+ if (n >= 0) uci->hash = double(n) / 1000.0;\r
+\r
+ } else if (my_string_equal(option,"multipv")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ if(Uci->multipv_mode) multipvline=n;\r
+ \r
+ ASSERT(n>=1);\r
+\r
+ } else if (my_string_equal(option,"nodes")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ ln = my_atoll(argument);\r
+ ASSERT(ln>=0);\r
+\r
+ if (ln >= 0) uci->node_nb = ln;\r
+\r
+ } else if (my_string_equal(option,"nps")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=0);\r
+\r
+ if (n >= 0) uci->speed = double(n);\r
+\r
+ } else if (my_string_equal(option,"pv")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ line_from_can(uci->pv,uci->board,argument,LineSize);\r
+ event |= EVENT_PV;\r
+\r
+ } else if (my_string_equal(option,"refutation")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ line_from_can(uci->pv,uci->board,argument,LineSize);\r
+\r
+ } else if (my_string_equal(option,"score")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ parse_score(uci,argument);\r
+\r
+ } else if (my_string_equal(option,"seldepth")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=0);\r
+\r
+ if (n >= 0) uci->sel_depth = n;\r
+\r
+ } else if (my_string_equal(option,"string")) {\r
+ if(!strncmp(argument,"DrawOffer",9))\r
+ event |= EVENT_DRAW;\r
+ if(!strncmp(argument,"Resign",6))\r
+ event |= EVENT_RESIGN;\r
+\r
+ // TODO: argument to EOS\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ } else if (my_string_equal(option,"tbhits")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ ln = my_atoll(argument);\r
+ ASSERT(ln>=0);\r
+\r
+ } else if (my_string_equal(option,"time")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n>=0);\r
+\r
+ if (n >= 0) uci->time = double(n) / 1000.0;\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+\r
+ // update display\r
+ //lousy uci,filter out lower depth multipv lines that have been repeated from the engine \r
+ if(multipvline>1 && uci->depth<uci->best_depth) event &= ~EVENT_PV;\r
+ if ((event & EVENT_PV) != 0) {\r
+ uci->best_score = uci->score; \r
+ uci->best_depth = uci->depth;\r
+ if(multipvline==1)uci->depth=-1; //HACK ,clears the engine outpout window,see send_pv in adapter.cpp \r
+ uci->best_sel_depth = uci->sel_depth;\r
+ line_copy(uci->best_pv,uci->pv);\r
+ }\r
+ return event;\r
+}\r
+\r
+int uci_get_option(uci_t * uci, const char * name){\r
+ int i;\r
+ for(i=0;i<Uci->option_nb;i++){\r
+ if(my_string_case_equal(Uci->option[i].name,name)){\r
+ return i;\r
+ }\r
+ }\r
+ return -1;\r
+}\r
+\r
+\r
+\r
+// uci_set_option()\r
+\r
+void uci_set_option(uci_t * uci,\r
+ const char * name,\r
+ const char * value,\r
+ const char * type,\r
+ const char * max,\r
+ const char * min,\r
+ const char * var){\r
+ int i;\r
+ for(i=0;i<Uci->option_nb;i++){\r
+ if(my_string_equal(Uci->option[i].name,name)){\r
+ break;\r
+ }\r
+ }\r
+ if(i<OptionNb){\r
+ my_string_set(&(Uci->option[i].name),name);\r
+ my_string_set(&(Uci->option[i].value),value);\r
+ my_string_set(&(Uci->option[i].type),type);\r
+ my_string_set(&(Uci->option[i].min),min);\r
+ my_string_set(&(Uci->option[i].max),max);\r
+ my_string_set(&(Uci->option[i].var),var);\r
+ if(i==Uci->option_nb){\r
+ Uci->option_nb++;\r
+ }\r
+ }\r
+}\r
+\r
+// parse_option()\r
+\r
+static void parse_option(uci_t * uci, const char string[]) {\r
+\r
+ option_t * opt;\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char option[StringSize];\r
+ char argument[StringSize];\r
+\r
+ ASSERT(uci!=NULL);\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ strcpy(command,"option");\r
+\r
+ if (uci->option_nb >= OptionNb) return;\r
+\r
+ opt = &uci->option[uci->option_nb];\r
+ uci->option_nb++;\r
+\r
+ opt->name = NULL;\r
+ my_string_set(&opt->name,"<empty>");\r
+\r
+ opt->value = NULL;\r
+ my_string_set(&opt->value,"<empty>");\r
+\r
+ opt->max = NULL;\r
+ my_string_set(&opt->max,"<empty>");\r
+\r
+ opt->min = NULL;\r
+ my_string_set(&opt->min,"<empty>");\r
+\r
+ opt->type = NULL;\r
+ my_string_set(&opt->type,"<empty>");\r
+\r
+ opt->var = NULL;\r
+ my_string_set(&opt->var,"<empty>");\r
+\r
+ parse_open(parse,string);\r
+ parse_add_keyword(parse,"default");\r
+ parse_add_keyword(parse,"max");\r
+ parse_add_keyword(parse,"min");\r
+ parse_add_keyword(parse,"name");\r
+ parse_add_keyword(parse,"type");\r
+ parse_add_keyword(parse,"var");\r
+\r
+ // loop\r
+\r
+ while (parse_get_word(parse,option,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" OPTION \"%s\" ARGUMENT \"%s\"\n",command,option,argument);\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(option,"default")) {\r
+\r
+ // ASSERT(!my_string_empty(argument)); // HACK for Pepito\r
+\r
+ if (!my_string_empty(argument)) {\r
+ my_string_set(&opt->value,argument);\r
+ }\r
+\r
+ } else if (my_string_equal(option,"max")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&opt->max,argument);\r
+\r
+ } else if (my_string_equal(option,"min")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&opt->min,argument);\r
+\r
+ } else if (my_string_equal(option,"name")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ if (!my_string_empty(argument)) {\r
+ my_string_set(&opt->name,argument);\r
+ }\r
+\r
+ } else if (my_string_equal(option,"type")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&opt->type,argument);\r
+\r
+ } else if (my_string_equal(option,"var")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+ my_string_set(&opt->var,argument);\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+\r
+ if (UseDebug) my_log("POLYGLOT option name \"%s\" value \"%s\"\n",opt->name,opt->value);\r
+}\r
+\r
+// parse_score()\r
+\r
+static void parse_score(uci_t * uci, const char string[]) {\r
+\r
+ parse_t parse[1];\r
+ char command[StringSize];\r
+ char option[StringSize];\r
+ char argument[StringSize];\r
+ int n;\r
+\r
+ ASSERT(uci_is_ok(uci));\r
+ ASSERT(string!=NULL);\r
+\r
+ // init\r
+\r
+ strcpy(command,"score");\r
+\r
+ parse_open(parse,string);\r
+ parse_add_keyword(parse,"cp");\r
+ parse_add_keyword(parse,"lowerbound");\r
+ parse_add_keyword(parse,"mate");\r
+ parse_add_keyword(parse,"upperbound");\r
+\r
+ // loop\r
+\r
+ while (parse_get_word(parse,option,StringSize)) {\r
+\r
+ parse_get_string(parse,argument,StringSize);\r
+\r
+ if (UseDebug) my_log("POLYGLOT COMMAND \"%s\" OPTION \"%s\" ARGUMENT \"%s\"\n",command,option,argument);\r
+\r
+ if (false) {\r
+\r
+ } else if (my_string_equal(option,"cp")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+\r
+ uci->score = n;\r
+\r
+ } else if (my_string_equal(option,"lowerbound")) {\r
+\r
+ ASSERT(my_string_empty(argument));\r
+\r
+ } else if (my_string_equal(option,"mate")) {\r
+\r
+ ASSERT(!my_string_empty(argument));\r
+\r
+ n = atoi(argument);\r
+ ASSERT(n!=0);\r
+\r
+ uci->score = mate_score(n);\r
+\r
+ } else if (my_string_equal(option,"upperbound")) {\r
+\r
+ ASSERT(my_string_empty(argument));\r
+\r
+ } else {\r
+\r
+ my_log("POLYGLOT unknown option \"%s\" for command \"%s\"\n",option,command);\r
+ }\r
+ }\r
+\r
+ parse_close(parse);\r
+}\r
+\r
+// mate_score()\r
+\r
+static int mate_score(int dist) {\r
+\r
+ ASSERT(dist!=0);\r
+\r
+ if (false) {\r
+ } else if (dist > 0) {\r
+ return +option_get_int("MateScore") - (+dist) * 2 + 1;\r
+ } else if (dist < 0) {\r
+ return -option_get_int("MateScore") + (-dist) * 2;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+// end of uci.cpp\r
+\r
--- /dev/null
+\r
+// uci.h\r
+\r
+#ifndef UCI_H\r
+#define UCI_H\r
+\r
+// includes\r
+\r
+#include "board.h"\r
+#include "engine.h"\r
+#include "line.h"\r
+#include "move.h"\r
+#include "util.h"\r
+\r
+// constants\r
+\r
+const int OptionNb = 256;\r
+\r
+// types\r
+\r
+struct option_t {\r
+ const char * name;\r
+ const char * value;\r
+ const char * type;\r
+ const char * max;\r
+ const char * min;\r
+ const char * var;\r
+};\r
+\r
+struct uci_t {\r
+\r
+ engine_t * engine;\r
+\r
+ const char * name;\r
+ const char * author;\r
+\r
+ int option_nb;\r
+ option_t option[OptionNb];\r
+\r
+ bool ready;\r
+ int ready_nb;\r
+\r
+ bool searching;\r
+ int pending_nb;\r
+\r
+ board_t board[1];\r
+\r
+ int best_move;\r
+ int ponder_move;\r
+\r
+ int score;\r
+ int depth;\r
+ int sel_depth;\r
+ move_t pv[LineSize];\r
+\r
+ int best_score;\r
+ int best_depth;\r
+ int best_sel_depth;\r
+ move_t best_pv[LineSize];\r
+\r
+ sint64 node_nb;\r
+ double time;\r
+ double speed;\r
+ double cpu;\r
+ double hash;\r
+ move_t current_line[LineSize];\r
+\r
+ int root_move;\r
+ int root_move_pos;\r
+ int root_move_nb;\r
+ bool multipv_mode;\r
+};\r
+\r
+enum dummy_event_t {\r
+ EVENT_NONE = 0,\r
+ EVENT_UCI = 1 << 0,\r
+ EVENT_READY = 1 << 1,\r
+ EVENT_STOP = 1 << 2,\r
+ EVENT_MOVE = 1 << 3,\r
+ EVENT_PV = 1 << 4,\r
+ EVENT_DEPTH = 1 << 5,\r
+ EVENT_DRAW = 1 << 6,\r
+ EVENT_RESIGN= 1 << 7\r
+};\r
+\r
+// variables\r
+\r
+extern uci_t Uci[1];\r
+\r
+// functions\r
+\r
+extern void uci_open (uci_t * uci, engine_t * engine);\r
+extern void uci_send_isready (uci_t * uci);\r
+extern void uci_send_isready_sync (uci_t * uci);\r
+extern void uci_send_stop (uci_t * uci);\r
+extern void uci_send_stop_sync (uci_t * uci);\r
+extern void uci_send_ucinewgame (uci_t * uci);\r
+extern void uci_set_threads (uci_t * uci, int n);\r
+extern bool uci_thread_option_exist(uci_t * uci);\r
+extern int uci_get_option (uci_t * uci, const char * name);\r
+\r
+extern bool uci_option_exist (uci_t * uci, const char option[]);\r
+extern void uci_send_option (uci_t * uci, const char option[], const char format[], ...);\r
+\r
+extern void uci_close (uci_t * uci);\r
+\r
+extern void uci_clear (uci_t * uci);\r
+\r
+extern int uci_parse (uci_t * uci, const char string[]);\r
+\r
+void uci_set_option(uci_t * uci,\r
+ const char * name,\r
+ const char * value,\r
+ const char * type,\r
+ const char * max,\r
+ const char * min,\r
+ const char * var);\r
+\r
+#endif // !defined UCI_H\r
+\r
+// end of uci.h\r
+\r
--- /dev/null
+// uci2uci.cpp
+
+// includes
+
+#include <cstring>
+#include <cstdlib>
+
+#include "util.h"
+#include "adapter.h"
+#include "board.h"
+#include "engine.h"
+#include "fen.h"
+#include "gui.h"
+#include "move.h"
+#include "move_do.h"
+#include "move_legal.h"
+#include "parse.h"
+#include "option.h"
+#include "book.h"
+#include "main.h"
+#include "uci.h"
+
+// constants
+
+static const int StringSize = 4096;
+
+// variables
+
+static board_t UCIboard[1];
+static bool Init=true;
+static int SavedMove=MoveNone;
+
+// defines
+
+#ifdef _WIN32
+#define strcasecmp lstrcmpi
+#endif
+
+// parse_position()
+
+static void parse_position(const char string[]) {
+
+/* This is borrowed from Toga II. This code is quite hacky and will be
+ rewritten using the routines in parse.cpp.
+*/
+
+ const char * fen;
+ char * moves;
+ const char * ptr;
+ char move_string[256];
+ int move;
+ char * string_copy;
+
+ // init
+
+ string_copy=my_strdup(string);
+
+ fen = strstr(string_copy,"fen ");
+ moves = strstr(string_copy,"moves ");
+
+ // start position
+
+ if (fen != NULL) { // "fen" present
+
+ if (moves != NULL) { // "moves" present
+ ASSERT(moves>fen);
+ moves[-1] = '\0'; // dirty, but so is UCI
+ }
+
+ board_from_fen(UCIboard,fen+4); // CHANGE ME
+
+ } else {
+
+ // HACK: assumes startpos
+
+ board_from_fen(UCIboard,StartFen);
+ }
+
+ // moves
+
+ if (moves != NULL) { // "moves" present
+
+ ptr = moves + 6;
+
+ while (*ptr != '\0') {
+
+ while (*ptr == ' ') ptr++;
+
+ move_string[0] = *ptr++;
+ move_string[1] = *ptr++;
+ move_string[2] = *ptr++;
+ move_string[3] = *ptr++;
+
+ if (*ptr == '\0' || *ptr == ' ') {
+ move_string[4] = '\0';
+ } else { // promote
+ move_string[4] = *ptr++;
+ move_string[5] = '\0';
+ }
+ move = move_from_can(move_string,UCIboard);
+
+ move_do(UCIboard,move);
+
+ }
+ }
+ free(string_copy);
+}
+
+
+// send_book_move()
+
+static void send_book_move(int move){
+ char move_string[256];
+ my_log("POLYGLOT *BOOK MOVE*\n");
+ move_to_can(move,UCIboard,move_string,256);
+ // bogus info lines
+ gui_send(GUI,"info depth 1 time 0 nodes 0 nps 0 cpuload 0");
+ gui_send(GUI,"bestmove %s",move_string);
+}
+
+// send_uci_options()
+
+void send_uci_options() {
+ int i;
+ char option_line[StringSize]="";
+ char option_string[StringSize]="";
+ gui_send(GUI,"id name %s", Uci->name);
+ gui_send(GUI,"id author %s", Uci->author);
+ for(i=0;i<Uci->option_nb;i++){
+ strcat(option_line,"option");
+ if(strcmp(Uci->option[i].name,"<empty>")){
+ sprintf(option_string," name %s",Uci->option[i].name);
+ strcat(option_line,option_string);
+ }
+ if(strcmp(Uci->option[i].type,"<empty>")){
+ sprintf(option_string," type %s",Uci->option[i].type);
+ strcat(option_line,option_string);
+ }
+ if(strcmp(Uci->option[i].value,"<empty>")){
+ sprintf(option_string," default %s",Uci->option[i].value);
+ strcat(option_line,option_string);
+ }
+ if(strcmp(Uci->option[i].min,"<empty>")){
+ sprintf(option_string," min %s",Uci->option[i].min);
+ strcat(option_line,option_string);
+ }
+ if(strcmp(Uci->option[i].max,"<empty>")){
+ sprintf(option_string," max %s",Uci->option[i].max);
+ strcat(option_line,option_string);
+ }
+ if(strcmp(Uci->option[i].var,"<empty>")){
+ sprintf(option_string," var %s",Uci->option[i].var);
+ strcat(option_line,option_string);
+ }
+ gui_send(GUI,"%s",option_line);
+ strcpy(option_line,"");
+ }
+ gui_send(GUI,"uciok");
+}
+
+// parse_setoption()
+
+
+
+static void parse_setoption(const char string[]) {
+ parse_t parse[1];
+ char option[StringSize];
+ char name[StringSize];
+ char value[StringSize];
+ char * string_copy;
+ string_copy=my_strdup(string);
+ parse_open(parse,string_copy);
+ parse_add_keyword(parse,"setoption");
+ parse_add_keyword(parse,"name");
+ parse_add_keyword(parse,"value");
+ parse_get_word(parse,option,StringSize);
+ ASSERT(my_string_equal(option,"setoption"));
+ if(parse_get_word(parse,option,StringSize)){
+ if(my_string_equal(option,"name")){
+ parse_get_string(parse,name,StringSize);
+ if(parse_get_word(parse,option,StringSize)){
+ if(my_string_equal(option,"value")){
+ parse_get_string(parse,value,StringSize);
+ if(my_string_case_equal(name,PolyglotBookFile)){
+ my_log("POLYGLOT *** SETTING BOOK ***\n");
+ my_log("POLYGLOT BOOK \"%s\"\n",value);
+ book_close();
+ book_clear();
+ book_open(value);
+ if(!book_is_open()){
+ my_log("POLYGLOT Unable to open book \"%s\"\n",value);
+ }
+ }else{
+ engine_send(Engine,"%s",string);
+ }
+ }
+ }
+ }
+ }
+ parse_close(parse);
+ free(string_copy);
+}
+
+
+// uci_gui_step()
+
+void uci_gui_step(char string[]) {
+ int move;
+ if(false){
+ }else if(match(string,"uci")){
+ send_uci_options();
+ return;
+ }else if(match(string,"setoption *")){
+ parse_setoption(string);
+ return;
+ }else if(match(string,"position *")){
+ parse_position(string);
+ Init=false;
+ }else if(match(string,"go *")){
+ if(Init){
+ board_from_fen(UCIboard,StartFen);
+ Init=false;
+ }
+ SavedMove=MoveNone;
+ if(!strstr(string,"infinite")){
+ move=book_move(UCIboard,option_get_bool("BookRandom"));
+ if (move != MoveNone && move_is_legal(move,UCIboard)) {
+ if(strstr(string,"ponder")){
+ SavedMove=move;
+ return;
+ }else{
+ send_book_move(move);
+ return;
+ }
+ }
+ }
+ }else if(match(string,"ponderhit") || match(string,"stop")){
+ if(SavedMove!=MoveNone){
+ send_book_move(SavedMove);
+ SavedMove=MoveNone;
+ return;
+ }
+ }else if(match(string,"quit")){
+ my_log("POLYGLOT *** \"quit\" from GUI ***\n");
+ quit();
+ }
+ engine_send(Engine,"%s",string);
+}
+
+void uci_engine_step(char string[]) {
+ gui_send(GUI,string);
+}
+
+// end of uci2uci.cpp
--- /dev/null
+
+// uci2uci.h
+
+#ifndef UCI2UCI_H
+#define UCI2UCI_H
+
+// constants
+
+const char * const PolyglotBookFile="Polyglot BookFile";
+
+// functions
+
+extern void uci_gui_step(char string[]);
+extern void uci_engine_step(char string[]);
+extern void send_uci_options();
+
+#endif // !defined UCI2UCI_H
+
+// end of uci2uci.h
--- /dev/null
+\r
+// util.cpp\r
+\r
+// includes\r
+\r
+#include <cctype>\r
+#include <cerrno>\r
+#include <cmath>\r
+#include <cstdarg>\r
+#include <cstdio>\r
+#include <cstdlib>\r
+#include <cstring>\r
+#include <ctime>\r
+\r
+#include "main.h"\r
+#include "posix.h"\r
+#include "util.h"\r
+\r
+// variables\r
+\r
+static bool Error;\r
+\r
+FILE * LogFile=NULL;\r
+\r
+\r
+// functions\r
+\r
+// util_init()\r
+\r
+void util_init() {\r
+\r
+ Error = false;\r
+\r
+ // init log file\r
+\r
+ LogFile = NULL;\r
+\r
+ // switch file buffering off\r
+\r
+ setbuf(stdin,NULL);\r
+ setbuf(stdout,NULL);\r
+}\r
+\r
+// my_random_init()\r
+\r
+void my_random_init() {\r
+ srand(time(NULL));\r
+}\r
+\r
+// my_random_int()\r
+\r
+int my_random_int(int n) {\r
+\r
+ int r;\r
+\r
+ ASSERT(n>0);\r
+\r
+ r = int(floor(my_random_double()*double(n)));\r
+ ASSERT(r>=0&&r<n);\r
+\r
+ return r;\r
+}\r
+\r
+// my_random_double()\r
+\r
+double my_random_double() {\r
+\r
+ double r;\r
+\r
+ r = double(rand()) / (double(RAND_MAX) + 1.0);\r
+ ASSERT(r>=0.0&&r<1.0);\r
+\r
+ return r;\r
+}\r
+\r
+// my_atoll()\r
+\r
+sint64 my_atoll(const char string[]) {\r
+\r
+ sint64 n;\r
+\r
+ sscanf(string,S64_FORMAT,&n);\r
+\r
+ return n;\r
+}\r
+\r
+// my_round()\r
+\r
+int my_round(double x) {\r
+\r
+ return int(floor(x+0.5));\r
+}\r
+\r
+// my_malloc()\r
+\r
+void * my_malloc(size_t size) {\r
+\r
+ void * address;\r
+\r
+ ASSERT(size>0);\r
+\r
+ address = malloc(size);\r
+ if (address == NULL) my_fatal("my_malloc(): malloc(): %s\n",strerror(errno));\r
+\r
+ return address;\r
+}\r
+\r
+// my_realloc()\r
+\r
+void * my_realloc(void * address, size_t size) {\r
+\r
+ ASSERT(address!=NULL);\r
+ ASSERT(size>0);\r
+\r
+ address = realloc(address,size);\r
+ if (address == NULL) my_fatal("my_realloc(): realloc(): %s\n",strerror(errno));\r
+\r
+ return address;\r
+}\r
+\r
+// my_free()\r
+\r
+void my_free(void * address) {\r
+\r
+ ASSERT(address!=NULL);\r
+\r
+ free(address);\r
+}\r
+\r
+// my_log_open()\r
+\r
+void my_log_open(const char file_name[]) {\r
+\r
+ ASSERT(file_name!=NULL);\r
+\r
+ LogFile = fopen(file_name,"a");\r
+#ifndef _WIN32\r
+//line buffering doesn't work too well in MSVC and/or windows \r
+ if (LogFile != NULL) setvbuf(LogFile,NULL,_IOLBF,0); // line buffering\r
+#endif\r
+}\r
+\r
+// my_log_close()\r
+\r
+void my_log_close() {\r
+\r
+ if (LogFile != NULL) fclose(LogFile);\r
+}\r
+\r
+// my_log()\r
+\r
+void my_log(const char format[], ...) {\r
+\r
+ va_list ap;\r
+\r
+ ASSERT(format!=NULL);\r
+\r
+ if (LogFile != NULL) {\r
+ fprintf(LogFile,"%.3f ",now_real());\r
+ va_start(ap,format);\r
+\r
+ vfprintf(LogFile,format,ap);\r
+ va_end(ap);\r
+#ifdef _WIN32\r
+ fflush(LogFile);\r
+#endif\r
+ }\r
+}\r
+\r
+// my_fatal()\r
+\r
+void my_fatal(const char format[], ...) {\r
+\r
+ va_list ap;\r
+\r
+ ASSERT(format!=NULL);\r
+\r
+ va_start(ap,format);\r
+\r
+ vfprintf(stderr,format,ap);\r
+ if (LogFile != NULL) vfprintf(LogFile,format,ap);\r
+\r
+ va_end(ap);\r
+ if (Error) { // recursive error\r
+ my_log("POLYGLOT *** RECURSIVE ERROR ***\n");\r
+ exit(EXIT_FAILURE);\r
+ // abort();\r
+ } else {\r
+ Error = true;\r
+ quit();\r
+ }\r
+}\r
+\r
+// my_file_read_line()\r
+\r
+bool my_file_read_line(FILE * file, char string[], int size) {\r
+\r
+ int src, dst;\r
+ int c;\r
+\r
+ ASSERT(file!=NULL);\r
+ ASSERT(string!=NULL);\r
+ ASSERT(size>0);\r
+\r
+ if (fgets(string,size,file) == NULL) {\r
+ if (feof(file)) {\r
+ return false;\r
+ } else { // error\r
+ my_fatal("my_file_read_line(): fgets(): %s\n",strerror(errno));\r
+ }\r
+ }\r
+\r
+ // remove CRs and LFs\r
+\r
+ src = 0;\r
+ dst = 0;\r
+ \r
+ while ((c=string[src++]) != '\0') {\r
+ if (c != '\r' && c != '\n') string[dst++] = c;\r
+ }\r
+\r
+ string[dst] = '\0';\r
+\r
+ return true;\r
+}\r
+\r
+// my_string_empty()\r
+\r
+bool my_string_empty(const char string[]) {\r
+\r
+ return string == NULL || string[0] == '\0';\r
+}\r
+\r
+// my_string_whitespace()\r
+\r
+bool my_string_whitespace(const char string[]){\r
+ int pos=0;\r
+ while(string[pos]!='\0'){\r
+ if(string[pos]!=' ' && string[pos]!='\t'){\r
+ return false;\r
+ }\r
+ pos++;\r
+ }\r
+ return true;\r
+}\r
+\r
+// my_string_equal()\r
+\r
+bool my_string_equal(const char string_1[], const char string_2[]) {\r
+\r
+ ASSERT(string_1!=NULL);\r
+ ASSERT(string_2!=NULL);\r
+\r
+ return strcmp(string_1,string_2) == 0;\r
+}\r
+\r
+// my_string_case_equal()\r
+\r
+bool my_string_case_equal(const char string_1[], const char string_2[]) {\r
+\r
+ int c1, c2;\r
+\r
+ ASSERT(string_1!=NULL);\r
+ ASSERT(string_2!=NULL);\r
+\r
+ while (true) {\r
+\r
+ c1 = *string_1++;\r
+ c2 = *string_2++;\r
+\r
+ if (tolower(c1) != tolower(c2)) return false;\r
+ if (c1 == '\0') return true;\r
+ }\r
+\r
+ return false;\r
+}\r
+\r
+// my_strdup()\r
+\r
+char * my_strdup(const char string[]) {\r
+\r
+ char * address;\r
+\r
+ ASSERT(string!=NULL);\r
+\r
+ // strdup() is not ANSI C\r
+\r
+ address = (char *) my_malloc(strlen(string)+1);\r
+ strcpy(address,string);\r
+\r
+ return address;\r
+}\r
+\r
+// my_string_clear()\r
+\r
+void my_string_clear(const char * * variable) {\r
+\r
+ ASSERT(variable!=NULL);\r
+\r
+ if (*variable != NULL) {\r
+ my_free((void*)(*variable));\r
+ *variable = NULL;\r
+ }\r
+}\r
+\r
+// my_string_set()\r
+\r
+void my_string_set(const char * * variable, const char string[]) {\r
+\r
+ ASSERT(variable!=NULL);\r
+ ASSERT(string!=NULL);\r
+\r
+ if (*variable != NULL) my_free((void*)(*variable));\r
+ *variable = my_strdup(string);\r
+}\r
+\r
+// my_timer_reset()\r
+\r
+void my_timer_reset(my_timer_t * timer) {\r
+\r
+ ASSERT(timer!=NULL);\r
+\r
+ timer->start_real = 0.0;\r
+ timer->elapsed_real = 0.0;\r
+ timer->running = false;\r
+}\r
+\r
+// my_timer_start()\r
+\r
+void my_timer_start(my_timer_t * timer) {\r
+// timer->start_real = 0.0;\r
+ timer->elapsed_real = 0.0;\r
+// timer->running = false;\r
+ ASSERT(timer!=NULL);\r
+\r
+ timer->running = true;\r
+ timer->start_real = now_real();\r
+}\r
+\r
+// my_timer_stop()\r
+\r
+void my_timer_stop(my_timer_t * timer) {\r
+\r
+ ASSERT(timer!=NULL);\r
+\r
+ ASSERT(timer->running);\r
+\r
+ timer->elapsed_real += now_real() - timer->start_real;\r
+ timer->start_real = 0.0;\r
+ timer->running = false;\r
+}\r
+\r
+// my_timer_elapsed_real()\r
+\r
+double my_timer_elapsed_real(const my_timer_t * timer) {\r
+\r
+ double elapsed;\r
+\r
+ ASSERT(timer!=NULL);\r
+\r
+ elapsed = timer->elapsed_real;\r
+ if (timer->running) elapsed += now_real() - timer->start_real;\r
+\r
+ if (elapsed < 0.0) elapsed = 0.0;\r
+\r
+ return elapsed;\r
+}\r
--- /dev/null
+\r
+// util.h\r
+\r
+#ifndef UTIL_H\r
+#define UTIL_H\r
+\r
+// includes\r
+\r
+#include <cstdio>\r
+\r
+// constants\r
+\r
+#undef FALSE\r
+#define FALSE 0\r
+\r
+#undef TRUE\r
+#define TRUE 1\r
+\r
+#ifdef DEBUG\r
+# undef DEBUG\r
+# define DEBUG TRUE\r
+#else\r
+# define DEBUG FALSE\r
+#endif\r
+\r
+#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)\r
+# define S64_FORMAT "%I64d"\r
+# define U64_FORMAT "%016I64X"\r
+#else\r
+# define S64_FORMAT "%lld"\r
+# define U64_FORMAT "%016llX"\r
+#endif\r
+\r
+// macros\r
+\r
+#ifdef _MSC_VER\r
+# define S64(u) (u##i64)\r
+# define U64(u) (u##ui64)\r
+#else\r
+# define S64(u) (u##LL)\r
+# define U64(u) (u##ULL)\r
+#endif\r
+\r
+#undef ASSERT\r
+#if DEBUG\r
+# define ASSERT(a) { if (!(a)) my_fatal("file \"%s\", line %d, assertion \"" #a "\" failed\n",__FILE__,__LINE__); }\r
+#else\r
+# define ASSERT(a)\r
+#endif\r
+\r
+// types\r
+\r
+typedef signed char sint8;\r
+typedef unsigned char uint8;\r
+\r
+typedef signed short sint16;\r
+typedef unsigned short uint16;\r
+\r
+typedef signed int sint32;\r
+typedef unsigned int uint32;\r
+\r
+#ifdef _MSC_VER\r
+ typedef signed __int64 sint64;\r
+ typedef unsigned __int64 uint64;\r
+#else\r
+ typedef signed long long int sint64;\r
+ typedef unsigned long long int uint64;\r
+#endif\r
+\r
+struct my_timer_t {\r
+ double start_real;\r
+ double elapsed_real;\r
+ bool running;\r
+};\r
+\r
+// functions\r
+\r
+#ifdef _WIN32\r
+ #include <windows.h>\r
+ inline void Idle(void) {\r
+ Sleep(1);\r
+ }\r
+ inline void Idle500msecs(void){\r
+ Sleep(500);\r
+ }\r
+#else\r
+ #include <unistd.h>\r
+ inline void Idle(void) {\r
+ usleep(1000);\r
+ }\r
+#endif\r
+extern void util_init ();\r
+\r
+extern void my_random_init ();\r
+extern int my_random_int (int n);\r
+extern double my_random_double ();\r
+\r
+extern sint64 my_atoll (const char string[]);\r
+\r
+extern int my_round (double x);\r
+\r
+extern void * my_malloc (size_t size);\r
+extern void * my_realloc (void * address, size_t size);\r
+extern void my_free (void * address);\r
+\r
+extern void my_log_open (const char file_name[]);\r
+extern void my_log_close ();\r
+\r
+extern void my_log (const char format[], ...);\r
+extern void my_fatal (const char format[], ...);\r
+\r
+extern bool my_file_read_line (FILE * file, char string[], int size);\r
+\r
+extern bool my_string_empty (const char string[]);\r
+extern bool my_string_whitespace (const char string[]);\r
+extern bool my_string_equal (const char string_1[], const char string_2[]);\r
+extern bool my_string_case_equal (const char string_1[], const char string_2[]);\r
+extern char * my_strdup (const char string[]);\r
+\r
+extern void my_string_clear (const char * * variable);\r
+extern void my_string_set (const char * * variable, const char string[]);\r
+\r
+extern void my_timer_reset (my_timer_t * timer);\r
+extern void my_timer_start (my_timer_t * timer);\r
+extern void my_timer_stop (my_timer_t * timer);\r
+\r
+extern double my_timer_elapsed_real (const my_timer_t * timer);\r
+\r
+\r
+#endif // !defined UTIL_H\r
+\r
+// end of util.h\r